bam.logs#
Classes#
Collection of processed trajectory logs used for identification. |
Module Contents#
- class bam.logs.Logs(directory: str)#
Collection of processed trajectory logs used for identification.
Loads all JSON files found in a directory (produced by
python -m bam.process) and exposes them as a list of log dicts. Each log dict contains the pendulum configuration (mass, arm_mass, length, kp, vin) and a list of timestep entries with position, velocity, and control values.- Parameters:
directory – Path to a directory of processed JSON log files.
- directory: str#
- json_files#
- logs = []#
- split(selector_kp: int) Logs#
Split logs by P-gain value to create a validation set.
Removes all logs recorded with
kp == selector_kpfrom this object and returns them as a newLogsinstance. Modifiesselfin place.- Parameters:
selector_kp – P-gain value used to select the held-out logs.
- Returns:
A new
Logsobject containing only the held-out logs.
- make_batch() dict#
Make a batch log from all the logs. In a batch log, all entries are vectorized. For example, batch[“mass”] is a vector of all masses batch[“entries”][0][“position”] will be a vector of all positions