ionique.datatypes

Data structure definitions and session file management for analysis.

class ionique.datatypes.SessionFileManager(*args, **kwargs)

Bases: MetaSegment

Singleton-based session manager for hierarchical data.

This class inherits from MetaSegment and uses the Singleton metaclass to ensure only one instance exists during a given session. It serves as the root segment for a data analysis session and is responsible for managing metadata and registered “affectors” (i.e., objects that modify or interact with the session).

__init__() None

Initialize the session manager.

Sets the session start time and prepares the affector log structure.

add_child(child: AnySegment) None

Add a single child segment to the session’s hierarchy.

Parameters:

child (AnySegment) – The segment to be added as a child.

add_children(children: list[AnySegment]) None

Add multiple child segments to the session.

Parameters:

children (list[AnySegment]) – A list of segments to be added as children.

rank: str = 'root'
register_affector(affector)

Register an affector object that influences the session data.

Records metadata including class name, string representation, and timestamp, and logs the event with a unique identifier.

Parameters:

affector (object) – An object that modifies or interacts with the session.

Returns:

A UUID string uniquely identifying the registered affector.

Return type:

str

unique_features
class ionique.datatypes.TraceFile(current: ndarray, voltage=None, rank='file', parent=None, unique_features: dict = {}, metadata: dict = {})

Bases: Segment

Data structure for representing a single trace file with current and optional voltage information.

This class inherits from Segment and encapsulates current and voltage data. It sets up segment metadata, defines parent-child hierarchy, and optionally initializes child segments based on voltage steps.

Typical usage includes assigning metadata and organizing hierarchical data structures for downstream processing or visualization.

__init__(current: ndarray, voltage=None, rank='file', parent=None, unique_features: dict = {}, metadata: dict = {})

If voltage steps are provided, corresponding child segments of rank “vstep” are created.

Parameters:
  • current (numpy.ndarray) – current array.

  • voltage (list[tuple[tuple[int, int], float]] or None) – Optional list of tuples containing (start, end) index pairs and voltage values. Used to create child segments for each voltage step.

  • rank (str) – Segment rank label, defaults to “file”.

  • parent (Segment or None) – Optional parent segment to which this trace belongs.

  • unique_features (dict) – Dictionary of metadata such as sampling frequency.

  • metadata (dict) – Additional metadata.

children: list[AnySegment]
delete()

Delete the current object, removing it from its parent

end: int | None
parent: AnySegment | None
plot(rank, axes, downsample_per_rank, color_per_rank)

Method for plotting

rank: str
start: int | None