Analysis

Analysises

Main analysis class

class cicada.analysis.cicada_analysis.CicadaAnalysis(name, short_description, family_id=None, long_description=None, data_to_analyse=None, data_format=None, config_handler=None, gui=True)[source]

An abstract class that should be inherit in order to create a specific analyse

add_argument_for_gui(with_incremental_order=True, **kwargs)[source]
Parameters:
  • **kwargs
  • with_incremental_order – boolean, if True means the order of the argument will be the same as when added

Returns:

add_ci_movie_arg_for_gui(long_description=None)[source]

Will add an argument for gui, named ci_movie that will list all calcium imaging available for each session Returns:

add_segmentation_arg_for_gui()[source]

Will add an argument for gui, named segmentation that will list all segmentations available for each session Returns:

check_data()[source]

Check the data given one initiating the class and return True if the data given allows the analysis implemented, False otherwise. :return: a boolean

create_results_directory(dir_path)[source]

Will create a directory in dir_path with the name of analysis and time at which the directory is created so it can be unique. The attribute _results_path will be updated with the path of this new directory :param dir_path: path of the dir in which create the results dir

Returns: this new directory

get_data_identifiers()[source]

Return a list of string representing each data to analyse Returns:

get_data_to_analyse()[source]
Returns:a list of the data to analyse
get_results_path()[source]

Return the path when the results from the analysis will be saved or None if it doesn’t exist yet Returns:

run_analysis(**kwargs)[source]

Run the analysis :param kwargs: :return:

set_arguments_for_gui()[source]

Need to be implemented in order to be used through the graphical interface. super().set_arguments_for_gui() should be call first to instantiate an AnalysisArgumentsHandler and create the attribution for results_path :return: None

set_data(data_to_analyse, data_format='nwb')[source]

A list of :param data_to_analyse: list of data_structure :param data_format: indicate the type of data structure. for NWB, NIX

update_original_data()[source]

To be called if the data to analyse should be updated after the analysis has been run. :return: boolean: return True if the data has been modified

update_progressbar(time_started, increment_value=0, new_set_value=0)[source]
Parameters:
  • time_started (float) – Start time of the analysis
  • increment_value (float) – Value that should be added to the current value of the progress bar
  • new_set_value (float) – Value that should be set as the current value of the progress bar

Argument handler

class cicada.analysis.cicada_analysis_arguments_handler.AnalysisArgumentsHandler(cicada_analysis)[source]

Handle the AnalysisArgument instances for a given CicadaAnalysis instance. Allows to create the widgets and get the values to pass to run_analysis() of the CicadaAnalysis instance.

add_argument(**kwargs)[source]
Parameters:**kwargs

Returns:

check_arguments_validity()[source]

Check if all mandatory arguments have been filled Returns: True if we can run the analysis

get_analysis_argument(arg_name)[source]
Parameters:arg_name

Returns:

get_analysis_arguments(sorted=False)[source]
Parameters:sorted

Returns:

get_gui_widgets(group_by_family=False)[source]

Get the list of widgets necessary to fill the arguments for the cicada analysis associated :param group_by_family: if True, group the widgets in one widget to be grouped together if they belong to the same :param family. AnalysisArgument will have an attribute named family_widget whose value is a string.:

Returns:

load_analysis_argument_from_yaml_file(file_name)[source]

Set the analysis argument value based on the value in the yaml file. The :param file_name:

Returns:

save_analysis_arguments_to_yaml_file(path_dir, yaml_file_name)[source]

Save the arguments value to a yaml file. The first key will represent the argument name then the value will be a dict with the argument details such as the type etc… :param path_dir: directory in which save the yaml file :param yaml_file_name: yaml file name, with the extension or without (will be added in that case)

Returns:

set_argument_value(arg_name, **kwargs)[source]

Set an argument values, will be use to run analysis :param arg_name: :param **kwargs:

Returns:

set_widgets_to_default_value()[source]

Set the widgets to the default value of their AnalysisArgument Returns:

Format wrapper

class cicada.analysis.cicada_analysis_format_wrapper.CicadaAnalysisFormatWrapper(data_ref, data_format, load_data=True)[source]

An abstract class that should be inherit in order to create a specific format wrapper

age

Age of the subject :return: None if age unknown

contains_ci_movie(consider_only_2_photons)[source]

Indicate if the data object contains at least one calcium imaging movie :param consider_only_2_photons: boolean, it True means we consider only 2 photons calcium imaging movies, :param if other exists but not 2 photons, then False will be return:

Returns: True if it’s the case, False otherwise

genotype

Genotype of the subject :return: None if age unknown

get_ci_movies(only_2_photons)[source]

Return a dict with as key a string identifying the movie, and as value a dict of CI movies a string as file_name if external, or a 3d array :param only_2_photons: return only the 2 photon movies

Returns:

get_identifier(session_data)[source]

Get the identifier of one of the data to analyse :param session_data: Data we want to know the identifier

Returns: A hashable object identfying the data

get_intervals_names()[source]

Return a list representing the intervals contains in this data Returns:

get_pixel_mask(segmentation_info)[source]

Return pixel_mask which is a list of list of pair of integers representing the pixels coordinate (x, y) for each cell. the list length is the same as the number of cells. :param segmentation_info: object (could be list, dict etc…) given information about how to reach the pixel_mask :param data:

Returns:

get_roi_response_series()[source]

Returns: a list or dict of objects representing all roi response series (rrs) names rrs could represents raw traces, or binary raster, and its link to a given segmentation. The results returned should allow to identify the segmentation associated. Object could be strings, or a list of strings, that identify a rrs and give information how to get there.

get_segmentations()[source]

Returns: a list or dict of objects representing all segmentation names up the segmentation planes (like in nwb) Object could be strings, or a list of strings, that identify a segmentation and give information how to get there.

identifier

Identifier of the session :return:

load_data()[source]

Load data in memory Returns:

sex

Sex (gender) of the subject :return: None if sex unknown

species

Species of the subject :return: None if age unknown

subject_id

Id of the subject :return: None if age unknown

weight

Id of the subject :return: None if age unknown

NWB wrapper

class cicada.analysis.cicada_analysis_nwb_wrapper.CicadaAnalysisNwbWrapper(data_ref, load_data=True)[source]

Allows to communicate with the nwb format

age

Age of the subject :return: None if age unknown

contains_ci_movie(consider_only_2_photons)[source]

Indicate if the data object contains at least one calcium imaging movie represented by an instance of pynwb.image.ImageSeries :param consider_only_2_photons: boolean, it True means we consider only 2 photons calcium imaging movies, :param if other exists but not 2 photons, then False will be return:

Returns: True if it’s the case, False otherwise

genotype

Genotype of the subject :return: None if age unknown

get_ci_movies(only_2_photons)[source]

Return a dict with as key a string identifying the movie, and as value a dict of CI movies a string as file_name if external, or a 3d array :param only_2_photons: return only the 2 photon movies

Returns:

get_identifier(session_data)[source]

Get the identifier of one of the data to analyse :param session_data: Data we want to know the identifier

Returns: A hashable object identfying the data

get_intervals_names()[source]

Return a list representing the intervals contains in this data Returns:

get_pixel_mask(segmentation_info)[source]

Return pixel_mask which is a list of list of pair of integers representing the pixels coordinate (x, y) for each cell. the list length is the same as the number of cells. :param segmentation_info: a list of 3 elements: first one being the name of the module, then the name :param of image_segmentation and then the name of the segmentation plane.:

Returns:

get_roi_response_series()[source]

Returns: a list or dict of objects representing all roi response series (rrs) names rrs could represents raw traces, or binary raster, and its link to a given segmentation. The results returned should allow to identify the segmentation associated. Object could be strings, or a list of strings, that identify a rrs and give information how to get there.

get_segmentations()[source]

Returns: a dict that for each step till plane_segmentation represents the different option. First dict will have as keys the name of the modules, then for each modules the value will be a new dict with keys the ImageSegmentation names and then the value will be a list representing the segmentation plane

identifier

Identifier of the session :return:

load_data()[source]

Load data in memory Returns:

sex

Sex (gender) of the subject :return: None if sex unknown

species

Species of the subject :return: None if age unknown

subject_id

Id of the subject :return: None if subject_id unknown

weight

Id of the subject :return: None if weight unknown

Cells count

Connectivity graph

class cicada.analysis.cicada_connectivity_graph.CicadaConnectivityGraph[source]
check_data()[source]

Check the data given one initiating the class and return True if the data given allows the analysis implemented, False otherwise. :return: a boolean

run_analysis(**kwargs)[source]

test :param kwargs: :return:

update_original_data()[source]

To be called if the data to analyse should be updated after the analysis has been run. :return: boolean: return True if the data has been modified

Frames count

Hubs analysis

class cicada.analysis.cicada_hubs_analysis.CicadaHubsAnalysis[source]
check_data()[source]

Check the data given one initiating the class and return True if the data given allows the analysis implemented, False otherwise. :return: a boolean

run_analysis(**kwargs)[source]

test :param kwargs: :return:

update_original_data()[source]

To be called if the data to analyse should be updated after the analysis has been run. :return: boolean: return True if the data has been modified

PSTH analysis

class cicada.analysis.cicada_psth_analysis.CicadaPsthAnalysis[source]
check_data()[source]

Check the data given one initiating the class and return True if the data given allows the analysis implemented, False otherwise. :return: a boolean

run_analysis(**kwargs)[source]

test :param kwargs: :return:

set_arguments_for_gui()[source]

Returns:

update_original_data()[source]

To be called if the data to analyse should be updated after the analysis has been run. :return: boolean: return True if the data has been modified

Annexe

UML graph of analysis module