simulariumio.writers package

Submodules

simulariumio.writers.binary_chunk module

class simulariumio.writers.binary_chunk.BinaryChunk(first_frame_index: int = 0)[source]

Bases: object

Object to store size info for a binary file. BinaryChunk is used to determine how many files to save and how to chunk up the data, if the data is larger than the max file size.

Parameters:
first_frame_index: int (optional)
Which time index does this chunk start at?

Default: 0

first_frame_index: int
frame_n_values: List[int]
get_global_index(local_index: int) int[source]

Get the index in the entire trajectory for the index within this chunk

Parameters:
local_index: int

The index of the frame within this chunk

n_bytes: int
n_frames: int
n_values: int

simulariumio.writers.binary_values module

class simulariumio.writers.binary_values.BinaryValues(values: List[Any], format_string: str)[source]

Bases: object

This object contains value(s) to be written in binary and the format string to use when packing

Parameters:
values: List[Any]

A list of value(s) that will be written to binary

format_string: str

A format string for packing into binary

format_string: str
values: List[Any]

simulariumio.writers.binary_writer module

class simulariumio.writers.binary_writer.BinaryWriter[source]

Bases: Writer

static format_trajectory_data(trajectory_data: TrajectoryData, max_bytes: int = 4000000000) Tuple[List[BinaryValues], List[Dict[str, Any]], List[List[BinaryValues]]][source]

Return the data shaped for Simularium binary Parameters ———- trajectory_data: TrajectoryData

the data to format

static save(trajectory_data: TrajectoryData, output_path: str, validate_ids: bool) None[source]

Save the simularium data in .simularium binary format at the output path Parameters ———- trajectory_data: TrajectoryData

the data to save

output_path: str

where to save the file

validate_ids: bool

additional validation to check agent ID size?

simulariumio.writers.json_writer module

class simulariumio.writers.json_writer.JsonWriter[source]

Bases: Writer

static format_trajectory_data(trajectory_data: TrajectoryData) Dict[str, Any][source]

Return the data shaped for Simularium JSON Parameters ———- trajectory_data: TrajectoryData

the data to format

static save(trajectory_data: TrajectoryData, output_path: str, validate_ids: bool) None[source]

Save the simularium data in .simularium JSON format at the output path Parameters ———- trajectory_data: TrajectoryData

the data to save

output_path: str

where to save the file

validate_ids: bool (optional)

additional validation to check agent ID size?

static save_plot_data(plot_data: List[Dict[str, Any]], output_path: str)[source]

Save the current plot data in JSON format at the output path Parameters ———- plot_data: List[Dict[str, Any]]

the data to save

output_path: str

where to save the file

simulariumio.writers.writer module

class simulariumio.writers.writer.Writer[source]

Bases: ABC

abstract static format_trajectory_data(self, trajectory_data: TrajectoryData) Any[source]
abstract static save(self, trajectory_data: TrajectoryData, validate_ids: bool) None[source]

Module contents