Skip to content

Commit 59667e4

Browse files
committed
disable autodownload of IERS tables; better stability; preparing v2.6.0
1 parent 70c05e4 commit 59667e4

File tree

6 files changed

+38
-11
lines changed

6 files changed

+38
-11
lines changed

CHANGELOG

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
2.6.0
12
- support for monochrome cameras
2-
- better support for seldom raw and RGB frame formats
3+
- support for new raw and RGB frame formats (including monochrome)
4+
- disable astropy to download the latest IERS-A table from internet to avoid errors during observation session
5+
- better stability of exposure loop
36

47
2.5.0
58
- fixed changed data alignment in Pi 5 raw images

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ every frame exposure can solve this issue. Valid values of this switch are:
114114
* `auto`: Automatically choose based on list of known critical cameras.
115115

116116
Default (if not otherwise set in INI file) is `auto`.
117-
117+
- `enable_IERS_autoupdate` (`yes`, `no`): Allows the `astropy` library to update the IERS-A table from internet.
118+
By default this is disabled to avoid errors when the camera is not connected to internet.
118119

119120
There are more settings, mostly to support debugging.
120121

src/indi_pylibcamera/CameraControl.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,14 @@
1212
from astropy.io import fits
1313
import astropy.coordinates
1414
import astropy.units
15+
import astropy.utils.iers
1516

1617
from picamera2 import Picamera2
1718
from libcamera import controls, Rectangle
1819

1920

2021
from .indidevice import *
2122

22-
# From time to time astropy downloads the latest IERS-A table from internet.
23-
# If offline this will raise an error. Here we disable the auto update.
24-
from astropy.utils.iers import conf
25-
conf.auto_max_age = None
2623

2724
class CameraSettings:
2825
"""exposure settings
@@ -217,8 +214,14 @@ class CameraControl:
217214
def __init__(self, parent, config):
218215
self.parent = parent
219216
self.config = config
220-
self.do_CameraAdjustments = config.getboolean("driver", "CameraAdjustments", fallback=True)
221-
self.IgnoreRawModes = config.getboolean("driver", "IgnoreRawModes", fallback=False)
217+
# From time to time astropy downloads the latest IERS-A table from internet.
218+
# If offline this will raise an error. Here we disable the auto update.
219+
if self.config.getboolean("driver", "enable_IERS_autoupdate", fallback=True):
220+
astropy.utils.iers.conf.auto_max_age = None
221+
astropy.utils.iers.conf.iers_degraded_accuracy = "ignore"
222+
#
223+
self.do_CameraAdjustments = self.config.getboolean("driver", "CameraAdjustments", fallback=True)
224+
self.IgnoreRawModes = self.config.getboolean("driver", "IgnoreRawModes", fallback=False)
222225
# reset states
223226
self.picam2 = None
224227
self.present_CameraSettings = CameraSettings()
@@ -737,6 +740,7 @@ def __ExposureLoop(self):
737740
self.Sig_ActionExpose.clear()
738741
if self.Sig_ActionExit.is_set():
739742
# exit exposure loop
743+
#logger.error(f'DBG vor stop (line 744): {self.picam2.started=}') # FIXME
740744
self.picam2.stop_()
741745
self.parent.setVector("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", value=0, state=IVectorState.OK)
742746
return
@@ -763,6 +767,7 @@ def __ExposureLoop(self):
763767
if self.present_CameraSettings.is_ReconfigurationNeeded(NewCameraSettings) or self.needs_Restarts:
764768
logger.info(f'reconfiguring camera')
765769
# need a new camera configuration
770+
#logger.error(f'DBG vor create_still_configuration: {self.picam2.started=}') # FIXME
766771
config = self.picam2.create_still_configuration(
767772
queue=NewCameraSettings.DoFastExposure,
768773
buffer_count=2 # 2 if NewCameraSettings.DoFastExposure else 1 # need at least 2 buffer for queueing
@@ -783,22 +788,27 @@ def __ExposureLoop(self):
783788
#self.parent.setVector("CCD_FRAME", "HEIGHT", value=NewCameraSettings.ProcSize[1])
784789
# optimize (align) configuration: small changes to some main stream configurations
785790
# (for instance: size) will fit better to hardware
791+
#logger.error(f'DBG vor align_configuration: {self.picam2.started=}') # FIXME
786792
self.picam2.align_configuration(config)
787793
# set still configuration
794+
#logger.error(f'DBG vor configure: {self.picam2.started=}') # FIXME
788795
self.picam2.configure(config)
789796
# changing exposure time or analogue gain needs a restart
790797
if IsRestartNeeded:
791798
# change camera controls
799+
#logger.error(f'DBG vor set_controls: {self.picam2.started=}') # FIXME
792800
self.picam2.set_controls(NewCameraSettings.get_controls())
793801
# start camera if not already running in Fast Exposure mode
794802
if not self.picam2.started:
803+
#logger.error(f'DBG vor start (line 802): {self.picam2.started=}') # FIXME
795804
self.picam2.start()
796805
logger.debug(f'camera started')
797806
# camera runs now with new parameter
798807
self.present_CameraSettings = NewCameraSettings
799808
# last chance to exit or abort before doing exposure
800809
if self.Sig_ActionExit.is_set():
801810
# exit exposure loop
811+
#logger.error(f'DBG vor stop (line 811): {self.picam2.started=}') # FIXME
802812
self.picam2.stop_()
803813
self.parent.setVector("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", value=0, state=IVectorState.OK)
804814
return
@@ -808,6 +818,7 @@ def __ExposureLoop(self):
808818
# get (non-blocking!) frame and meta data
809819
self.Sig_CaptureDone.clear()
810820
ExpectedEndOfExposure = time.time() + self.present_CameraSettings.ExposureTime
821+
#logger.error(f'DBG vor capture_arrays: {self.picam2.started=}') # FIXME
811822
job = self.picam2.capture_arrays(
812823
["raw" if self.present_CameraSettings.DoRaw else "main"],
813824
wait=False, signal_function=self.on_CaptureFinished,
@@ -824,12 +835,15 @@ def __ExposureLoop(self):
824835
# allow to close camera
825836
if self.Sig_ActionExit.is_set():
826837
# exit exposure loop
838+
#logger.error(f'DBG vor stop (line 838): {self.picam2.started=}') # FIXME
827839
self.picam2.stop_()
828840
self.parent.setVector("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", value=0, state=IVectorState.OK)
829841
return
830842
# allow to abort exposure
831843
Abort = self.Sig_ActionAbort.is_set()
832844
if Abort:
845+
#logger.error(f'DBG vor stop (line 846): {self.picam2.started=}') # FIXME
846+
self.picam2.stop_() # stop exposure immediately
833847
self.Sig_ActionAbort.clear()
834848
break
835849
# allow exposure to finish earlier than expected (for instance when in fast exposure mode)
@@ -838,6 +852,7 @@ def __ExposureLoop(self):
838852
time.sleep(PollingPeriod_s)
839853
# get frame and its metadata
840854
if not Abort:
855+
#logger.error(f'DBG vor wait: {self.picam2.started=}') # FIXME
841856
(array, ), metadata = self.picam2.wait(job)
842857
logger.info('got exposed frame')
843858
# at least HQ camera reports CCD temperature in meta data
@@ -848,6 +863,7 @@ def __ExposureLoop(self):
848863
# last chance to exit or abort before sending blob
849864
if self.Sig_ActionExit.is_set():
850865
# exit exposure loop
866+
#logger.error(f'DBG vor stop (line 864): {self.picam2.started=}') # FIXME
851867
self.picam2.stop_()
852868
self.parent.setVector("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", value=0, state=IVectorState.OK)
853869
return
@@ -859,7 +875,8 @@ def __ExposureLoop(self):
859875
FastCount_Frames = self.parent.knownVectors["CCD_FAST_COUNT"]["FRAMES"].value
860876
if not DoFastExposure:
861877
# in normal exposure mode the camera needs to be started with exposure command
862-
self.picam2.stop_()
878+
#logger.error(f'DBG vor stop (line 876): {self.picam2.started=}') # FIXME
879+
self.picam2.stop()
863880
if not Abort:
864881
if DoFastExposure:
865882
FastCount_Frames -= 1

src/indi_pylibcamera/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
INDI driver for libcamera supported cameras
33
"""
44

5-
__version__ = "2.5.0"
5+
__version__ = "2.6.0"

src/indi_pylibcamera/indi_pylibcamera.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ DoSnooping=yes
3636
#force_Restart=no
3737
#force_Restart=yes
3838

39+
# From time to time astropy downloads the latest IERS-A table from internet. This will raise an error when the
40+
# the camera is not connected to internet. Therefore the auto update is disabled by default. That can lead to
41+
# small errors in the object coordinates stored in the FITS header. If your camera is internet connected you can
42+
# enable the autoupdate here:
43+
#enable_IERS_autoupdate=yes
44+
3945
#####################################
4046
# The following settings are to help debugging. Don't change them unasked!
4147
#

src/indi_pylibcamera/indi_pylibcamera.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<devGroup group="CCDs">
33
<device label="INDI pylibcamera">
44
<driver name="INDI pylibcamera">indi_pylibcamera</driver>
5-
<version>2.5.0</version>
5+
<version>2.6.0</version>
66
</device>
77
</devGroup>
88
</driversList>

0 commit comments

Comments
 (0)