neclib.utils.data_utils#

Utility functions for data structure handling.

class ParameterList(value=[])[source]#

Bases: list

List, specialized in parameter storing.

Parameters:

value (Iterable) – Iterable object to be converted to ParameterList.

Examples

>>> neclib.utils.ParameterList([0, 0])
ParameterList([0, 0])
>>> neclib.utils.ParameterList(range(5))
ParameterList([0, 1, 2, 3, 4])
classmethod new(length, initvalue=nan)[source]#

Create new ParameterList instance filled with initial value.

Parameters:
  • length (int) – Length of ParameterList to be created.

  • initvalue (Any) – Initial value to fill the ParameterList.

Return type:

ParameterList

Examples

>>> neclib.utils.ParameterList.new(3, 100)
ParameterList([100, 100, 100])
push(value)[source]#

Append new value to ParameterList, preserving its length.

Parameters:

value (Any) – Value to be appended.

Return type:

None

Examples

>>> param = neclib.utils.ParameterList([1, 2])
>>> param.push(5)
>>> param
ParameterList([2, 5])
copy()[source]#

Return copied ParameterList.

Examples

>>> param = neclib.utils.ParameterList([1, 2])
>>> param.copy()
ParameterList([1, 2])
map(func)[source]#

Map a function to every element in the ParameterList.

Parameters:

func (Callable) – Function to apply.

Return type:

ParameterList

Examples

>>> param = neclib.utils.ParameterList([1, 2])
>>> param.map(lambda x: 10 * x)
ParameterList([10, 20])
class AzElData(az: Any = None, el: Any = None)[source]#

Bases: object

Parameters:
  • az (Any) –

  • el (Any) –

az: Any = None#

Parameter related to azimuth axis.

el: Any = None#

Parameter related to elevation axis.

class ParameterMapping[source]#

Bases: dict

Dict, with attribute access to parameter supported.

Parameter mapping, supports both dict-key syntax and attribute access syntax. Dict methods are fully supported.

Examples

>>> param = neclib.utils.ParameterMapping(a=1, b=2)
>>> param["a"]
1
>>> param.a
1
>>> neclib.utils.ParameterMapping({"a": 1, "b": 2}) == param
True
copy()[source]#

Return copied ParameterMapping.

Examples

>>> param = neclib.utils.ParameterMapping(a=1, b=2)
>>> param.copy()
ParameterMapping({'a': 1, 'b': 2})
toCamelCase(data, kind='python')[source]#
Parameters:
  • data (str) –

  • kind (Literal['upper', 'pascal', 'bumpy', 'python', 'lower', '']) –

Return type:

str

to_snake_case(data)[source]#
Parameters:

data (str) –

Return type:

str

class AliasedDict(*args, **kwargs)[source]#

Bases: UserDict

alias(**kwargs)[source]#
Return type:

None