mahos.meas.recorder.Recorder#
- class mahos.meas.recorder.Recorder(gconf: dict, name, context=None)#
Generic data-logging measurement for time-series data.
The target instruments must implement following APIs:
get_param_dict_labels(),get_param_dict(),configure(),start(),stop(), andget().get("unit")is required only when channel unit is not specified in mode config.- Parameters:
target.servers (dict[str, str]) – InstrumentServer targets (instrument name, server full name). Required keys: each instrument name referenced by
modechannelinstvalues.target.tweakers (list[str]) – The Tweaker targets (list of tweaker full name).
target.log (str) – The LogBroker target (broker full name).
mode (dict[str, dict[str, tuple[str, str] | dict[str, str]]]) – Nested dictionary to define the measurement modes. First-level key is mode name and second-level key is measurement channel name, and value is the channel config. Channel config can be tuple[str, str] (instrument name, label name), or dict with keys:
inst(required),label(optional, default""),key(optional, default"data"), andunit(optional).collector.interval_sec (float) – Default polling interval used by Collector.
pub_interval_sec (float) – Maximum interval between periodic status/data publications.
Runtime behavior for each channel in selected mode:
get_param_dict()request: callsget_param_dict(inst, label).Start sequence:
lock(inst)(optional),configure(inst, params[channel], label), then unit resolution byunitin config orget(inst, "unit", label=label). Finally,start(inst, label=label)is called.Polling sequence (ACTIVE): calls
get(inst, key, label=label)repeatedly at collector interval and appends returned values toRecorderDataunder the channel name.Stop sequence: calls
stop(inst, label=label)and releases lock.Reset sequence (IDLE only): calls
reset(inst, label=label)without lock/release.
- __init__(gconf: dict, name, context=None)#
Methods
__init__(gconf, name[, context])change_state(msg)Change state to msg.state.
close_resources()Close custom resources.
export_data(msg)Export data.
get_param_dict(msg)Get parameter dict.
get_param_dict_labels(msg)Get parameter dict labels.
handle_req(msg)Handle Request other than basic requests.
load_data(msg)Load data.
main()Main procedure that will be looped.
reset(msg)save_data(msg)Save data.
wait()Wait until required resources are ready.
Attributes