Skip to content

Data input/ output

ephysiopy.io.bases.TrialInterface(pname: Path, **kwargs)

Bases: FigureMaker

Defines a minimal and required set of methods for loading electrophysiology data recorded using Axona or OpenEphys (OpenEphysNWB is there but not used)

Parameters:

Name Type Description Default
pname Path
required

Attributes:

Name Type Description
pname (str) the absolute pathname of the top-level data directory
settings (dict) contains metadata about the trial
PosCalcs (PosCalcsGeneric) contains the positional data for the trial
RateMap RateMap

A class for binning data

EEGCalcs EEGCalcs

For dealing with LFP data

clusterData clusterData

contains results of a spike sorting session (i.e. KiloSort)

recording_start_time float

the start time of the recording in seconds

sync_message_file Path

the location of the sync_message_file (OpenEphys)

ttl_data dict

ttl data including timestamps, ids and states

accelerometer_data ndarray

data relating to headstage accelerometers

path2PosData Path

location of the positional data

mask_array MaskedArray

contains the mask (if applied) for positional data

filter TrialFilter

contains details of the filter applied to the positional data

Methods:

Name Description
load_pos_data

Load the position data

load_neural_data

Load the neural data

load_ttl
load_cluster_data

Load the cluster data (Kilosort/ Axona cut/ whatever else

load_settings

Loads the format specific settings file

apply_filter

Apply a mask to the recorded data. This will mask all the currently

get_field_properties

Gets the properties of a given field (area, runs through the field,

load_pos_data(ppm: int = 300, jumpmax: int = 100, *args, **kws) abstractmethod

Load the position data

Parameters:

Name Type Description Default
ppm int

pixels per metre

300
jumpmax int

max jump in pixels between positions, more than this and the position is interpolated over

100

load_neural_data(*args, **kwargs) abstractmethod

Load the neural data

load_ttl(*args, **kwargs) -> bool abstractmethod

load_cluster_data(*args, **kwargs) -> bool abstractmethod

Load the cluster data (Kilosort/ Axona cut/ whatever else

load_settings(*args, **kwargs) abstractmethod

Loads the format specific settings file

apply_filter(*trial_filter: TrialFilter) -> np.ndarray

Apply a mask to the recorded data. This will mask all the currently loaded data (LFP, position etc)

Parameters:

Name Type Description Default
trial_filter TrialFilter

A namedtuple containing the filter name, start and end values name (str): The name of the filter start (float): The start value of the filter end (float): The end value of the filter

Valid names are: 'dir' - the directional range to filter for NB Following mathmatical convention, 0/360 degrees is 3 o'clock, 90 degrees is 12 o'clock, 180 degrees is 9 o'clock and 270 degrees 'speed' - min and max speed to filter for 'x' - min and max values to filter x pos values 'x' - same as x but for y pos 'time' - the times to keep / remove specified in ms

Values are pairs specifying the range of values to filter for from the namedtuple TrialFilter that has fields 'start' and 'end' where 'start' and 'end' are the ranges to filter for

()

Returns:

Type Description
ndarray

An array of bools that is True where the mask is applied

get_field_properties(cluster: int | list, channel: int | list, **kwargs) -> list[FieldProps]

Gets the properties of a given field (area, runs through the field, etc)

Parameters:

Name Type Description Default
cluster int | list

The cluster(s) to get the field properties for

required
channel int | list

The channel(s) to get the field properties for

required
**kwargs

partition : str How the field is separated from the background. This is passed to the fieldproperties function and can be used to specify the partition to use for the field properties.

Valid options are 'simple' and 'fancy'

Other kwargs get passed to get_rate_map and
fieldprops, the most important of which may be
how the runs are split in fieldprops (options are
'field' and 'clump_runs') which differ depending on
if the position data is open-field (field) or linear track
in which case you should probably use 'clunmp_runs'
{}

Returns:

Type Description
list[FieldProps]

A list of FieldProps namedtuples containing the properties of the field

ephysiopy.io.recording.OpenEphysBase(pname: Path, **kwargs)

Bases: TrialInterface

Methods:

Name Description
load_pos_data
load_neural_data
load_ttl
load_cluster_data
load_settings

Load the settings.xml file associated with the recording

load_pos_data(ppm: int = 300, jumpmax: int = 100, *args, **kwargs) -> None

load_neural_data(*args, **kwargs)

load_ttl(*args, **kwargs) -> bool

load_cluster_data(removeNoiseClusters=True, *args, **kwargs) -> bool

load_settings(*args, **kwargs)

Load the settings.xml file associated with the recording

ephysiopy.io.recording.AxonaTrial(pname: Path, **kwargs)

Bases: TrialInterface

Methods:

Name Description
load_pos_data
load_neural_data
load_ttl
load_cluster_data
load_settings

load_pos_data(ppm: int = 300, jumpmax: int = 100, *args, **kwargs) -> None

load_neural_data(*args, **kwargs)

load_ttl(*args, **kwargs) -> bool

load_cluster_data(*args, **kwargs)

load_settings(*args, **kwargs)