Naming module

naming.specifiers: _specifiers[source]
naming.sub_specifiers: _sub_specifiers[source]
naming.specifiers_ss_para: _specifiers_ss_para[source]
class DMT.core.naming.SpecifierStr(specifier: str | SpecifierStr, *nodes: str, sub_specifiers: FrozenSet[str | SpecifierStr] | Set[str | SpecifierStr] | List[str | SpecifierStr] | str | SpecifierStr | None = None)[source]

Bases: str

Acts like a string, but at the same time has the attribute “nodes”

https://stackoverflow.com/a/2673863

Yeah it is already implemented :P

Parameters:
specifierstr
nodes[str], optional
sub_specifiers[str], str, {‘’, sub_specifier}, optional
Attributes:
specifierstr
nodes[str]
sub_specifiers[str]
get_descriptor()[source]

Can be generalized using the _specifiers class.

get_pint_unit() Unit[source]

Return the DMT base unit of this specifier as a pint unit

get_tex_unit(scale=1, add='') str[source]

Get the unit of a given specifier in base units.

If scale is different from one, a suitable unit prefix is chosen. E.g. scale=1e3 and specifier=CURRENT -> si{milliampere}

Parameters:
scalefloat, integer

Unit prefix determination scale.

addstr

Additional string that is added to the unit

Returns:
unitstr

TeX representation of the specifer’s unit

nodes: List[str] = [][source]
specifier: str = ''[source]
classmethod string_from_load(string) str[source]

Generates a SpecifierStr from a string if the string was generated using string_to_save().

string_to_save() str[source]

Generates a single string which allows to identify the specifers, nodes and subspecifiers. Used to save into HDF5 as there the columns have to be valid strings.

sub_specifiers: FrozenSet[str] = [][source]
to_label(scale=1, negative=False, divide_by_unit=False, **kwargs) str[source]

Generates a label for plots for this specifier, where scale determines the unit prefix.

Parameters:
scalefloat, integer, optional

Unit prefix determination scale.

negativebool, optional

If True, a minus sign is added before the label

divide_by_unitbool, optional

If True, the unit is given as division, if False in brackets.

kwargsoptional

Keyword arguments passed on to self.to_tex(). Currently this allows subscript and superscript strings.

Returns:
unitstr

TeX representation of the specifer’s unit

to_legend_with_value(value, scale=1, decimals=2, **kwargs) str[source]

Creates a SI legend entry in the form : specifier_tex = SI{value}{scale, spec_unit}

Parameters:
valuefloat

Value to print into the legend

scaleint, optional

Scaling of unit and value using SI prefixes, by default 1.

**kwargs

Are passed to specifier.to_tex

Returns:
str

math tex legend entry

to_raw_string() str[source]

get a raw string from the specifier -> can be used for string operations and variable naming…

Returns:
strstr

string conversion of self…

to_tex(subscript='', superscript='')[source]

Return a Tex representation of this specifier. If subscript is not None the string in subscript will be appended. If superscript is not None, a superscript will be added.

Parameters:
subscriptstr

Subscript to add to the specifier’s Tex representation

superscriptstr

Superscript to add to the specifier’s Tex representation

Returns:
texstr

A Tex representation fo the specifier.

class DMT.core.naming._specifiers(*args, **kwargs)[source]
ACCEPTORS = 'ACC'[source]
CAPACITANCE = 'C'[source]
CHARGE = 'Q'[source]
CHARGE_DENSITY = "Q''"[source]
CONDUCTANCE = 'G'[source]
CONDUCTION_BAND_EDGE = 'EC'[source]
CURRENT = 'I'[source]
CURRENT_DENSITY = 'J'[source]
DC_CURRENT_AMPLIFICATION = 'BETA'[source]
DONNORS = 'DON'[source]
ELECTRICAL_POTENTIAL = 'PSI'[source]
ELECTRONS = 'N'[source]
ENERGY = 'E'[source]
FIELD = 'F'[source]
FREQUENCY = 'FREQ'[source]
GRADING = 'GRADING'[source]
HOLES = 'P'[source]
INDUCTANCE = 'L'[source]
MAXIMUM_AVAILABLE_GAIN = 'MAG'[source]
MAXIMUM_OSCILLATION_FREQUENCY = 'F_MAX'[source]
MAXIMUM_STABLE_GAIN = 'MSG'[source]
MOBILITY = 'MU'[source]
NET_DOPING = 'NNET'[source]
NOISE = 'N'[source]
OUTPUT_CONDUCTANCE = 'GO'[source]
POWER = 'P'[source]
QUASI_FERMI_POTENTIAL = 'PHI'[source]
RESISTANCE = 'R'[source]
SPACE_CHARGE = 'RHO'[source]
SS_PARA_A = 'A'[source]
SS_PARA_H = 'H'[source]
SS_PARA_S = 'S'[source]
SS_PARA_T = 'T'[source]
SS_PARA_Y = 'Y'[source]
SS_PARA_Z = 'Z'[source]
TEMPERATURE = 'TEMP'[source]
TIME = 'TIME'[source]
TRANSCONDUCTANCE = 'GM'[source]
TRANSIT_FREQUENCY = 'F_T'[source]
TRANSIT_TIME = 'TAU_F'[source]
UNILATERAL_GAIN = 'GU'[source]
VALENCE_BAND_EDGE = 'EV'[source]
VELOCITY = 'VELO'[source]
VOLTAGE = 'V'[source]
X = 'x'[source]
Y = 'y'[source]
Z = 'z'[source]
add_members(members)[source]
class DMT.core.naming._sub_specifiers(*args, **kwargs)[source]
AC = '|AC'[source]
AC_1 = '|AC_1'[source]
AC_2 = '|AC_2'[source]
AC_BASE = '|AC_BASE'[source]
AC_COLLECTOR = '|AC_COLLECTOR'[source]
AC_DRAIN = '|AC_DRAIN'[source]
AC_GATE = '|AC_GATE'[source]
AREA = '|AREA'[source]
CHANNEL = '|CHANNEL'[source]
CORNER = '|CORNER'[source]
DELTA = '|DELTA'[source]
ELECTRONS = '|ELECTRONS'[source]
FORCED = '|FORCED'[source]
HOLES = '|HOLES'[source]
IMAG = '|IMAG'[source]
JUNCTION = '|JUNCTION'[source]
LENGTH = '|LENGTH'[source]
MAG = '|MAG'[source]
MAJORITY = '|MAJORITY'[source]
MAX = '|MAX'[source]
MEAN = '|MEAN'[source]
MID = '|MID'[source]
MIN = '|MIN'[source]
MINORITY = '|MINORITY'[source]
NOISE = '|NOISE'[source]
PERIMETER = '|PERI'[source]
PHASE = '|PHASE'[source]
QUASISTATIC = '|QUASISTATIC'[source]
REAL = '|REAL'[source]
TRAPS = '|TRAPS'[source]
WIDTH = '|WIDTH'[source]
XDIR = '|XDIR'[source]
YDIR = '|YDIR'[source]
ZDIR = '|ZDIR'[source]
add_members(members)[source]
class DMT.core.naming._specifiers_ss_para(*args, **kwargs)[source]
SS_PARA_A = 'A'[source]
SS_PARA_H = 'H'[source]
SS_PARA_S = 'S'[source]
SS_PARA_T = 'T'[source]
SS_PARA_Y = 'Y'[source]
SS_PARA_Z = 'Z'[source]