ibllib.qc.base
Functions
Create sign off dictionary. |
Classes
A base class for data quality control. |
- class QC(endpoint_id, one=None, log=None, endpoint='sessions')[source]
Bases:
object
A base class for data quality control.
- abstract run()[source]
Run the QC tests and return the outcome.
- Returns:
One of “CRITICAL”, “FAIL”, “WARNING” or “PASS”
- abstract load_data()[source]
Load the data required to compute the QC.
Subclasses may implement this for loading raw data.
- property outcome
The overall session outcome.
- Type:
- static overall_outcome(outcomes: iter, agg=<built-in function max>) QC [source]
Given an iterable of QC outcomes, returns the overall (i.e. worst) outcome.
Example
QC.overall_outcome([‘PASS’, ‘NOT_SET’, None, ‘FAIL’]) # Returns ‘FAIL’
- Parameters:
outcomes (iterable of one.alf.spec.QC, str or int) – An iterable of QC outcomes.
agg (function) – Outcome code aggregate function, default is max (i.e. worst).
- Returns:
The overall outcome.
- Return type:
- update(outcome=None, namespace='experimenter', override=False)[source]
Update the qc field in Alyx.
Updates the ‘qc’ field in Alyx if the new QC outcome is worse than the current value.
- Parameters:
outcome (str, int, one.alf.spec.QC) – A QC outcome; one of “CRITICAL”, “FAIL”, “WARNING”, “PASS” or “NOT_SET”.
namespace (str) – The extended QC key specifying the type of QC associated with the outcome.
override (bool) – If True the QC field is updated even if new value is better than previous.
- Returns:
The current QC outcome on Alyx.
- Return type:
Example
>>> qc = QC('path/to/session') >>> qc.update('PASS') # Update current QC field to 'PASS' if not set
- sign_off_dict(exp_dec, sign_off_categories=None)[source]
Create sign off dictionary.
Creates a dict containing ‘sign off’ keys for each device and task protocol in the provided experiment description.
- Parameters:
exp_dec (dict) – A loaded experiment description file.
sign_off_categories (dict of list) – A dictionary of custom JSON keys for a given device in the acquisition description file.
- Returns:
The sign off dictionary with the main key ‘sign_off_checklist’ containing keys for each device and task protocol.
- Return type:
dict of dict