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_ft(port_1, port_2)[source]
Calculates the transit frequency FT using the spot frequency method.
- calc_go(ports=['B', 'C', 'E'])[source]
Calculates the DC output condutance of a BJT or generic transistor in common emitter/source configuration.
- calc_tfit1(port_1, port_2)[source]
Calculates the transit frequency FT using the spot frequency method.
- calc_tfit2(port_1, port_2)[source]
Calculates the transit frequency FT using the spot frequency method.
- 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_voltage
str
Specifier for the voltage, defaults to ‘V’
- specifier_current
str
Specifier for the voltage, defaults to ‘I’
- specifier_capacitance
str
Specifier for the voltage, defaults to ‘C’
- specifier_frequency
str
Specifier for the frequency, defaults to ‘FREQ’
- specifier_temperature
str
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 forget_nodes()
, defaults to ‘TEMP’
- nodes[
- 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_voltage
str
,optional
Indicator for voltages in the measurements, by default specifiers.VOLTAGE
- specifier_current
str
,optional
Indicator for currents in the measurements, by default specifiers.CURRENT
- specifier_capacitance
str
,optional
Indicator for capacitances in the measurements, by default specifiers.CAPACITANCE
- specifiers_ss_parameter
optional
Small signal parameters in the measurements, by default specifiers_ss_para
- ignore
list
,optional
Columns in the measurements to ignore, by default None
- specifier_voltage
- 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:
- self
DMT.core.DataFrame
Dataframe that contains real and imag columns instead of cmplx columns.
- self
- 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_from
str
String that specifies which parameters are already present in self.
- p_to
str
String that specifies which parameters should be created in self.
- z0
float
() 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’].
- p_from
- Returns:
- self
DMT.core.DataFrame
Dataframe that contains the p_to n_port parameters
- self
- create_potential(nodes, reference_node, voltage_sub_specifiers=None, debug=False)[source]
Try to create col from existing data in dataframe df.
- Parameters:
- Returns:
- df
DMT.core.DataFrame
DMT.Dataframe with new dataframe, if successfull
- df
- 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:
- 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_open
DMT.core.DataFrame
df containgin the measured open structure.
- df_short
DMT.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’, …]
- ndevices
int
Number of parallel devices to be deembedded.
- ndevices_open
int
Number of parallel devices of the open structure.
- ndevices_short
int
Number of parallel devices of the short structure.
- df_open
- 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: Dict | None = None, df_short_dc=None, forced_current=False, ac_ports=None, reference_node='E')[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:
- mres
dict
- df_short_dc
DMT.core.DataFrame
df containing the dc-measured short structure.
- mres
- 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:
- 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_short
DMT.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’, …]
- times
int
The number of times the short has to be removed.
- df_short
- Returns:
DMT.core.DataFrame
DataFrame containing the de-embedded S parameters.
- determine_mres(forced_current=False, ac_ports=None, reference_node='E') Dict [source]
Determine the external restistances caused by the metallization.
- 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:
- specifier
str
Ideally a specifier from
specifiers
- *nodes
str
,optional
Nodes for the column. Like ‘B’ for base or ‘B’, ‘E’ for base-emitter
- sub_specifiers
str
, {‘’,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_node
str
,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.
- area
float
,None
Specific area used to calculate area specific quantities.
- force
Bool
,False
If true: re-calculate specifier, even if already existing.
- specifier
- Raises:
KeyError
If the column does not exist.
- classmethod from_feather(file_name: str | PathLike, to_specifier=True)[source]
Load the data stored in file_name, where file_name is the direct path to the file.
- 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.
- get_ss_para(para, port_1, *ports_n)[source]
Return an array of the small signal (ss) parameters para in df.
- Parameters:
- 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:
- Yields:
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:
- Returns:
DMT.core.DataFrame
DataFrame containing the normalized S parameters and currents.
- real2cmplx()[source]
Add real and imaginary columns in DataFrame to complex columns.
- Returns:
- self
DMT.core.DataFrame
Dataframe that contains cmplx columns instead of seperate real and imag columns.
- self
- repeat_rows(count)[source]
Repeats the DataFrame rows by the number count.
- Parameters:
- count
int
Number of repeats per row.
- count
- 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:
- 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-
- strip_ss_para(keep='S')[source]
Throw away all but keep small signal parameters.
- Parameters:
- keep
str
Default=’S’. SS Para that shall be kept.
- keep
- Returns:
DMT.core.DataFrame
The initial DataFrame without all ss parameters except keep.
- to_feather(file_name: str | PathLike, version=2, compression='lz4', **kwargs)[source]
Saves the dataframe as a feather binary file
- Parameters:
- file_name
str
|os.PathLike
file name and path to save to.
- version
int
,optional
Feather version (passed on to pandas.DataFrame.to_feather), by default 2
- compression
str
,optional
compresion algorithm (passed on to pandas.DataFrame.to_feather), by default “lz4”
- kwargs: optional
passed on to pandas.DataFrame.to_feather
- file_name
- 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