bam.logs ======== .. py:module:: bam.logs Classes ------- .. autoapisummary:: bam.logs.Logs Module Contents --------------- .. py:class:: 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. :param directory: Path to a directory of processed JSON log files. .. py:attribute:: directory :type: str .. py:attribute:: json_files .. py:attribute:: logs :value: [] .. py:method:: split(selector_kp: int) -> Logs Split logs by P-gain value to create a validation set. Removes all logs recorded with ``kp == selector_kp`` from this object and returns them as a new :class:`Logs` instance. Modifies ``self`` in place. :param selector_kp: P-gain value used to select the held-out logs. :returns: A new :class:`Logs` object containing only the held-out logs. .. py:method:: 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