1212
1313
1414class QC :
15- """A base class for data quality control"""
15+ """A base class for data quality control. """
1616
1717 def __init__ (self , endpoint_id , one = None , log = None , endpoint = 'sessions' ):
1818 """
19+ A base class for data quality control.
20+
1921 :param endpoint_id: Eid for endpoint. If using sessions can also be a session path
2022 :param log: A logging.Logger instance, if None the 'ibllib' logger is used
2123 :param one: An ONE instance for fetching and setting the QC on Alyx
@@ -38,15 +40,17 @@ def __init__(self, endpoint_id, one=None, log=None, endpoint='sessions'):
3840
3941 @abstractmethod
4042 def run (self ):
41- """Run the QC tests and return the outcome
43+ """Run the QC tests and return the outcome.
44+
4245 :return: One of "CRITICAL", "FAIL", "WARNING" or "PASS"
4346 """
4447 pass
4548
4649 @abstractmethod
4750 def load_data (self ):
48- """Load the data required to compute the QC
49- Subclasses may implement this for loading raw data
51+ """Load the data required to compute the QC.
52+
53+ Subclasses may implement this for loading raw data.
5054 """
5155 pass
5256
@@ -85,7 +89,8 @@ def overall_outcome(outcomes: iter, agg=max) -> spec.QC:
8589 return agg (map (spec .QC .validate , outcomes ))
8690
8791 def _set_eid_or_path (self , session_path_or_eid ):
88- """Parse a given eID or session path
92+ """Parse a given eID or session path.
93+
8994 If a session UUID is given, resolves and stores the local path and vice versa
9095 :param session_path_or_eid: A session eid or path
9196 :return:
@@ -215,16 +220,16 @@ def update_extended_qc(self, data):
215220 return out
216221
217222 def compute_outcome_from_extended_qc (self ) -> str :
218- """
219- Returns the session outcome computed from aggregating the extended QC
220- """
223+ """Return the session outcome computed from aggregating the extended QC."""
221224 details = self .one .alyx .get (f'/{ self .endpoint } /{ self .eid } ' , clobber = True )
222225 extended_qc = details ['json' ]['extended_qc' ] if self .json else details ['extended_qc' ]
223226 return self .overall_outcome (v for k , v in extended_qc .items () or {} if k [0 ] != '_' )
224227
225228
226229def sign_off_dict (exp_dec , sign_off_categories = None ):
227230 """
231+ Create sign off dictionary.
232+
228233 Creates a dict containing 'sign off' keys for each device and task protocol in the provided
229234 experiment description.
230235
0 commit comments