allensdk.brain_observatory.session_analysis module¶
-
class
allensdk.brain_observatory.session_analysis.
SessionAnalysis
(nwb_path, save_path)[source]¶ Bases:
object
Run all of the stimulus-specific analyses associated with a single experiment session.
Parameters: - nwb_path: string, path to NWB file
- save_path: string, path to HDF5 file to store outputs. Recommended NOT to modify the NWB file.
-
append_experiment_metrics
(metrics)[source]¶ Extract stimulus-agnostic metrics from an experiment into a dictionary
-
append_metadata
(df)[source]¶ Append the metadata fields from the NWB file as columns to a pd.DataFrame
-
append_metrics_drifting_grating
(metrics, dg)[source]¶ Extract metrics from the DriftingGratings peak response table into a dictionary.
-
append_metrics_locally_sparse_noise
(metrics, lsn)[source]¶ Extract metrics from the LocallySparseNoise peak response table into a dictionary.
-
append_metrics_natural_movie_one
(metrics, nma)[source]¶ Extract metrics from the NaturalMovie(stimulus_info.NATURAL_MOVIE_ONE) peak response table into a dictionary.
-
append_metrics_natural_movie_three
(metrics, nma)[source]¶ Extract metrics from the NaturalMovie(stimulus_info.NATURAL_MOVIE_THREE) peak response table into a dictionary.
-
append_metrics_natural_movie_two
(metrics, nma)[source]¶ Extract metrics from the NaturalMovie(stimulus_info.NATURAL_MOVIE_TWO) peak response table into a dictionary.
-
append_metrics_natural_scene
(metrics, ns)[source]¶ Extract metrics from the NaturalScenes peak response table into a dictionary.
-
append_metrics_static_grating
(metrics, sg)[source]¶ Extract metrics from the StaticGratings peak response table into a dictionary.
-
save_session_a
(dg, nm1, nm3, peak)[source]¶ Save the output of session A analysis to self.save_path.
Parameters: - dg: DriftingGratings instance
- nm1: NaturalMovie instance
This NaturalMovie instance should have been created with movie_name = stimulus_info.NATURAL_MOVIE_ONE
- nm3: NaturalMovie instance
This NaturalMovie instance should have been created with movie_name = stimulus_info.NATURAL_MOVIE_THREE
- peak: pd.DataFrame
The combined peak response property table created in self.session_a().
-
save_session_b
(sg, nm1, ns, peak)[source]¶ Save the output of session B analysis to self.save_path.
Parameters: - sg: StaticGratings instance
- nm1: NaturalMovie instance
This NaturalMovie instance should have been created with movie_name = stimulus_info.NATURAL_MOVIE_ONE
- ns: NaturalScenes instance
- peak: pd.DataFrame
The combined peak response property table created in self.session_b().
-
save_session_c
(lsn, nm1, nm2, peak)[source]¶ Save the output of session C analysis to self.save_path.
Parameters: - lsn: LocallySparseNoise instance
- nm1: NaturalMovie instance
This NaturalMovie instance should have been created with movie_name = stimulus_info.NATURAL_MOVIE_ONE
- nm2: NaturalMovie instance
This NaturalMovie instance should have been created with movie_name = stimulus_info.NATURAL_MOVIE_TWO
- peak: pd.DataFrame
The combined peak response property table created in self.session_c().
-
save_session_c2
(lsn4, lsn8, nm1, nm2, peak)[source]¶ Save the output of session C2 analysis to self.save_path.
Parameters: - lsn4: LocallySparseNoise instance
This LocallySparseNoise instance should have been created with self.stimulus = stimulus_info.LOCALLY_SPARSE_NOISE_4DEG.
- lsn8: LocallySparseNoise instance
This LocallySparseNoise instance should have been created with self.stimulus = stimulus_info.LOCALLY_SPARSE_NOISE_8DEG.
- nm1: NaturalMovie instance
This NaturalMovie instance should have been created with movie_name = stimulus_info.NATURAL_MOVIE_ONE
- nm2: NaturalMovie instance
This NaturalMovie instance should have been created with movie_name = stimulus_info.NATURAL_MOVIE_TWO
- peak: pd.DataFrame
The combined peak response property table created in self.session_c2().
-
session_a
(plot_flag=False, save_flag=True)[source]¶ Run stimulus-specific analysis for natural movie one, natural movie three, and drifting gratings. The input NWB be for a stimulus_info.THREE_SESSION_A experiment.
Parameters: - plot_flag: bool
Whether to generate brain_observatory_plotting work plots after running analysis.
- save_flag: bool
Whether to save the output of analysis to self.save_path upon completion.
-
session_b
(plot_flag=False, save_flag=True)[source]¶ Run stimulus-specific analysis for natural scenes, static gratings, and natural movie one. The input NWB be for a stimulus_info.THREE_SESSION_B experiment.
Parameters: - plot_flag: bool
Whether to generate brain_observatory_plotting work plots after running analysis.
- save_flag: bool
Whether to save the output of analysis to self.save_path upon completion.
-
session_c
(plot_flag=False, save_flag=True)[source]¶ Run stimulus-specific analysis for natural movie one, natural movie two, and locally sparse noise. The input NWB be for a stimulus_info.THREE_SESSION_C experiment.
Parameters: - plot_flag: bool
Whether to generate brain_observatory_plotting work plots after running analysis.
- save_flag: bool
Whether to save the output of analysis to self.save_path upon completion.
-
session_c2
(plot_flag=False, save_flag=True)[source]¶ Run stimulus-specific analysis for locally sparse noise (4 deg.), locally sparse noise (8 deg.), natural movie one, and natural movie two. The input NWB be for a stimulus_info.THREE_SESSION_C2 experiment.
Parameters: - plot_flag: bool
Whether to generate brain_observatory_plotting work plots after running analysis.
- save_flag: bool
Whether to save the output of analysis to self.save_path upon completion.
-
allensdk.brain_observatory.session_analysis.
multi_dataframe_merge
(dfs)[source]¶ merge a number of pd.DataFrames into a single dataframe on their index columns. If any columns are duplicated, prefer the first occuring instance of the column
-
allensdk.brain_observatory.session_analysis.
run_session_analysis
(nwb_path, save_path, plot_flag=False, save_flag=True)[source]¶ Inspect an NWB file to determine which experiment session was run and compute all stimulus-specific analyses.
Parameters: - nwb_path: string
Path to NWB file.
- save_path: string
path to save results. Recommended NOT to use NWB file.
- plot_flag: bool
Whether to save brain_observatory_plotting work plots.
- save_flag: bool
Whether to save results to save_path.