molgri.space.translations
Parse linear discretisations provided by users.
Classes
|
User input is expected in nanometers (nm)! |
- class molgri.space.translations.TranslationParser(user_input: str)
User input is expected in nanometers (nm)!
- Parse all ways in which the user may provide a linear translation grid. Currently supported formats:
a list of numbers, eg ‘[1, 2, 3]’
a linearly spaced list with optionally provided number of elements eg. ‘linspace(1, 5, 50)’
a range with optionally provided step, eg ‘range(0.5, 3, 0.4)’
- Args:
user_input: a string in one of allowed formats
- __init__(user_input: str)
User input is expected in nanometers (nm)!
- Parse all ways in which the user may provide a linear translation grid. Currently supported formats:
a list of numbers, eg ‘[1, 2, 3]’
a linearly spaced list with optionally provided number of elements eg. ‘linspace(1, 5, 50)’
a range with optionally provided step, eg ‘range(0.5, 3, 0.4)’
- Args:
user_input: a string in one of allowed formats
- get_trans_grid() ndarray[Any, dtype[ScalarType]]
- get_N_trans() int
- sum_increments_from_first_radius() _SupportsArray[dtype] | _NestedSequence[_SupportsArray[dtype]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]
Get final distance - first non-zero distance == sum(increments except the first one).
Useful because often the first radius is large and then only small increments are made.
- get_increments() ndarray[Any, dtype[ScalarType]]
Get an array where each element represents an increment needed to get to the next radius.
- Example:
self.trans_grid = np.array([10, 10.5, 11.2]) self.get_increments() -> np.array([10, 0.5, 0.7])