LogContainer#
- class cbclib.LogContainer(protocol=<factory>, log_attr=<factory>, log_data=<factory>, idxs=None, translations=None)[source]#
Log data container class. Takes a log protocol
cbclib.LogProtocoland provides an interface to read the log files and generate a an array of sample translations and a set of scan samplescbclib.ScanSamples.- Parameters
protocol (
LogProtocol) – A log protocol objectlog_attr (
Dict[str,Dict[str,Any]]) – A dictionary of log attributes imported from a log file.log_data (
Dict[str,Any]) – A dictionary of log data imported from a log file.idxs (
Optional[ndarray]) – A set of indices of the scan steps imported from a log file.translations (
Optional[ndarray]) – An array of sample translations.
- contents()#
Return a list of the attributes stored in the container that are initialised.
- find_log_attribute(attr, part_key=None)[source]#
Find a value in the log attributes corresponding to an attribute name attr.
- find_log_dataset(attr)[source]#
Find a dataset in the log data corresponding to an attribute name attr.
- find_log_part_key(attr)[source]#
Find a name of the log dictionary corresponding to an attribute name attr.
- generate_samples(dist, setup)[source]#
Generate a
cbclib.ScanSamplesobject from the sample translations.- Parameters
- Raises
ValueError – If
translationsis missing.- Return type
- Returns
A scan samples object.
- get(attr, value=None)#
Retrieve a dataset, return
valueif the attribute is not found.
- items()#
Return (key, value) pairs of the datasets stored in the container.
- Return type
- Returns
(key, value) pairs of the datasets stored in the container.
- keys()#
Return a list of the attributes available in the container.
- read_logs(log_path, idxs=None)[source]#
Read a log file under the path log_path. Read out only the frame indices defined by
idxs. Ifidxsis None, read the whole log file.
- read_translations()[source]#
Generate sample translations based on the log data.
- Raises
ValueError – If
log_datais missing.- Return type
- Returns
A new log container with
translationsupdated.
- replace(**kwargs)#
Return a new container object with a set of attributes replaced.
- simulate_translations()[source]#
Simulate sample translations based on the log attributes.
- Raises
ValueError – If
log_attris missing.- Return type
- Returns
A new log container with
translationsupdated.
- values()#
Return the attributes’ data stored in the container.
- Return type
- Returns
List of data stored in the container.