microcalorimetry.math.vna

A collection of analysis functions commonly used with VNA measurements.

Attributes

DataArray

Functions

calc_s1p_basis(*s1p_c)

Generate basis frequency dependent basis vectors for the RI plane.

rotate_s1p_basis(s1p_c, basis[, return_as])

Rotate an s1p_c file to a new basis in the RlIm plane.

dbmag(→ DataArray)

Convert complex s parameters to magnitude in dB.

phase(s_params)

Calculate the phase of complex s parameters.

linmag(s_params)

Calculate linear magnitude of complex s-parameters.

rotate_device(device, axes)

Rotate the parameters of a device

Module Contents

microcalorimetry.math.vna.DataArray[source]
microcalorimetry.math.vna.calc_s1p_basis(*s1p_c)[source]

Generate basis frequency dependent basis vectors for the RI plane.

Returns a 2x2 matrix that when given to rotate_s1p basis will transform them onto the new coordinate space in the imaginary plane.

The new basis vectors are given from SVD, and so the first one represents the directo of change for the given sensors.

Parameters:
*s1p_cTYPE

Sensors.

Returns:
new_basisTYPE

new basis vectors.

microcalorimetry.math.vna.rotate_s1p_basis(s1p_c: xarray.DataArray, basis: xarray.DataArray, return_as: microcalorimetry._gwex.DataFormat = dfm.s1p_c)[source]

Rotate an s1p_c file to a new basis in the RlIm plane.

Parameters:
s1p_cxr.DataArray

Complex s1p file.

basisxr.DataArray

s2p_c like with real values.

return_as: optional

What format to return as. Defaults to s1p_c.

Returns:
s1p_c

s1p_c data that has been rotated.

microcalorimetry.math.vna.dbmag(s_params: DataArray, const: float = 20) DataArray[source]

Convert complex s parameters to magnitude in dB.

Calculates by const*log10(linmag(s_params)). By default const = 20.

Parameters:
s_paramsarray like

any complex format s parameters. array like.

constfloat, optional

Multiplication constant for converting to magnitude (i.e. const*log10(magnitude). Default is 20

Returns:
DataArray

Magnitude of s parameters in dB.

microcalorimetry.math.vna.phase(s_params: DataArray)[source]

Calculate the phase of complex s parameters.

Parameters:
s_paramsDataArray

any complex format s parameters. array like.

Returns:
DataArray

Phase of s_params.

microcalorimetry.math.vna.linmag(s_params: DataArray)[source]

Calculate linear magnitude of complex s-parameters.

Parameters:
s_paramsDataArray

any complex format s parameters.

Returns:
DataArray

Converted sparams.

microcalorimetry.math.vna.rotate_device(device: DataArray, axes: list)[source]

Rotate the parameters of a device

Parameters:
device: DataArray

The device to rotate. Supported formats are s2p.

axes: list

The axes to change to. The original ones are the index (1, 2, …) and the list are the ones to change to, so for example (2, 1) on an s2p will flip sides 1 and 2.

Returns:
DataArray

Rotated device.