neclib.core.configuration#

Aliases#

NECSTConfigurationError

Error related to parameter configuration.

NECSTParameterNameError

Error related to limitation on parameter name.

RichParameters

Parameters with flexible look-up and high-level representation support.

ValueRange

Value range bound by 2 values.

get_logger

Get logger instance which prints operation logs to console.

read

Read a file, if it’s accessible via any available way.

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

Bases: RichParameters

classmethod from_file(_Configuration__path)[source]#

Read parameters from a TOML file.

Parameters:
  • file – The file path or file object.

  • _Configuration__path (Union[PathLike, str, IO]) –

Examples

>>> params = RichParameters.from_file("path/to/file.toml")

You can also read parameters from a file-like object.

>>> with open("path/to/file.toml") as f:
...     params = RichParameters.from_file(f)

And if you wish, remote files can be read:

>>> params = RichParameters.from_file("https://example.com/file.toml")
reload()[source]#

Reload the configuration.

This method is to reflect the changes made to the configuration file or the change of environment variables.

classmethod configure()[source]#

Copy default configuration files into your local file system.

Important

The files would be placed in $HOME/.necst/. The file contents MUST BE UPDATED accordingly, before using this software to actually drive your telescope.

Caution

Running this software with misconfigured parameter files could result in catastrophic damage to your telescope, by many possible cause. The consequence can include: 1) the antenna becomes uncontrollable because the commands are calculated in positive feedback, 2) damage your receivers with applying too large voltage, and so on.

property parameters: Dict[str, Any]#

Return a copy of the raw parameters.

keys()[source]#
Return type:

KeysView

values()[source]#
Return type:

ValuesView

items()[source]#
Return type:

ItemsView

find_config()[source]#

Look for the configuration file from environment variables and defaults.

Return type:

str

class ConfigurationView(prefix='', /, **kwargs)[source]#

Bases: Configuration

Sliced configuration.

Parameters:

prefix (str) –

reload()[source]#

Reload the configuration.

This method is to reflect the changes made to the configuration file or the change of environment variables.

Return type:

None

config = Configuration(159 elements)#

Collection of system-wide configurations.

configure()#

Copy default configuration files into your local file system.

Important

The files would be placed in $HOME/.necst/. The file contents MUST BE UPDATED accordingly, before using this software to actually drive your telescope.

Caution

Running this software with misconfigured parameter files could result in catastrophic damage to your telescope, by many possible cause. The consequence can include: 1) the antenna becomes uncontrollable because the commands are calculated in positive feedback, 2) damage your receivers with applying too large voltage, and so on.