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:
- Attributes:
- 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}
- 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.
- 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:
- scale
float
,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.
- kwargs
optional
Keyword arguments passed on to self.to_tex(). Currently this allows subscript and superscript strings.
- scale
- Returns:
- unit
str
TeX representation of the specifer’s unit
- 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}
- to_raw_string() str [source]
get a raw string from the specifier -> can be used for string operations and variable naming…
- Returns:
- str
str
string conversion of self…
- str