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.
- calc_RBC_RBE(mres, df_RM, ac_ports=None, reference_node='E')[source]
Calculate the metallization resistances R_CE and R_BE.
- Parameters:
- df_RM
df
Containing all values for the incoming df, where V_CE=0V.
- df_RM
- Returns:
- mres[
list
] List containing the calculated resistance values
- mres[
- calc_RCE(mres, df_RM, ac_ports=None, reference_node='E')[source]
Calculate the metallization resistances R_BC.
- Parameters:
- df_RM
df
Containing all values for the incoming df, where V_BE=0V.
- df_RM
- Returns:
- mres{
dict
} List containing the calculated resistance values
- mres{
- calc_beta(ic, ib)[source]
Calculates the base collector current amplification from dc currents
- Parameters:
- ic
np.ndarray
() DC Collector current.
- ib
np.ndarray
() DC Base current.
- ic
- Returns:
- beta
np.ndarray
() Base collector junction capacitance as an array with shape [n_freq].
- beta
- 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:
- freq
np.ndarray
() Frequencys that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- cbc
np.ndarray
() Base collector junction capacitance as an array with shape [n_freq].
- cbc
- 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:
- freq
np.ndarray
() Frequencies that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- cbe
np.ndarray
() Base emitter junction capacitance as an array with shape [n_freq].
- cbe
- 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:
- freq
np.ndarray
() Frequencys that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- cce
np.ndarray
() Collector emitter junction capacitance as an array with shape [n_freq].
- cce
- 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:
- freq
np.ndarray
() Frequenciess that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- cgg
np.ndarray
() Total capacitance at port 1.
- cgg
- calc_fmax(freq, para_values, p_type)[source]
Calculate the maximum frequency of oscillation from the unilateral gain.
- Parameters:
- freq
np.ndarray
() Frequencies that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- fmax
np.ndarray
() Array of shape [n_freq] that contains ft from the spot frequency method.
- fmax
- calc_ft(freq, para_values, p_type)[source]
Calculate the transit frequency F_T using the spot frequency method.
- Parameters:
- freq
np.ndarray
() Frequencies that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- F_T
np.ndarray
() Array of shape [n_freq] that contains ft from the spot frequency method.
- F_T
- calc_gm(ic, vbe, vb_forced=None, vc_forced=None)[source]
Calculates the transconductance of a bjt or mosfet.
- Parameters:
- ic
np.ndarray
() DC Collector current.
- vbe
np.ndarray
() be voltage
- vbc
np.ndarray
() bc voltage
- ic
- Returns:
- gm
np.ndarray
() The transconductance
- gm
- calc_go(ic, vce)[source]
Calculates the output conductance of a bjt or mosfet.
- Parameters:
- ic
np.ndarray
() DC Collector current.
- vc
np.ndarray
() c or d voltage
- ic
- Returns:
- go
np.ndarray
() The output conductance
- go
- calc_k(freq, para_values, p_type)[source]
Calculates the k-factor.
- Parameters:
- freq
np.ndarray
() Frequencies that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- k
np.ndarray
() Stability factor k.
- k
Notes
..todo: from s para
- calc_mag(freq, para_values, p_type)[source]
Calculates the maximum available gain MAG.
- Parameters:
- freq
np.ndarray
() Frequencies that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- mag
np.ndarray
() maximum available gain mag.
- mag
- calc_msg(freq, para_values, p_type)[source]
Calculates the maximum stable gain MSG.
- Parameters:
- freq
np.ndarray
() Frequencys that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- msg
np.ndarray
() Maximum stable gain MAG.
- msg
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:
- freq
np.ndarray
() Frequencies that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- tfit
np.ndarray
() Array of shape [n_freq] that contains tfit from the spot frequency method.
- tfit
- calc_tfit2(freq, para_values, p_type)[source]
Calculate the transit frequency F_T using the spot frequency method.
- Parameters:
- freq
np.ndarray
() Frequencies that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- tfit
np.ndarray
() Array of shape [n_freq] that contains tfit from the spot frequency method.
- tfit
- calc_unilateral_gain(freq, para_values, p_type)[source]
Calculates the unilateral gain GU . | https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=1083579
- Parameters:
- freq
np.ndarray
() Frequencies that correspond to para_values.
- para_values
np.ndarray
() Small signal parameters of type p_type with shape [n_freq, n_port, n_port]
- p_type
str
Type of the small signal parameters in para_values.
- freq
- Returns:
- gu
np.ndarray
() Unilateral gain as an array with shape [n_freq].
- gu
- convert_mres(mres, ac_ports=None, reference_node='E')[source]
Converts the calculated resistance network from delta- to wye-form.
- 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_values
np.ndarray
() Numpy array with shape (n_freq, n_port, n_port) holding the values of the small signal parameter p_from.
- p_from
str
String that specifies which parameters are stored in p_from.
- p_to
str
String that specifies which parameters should be created from the parameters p_from.
- z0
float
() Reference impedance in ohms, default is float(50).
- para_values
- Returns:
- para_new
np.ndarray
() Numpy array with shape (n_freq, n_port, n_port) holding the values of the small signal parameter p_to.
- para_new
- deembed_mres(df, mres, ac_ports=None, reference_node='E')[source]
Substract external voltage drop over metal resistances from measured voltages.
- Parameters:
- df
DMT.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.
- df
- 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_values
np.ndarray
(np.cmplx128
) S parameters that shall be de-embedded.
- s_para_open_values
np.ndarray
(np.cmplx128
) S parameters of a short dummy.
- times
int
Numer of times the open has to be removed.
- s_para_values
- Returns:
- s_para_values
np.ndarray
(np.cmplx128
) Short de-embedded S parameters.
- s_para_values
- 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_values
np.ndarray
(np.cmplx128
) S parameters that shall be de-embedded.
- s_para_short_values
np.ndarray
(np.cmplx128
) S parameters of a short dummy.
- times
int
Number of times the short has to be removed
- s_para_values
- Returns:
- s_para_values
np.ndarray
(np.cmplx128
) Short de-embedded S parameters.
- s_para_values
- 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:
- z0
number
, 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)
- nfreqs
int
number of frequency points
- nports
int
number of ports
- z0
- Returns:
- z0
array
of
shape
==(nfreqs,nports) z0 with the right shape for a nport Network
- z0
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_values
np.ndarray
(np.cmplx128
) S parameters that shall be de-embedded.
- ndevices
int
Number of parallel devices.
- s_para_values
- Returns:
- s_para_values
np.ndarray
(np.cmplx128
) Normalized S-para-values
- 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:
- s
complex
array_like scattering parameters
- z0
complex
array_like ornumber
port impedances
- s
- Returns:
- y
complex
array_like admittance parameters
- y
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:
- s
complex
array_like scattering parameters
- z0
complex
array_like ornumber
port impedances.
- s
- Returns:
- z
complex
array_like impedance parameters
- z
References
- DMT.core.data_processor.flatten(items)[source]
Yield items from any nested iterable; see Reference https://stackoverflow.com/a/40857703.