swc.aeon.io.reader#
Module for reading data from raw files in an Aeon dataset.
- class swc.aeon.io.reader.BitmaskEvent(pattern, value, tag)[source]#
Bases:
HarpExtracts event data matching a specific digital I/O bitmask.
Columns:
event (str): Unique identifier for the event code.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- class swc.aeon.io.reader.Chunk(reader=None, pattern=None, extension=None)[source]#
Bases:
ReaderExtracts path and epoch information from chunk files in the dataset.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- class swc.aeon.io.reader.Csv(pattern, columns, dtype=None, extension='csv')[source]#
Bases:
ReaderExtracts data from comma-separated (CSV) text files.
The first column stores the Aeon timestamp, in seconds.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- class swc.aeon.io.reader.DigitalBitmask(pattern, mask, columns)[source]#
Bases:
HarpExtracts event data matching a specific digital I/O bitmask.
Columns:
event (str): Unique identifier for the event code.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- class swc.aeon.io.reader.Encoder(pattern)[source]#
Bases:
HarpExtract magnetic encoder data.
Columns:
angle (float): Absolute angular position, in radians, of the magnetic encoder.
intensity (float): Intensity of the magnetic field.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- class swc.aeon.io.reader.Harp(pattern, columns, extension='bin')[source]#
Bases:
ReaderExtracts data from raw binary files encoded using the Harp protocol.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- class swc.aeon.io.reader.Heartbeat(pattern)[source]#
Bases:
HarpExtract periodic heartbeat event data.
Columns:
second (int): The whole second corresponding to the heartbeat, in seconds.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- class swc.aeon.io.reader.JsonList(pattern, columns=(), root_key='value', extension='jsonl')[source]#
Bases:
ReaderExtracts data from .jsonl files, where the key “seconds” stores the Aeon timestamp.
- columns: SequenceNotStr[str]#
Column labels to extract from the dictionary stored in the root_key of the JSON object. Each column name must correspond to a key in the dictionary stored in the root_key. Defaults to an empty tuple, i.e. the JSON objects are read as-is.
- read(path)[source]#
Reads data from the specified jsonl file.
- Parameters:
path (
Path) – Path to the jsonl file to read. The file must contain a “seconds” key that stores the Aeon timestamp, and the root_key must contain a dictionary with keys corresponding to the specified columns.- Return type:
- Returns:
A DataFrame with “seconds” as the index, other keys as columns, and the specified columns extracted from the root_key dictionary (if any).
- class swc.aeon.io.reader.Log(pattern)[source]#
Bases:
CsvExtracts message log data.
Columns:
priority (str): Priority level of the message.
type (str): Type of the log message.
message (str): Log message data. Can be structured using tab separated values.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- read(path)#
Reads data from the specified CSV text file.
If the file is non-empty, the first column is assumed to contain the Aeon timestamp and is set as the index of the DataFrame. If the file is empty, pandas defaults to using pandas.RangeIndex as the index.
- class swc.aeon.io.reader.Metadata(pattern='Metadata')[source]#
Bases:
ReaderExtracts metadata information from all epochs in the dataset.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- class swc.aeon.io.reader.Pose(pattern, model_root=None)[source]#
Bases:
HarpReader for Harp-binarized tracking data given a model that outputs id, parts, and likelihoods.
Columns:
class (int): Int ID of a subject in the environment.
class_likelihood (float): Likelihood of the subject’s identity.
part (str): Bodypart on the subject.
part_likelihood (float): Likelihood of the specified bodypart.
x (float): X-coordinate of the bodypart.
y (float): Y-coordinate of the bodypart.
- static class_int2str(data, classes)[source]#
Converts a class integer in a tracking data dataframe to its associated string (subject id).
- Parameters:
- Return type:
- Returns:
DataFrame with the “identity” column converted to string class names.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- static get_bodyparts(config_file_path)[source]#
Returns a list of bodyparts from a model’s config file.
- static get_class_names(config_file_path)[source]#
Returns a list of classes from a model’s config file.
- classmethod get_config_file(config_file_dir, config_file_names=None)[source]#
Returns the config file from a model’s config directory.
- Return type:
- class swc.aeon.io.reader.Position(pattern)[source]#
Bases:
HarpExtract 2D position tracking data for a specific camera.
Columns:
x (float): x-coordinate of the object center of mass.
y (float): y-coordinate of the object center of mass.
angle (float): angle, in radians, of the ellipse fit to the object.
major (float): length, in pixels, of the major axis of the ellipse fit to the object.
minor (float): length, in pixels, of the minor axis of the ellipse fit to the object.
area (float): number of pixels in the object mass.
id (float): unique tracking ID of the object in a frame.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- class swc.aeon.io.reader.Subject(pattern)[source]#
Bases:
CsvExtracts metadata for subjects entering and exiting the environment.
Columns:
id (str): Unique identifier of a subject in the environment.
weight (float): Weight measurement of the subject on entering or exiting the environment.
event (str): Event type. Can be one of Enter, Exit or Remain.
- columns: SequenceNotStr[str]#
Column labels to use for the data.
- read(path)#
Reads data from the specified CSV text file.
If the file is non-empty, the first column is assumed to contain the Aeon timestamp and is set as the index of the DataFrame. If the file is empty, pandas defaults to using pandas.RangeIndex as the index.
- class swc.aeon.io.reader.Video(pattern)[source]#
Bases:
CsvExtracts video frame metadata.
Columns:
hw_counter (int): Hardware frame counter value for the current frame.
hw_timestamp (int): Internal camera timestamp for the current frame.
_frame (int): Frame index in the video file.
_path (str): Path to the video file.
_epoch (str): Epoch name associated with the video file.
- columns: SequenceNotStr[str]#
Column labels to use for the data.