Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better gphoto2 readtout timers #1282

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions src/panoptes/pocs/camera/gphoto/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import subprocess
import time
from abc import ABC
from typing import List, Dict, Union
from typing import Dict, List, Union

from panoptes.utils import error
from panoptes.utils.images import cr2 as cr2_utils
Expand Down Expand Up @@ -252,14 +252,21 @@ def _poll_exposure(self, readout_args, exposure_time, timeout=None, interval=0.0
This will essentially block until the camera is done exposing, which means
the super call should not have to wait.
"""
self.logger.debug(f'Calling get_command_result from base gphoto2 for {self}')
# Wait for and clear the _command_proc.
outs = self.get_command_result(timeout)
self.logger.debug(f'Camera response for {self}: {outs}')
self._is_exposing_event.clear()
self.logger.debug(f'Exposing event cleared for {self}')

super()._poll_exposure(readout_args, exposure_time, timeout=timeout, interval=interval)
try:
self.logger.debug(f'Calling get_command_result from base gphoto2 for {self}')
# Wait for the exposure to complete, this blocks in gphoto2.
outs = self.get_command_result(timeout)
self.logger.debug(f'Exposure complete for {self}, getting readout')
self._readout(*readout_args)
except Exception as err:
self.logger.error(f"Error during readout on {self}: {err!r}")
self._exposure_error = repr(err)
raise err
finally:
self.logger.debug(f'Camera response for {self}: {outs}')
self._is_exposing_event.clear()
self.logger.debug(f'Exposing event cleared for {self}')

def _readout(self, filename, headers, *args, **kwargs):
self.logger.debug(f'Reading Canon DSLR exposure for {filename=}')
Expand Down
Loading