atlas_gui.utils package

Submodules

atlas_gui.utils.config module

load_config(path='config.yaml')[source]

Load a YAML configuration file.

Parameters:

path (str) – Path to the configuration file. Defaults to ‘config.yaml’.

Returns:

Parsed YAML configuration as a Python dictionary.

Return type:

dict

get_nested(data_dict, key_path)[source]

Access a nested dictionary using a slash-separated key path.

Parameters:
  • data_dict (dict) – The dictionary to traverse.

  • key_path (str) – Slash-separated path to the nested key (e.g., ‘robot_state/joint_efforts’).

Returns:

The value found at the nested key path.

Return type:

Any

has_nested_key(data, path)[source]

Check whether a nested key path exists in a dictionary.

Parameters:
  • data (dict) – The dictionary to search.

  • path (str) – Slash-separated path representing the nested key.

Returns:

True if the nested key exists, False otherwise.

Return type:

bool

get_nested_np(data_dict, key_path)[source]

Access a nested dictionary key and convert the result to a NumPy array.

Specifically used for RLDS datasets, where TensorFlow tensors need to be converted.

Parameters:
  • data_dict (dict) – The dictionary to access.

  • key_path (str) – Slash-separated path to the nested key.

Returns:

The NumPy array corresponding to the nested value.

Return type:

np.ndarray

create_dataset(dataset_type, config)[source]

Factory method to instantiate the appropriate dataset class.

Parameters:
  • dataset_type (str) – Type of dataset to load, either ‘reassemble’ or ‘rlds’.

  • config (dict) – Configuration dictionary to pass to the dataset.

Returns:

An instance of either Reassemble or RLDS dataset.

Return type:

DatasetBase

Raises:

ValueError – If the dataset_type is unsupported.

atlas_gui.utils.keys module

key_string_to_qt_enum(key_str)[source]

Convert a string representation of a key to the corresponding Qt key enum.

Parameters:

key_str (str) – A string like ‘Space’, ‘A’, ‘Enter’, etc.

Returns:

The corresponding Qt enum value (e.g., Qt.Key_Space).

Return type:

Qt.Key

Raises:

ValueError – If the string does not match any valid Qt key name.

load_key_bindings_from_config(config_dict, default_keys=None)[source]

Load and validate key bindings from a configuration dictionary.

Parameters:
  • config_dict (dict) – A mapping of action names to key names (e.g., {‘play’: ‘Space’, ‘next’: ‘Right’}).

  • default_keys (dict, optional) – A fallback dictionary to use if a key is invalid or missing.

Returns:

A mapping from action names to Qt key enums.

Return type:

dict

Raises:

ValueError – If a key is invalid and no default is provided.

load_action_map_from_config(action_map_dict)[source]

Convert an action map from key strings to Qt key enums.

Parameters:

action_map_dict (dict) – A mapping from key strings to action names (e.g., {‘1’: ‘Approach’, ‘G’: ‘Grasp’}).

Returns:

A mapping from Qt key enums to action names

(e.g., {Qt.Key_1: ‘Approach’, Qt.Key_G: ‘Grasp’}).

Return type:

dict

atlas_gui.utils.reassemble_helpers module

merge_dict_keys(data_dict)[source]

Reorganize robot state data by merging related keys into structured arrays.

This function combines separate x, y, z components into single vector arrays and organizes joint data into logical groups.

Parameters:

data_dict – Dictionary containing robot state data with individual components

Returns:

Reorganized dictionary with merged components

load_segments_info(file_path)[source]

Load only the segments_info from an h5 file.

Parameters:

file_path (str) – Path to the h5 file

Returns:

The segments_info data from the h5 file

mp4_blob_to_numpy_interval(binary_blob, frame_indices)[source]

Convert MP4 binary blob to numpy array, loading only specified frames using OpenCV for better performance.

Parameters:
  • binary_blob (bytes) – MP4 encoded video as bytes

  • frame_indices (list) – List of frame indices to extract

Returns:

Array of decoded frames at specified indices

Return type:

np.ndarray

load_h5_time_interval(file_path, start_time, end_time, skip_no_timestamps=True)[source]

Load data from h5 file for a specified time interval, maintaining original dictionary structure.

Parameters:
  • file_path (str) – Path to the h5 file

  • start_time (float) – Start time in seconds

  • end_time (float) – End time in seconds

  • skip_no_timestamps (bool) – If True, skip loading data without corresponding timestamps. If False, load the entire data for keys without timestamps.

Returns:

Dictionary containing the data within the specified time interval

Return type:

dict

save_data_to_h5(file_path, data)[source]

Save modified data back to the original HDF5 file.

Parameters:
  • file_path (str) – Path to the original HDF5 file.

  • data (dict) – Modified data dictionary (including additional keys).

atlas_gui.utils.rlds_helpers module

Module contents