npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sxp-to-json

v1.0.3

Published

Touchstone file to javascript object conversion library

Downloads

42

Readme

sXp-to-json

:satellite: Library that provides tools to transform Touchstone file in JSON object

Description

This library serve several methods to handle Touchstone files and their data content.

You can instance a object of class s2p passing a valid file path to its constructor.

After object initilization, data is saved on object according to the configuration described in JSON FORMAT and all paremeters are saved as Real and Imaginary values. However, original format is saved so you can know in wich format data was exported.

Features

  • Handles .s2p files

  • Distinguish wich parameters are present

  • Get units on wich file was exported

  • Suport several formats: RI, dB, MA

  • Calc Return Loss, VSWR, Absolute Value

  • Save Object to .json File

Methods

  • constructor(path) => Initializes new instance given file path, **path**.

  • ReIm(p) => Calculates A+jB for parameter, **p**, selected.

  • LogMag(p) => Calculates 20Log10(|p|) for parameter, **p**, selected.

  • LinMag(p) => Calculate |p| for parameter, **p**, selected.

  • LinAng(p) => Calculate |p| and Angle º for parameter, **p**, selected.

  • VSWR(p) => Calculate VSWR for parameter, **p**, selected.

  • save(name) => Save object to _json_ file named *name*.

Example

Initialize object.

var s2p = require('./index.js')
let sxp = new s2p('file.s2p', null)

// Alternatively, d = array of strings readed from file

var s2p = require('./index.js')
let sxp = new s2p(null, file)

Get VSWR.

let vswr11 = sxp.VSWR(11);
let vswr21 = sxp.VSWR(21);

Get LogMagnitude.

let rl11 = sxp.LogMag(11);
let rl21 = sxp.LogMag(21);

Save object to JSON file.

sxp.save('file.json');

JSON FORMAT

Data is saved in the following format.

Meanings:

  • fscale : Frequency Scale, Hz -> 0, KHz -> 3, ...

  • params : 2=>One-Path or 4=>Two-Path s2p file,

  • format : Real and Imaginarie, RI, Magnitude and Angle, MA, Decibel and Angle, DB

  • load : Load used for system Calibration

{
"fscale": 6,
"params": "S",
"format": "RI",
"load": 50,
"freq": \[
100,
200,
300,
\],
"p11": \[
{
"x": 15,
"y": 17
},
{
"x": 2,
"y": 15
}
\],
"p21": \[
{
"x": 15,
"y": 17
},
{
"x": 2,
"y": 15
}
\],
"p12": \[
{
"x": 15,
"y": 17
},
{
"x": 2,
"y": 15
}
\],
"p22": \[
{
"x": 15,
"y": 17
},
{
"x": 2,
"y": 15
}
\]
}

TODO:

  • [ ] Add Support for Z,Y, T parameters

  • [ ] Verify is file is valid

  • [ ] Extract equipment information from file

  • [ ] Suport for .s1p files

  • [x] Round values with n decimal places

  • [x] Search for frequency ou parameter 

Changes

  • Can now choose between read file or accept already readed file as array data, \n separeted
  • 8/6/18 - Some Improvements on Code