allensdk.brain_observatory.ecephys.stimulus_table.stimulus_parameter_extraction module¶
-
allensdk.brain_observatory.ecephys.stimulus_table.stimulus_parameter_extraction.
extract_const_params_from_stim_repr
(stim_repr, repr_params_re=re.compile('([a-z0-9]+=[^=]+)[,\)]', re.IGNORECASE), array_re=re.compile('array\((?P<contents>\[.*\])\)'))[source]¶ Parameters which are not set as sweep_params in the stimulus script (usually because they are not varied during the course of the session) are not output in an easily machine-readable format. This function attempts to recover them by parsing the string repr of the stimulus.
Parameters: - stim_repr : str
The repr of the camstim stimulus object. Served up per-stimulus in the stim pickle.
- repr_params_re : re.Pattern
Extracts attributes as “=”-seperated strings
- array_re : re.Pattern
Extracts list reprs from numpy array reprs.
Returns: - repr_params : dict
dictionary of paramater keys and values extracted from the stim repr. Where possible, the values are converted to native Python types.
-
allensdk.brain_observatory.ecephys.stimulus_table.stimulus_parameter_extraction.
extract_stim_class_from_repr
(stim_repr, repr_class_re=re.compile('^(?P<class_name>[a-z0-9]+)\(.*\)$', re.IGNORECASE))[source]¶
-
allensdk.brain_observatory.ecephys.stimulus_table.stimulus_parameter_extraction.
parse_stim_repr
(stim_repr, drop_params=('name', 'autoLog', 'autoDraw', 'win'), repr_params_re=re.compile('([a-z0-9]+=[^=]+)[,\)]', re.IGNORECASE), array_re=re.compile('array\((?P<contents>\[.*\])\)'), raise_on_unrecognized=False)[source]¶ Read the string representation of a psychopy stimulus and extract stimulus parameters.
Parameters: - stim_repr : str
- drop_params : tuple
- repr_params_re : re.Pattern
- array_re : re.Pattern
Returns: - dict :
maps extracted parameter names to values