-
Notifications
You must be signed in to change notification settings - Fork 0
2. Functions
Jane Ling edited this page Jul 19, 2023
·
15 revisions
self.__init__(read_path, save_path=None, cells_to_process=None, cells_to_plot=None)
"""
Start PecanPie. Load .npy and .bin data. Define other parameters.
Parameters
----------
read_path : str
Path to folder containing .npy and .bin files.
save_path : str
Path to folder for saving output files. (Default) same as read_path
cells_to_process : array
Indices to selected cells for data analysis. (Default) All ROIs identified in suite2p
cells_to_plot : array
Indices to selected cells for plotting. (Default) All ROIs within cells_to_process that are identified as cells in suite2p
Returns
-------
None.
"""self.create_metadata(_print=True)
"""
Calculate metadata of selected cells, columns include 'ROInum', 'iscell', 'ypix', 'xpix', 'contour', 'area',
'centroid', 'major_axis', 'minor_axis', 'orientation', 'aspect_ratio', 'circularity', 'perimeter', 'compact',
'solidity'
Parameters
----------
_print : bool
(FOR INTERNAL USE) Whether to print information about metadata after processing. (Default) True
Returns
-------
None.
"""self.print_ori_metadata()
"""
Print information about the metadata obtained from suite2p.
Parameters
----------
None.
Returns
-------
None.
"""self.print_metadata()
"""
Print information about the metadata calculated by PecanPie.
Parameters
----------
None.
Returns
-------
None.
"""self.create_fig(plottype, plot=True, filename=None)
"""
Sets parameters for plotting according to plot type.
Parameters
----------
plottype : str
'avg_bin' = plots the registered binary data averaged over time
'selected_cells' = plots the selected cells in peak delta F over F intensity
'contour' = plots the selected cells with their contours after morphological operations
'axis' = plots the selected cells with their contours and axes after morphological operations
'cell_selection' = (FOR INTERNAL USE) for internactive selection of cells. Plots all cells with green contour. Contours of cells not in self.tmp would be invisible.
plot : bool
Whether to show plot or not. (Default) True
filename : str
Filename of figure to save. If filename is not set, the figure will NOT be saved. (Default) None
Returns
-------
None.
"""self.plot_fig(_ion=False)
"""
Visualize image data and saving
Parameters
----------
_ion : bool
(FOR INTERNAL USE) Whether to turn interactive mode on. (Default) False
Returns
-------
None.
"""self.change_cell_selection(cells_to_process=None, cells_to_plot=None)
"""
Changing selections according to the array input.
Parameters
----------
cells_to_process : array
Indices to selected cells for data analysis. (Default) All ROIs identified in suite2p
cells_to_plot : array
Indices to selected cells for plotting. (Default) All ROIs within cells_to_process that are identified as
cells in suite2p
Returns
-------
None.
"""self.cells_to_process_from_fig()
"""
Open an interactive graphical interface for selecting and deselecting cells in cells_to_process
Parameters
----------
None.
Returns
-------
None.
"""self.cells_to_plot_from_fig()
"""
Open an interactive graphical interface for selecting and deselecting cells in cells_to_plot
Parameters
----------
None.
Returns
-------
None.
"""self.__repr__()
"""
Print information about the PecanPie object when the name of object is typed in the console.
Parameters
----------
None.
Returns
-------
None.
"""self.read_npy(filename)
"""
Loads data from .npy
Parameters
----------
filename : str
filename of the .npy data file
Returns
-------
data : ndarray (ROIs x timepoints)
data stored in the .npy data file
"""self.print_data_status(val, txt):
"""
Print information about a parameter.
Parameters
----------
val : number / bool
Value of the parameter. 1 (True) to print a tick. 0 (False) to print a cross. Other values would be printed as they are.
txt : str
Name of the parameter to print out.
Returns
-------
None.
"""self.check_cells_to_process(cells_to_process)
"""
Check that the newly defined cells_to_process is within the scope of stat.npy
Parameters
----------
cells_to_process : array
Indices to selected cells for data analysis. (Default) All ROIs identified in suite2p
Returns
-------
None.
"""self.check_cells_to_plot(cells_to_plot)
"""
Check that the newly defined cells_to_plot is within the scope of cells_to_process
Parameters
----------
cells_to_plot : array
Indices to selected cells for plotting. (Default) All ROIs within cells_to_process that are identified as
cells in suite2p
Returns
-------
None.
"""self.default_cells_to_process()
"""
Defining the default cells_to_process, which is all ROIs.
Parameters
----------
None.
Returns
-------
None.
"""self.default_cells_to_plot()
"""
Defining the default cells_to_plot, which is all real cells within cells_to_process.
Parameters
----------
None.
Returns
-------
None.
"""self.get_selection()
"""
Get point from graph and update the temporary selection
Parameters
----------
None.
Returns
-------
tmp_selection : array
temporary selection of cells
"""self.create_ori_metadata()
"""
Create a DataFrame for storing metadata of cells. Insert existing data from self.stat and self.iscell.
Parameters
----------
None.
Returns
-------
None.
"""self.cal_dfof()
"""
Calculates delta F over F.
Parameters
----------
None.
Returns
-------
data : ndarray (ROIs x timepoints)
delta F over F
"""self.switch_idx_to_intensity()
"""
Switch index in label_mask to max dfof if index belongs to cells_to_plot
Switch index in label_mask to 0 if index belongs to cells_to_process but not cells_to_plot
Parameters
----------
None.
Returns
-------
None.
""" """
Timer for checking performance
Parameters
----------
verbose : bool
Whether to print timing in console or not. (Default) False
txt : str
Description of the current process.
Returns
-------
None.
"""
# Initializes timer with current time
t = _Timer(verbose=False)
# Starts a new timer with current time
t.tic(txt)
# Ends the timer and prints elapsed time. Restart timer.
t.toc() """
Colours for printing
Parameters
----------
None.
Returns
-------
None.
"""