allensdk.brain_observatory.ecephys.stimulus_table.naming_utilities module¶
-
allensdk.brain_observatory.ecephys.stimulus_table.naming_utilities.
add_number_to_shuffled_movie
(table, natural_movie_re=re.compile('natural_movie_(?P<number>\d+|one|two|three|four|five|six|seven|eight|nine)(_shuffled){0, 1}(_more_repeats){0, 1}'), template_re=re.compile('natural_movie_shuffled'), stim_colname='stimulus_name', template='natural_movie_{}_shuffled', tmp_colname='__movie_number__')[source]¶
-
allensdk.brain_observatory.ecephys.stimulus_table.naming_utilities.
collapse_columns
(table)[source]¶ merge, where possible, columns that describe the same parameter. This is pretty conservative - it only matches columns by capitalization and it only overrides nans.
-
allensdk.brain_observatory.ecephys.stimulus_table.naming_utilities.
drop_empty_columns
(table)[source]¶ Remove from the stimulus table columns whose values are all nan
-
allensdk.brain_observatory.ecephys.stimulus_table.naming_utilities.
map_column_names
(table, name_map=None, ignore_case=True)[source]¶
-
allensdk.brain_observatory.ecephys.stimulus_table.naming_utilities.
map_stimulus_names
(table, name_map=None, stim_colname='stimulus_name')[source]¶ Applies a mappting to the stimulus names in a stimulus table
Parameters: - table : pd.DataFrame
the input stimulus table
- name_map : dict, optional
rename the stimuli according to this mapping
- stim_colname: str, optional
look in this column for stimulus names
-
allensdk.brain_observatory.ecephys.stimulus_table.naming_utilities.
standardize_movie_numbers
(table, movie_re=re.compile('natural_movie_(?P<number>\d+|one|two|three|four|five|six|seven|eight|nine)(_shuffled){0, 1}(_more_repeats){0, 1}'), numeral_re=re.compile('(?P<number>\d+)'), digit_names={'1': 'one', '2': 'two', '3': 'three', '4': 'four', '5': 'five', '6': 'six', '7': 'seven', '8': 'eight', '9': 'nine'}, stim_colname='stimulus_name')[source]¶ Natural movie stimuli in visual coding are numbered using words, like “natural_movie_two” rather than “natural_movie_2”. This function ensures that all of the natural movie stimuli in an experiment are named by that convention.
Parameters: - table : pd.DataFrame
the incoming stimulus table
- movie_re : re.Pattern, optional
regex that matches movie stimulus names
- numeral_re : re.Pattern, optional
regex that extracts movie numbers from stimulus names
- digit_names : dict, optional
map from numerals to english words
- stim_colname : str, optional
the name of the dataframe column that contains stimulus names
Returns: - table : pd.DataFrame
the stimulus table with movie numerals having been mapped to english words