DataFrame

data_frame module

Implements a extended pandas.DataFrame. It is based on the pandas.DataFrame and extended by many special methods that simplify working with electrical quantities. This includes easy management of small signal parameter and other quantities which can be calculated from them.

class DMT.core.data_frame.DataFrame(data=None, index: Axes | None = None, columns: Axes | None = None, dtype: Dtype | None = None, copy: bool | None = None)[source]

Bases: DataProcessor, DataFrame

Two-dimensional size-mutable, potentially heterogeneous tabular data structure for electrical data with labeled axes (rows and columns).

The primary DMT data structure. This class inherits from pandas.DataFrame and from the Mixin class DataProcessor.

The inheritance from pandas is implemented according to <http://pandas.pydata.org/pandas-docs/stable/extending.html#extending-subclassing-pandas>.

The inheritance from Mixin class DataProcessor is implemented according to <http://www.qtrac.eu/pyagg.html>.

Note that pandas DataFrames are not always mutable and hence class methods that modify the DataFrame should be called like this:

df = df.calc_ft()

Methods

convert_n_port_para(p_from=’’, p_to=’’, z0=float(50), ports=None)

convert the small signal parameters of type p_from to small signal parameters of type p_to.

cmplx2real()

find all complex columns in self and split them up into one column for the real and one column for the complex part.

real2cmplx()

find all associated columns that contain real and imaginary parts and merge them into one column that holds complex numbers.

clean_data(nodes, fallback=None, specifier_voltage=specifiers.VOLTAGE, specifier_current=specifiers.CURRENT, specifier_capacitance=specifiers.CAPACITANCE, specifier_frequency=specifiers.FREQUENCY, specifier_temperature=specifiers.TEMPERATURE)

convert a DataFrame into the DMT format, e.g. use specifiers for the column names, drop unknown or unncessary columns and so on.

clean_names( specifier_voltage=specifiers.VOLTAGE, specifier_current=specifiers.CURRENT, specifier_capacitance=specifiers.CAPACITANCE, specifiers_ss_parameter=specifiers.SPECIFIERS_SS_PARA)

convert all column names into a nicer format.

get_col_name(specifier, *nodes, sub_specifiers=’’)

get the content of the column specified.y by the input to this method.

ensure_specifier_column(specifier, *nodes, sub_specifiers=None, ports=None)

make sure that the specifier specified by the arguments exists in the DataFrame.

create_voltage(nodes, sub_specifiers=None)

Try to create the voltage between nodes and save it into self.

create_potential(nodes, sub_specifiers=None)

Try to create the potential at node and save it into self.

drop_all_voltages()

Delete all voltages (but keep potentials).

get_all_voltages()

Return all voltages.

parallel_norm(n_parallel, port_1, port_2)

Normalize Currents and small signal parameters assuming that n_parallel devices have been measured.

deembed_short(df_short, ports)

perform a short deembeding of self with df_short.

deembed_open(df_open, ports)

perform an open deembeding of self with df_short.

deembed(df_open, df_short, ports=None)

perform open short deembeding of self with df_short and df_open.

determine_mres()

assume that self contains measurements of short structures. determine the metallization resistances using polyfits.

deembed_DC(df_short_dc)

perform DC deembeding of the currents in self, assuming that the metallization resistances can be calculated from df_short_dc.

check_ss_cols(para)

check if the small signal parameters para are existent in self.

get_ss_para(para, port_1, *ports_n)

return the small signal parameter in self.

set_ss_para(para, para_values, port_1, *ports_n)

set the small signal parameters para to self.

strip_ss_para(keep=’S’)

remove all small signal parameters except those specified by the keep argument.

get_all_ss_para()

return all small signal parameters in self.

calc_ft(port_1, port_2)

calculate ft using the spot frequency method.

calc_fmax(port_1, port_2)

calculate fmax from msg.

calc_msg(port_1, port_2)

calculate msg and save into self.

calc_unilateral_gain(port_1, port_2)

calculate u and save into self.

calc_mag(port_1, port_2)

calculate mag and save into self.

calc_k(port_1, port_2)

calculate k and save into self.

calc_cbe()

calculate cbe and save into self.

calc_cbc()

calculate cbc and save into self.

calc_beta()

calculate beta and save into self.

calc_gm()

calculate gm and save into self.

calc_beta()[source]

Calculates the DC current gain of a bipolar transistor

Returns:
DMT.core.DataFrame

Dataframe that contains the DC current amplficiation I_C/I_B

calc_cbc(port_1='B', port_2='C')[source]

Calculates the base-collector junction capacitance CBC.

Returns:
DMT.core.DataFrame

Dataframe that contains CBE.

calc_cbe(port_1='B', port_2='C')[source]

Calculates the base-emitter junction capacitance CBE assuming PI equivalent circuit and common emitter configuration.

Returns:
DMT.core.DataFrame

Dataframe that contains CBE.

calc_cce(port_1='B', port_2='C')[source]

Calculates the collector-emitter junction capacitance CCE, assuming PI equivalent circuit and common emitter configuration with base at port 1.

Returns:
DMT.core.DataFrame

Dataframe that contains CCE.

calc_cdb(port_1='G', port_2='D', port_3='B')[source]

Calculates the drain-bulk capacitance CDB assuming PI equivalent circuit and common source configuration.

Returns:
DMT.core.DataFrame

Dataframe that contains CDB.

calc_cgd(port_1='G', port_2='D')[source]

Calculates the gate-drain capacitance CGD.

Returns:
DMT.core.DataFrame

Dataframe that contains CGD.

calc_cgg(port_1='G', port_2='D')[source]

Calculates the total gate capacitance CGG assuming PI equivalent circuit and common source configuration.

Returns:
DMT.core.DataFrame

Dataframe that contains CBE.

calc_cgs(port_1='B', port_2='C')[source]

Calculates the gate-source capacitance CGS assuming PI equivalent circuit and common source configuration.

Returns:
DMT.core.DataFrame

Dataframe that contains CBE.

calc_csb(port_1='G', port_2='D', port_3='B')[source]

Calculates the source-bulk capacitance CDB assuming PI equivalent circuit and common source configuration.

Returns:
DMT.core.DataFrame

Dataframe that contains CDB.

calc_fmax(port_1, port_2)[source]

Calculates the maximum frequency of oscillation FMAX.

Parameters:
port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

port_2str

Name of the nodes of the port 2, for a BJT in common-emitter this is ‘C’.

Returns:
DMT.core.DataFrame

Dataframe that contains F_MAX.

calc_ft(port_1, port_2)[source]

Calculates the transit frequency FT using the spot frequency method.

Parameters:
port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

port_2str

Name of the nodes of the port 2, for a BJT in common-emitter this is ‘C’.

Returns:
DMT.core.DataFrame

Dataframe that contains F_T.

calc_gm(ports=['B', 'C', 'E'])[source]

Calculates the DC transconductance of a BJT.

Parameters:
ports[str], None

If None, BJT contact ports are assumed. Else it is assumed that ports[2] is the grounded contact, ports[0] is the input port (gate/base) and ports[1] is the output port.

Returns:
DMT.core.DataFrame

Dataframe that contains the TRANSCONDUCTANCE

calc_go(ports=['B', 'C', 'E'])[source]

Calculates the DC output condutance of a BJT or generic transistor in common emitter/source configuration.

Parameters:
ports[str], None

If None, BJT contact ports are assumed. Else it is assumed that ports[2] is the grounded contact, ports[0] is the input port (gate/base) and ports[1] is the output port.

Returns:
DMT.core.DataFrame

Dataframe that contains the TRANSCONDUCTANCE

calc_k(port_1, port_2)[source]

Calculates the k-factor K.

Parameters:
port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

port_2str

Name of the nodes of the port 2, for a BJT in common-emitter this is ‘C’.

Returns:
DMT.core.DataFrame

Dataframe that contains K.

calc_mag(port_1, port_2)[source]

Calculates the maximum available gain MAG.

Parameters:
port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

port_2str

Name of the nodes of the port 2, for a BJT in common-emitter this is ‘C’.

Returns:
DMT.core.DataFrame

Dataframe that contains MAG.

calc_msg(port_1, port_2)[source]

Calculates the maximum stable gain MSG.

Parameters:
port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

port_2str

Name of the nodes of the port 2, for a BJT in common-emitter this is ‘C’.

Returns:
DMT.core.DataFrame

Dataframe that contains MSG.

calc_tfit(tfit_kind: int, ports)[source]
calc_tfit1(port_1, port_2)[source]

Calculates the transit frequency FT using the spot frequency method.

Parameters:
port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

port_2str

Name of the nodes of the port 2, for a BJT in common-emitter this is ‘C’.

Returns:
DMT.core.DataFrame

Dataframe that contains F_T.

calc_tfit2(port_1, port_2)[source]

Calculates the transit frequency FT using the spot frequency method.

Parameters:
port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

port_2str

Name of the nodes of the port 2, for a BJT in common-emitter this is ‘C’.

Returns:
DMT.core.DataFrame

Dataframe that contains F_T.

calc_unilateral_gain(port_1, port_2)[source]

Calculates the unilateral gain GU .

Parameters:
port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

port_2str

Name of the nodes of the port 2, for a BJT in common-emitter this is ‘C’.

Returns:
DMT.core.DataFrame

Dataframe that contains GU.

check_ss_cols(para)[source]

Check the existence of the small signal parameters para cols.

Parameters:
parastr

Small signal parameter whose existence shall be checked.

Raises:
IOError

Raised if the ss parameters para are not present in self.columns.

clean_data(nodes, reference_node, fallback=None, ac_ports=None, specifier_voltage='V', specifier_current='I', specifier_capacitance='C', specifier_frequency='FREQ', specifier_temperature='TEMP', warnings=True)[source]

Clean DataFrame. This is one of the most important methods and should be called on all imported data. This ensures data consistency within DMT!

Clean a DataFrame. This means:

  • make sure all potentials and voltages of the dut are stored correctly

  • convert separate real and imaginary parts of complex numbers into a single cmplx128 number

  • assign a SpecifierStr as column name if possible.

If the nodes in the columns do not match with the nodes in the nodes parameter, the fallback dictionary is used to try and rename the nodes.

Parameters:
nodes[str]

List of strings with the node names.

fallback{string:string, specifier_frequency:’FREQ’, specifier_temperature=’TEMP’}

A dict that can be used to remap nodes in the file to nodes parameter. The keys of this dict are node names that may be errorneous or duplicate in the DataFrame and the values are the actual correct node names, according to DMT specifiers. E.g. one may have a voltage V_C1 in the DataFrame, but it should actually be V_C. Then fallback={‘C1’:’C’} will save the day. So the key is the current column name and the value the desired column name. The specifier_frequency and specifier_temperature are set to this dictionary. If the value of a key in this dict is None, the column will be dropped.

ac_ports[str]

List that specifies the connection of the AC ports. E.g. [‘B’,’C’] for common emitter.

specifier_voltagestr

Specifier for the voltage, defaults to ‘V’

specifier_currentstr

Specifier for the voltage, defaults to ‘I’

specifier_capacitancestr

Specifier for the voltage, defaults to ‘C’

specifier_frequencystr

Specifier for the frequency, defaults to ‘FREQ’

specifier_temperaturestr

Specifier for the column names in the measurements. Can be used to identify variables which have different names in the measurements. Inside of DMT the given default names are assumed to be valid and hence they can be renamed using these specifiers. Voltages, currents and capacitances are renamed in clean_names(), temperature and frequency are set as fallbacks for get_nodes(), defaults to ‘TEMP’

Returns:
DMT.core.DataFrame

Dataframe that contains columns according to the DMT internal standard.

Notes

..todo: fall also needs to be cast to upper()

Examples

>>> df.columns
['V_BE','V_c','V_c_','I_B']
>>> df.clean_data('B', 'E', {'c_':'C'})
>>> df.columns
['V_B','V_E','V_C','I_B'] # the second V_c_ got deleted in this case
clean_names(specifier_voltage: str = 'V', specifier_current: str = 'I', specifier_capacitance: str = 'C', specifiers_ss_parameter=<DMT.core.naming._specifiers_ss_para object>, ignore: list | None = None)[source]

Clean column names of DataFrame.

Clean the column names of DataFrame into the DMT standard:

  • Goal is to have all column names as a SpecifierStr.

  • potentials and voltages start with ‘V_’

  • currents start with ‘I_’

  • capacitances start with ‘C_’

Specifier for the column names in the measurements. Can be used to identify variables which have different names in the measurements. Inside of DMT the given default names are assumed to be valid and hence they can be renamed using these specifiers.

Parameters:
specifier_voltagestr, optional

Indicator for voltages in the measurements, by default specifiers.VOLTAGE

specifier_currentstr, optional

Indicator for currents in the measurements, by default specifiers.CURRENT

specifier_capacitancestr, optional

Indicator for capacitances in the measurements, by default specifiers.CAPACITANCE

specifiers_ss_parameteroptional

Small signal parameters in the measurements, by default specifiers_ss_para

ignorelist, optional

Columns in the measurements to ignore, by default None

Returns:
DMT.core.DataFrame

Dataframe that contains columns with names according to the DMT internal standard.

cmplx2real()[source]

Create real and imaginary columns from complex columns in DataFrame.

Returns:
selfDMT.core.DataFrame

Dataframe that contains real and imag columns instead of cmplx columns.

convert_n_port_para(p_from='', p_to='', z0=50.0, ports=None)[source]

Convert between the small signal parameters S,Y,Z,T,A stored in self.

Parameters:
p_fromstr

String that specifies which parameters are already present in self.

p_tostr

String that specifies which parameters should be created in self.

z0float()

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

ports[str], optional

Name of the ports in correct order. Defaults to [‘1’, ‘2’], for a BJT in common-emitter this would be [‘B’, ‘C’].

Returns:
selfDMT.core.DataFrame

Dataframe that contains the p_to n_port parameters

create_potential(nodes, reference_node, voltage_sub_specifiers=None, debug=False)[source]

Try to create col from existing data in dataframe df.

Parameters:
nodes[node]

List containing the nodes present in self or just directly list of nodes.

reference_nodestr

Name of the reference node.

voltage_sub_specifiers[str]

The sub specifier that shall be valid for the voltage to be created by this method.

debugbool, False

If True, print out debugging information

Returns:
dfDMT.core.DataFrame

DMT.Dataframe with new dataframe, if successfull

Raises:
IOError

If it is not possible to create the potential

create_voltage(nodes, voltage_sub_specifiers=None, reference_node=None)[source]

Try to create col from existing data in dataframe df.

Parameters:
nodes[node]

List containing the nodes present in self or just directly list of nodes.

sub_specifiers[str]

The sub specifier that shall be valid for the voltage to be created by this method.

reference_nodestr

Reference node of the potentials, defaults to ‘E’

Returns:
DMT.core.DataFrame

DMT.Dataframe with new dataframe, if successfull

deembed(df_open, df_short, ports=None, ndevices=1, ndevices_open=1, ndevices_short=1)[source]

Deembed the measured data in df from the measured data in df_open and df_short.

This method deembeds the masured small signal parameters in df using the measured small signal parameters of one dummy open and one dummy short structure.

Parameters:
df_openDMT.core.DataFrame

df containgin the measured open structure.

df_shortDMT.core.DataFrame

df containing the measured short structure.

ports[str]

List of port names. Should be the same for the device and the open and short. Defaults to [‘1’, ‘2’]. For a BJT in common emitter, should be [‘B’, ‘C’, …]

ndevicesint

Number of parallel devices to be deembedded.

ndevices_openint

Number of parallel devices of the open structure.

ndevices_shortint

Number of parallel devices of the short structure.

Returns:
DMT.core.DataFrame

DataFrame containing the de-embedded S parameters.

Notes

..todo: make this method remember df_open and df_short.

deembed_DC(mres=None, df_short_dc=None, forced_current=False)[source]

Deembed the measured DC data in df from external metallization resistances.

Determine the metallization resistances and substract their impact from the measured voltages.

Parameters:
mresdict
df_short_dcDMT.core.DataFrame

df containing the dc-measured short structure.

Returns:
DMT.core.DataFrame

DataFrame containing the de-embedded DC-voltages.

deembed_open(df_open, ports, times=1)[source]

Deembed the measured data in df from the measured data in df_open.

This method deembeds the masured small signal parameters in df using the measured small signal parameters in df_open.

Parameters:
df_openDMT.core.DataFrame

df containgin the measured open structure.

ports[str]

List of port names. Should be the same for the device and the open and short. Usually this would be [‘1’, ‘2’]. For a BJT in common emitter, should be [‘B’, ‘C’, …]

timesint

Numer of times the open has to be removed.

Returns:
DMT.core.DataFrame

DataFrame containing the de-embedded S parameters.

deembed_short(df_short, ports, times=1)[source]

Deembed the measured data in df from the measured data in df_short.

This method deembeds the measured small signal parameters in df using the measured small signal parameters in df_short.

Parameters:
df_shortDMT.core.DataFrame

df containing the S parameters of a short dummy.

ports[str]

List of port names. Should be the same for the device and the open and short. Usually this would be [‘1’, ‘2’]. For a BJT in common emitter, should be [‘B’, ‘C’, …]

timesint

The number of times the short has to be removed.

Returns:
DMT.core.DataFrame

DataFrame containing the de-embedded S parameters.

determine_mres(forced_current=False)[source]

Determine the external restistances caused by the metallization.

Parameters:
forced_currentbool, optional
Returns:
dict

A dict of resistances Rb,m, Rc,m, and Re,m.

drop_all_voltages()[source]

Drops all found voltages (but ignores potentials)

Returns:
DMT.core.DataFrame

DMT.Dataframe with new dataframe, if successfull

ensure_specifier_column(specifier, *nodes, sub_specifiers_to_ensure=None, ports=None, reference_node=None, debug=False, area=None, force=False)[source]

Checks if a column with the specifier name exists in the dataframe, if not it tries to calculate it!

Parameters:
specifierstr

Ideally a specifier from specifiers

*nodesstr, optional

Nodes for the column. Like ‘B’ for base or ‘B’, ‘E’ for base-emitter

sub_specifiersstr, {‘’, DMT.core.sub_specifiers.PERIMETER, DMT.core.sub_specifiers.AREA}

Subscript of the specifier symbol to ensure.

ports[str], optional

Name of the ports, for a BJT in common-emitter this is [‘B’, ‘C’, …] . Only needed to calculate AC-Quantities.

reference_nodestr, optional

Name of the common reference node, for a BJT in common-emitter this is ‘E’ . Only needed to calculate potentials.

debugbool, False

If True, debug info is printed.

areafloat, None

Specific area used to calculate area specific quantities.

forceBool, False

If true: re-calculate specifier, even if already existing.

Raises:
KeyError

If the column does not exist.

get_all_nodes()[source]

Gives a set of all nodes in voltages of a given df.

Returns:
set

Set containing all nodes of a given device.

get_all_potentials()[source]
Returns:
list

List containing all voltages present in self.columns as specifiers.

get_all_ss_para()[source]

Return a list of strings of all small signal parameters (ss) in df.

Returns:
[str]

List of strings of the ss parameter columns in self.

get_all_voltages()[source]

returns all voltages in the data frame.

Returns:
list

List containing all voltages present in self.columns as specifiers.

get_col_name(specifier, *nodes, sub_specifiers='')[source]

Checks if a column with the given combination of specifier and nodes exists in the given dataframe using the DMT naming style.

Parameters:
specifierstr

Ideally a specifier from specifiers

*nodesstr, optional

Nodes for the column. Like ‘B’ for base or ‘B’, ‘E’ for base-emitter

sub_specifiersstr, {‘’, DMT.core.sub_specifiers.PERIMETER, DMT.core.sub_specifiers.AREA}
Returns:
str

If the column exists the name is returned.

Raises:
KeyError

If the column does not exist.

get_ss_para(para, port_1, *ports_n)[source]

Return an array of the small signal (ss) parameters para in df.

Parameters:
parastr

Name of the parameter to be returned

port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

*port_nstr

Further nodes in order to build up a higher order matrix.

Returns:
np.ndarray()

Numpy array containing the values of the ss parameter para with shape [n_freq,n_port_in,n_port_out].

iter_unique_col(column: SpecifierStr, decimals: int = 5) Iterator[Tuple[int, complex, DataFrame]][source]

Allows iteration over the unique values and their slices of a column

Parameters:
columnDMT.core.SpecifierStr or str

Column name to iterate over

decimalsint, optional

Rounding precision for the unique, None to turn off, by default 5

Yields:
int

Index of current iteration

float

Value of the uniqued column

DMT.core.Dataframe

Slice of the dataframe with the unique value

Examples

We want to replace:

>>> for vbc in np.unique(np.round(df[col_vbc], decimals=5)):
        data = df[np.isclose(df[col_vbc], atol=1e-5)]
        ... # user action

with

>>> for index, vbc, data in df.iter_unique_col(col_vbc, decimals=5):
        ... # user action
parallel_norm(n_parallel, port_1, port_2)[source]

Normalize the data in df with regard to the number of devices in parallel.

This method normalizes S-parameters and currents with regard to the number of devices of the same geometry connected in parallel.

Parameters:
n_parallelint

number of parallel devices

port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

port_2str

Name of the nodes of the port 2, for a BJT in common-emitter this is ‘C’.

Returns:
DMT.core.DataFrame

DataFrame containing the normalized S parameters and currents.

processor = <DMT.core.data_processor.DataProcessor object>[source]
real2cmplx()[source]

Add real and imaginary columns in DataFrame to complex columns.

Returns:
selfDMT.core.DataFrame

Dataframe that contains cmplx columns instead of seperate real and imag columns.

repeat_rows(count)[source]

Repeats the DataFrame rows by the number count.

Parameters:
countint

Number of repeats per row.

Returns:
DMT.core.DataFrame

Dataframe with repeated rows

set_ss_para(para, para_values, port_1, *ports_n)[source]

Create or update the columns corresponding to small signal (ss) parameters para in df using the values in para_values.

Parameters:
parastr

Name of the parameter to be set.

para_valuesnp.array()

Array that holds the values of the ss parameter with shape [n_freq,n_port,n_port].

port_1str

Name of the nodes of the port 1, for a BJT in common-emitter this is ‘B’.

*port_nstr

Further nodes in order to build up a higher order matrix.

Returns:
DMT.core.DataFrame

DataFrame that contains the columns for the ss parameter para with values according to para_values.

smooth_SS_para(ports, fmin)[source]

Smooth the Small signal parameters in self and return a new dataframe.

Method from: B. Saha et al., “Reliable Technology Evaluation of SiGe HBTs and MOSFETs: fMAX Estimation From Measured Data,” in IEEE Electron Device Letters, vol. 42, no. 1, pp. 14-17, Jan. 2021, doi: 10.1109/LED.2020.3040891. to calculate fmax It is assumed that the frequency is strictly increasing for every DC operating point in the DataFrame, as is usually the case for measurement data-

Parameters:
ports[str]

The AC ports of the device

fminfloat

Minimum frequency to consider for smoothing

Returns:
DMT.core.DataFrame

Dataframe that contains the smoothed Y Parameters

strip_ss_para(keep='S')[source]

Throw away all but keep small signal parameters.

Parameters:
keepstr

Default=’S’. SS Para that shall be kept.

Returns:
DMT.core.DataFrame

The initial DataFrame without all ss parameters except keep.

class DMT.core.data_frame.Series(data=None, index=None, dtype: Dtype | None = None, name=None, copy: bool | None = None, fastpath: bool | lib.NoDefault = _NoDefault.no_default)[source]

Bases: Series

DMT.core.data_frame.fun_im(freq, a2, a3)[source]

Fit function for imaginary Y Parameters normalized to omega.

DMT.core.data_frame.fun_re(freq, a1, a2, a3)[source]

Fit function for real Y Parameters normalized.