allensdk.brain_observatory.demixer module

allensdk.brain_observatory.demixer.demix_time_dep_masks(raw_traces: ndarray, stack: ndarray, masks: ndarray, max_block_size: int = 1000) Tuple[ndarray, list][source]

Demix traces of potentially overlapping masks extraced from a single 2p recording.

Parameters:
  • raw_traces – 2d array of traces for each mask, of dimensions (n, t), where t is the number of time points and n is the number of masks.

  • stack – 3d array representing a 1p recording movie, of dimensions (t, H, W) or corresponding hdf5 dataset.

  • masks – 3d array of binary roi masks, of shape (n, H, W), where n is the number of masks, and HW are the dimensions of an individual frame in the movie stack.

Max_block_size:

int representing maximum number of movie frames to read at a time (-1 for full length t of stack) (the default is 1000)

Returns:

Tuple of demixed traces and whether each frame was skipped in the demixing calculation.

allensdk.brain_observatory.demixer.find_negative_baselines(trace)[source]
allensdk.brain_observatory.demixer.find_negative_transients_threshold(trace, window=500, length=10, std_devs=3)[source]
allensdk.brain_observatory.demixer.find_zero_baselines(traces)[source]
allensdk.brain_observatory.demixer.identify_valid_masks(mask_array)[source]
allensdk.brain_observatory.demixer.plot_negative_baselines(raw_traces, demix_traces, mask_array, roi_ids_mask, plot_dir, ext='png')[source]
allensdk.brain_observatory.demixer.plot_negative_transients(raw_traces, demix_traces, valid_roi, mask_array, roi_ids_mask, plot_dir, ext='png')[source]
allensdk.brain_observatory.demixer.plot_overlap_masks_lengthOne(roi_ind, masks, savefile=None, weighted=False)[source]
allensdk.brain_observatory.demixer.plot_traces(raw_trace, demix_trace, roi_id, roi_ind, save_file)[source]
allensdk.brain_observatory.demixer.plot_transients(roi_ind, t_trans, masks, traces, demix_traces, savefile)[source]
allensdk.brain_observatory.demixer.rolling_window(trace, window=500)[source]
Parameters:
  • trace

  • window

Returns: