allensdk.brain_observatory.behavior.data_objects.cell_specimens.cell_specimens module

class allensdk.brain_observatory.behavior.data_objects.cell_specimens.cell_specimens.CellSpecimenMeta(imaging_plane: ImagingPlane, emission_lambda=520.0)[source]

Bases: DataObject, LimsReadableInterface, JsonReadableInterface, NwbReadableInterface

Cell specimen metadata

property emission_lambda
classmethod from_json(dict_repr: dict, ophys_timestamps: OphysTimestamps) CellSpecimenMeta[source]

Populates a DataFile from a JSON compatible dict (likely parsed by argschema)

Returns:
DataObject:

An instantiated DataObject which has name and value properties

classmethod from_lims(ophys_experiment_id: int, lims_db: PostgresQueryMixin, ophys_timestamps: OphysTimestamps) CellSpecimenMeta[source]

Populate a DataObject from an internal database (likely LIMS)

Returns:
DataObject:

An instantiated DataObject which has name and value properties

classmethod from_nwb(nwbfile: NWBFile) CellSpecimenMeta[source]

Populate a DataObject from a pyNWB file object.

Parameters:
nwbfile:

The file object (NWBFile) of a pynwb dataset file.

Returns:
DataObject:

An instantiated DataObject which has name and value properties

property imaging_plane
class allensdk.brain_observatory.behavior.data_objects.cell_specimens.cell_specimens.CellSpecimens(cell_specimen_table: DataFrame, meta: CellSpecimenMeta, events: Events, ophys_timestamps: OphysTimestamps, segmentation_mask_image_spacing: Tuple, corrected_fluorescence_traces: CorrectedFluorescenceTraces, dff_traces: DFFTraces | None = None, demixed_traces: DemixedTraces | None = None, neuropil_traces: NeuropilTraces | None = None, exclude_invalid_rois=True)[source]

Bases: DataObject, LimsReadableInterface, JsonReadableInterface, NwbReadableInterface, NwbWritableInterface

property corrected_fluorescence_traces: DataFrame

Corrected fluorescence traces which are neuropil corrected and demixed. Sampling rate can be found in metadata ‘ophys_frame_rate’

Returns:
pd.DataFrame

Dataframe that contains the corrected fluorescence traces for all valid cells.

dataframe columns:
cell_specimen_id [index]: (int)

unified id of segmented cell across experiments (assigned after cell matching)

cell_roi_id: (int)

experiment specific id of segmented roi (assigned before cell matching)

corrected_fluorescence: (list of float)

fluorescence values (arbitrary units)

RMSE: (float)

error values (arbitrary units)

r:

r values (arbitrary units)

property demixed_traces: DataFrame

Demixed traces are traces that are demixed from overlapping ROIs. Sampling rate can be found in metadata ‘ophys_frame_rate’

Returns:
pd.DataFrame

Dataframe that contains the corrected fluorescence traces for all valid cells.

dataframe columns:
cell_specimen_id [index]: (int)

unified id of segmented cell across experiments (assigned after cell matching)

cell_roi_id: (int)

experiment specific id of segmented roi (assigned before cell matching)

demixed_trace: (list of float)

fluorescence values (arbitrary units)

property dff_traces: DataFrame

traces of change in fluoescence / fluorescence

Returns:
pd.DataFrame

dataframe of traces of dff (change in fluorescence / fluorescence)

dataframe columns:
cell_specimen_id [index]: (int)

unified id of segmented cell across experiments assigned after cell matching

cell_roi_id: (int)

experiment specific id of segmented roi, assigned before cell matching

dff: (list of float)

fluorescence fractional values relative to baseline (arbitrary units)

property events: DataFrame
classmethod from_json(dict_repr: dict, ophys_timestamps: OphysTimestamps, segmentation_mask_image_spacing: Tuple, events_params: EventsParams, exclude_invalid_rois=True) CellSpecimens[source]

Populates a DataFile from a JSON compatible dict (likely parsed by argschema)

Returns:
DataObject:

An instantiated DataObject which has name and value properties

classmethod from_lims(ophys_experiment_id: int, lims_db: PostgresQueryMixin, ophys_timestamps: OphysTimestamps, segmentation_mask_image_spacing: Tuple, events_params: EventsParams, exclude_invalid_rois=True) CellSpecimens[source]

Populate a DataObject from an internal database (likely LIMS)

Returns:
DataObject:

An instantiated DataObject which has name and value properties

classmethod from_nwb(nwbfile: NWBFile, segmentation_mask_image_spacing: Tuple, events_params: EventsParams, exclude_invalid_rois=True) CellSpecimens[source]

Populate a DataObject from a pyNWB file object.

Parameters:
nwbfile:

The file object (NWBFile) of a pynwb dataset file.

Returns:
DataObject:

An instantiated DataObject which has name and value properties

property meta: CellSpecimenMeta
property neuropil_traces: DataFrame

neuropil traces are the fluorescent signal measured from the neuropil_masks. Sampling rate can be found in metadata ‘ophys_frame_rate’

Returns:
pd.DataFrame

Dataframe that contains the corrected fluorescence traces for all valid cells.

dataframe columns:
cell_specimen_id [index]: (int)

unified id of segmented cell across experiments (assigned after cell matching)

cell_roi_id: (int)

experiment specific id of segmented roi (assigned before cell matching)

neuropil_trace: (list of float)

fluorescence values (arbitrary units)

property roi_masks: DataFrame
property segmentation_mask_image: Image
property table: DataFrame
to_nwb(nwbfile: NWBFile, ophys_timestamps: OphysTimestamps) NWBFile[source]
:param nwbfile

In-memory nwb file object

:param ophys_timestamps

ophys timestamps

class allensdk.brain_observatory.behavior.data_objects.cell_specimens.cell_specimens.EventsParams(filter_scale_seconds: float = 0.06451612903225806, filter_n_time_steps: int = 20)[source]

Bases: object

Container for arguments to event detection

property filter_n_time_steps
property filter_scale_seconds