DataProcessor

Many standard electrical calculations. Many of these functions are employed in the DataFrame class.

data processor module

class DMT.core.data_processor.DataProcessor[source]

Bases: object

Basic class responsible for the manipulation and performing calculations on electrical Data in DMT.

This class is designed as a mixin class. This design pattern allows to use multiple inheritance in order to extend the functionality of other DMT modules by the basic functions provided here. The functions here are basic electrical functions on np.array() objects with a clear syntax that should not change a lot in the future.

Notes

..todo: Nice tex equations here!

Methods

convert_n_port_para(para_values, p_from, p_to, z0=float(50)):

Calculate the p_to n_port parameters from the p_from n_port parameters stored in para_values.

deembed_short(s_para_values, s_para_short_values):

de-embed the S parameters in s_para_values using the S parameters from the short dummy.

deembed_open(s_para_values, s_para_open_values):

de-embed the S parameters in s_para_values using the S parameters from the open dummy.

calc_ft(freq, para_values, p_type):

Calculate the transit frequency ft from the small signal parameters of type p_type in para_values.

calc_fmax(freq, para_values, p_type):

Calculate the maximum frequency of oscillation fmax from the small signal parameters of type p_type in para_values.

calc_cbe(freq, para_values, p_type):

Calculate the base-emitter junction capacitance from the small signal parameters of type p_type in para_values.

calc_cbc(freq, para_values, p_type):

Calculate the base-collector junction capacitance from the small signal parameters of type p_type in para_values.

a2y(a)[source]

My own a2y routine since scikit rf does not have one. What a shame!

calc_RBC_RBE(mres, df_RM)[source]

Calculate the metallization resistances R_CE and R_BE.

Parameters:
df_RMdf

Containing all values for the incoming df, where V_CE=0V.

Returns:
mres[list]

List containing the calculated resistance values

calc_RCE(mres, df_RM)[source]

Calculate the metallization resistances R_BC.

Parameters:
df_RMdf

Containing all values for the incoming df, where V_BE=0V.

Returns:
mres{dict}

List containing the calculated resistance values

calc_beta(ic, ib)[source]

Calculates the base collector current amplification from dc currents

Parameters:
icnp.ndarray()

DC Collector current.

ibnp.ndarray()

DC Base current.

Returns:
betanp.ndarray()

Base collector junction capacitance as an array with shape [n_freq].

calc_cap_series_thru(freq, para_values, p_type)[source]

Calculates the the series-thru junction capacitance cbc from the small signal parameters para_values.

Parameters:
freqnp.ndarray()

Frequencys that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
cbcnp.ndarray()

Base collector junction capacitance as an array with shape [n_freq].

calc_cap_shunt_port_1(freq, para_values, p_type)[source]

Calculates the shunt capacitance at port 1 assuming a Pi equivalent circuit capacitance cbe from the small signal parameters para_values.

Parameters:
freqnp.ndarray()

Frequencies that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
cbenp.ndarray()

Base emitter junction capacitance as an array with shape [n_freq].

calc_cap_shunt_port_2(freq, para_values, p_type)[source]

Calculates the active shunt capacitance at port_2 assuming a PI equivalent circuit.

Parameters:
freqnp.ndarray()

Frequencys that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
ccenp.ndarray()

Collector emitter junction capacitance as an array with shape [n_freq].

calc_cap_total_port_1(freq, para_values, p_type)[source]

Calculates the total capacitance at port 1 assuming a Pi equivalent circuit capacitance cgg from the small signal parameters para_values.

Parameters:
freqnp.ndarray()

Frequenciess that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
cggnp.ndarray()

Total capacitance at port 1.

calc_fmax(freq, para_values, p_type)[source]

Calculate the maximum frequency of oscillation from the unilateral gain.

Parameters:
freqnp.ndarray()

Frequencies that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
fmaxnp.ndarray()

Array of shape [n_freq] that contains ft from the spot frequency method.

calc_ft(freq, para_values, p_type)[source]

Calculate the transit frequency F_T using the spot frequency method.

Parameters:
freqnp.ndarray()

Frequencies that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
F_Tnp.ndarray()

Array of shape [n_freq] that contains ft from the spot frequency method.

calc_gm(ic, vbe, vb_forced=None, vc_forced=None)[source]

Calculates the transconductance of a bjt or mosfet.

Parameters:
icnp.ndarray()

DC Collector current.

vbenp.ndarray()

be voltage

vbcnp.ndarray()

bc voltage

Returns:
gmnp.ndarray()

The transconductance

calc_go(ic, vce)[source]

Calculates the output conductance of a bjt or mosfet.

Parameters:
icnp.ndarray()

DC Collector current.

vcnp.ndarray()

c or d voltage

Returns:
gonp.ndarray()

The output conductance

calc_k(freq, para_values, p_type)[source]

Calculates the k-factor.

Parameters:
freqnp.ndarray()

Frequencies that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
knp.ndarray()

Stability factor k.

Notes

..todo: from s para

calc_mag(freq, para_values, p_type)[source]

Calculates the maximum available gain MAG.

Parameters:
freqnp.ndarray()

Frequencies that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
magnp.ndarray()

maximum available gain mag.

calc_msg(freq, para_values, p_type)[source]

Calculates the maximum stable gain MSG.

Parameters:
freqnp.ndarray()

Frequencys that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
msgnp.ndarray()

Maximum stable gain MAG.

Notes

..todo: calc from S para too

calc_tfit1(freq, para_values, p_type)[source]

Calculate the transit frequency F_T using the spot frequency method.

Parameters:
freqnp.ndarray()

Frequencies that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
tfitnp.ndarray()

Array of shape [n_freq] that contains tfit from the spot frequency method.

calc_tfit2(freq, para_values, p_type)[source]

Calculate the transit frequency F_T using the spot frequency method.

Parameters:
freqnp.ndarray()

Frequencies that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
tfitnp.ndarray()

Array of shape [n_freq] that contains tfit from the spot frequency method.

calc_unilateral_gain(freq, para_values, p_type)[source]

Calculates the unilateral gain GU . | https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=1083579

Parameters:
freqnp.ndarray()

Frequencies that correspond to para_values.

para_valuesnp.ndarray()

Small signal parameters of type p_type with shape [n_freq, n_port, n_port]

p_typestr

Type of the small signal parameters in para_values.

Returns:
gunp.ndarray()

Unilateral gain as an array with shape [n_freq].

convert_mres(mres)[source]

Converts the calculated resistance network from delta- to wye-form.

Parameters:
mres{dict}

List containing the calculated delta-form resistances

Returns
——-
mres{dict}

Same list with appended wye-form parameters.

convert_n_port_para(para_values, p_from, p_to, z0=50.0)[source]

n_port parameter conversion routine.

Convert n_port parameters from p_from to p_to using scikit-rf. Available are all conversion between parameters S,Y,Z,T,A.

Parameters:
para_valuesnp.ndarray()

Numpy array with shape (n_freq, n_port, n_port) holding the values of the small signal parameter p_from.

p_fromstr

String that specifies which parameters are stored in p_from.

p_tostr

String that specifies which parameters should be created from the parameters p_from.

z0float()

Reference impedance in ohms, default is float(50).

Returns:
para_newnp.ndarray()

Numpy array with shape (n_freq, n_port, n_port) holding the values of the small signal parameter p_to.

deembed_mres(df, mres)[source]

Substract external voltage drop over metal resistances from measured voltages.

Parameters:
dfDMT.dataframe

df contains DC measurements that are to be deembedded.

mres{‘R_BM’:float64, ‘R_CM’:float64, ‘R_EM’_float64}

List of calculated resistances R_CM, R_BM, and R_EM.

deembed_open(s_para_values, s_para_open_values, times=1)[source]

Deembed the measured S parameters in s_para_values from the measured S parameters in s_para_open_values.

Parameters:
s_para_valuesnp.ndarray(np.cmplx128)

S parameters that shall be de-embedded.

s_para_open_valuesnp.ndarray(np.cmplx128)

S parameters of a short dummy.

timesint

Numer of times the open has to be removed.

Returns:
s_para_valuesnp.ndarray(np.cmplx128)

Short de-embedded S parameters.

deembed_short(s_para_values, s_para_short_values, times=1)[source]

Deembed the measured S parameters in s_para_values from the measured S parameters in s_para_short_values.

Parameters:
s_para_valuesnp.ndarray(np.cmplx128)

S parameters that shall be de-embedded.

s_para_short_valuesnp.ndarray(np.cmplx128)

S parameters of a short dummy.

timesint

Number of times the short has to be removed

Returns:
s_para_valuesnp.ndarray(np.cmplx128)

Short de-embedded S parameters.

fix_z0_shape(z0, nfreqs, nports)[source]

Make a port impedance of correct shape for a given network’s matrix

This attempts to broadcast z0 to satisfy

npy.shape(z0) == (nfreqs,nports)

Parameters:
z0number, array_like

z0 can be: * a number (same at all ports and frequencies) * an array-like of length == number ports. * an array-like of length == number frequency points. * the correct shape ==(nfreqs,nports)

nfreqsint

number of frequency points

nportsint

number of ports

Returns:
z0array of shape ==(nfreqs,nports)

z0 with the right shape for a nport Network

Examples

For a two-port network with 201 frequency points, possible uses may be

>>> z0 = rf.fix_z0_shape(50 , 201,2)
>>> z0 = rf.fix_z0_shape([50,25] , 201,2)
>>> z0 = rf.fix_z0_shape(range(201) , 201,2)
parallel_norm(s_para_values, ndevices)[source]

Normalize the measured S parameters in s_para_values to the number of parallel devices.

Parameters:
s_para_valuesnp.ndarray(np.cmplx128)

S parameters that shall be de-embedded.

ndevicesint

Number of parallel devices.

Returns:
s_para_valuesnp.ndarray(np.cmplx128)

Normalized S-para-values

s2y(s_in, z0=50)[source]

convert scattering parameters [1] to admittance parameters [2]

\[y = \sqrt {y_0} \cdot (I - s)(I + s)^{-1} \cdot \sqrt{y_0}\]
Parameters:
scomplex array_like

scattering parameters

z0complex array_like or number

port impedances

Returns:
ycomplex array_like

admittance parameters

See also

s2z
s2y
s2t
z2s
z2y
z2t
y2s
y2z
y2z
t2s
t2z
t2y
Network.s
Network.y
Network.z
Network.t

References

s2z(s_in, z0=50)[source]

Convert scattering parameters [1] to impedance parameters [2]

\[z = \sqrt {z_0} \cdot (I + s) (I - s)^{-1} \cdot \sqrt{z_0}\]
Parameters:
scomplex array_like

scattering parameters

z0complex array_like or number

port impedances.

Returns:
zcomplex array_like

impedance parameters

References

y2a(y)[source]

My own y2a routine since scikit rf does not have one. What a shame!

y2h(y)[source]

My own y2h routine since scikit rf does not have one. What a shame!

DMT.core.data_processor.flatten(items)[source]

Yield items from any nested iterable; see Reference https://stackoverflow.com/a/40857703.

DMT.core.data_processor.is_iterable(arg)[source]

Returns True if the object is iterable

Source: https://stackoverflow.com/a/36407550/13212532

DMT.core.data_processor.strictly_increasing(L)[source]

checks if given iterable is strictly increasing or not