-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhist_logger.py
More file actions
27 lines (23 loc) · 808 Bytes
/
hist_logger.py
File metadata and controls
27 lines (23 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import experiment as exp
import data_log
import video_system
class HistogramLoggerExperiment(exp.Experiment):
default_params = {
"obs_id": "hist",
}
def run(self):
self.obs_id = exp.get_params()["obs_id"]
self.obs = video_system.image_observers[self.obs_id]
bin_count = self.obs.get_config("bin_count")
self.obslog = data_log.ObserverLogger(
self.obs,
columns=[("time", "timestamptz not null")]
+ [(f"bin{i}", "double precision") for i in range(bin_count)],
csv_path=exp.session_state["data_dir"] / (self.obs_id + ".csv"),
split_csv=True,
)
self.obslog.start()
self.obs.start_observing()
def end(self):
self.obs.stop_observing()
self.obslog.stop()