flexiznam.camp package¶
Module contents¶
flexiznam.camp.sync_data module¶
File to handle acquisition yaml file and create datasets on flexilims
- flexiznam.camp.sync_data.clean_yaml(path_to_yaml)[source]¶
Read a yaml file and check that it is correctly formatted
This does not do any processing, just make sure that I can read the whole yaml and generate dictionary will all expected fields
- flexiznam.camp.sync_data.create_dataset(dataset_infos, parent, raw_data_folder, verbose=True, error_handling='crash')[source]¶
Create dictionary of datasets
- Parameters
dataset_infos – extra information for reading dataset outside of raw_data_folder or adding optional arguments
parent (dict) – yaml dictionary of the parent level
raw_data_folder (str) – folder where to look for data
verbose (bool) – (True) Print info about dataset found
error_handling (str) – error if crash otherwise replace the dataset instance by the error message in the output dictionary
- Returns
dictionary of dataset instances
- Return type
- flexiznam.camp.sync_data.create_sample_datasets(parent, raw_data_folder)[source]¶
Recursively index samples creating a nested dictionary and generate corresponding datasets
- flexiznam.camp.sync_data.find_xxerrorxx(yml_file=None, yml_data=None, pattern='XXERRORXX', _output=None)[source]¶
Utility to find where things went wrong
Look through a yml_file or the corresponding yml_Data dictionary recursively. Returns a dictionary with all entries containing the error pattern
_output is used for recursive calling.
- flexiznam.camp.sync_data.parse_yaml(path_to_yaml, raw_data_folder=None, verbose=True)[source]¶
Read an acquisition yaml and create corresponding datasets
- flexiznam.camp.sync_data.read_dataset(name, data)[source]¶
Read YAML information corresponding to a dataset
- flexiznam.camp.sync_data.read_level(yml_level, mandatory_args=('project', 'mouse', 'session'), optional_args=('path', 'notes', 'attributes'), nested_levels=('recordings', 'datasets', 'samples'))[source]¶
Read one layer of the yml file (i.e. a dictionary)
- Parameters
yml_level (dict) – a dictionary containing the yml level to analyse (and all sublevels)
mandatory_args – arguments that must be in this level
optional_args – arguments that are expected but not mandatory, will be None if absent
nested_levels – name of any nested level that should not be parsed
- Returns
- a tuple containing two dictionaries:
level (dict): dictonary of top level attributes nested_levels (dict): dictionary of nested dictonaries
- Return type
(tuple)
- flexiznam.camp.sync_data.read_recording(name, data)[source]¶
Read YAML information corresponding to a recording
- flexiznam.camp.sync_data.read_sample(name, data)[source]¶
Read YAML information corresponding to a sample
- flexiznam.camp.sync_data.trim_paths(session_data, raw_data_folder)[source]¶
Parses paths to make them relative to raw_data_folder
- flexiznam.camp.sync_data.upload_yaml(source_yaml, raw_data_folder=None, verbose=False, log_func=<built-in function print>, flexilims_session=None, conflicts='abort')[source]¶
Upload data from one yaml to flexilims
- Parameters
source_yaml (str) – path to clean yaml
raw_data_folder (str) – path to the folder containing the data. Default to data_root[‘raw’]
verbose (bool) – print progress information
log_func – function to deal with warnings and messages
flexilims_session (Flexilims) – session to avoid recreating a token
conflicts (str) – abort to crash if there is a conflict, skip to ignore and proceed
- Returns
dictionary or flexilims ID