Skip to content

Commit

Permalink
cleanup logging
Browse files Browse the repository at this point in the history
  • Loading branch information
domstoppable committed Jul 26, 2024
1 parent 37bb8e6 commit e207b8c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/pupil_labs/neon_recording/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,4 @@
],
)

log.info("NeonRecording: package loaded.")

__all__ = ["__version__", "load"]
11 changes: 4 additions & 7 deletions src/pupil_labs/neon_recording/neon_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ def __init__(self, rec_dir_in: Union[pathlib.Path, str]):
if not self._rec_dir.exists() or not self._rec_dir.is_dir():
raise FileNotFoundError(f"Directory not found or not valid: {self._rec_dir}")

log.info(f"NeonRecording: Loading recording from {rec_dir_in}")
log.debug(f"NeonRecording: Loading recording from {rec_dir_in}")

log.info("NeonRecording: Loading recording info")
log.debug("NeonRecording: Loading recording info")
with open(self._rec_dir / "info.json") as f:
self.info = json.load(f)

self.start_ts_ns = self.info["start_time"]
self.start_ts = self.start_ts_ns * 1e-9

log.info("NeonRecording: Loading wearer")
log.debug("NeonRecording: Loading wearer")
self.wearer = {"uuid": "", "name": ""}
with open(self._rec_dir / "wearer.json") as f:
wearer_data = json.load(f)

self.wearer["uuid"] = wearer_data["uuid"]
self.wearer["name"] = wearer_data["name"]

log.info("NeonRecording: Loading calibration data")
log.debug("NeonRecording: Loading calibration data")
self._calib = _parse_calib_bin(self._rec_dir)

self.calib_version = str(self._calib["version"])
Expand All @@ -83,11 +83,8 @@ def __init__(self, rec_dir_in: Union[pathlib.Path, str]):
self._calib["left_extrinsics_affine_matrix"],
)

log.info("NeonRecording: Loading data streams")
self.streams = {}

log.info("NeonRecording: Finished loading recording.")

@property
def gaze(self) -> GazeStream:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def __init__(self, name, base_name, recording, audio_or_video):
self._base_name = base_name
self.recording = recording

log.info(f"NeonRecording: Loading video: {self._base_name}.")
log.debug(f"NeonRecording: Loading video: {self._base_name}.")

self.video_parts = []

Expand Down
2 changes: 1 addition & 1 deletion src/pupil_labs/neon_recording/stream/event_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class EventStream(Stream):
"""

def __init__(self, recording):
log.info("NeonRecording: Loading event data")
log.debug("NeonRecording: Loading event data")

events_file = recording._rec_dir / "event.txt"
time_file = events_file.with_suffix(".time")
Expand Down
2 changes: 1 addition & 1 deletion src/pupil_labs/neon_recording/stream/eye_state_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class EyeStateStream(Stream):
"""

def __init__(self, recording):
log.info("NeonRecording: Loading eye state data")
log.debug("NeonRecording: Loading eye state data")

eye_state_files = find_sorted_multipart_files(recording._rec_dir, "eye_state")
eye_state_data, time_data = load_multipart_data_time_pairs(eye_state_files, "<f4", 2)
Expand Down
6 changes: 3 additions & 3 deletions src/pupil_labs/neon_recording/stream/gaze_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@

class GazeStream(Stream):
def __init__(self, recording):
log.info("NeonRecording: Loading gaze data")
log.debug("NeonRecording: Loading gaze data")

gaze_file_pairs = []

gaze_200hz_file = recording._rec_dir / "gaze_200hz.raw"
time_200hz_file = recording._rec_dir / "gaze_200hz.time"
if gaze_200hz_file.exists() and time_200hz_file.exists():
log.info("NeonRecording: Using 200Hz gaze data")
log.debug("NeonRecording: Using 200Hz gaze data")
gaze_file_pairs.append((gaze_200hz_file, time_200hz_file))

else:
log.info("NeonRecording: Using realtime gaze data")
log.debug("NeonRecording: Using realtime gaze data")
gaze_file_pairs = find_sorted_multipart_files(recording._rec_dir, "gaze")

gaze_data, time_data = load_multipart_data_time_pairs(gaze_file_pairs, "<f4", 2)
Expand Down
2 changes: 1 addition & 1 deletion src/pupil_labs/neon_recording/stream/imu/imu_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class IMUStream(Stream):
])

def __init__(self, recording):
log.info("NeonRecording: Loading IMU data")
log.debug("NeonRecording: Loading IMU data")

imu_files = find_sorted_multipart_files(recording._rec_dir, "extimu")
imu_data = []
Expand Down

0 comments on commit e207b8c

Please sign in to comment.