gondola.io#
Gondola I/O system. Read files and connect to sockets to obtain various flavors of data used trhoughout GAPS.
Functions
|
Applies a diff (patch) from a patch file to an original file, writing the result to a new file. |
|
Create a compressed bytestream out of a .toml file, so that we can pack it and send it as a TofPacket |
|
Computes the diff between two files, compresses the diff output, and returns it. |
|
Unpack a bytestream to a .toml file |
|
Retrieve the DateTime object from a string as used in the names of the run files |
|
Get the timestamp from a .tof.gaps file |
|
Get the relevant telemetry data files for time period from a directory |
|
Get a timestamp from a '.bin' file as written by telemetry |
|
Retrieve the UNIX timestamp from a string as used in the names of the run files |
Create date string in YYMMDD format |
|
Get a human readable timestamp for NOW |
|
|
Get the relevant telemetry data files for time period from a directory. |
|
Get all filenames in the current path sorted by timestamp if available If the given path is a file and not a directory, return only that file instead |
Classes
|
The central data container of the caraspace suite. |
|
A Caraspace object, that can be stored within a frame. |
|
Read binaries written through the caraspace i/o system |
|
Write CRFrames to disk. |
|
Read serialized TelemetryPackets from an existing file |
|
Read serialized TofPackets from an existing file or directory |
|
Write TofPackets to disk. |
- gondola.io.list_path_contents_sorted(input, pattern=None)#
Get all filenames in the current path sorted by timestamp if available If the given path is a file and not a directory, return only that file instead
# Arguments:
input : name of the target directory
- patternthe regex pattern to look for. That the sorting works,
the pattern needs to return a date for the first captured argument and a time for the second captured argument
- gondola.io.get_utc_now()#
Get a human readable timestamp for NOW
- gondola.io.get_utc_date()#
Create date string in YYMMDD format
- gondola.io.get_datetime(input, tformat=None)#
Retrieve the DateTime object from a string as used in the names of the run files
# Arguments:
- inputThe input string the datetime shall be extracted
from
- formatThe format of the date string. Something like
%y%m%d_%H%M%S
- gondola.io.get_rundata_from_file(fname, pattern=None)#
Get the timestamp from a .tof.gaps file
- # Arguments:
fname : Filename of .tof.gaps file
- gondola.io.get_unix_timestamp(input, tformat=None)#
Retrieve the UNIX timestamp from a string as used in the names of the run files
# Arguments:
- inputThe input string the datetime shall be extracted
from
- formatThe format of the date string. Something like
%y%m%d_%H%M%S
- gondola.io.apply_diff_to_file(compressed_bytes, original_file_path)#
Applies a diff (patch) from a patch file to an original file, writing the result to a new file.
# Arguments * original_file_path - Path to the original file. * patch_file_path - Path to the file containing the diff (patch).
# Returns Result<(), io::Error> indicating success or failure.
- gondola.io.compress_toml(file_path)#
Create a compressed bytestream out of a .toml file, so that we can pack it and send it as a TofPacket
- gondola.io.decompress_toml(compressed_data, output_path)#
Unpack a bytestream to a .toml file
- gondola.io.create_compressed_diff(old_path, new_path)#
Computes the diff between two files, compresses the diff output, and returns it.
# Arguments * old_path - Path to the original file * new_path - Path to the modified file
- gondola.io.get_ts_from_binfile(fname)#
Get a timestamp from a '.bin' file as written by telemetry
- # Arguments:
fname : name of the file
- # Returns:
datetime.datetime (UTC)
- gondola.io.get_telemetry_binaries(unix_time_start, unix_time_stop, data_dir='/gaps_binaries/live/raw/ethernet')#
Get the relevant telemetry data files for time period from a directory
- # Arguments
unix_time_start : seconds since epoch for run start
unix_time_end : seconds since epoch for run end
- # Keyword Arguments
data_dir : folder with telemetry binaries ('.bin')
- gondola.io.grace_get_telemetry_binaries(unix_time_start, unix_time_stop, data_dir='/gaps_binaries/live/raw/ethernet')#
Get the relevant telemetry data files for time period from a directory. This function is preferred over get_telemetry_binaries, since it is more precise in constricting the time range
- # Arguments
unix_time_start : seconds since epoch for run start
unix_time_end : seconds since epoch for run end
- # Keyword Arguments
data_dir : folder with telemetry binaries ('.bin')
Modules