File I/O

class finds.io.IO(...)
filestream
state_dataset
time_dataset
finds.io.init_input_filestream(filepath, cache_limit=None)

Initializes an I/O filestream for reading.

Parameters:
  • filepath (Path) – The path to the H5 file to begin reading from.

  • cache_limit (Optional[int]) – The total size in bytes of the raw data chunk cache for each dataset.

Returns:

A read-only I/O object.

Return type:

IO

finds.io.init_output_filestream(filepath, n_fish)

Initializes the I/O filestream for writing.

Parameters:
  • filepath (Path) – The filepath to write to.

  • n_fish (int) – The number of fish within the system.

Returns:

A write-only I/O filestream.

Return type:

IO

finds.io.close_filestream(io)

Closes the output filestream at h5file.

Parameters:

io (IO) – The filestream to close.

finds.io.serialize_to_file(system, time, io)

Writes the system state to the datafile located at output_filename.

Parameters:
  • system (NDArray) – The system.

  • time (float) – The current simulation time.

  • io (IO) – The IO filestream to write to.