Skip to content

Commit

Permalink
Fixes for abstracted light source, possible fix for premature Stytra …
Browse files Browse the repository at this point in the history
…trigger.
  • Loading branch information
vilim committed Sep 28, 2020
1 parent be7d0ec commit cbeac4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion sashimi/hardware/scanning/scanloops.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ def update_settings(self):

if not self.camera_on and self.n_samples_read > self.n_samples_period():
self.camera_on = True
self.wait_signal.clear()
self.trigger_exp_start = True
elif not self.camera_on:
self.wait_signal.set()
Expand Down Expand Up @@ -344,6 +343,7 @@ def fill_arrays(self):
if i_sample == 0:
camera_pulses = self.camera_pulses.read(i_sample, self.n_samples)
self.camera_was_off = False
self.wait_signal.clear()
else:
n_to_next_start = self.n_samples_period() - i_sample
if n_to_next_start < self.n_samples:
Expand All @@ -352,6 +352,7 @@ def fill_arrays(self):
).copy()
camera_pulses[:n_to_next_start] = 0
self.camera_was_off = False
self.wait_signal.clear()
else:
camera_pulses = self.camera_pulses.read(i_sample, self.n_samples)

Expand Down
10 changes: 6 additions & 4 deletions sashimi/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from pathlib import Path
from enum import Enum
from sashimi.config import read_config
from datetime import time

conf = read_config()

Expand Down Expand Up @@ -361,9 +362,6 @@ def __init__(self, sample_rate):
self.light_source = light_source_class_dict[conf["light_source"]["name"]](
port=conf["light_source"]["port"]
)
self.light_source_settings.intensity.unit = (
self.light_source.intensity_units
)
self.camera = CameraProcess(
stop_event=self.stop_event,
wait_event=self.scanner.wait_signal,
Expand Down Expand Up @@ -402,6 +400,9 @@ def __init__(self, sample_rate):

self.planar_setting = PlanarScanningSettings()
self.light_source_settings = LightSourceSettings()
self.light_source_settings.params.intensity.unit = (
self.light_source.intensity_units
)

self.save_status: Optional[SavingStatus] = None

Expand Down Expand Up @@ -541,11 +542,12 @@ def get_camera_status(self):
def start_experiment(self):
# TODO disable the GUI except the abort button
self.logger.log_message("started experiment")
self.send_scan_settings()
self.scanner.wait_signal.set()
self.send_scan_settings()
self.restart_event.set()
self.saver.save_queue.empty()
self.camera.image_queue.empty()
time.sleep(0.01)
self.is_saving_event.set()

def end_experiment(self):
Expand Down

0 comments on commit cbeac4c

Please sign in to comment.