Skip to content

Commit

Permalink
Merge pull request #115 from spacetelescope/bugfix/exposure_time_calc…
Browse files Browse the repository at this point in the history
…ulator

add exposure time formula for science cam
  • Loading branch information
asahooexo authored Aug 3, 2023
2 parents 1265065 + 6fbf20a commit 295a07b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion catkit2/services/zwo_camera/zwo_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def open(self):
self.offset_y = offset_y

self.gain = self.config.get('gain', 0)
self.exposure_time_step_size = self.config.get('exposure_time_step_size', 1)
self.exposure_time_offset_correction = self.config.get('exposure_time_offset_correction', 0)
self.exposure_time_base_step = self.config.get('exposure_time_base_step', 1)
self.exposure_time = self.config.get('exposure_time', 1000)

# Create datastreams
Expand Down Expand Up @@ -220,10 +223,15 @@ def end_acquisition(self):
@property
def exposure_time(self):
exposure_time, auto = self.camera.get_control_value(zwoasi.ASI_EXPOSURE)
return exposure_time
return exposure_time - self.exposure_time_offset_correction

@exposure_time.setter
def exposure_time(self, exposure_time):
exposure_time += self.exposure_time_offset_correction
exposure_time = np.round((exposure_time - self.exposure_time_base_step) / self.exposure_time_step_size)
exposure_time = np.maximum(exposure_time, 0)
exposure_time = exposure_time * self.exposure_time_step_size + self.exposure_time_base_step

self.camera.set_control_value(zwoasi.ASI_EXPOSURE, int(exposure_time))

@property
Expand Down

0 comments on commit 295a07b

Please sign in to comment.