neclib.recorders.recorder#

Aliases#

Writer

None

get_logger

Get logger instance which prints operation logs to console.

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

Bases: object

Data recorder, to be used with arbitrary writers.

Parameters:

record_root – Root directory of data storage. All the data will be stored inside this directory. Subdirectories will be structured by attached writers.

Examples

>>> recorder = neclib.recorders.Recorder("/home/user/data")
>>> recorder.add_writer(neclib.recorders.DBWriter(), neclib.recorders.FileWriter())
>>> recorder.start_recording()
>>> recorder.append("test", 1)  # Arbitrary number and type of data can be passed
>>> recorder.stop_recording()
add_writer(*writers)[source]#

Attach writer(s) to this recorder.

Parameters:

writers (Writer) –

Return type:

None

property writers#

List of attached writers.

drop_writer(*writers)[source]#

Drop writer(s) from this recorder.

Parameters:

writers (Union[int, Writer]) –

Return type:

None

start_recording(record_dir=None, *, noreset=False)[source]#

Activate all attached writers.

Parameters:
  • record_dir (Optional[PathLike]) –

  • noreset (bool) –

Return type:

None

append(*args, **kwargs)[source]#

Pass data to all attached writers.

Return type:

None

stop_recording(*, noreset=False)[source]#

Deactivate all attached writers.

Parameters:

noreset (bool) –

Return type:

None

property is_recording: bool#

Whether this recorder is accepting data or not.