DaveStrickland / AstroPhotography

Python workflow for processing astrophotography images from either digital cameras and/or amateur telescopes.
GNU General Public License v3.0
19 stars 3 forks source link

ApAddMetadata fails on iTelescope Premium Image sets #17

Closed DaveStrickland closed 1 year ago

DaveStrickland commented 2 years ago

iTelescope Premium Image sets come pre-calibrated and without standard FITS header metadata.

Attemping to run ap_add_metadata.py (ApAddMetadata) on one of these images fails:

python3 ~/git/AstroPhotography/src/AstroPhotography/scripts/ap_add_metadata.py --target "NGC 55" -l DEBUG Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits 
WARNING: Astrometry.net API key not found in configuration file [astroquery.astrometry_net.core]
WARNING: You need to manually edit the configuration file and add it [astroquery.astrometry_net.core]
WARNING: You may also register it for this session with AstrometryNet.key = 'XXXXXXXX' [astroquery.astrometry_net.core]
2021-12-13 06:58:07,976 | ApAddMetadata | INFO | Adding metadata to Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits, mode=iTelescope.
2021-12-13 06:58:07,976 | ApAddMetadata | DEBUG | User specified target name [NGC 55] will be used instead of filename derived target name [900s].
2021-12-13 06:58:07,976 | ApAddMetadata | INFO | Telescope=iTelescope, observer=Whale_Galaxy_NGC_55, and target=NGC 55.
2021-12-13 06:58:08,074 | ApAddMetadata | ERROR | Error, telescope itelescope not in list of iTelescope telescopes.
Shutting down due to fatal error
Traceback (most recent call last):
  File "/Users/dks/git/AstroPhotography/src/AstroPhotography/scripts/ap_add_metadata.py", line 106, in <module>
    status = main()
  File "/Users/dks/git/AstroPhotography/src/AstroPhotography/scripts/ap_add_metadata.py", line 96, in main
    meta_adder.process(p_fitsimg, p_mode, p_target)
  File "/Users/dks/Library/Python/3.8/lib/python/site-packages/AstroPhotography/core/ApAddMetadata.py", line 335, in process
    site          = self._get_itelescope_site(telescope_str)
  File "/Users/dks/Library/Python/3.8/lib/python/site-packages/AstroPhotography/core/ApAddMetadata.py", line 195, in _get_itelescope_site
    raise RunTimeError(err_msg)
NameError: name 'RunTimeError' is not defined
DaveStrickland commented 2 years ago

Probably also related to #1

DaveStrickland commented 1 year ago

Test

Create a text (YaML) file called test_yaml.yml in the same directory as the NGC 55 premium images with the following contents:

---
observer: iTelescopePremium
telescop: iTelescope T31
target:   NGC 55
...

Run ap_add_metadata with --mode=yamlkeyval --yamlfile=test_yaml.yml. It should run without error and correctly update the target, observer, telescop, and associated observatory and RA, DEC keywords. For example:

python3 ~/git/AstroPhotography/AstroPhotography/scripts/ap_add_metadata.py --target "NGC 55" -l DEBUG Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits  --mode=yamlkeyval --yamlfile=test_yaml.yml 
2022-10-01 08:15:35,986 | ApAddMetadata | INFO | Adding metadata to Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits, mode=yamlkeyval.
2022-10-01 08:15:35,986 | ApAddMetadata | INFO | Reading YaML file test_yaml.yml
2022-10-01 08:15:36,017 | ApAddMetadata | DEBUG | Adding OBSERVER=iTelescopePremium to FITS header.
2022-10-01 08:15:36,018 | ApAddMetadata | DEBUG | Adding TELESCOP=iTelescope T31 to FITS header.
2022-10-01 08:15:36,087 | ApAddMetadata | DEBUG | Adding TARGET=NGC 55 to FITS header.
2022-10-01 08:15:38,095 | ApAddMetadata | INFO | Loading extension 0 of FITS file Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits
2022-10-01 08:15:38,280 | ApAddMetadata | WARNING | FITS header does not contain these optional keywords: DATE-OBS
2022-10-01 08:15:38,280 | ApAddMetadata | WARNING | Can not compute AIRMASS at start of observation without DATE-OBS value.
2022-10-01 08:15:38,281 | ApAddMetadata | DEBUG | FITS header keywords to be added to output: {'OBSERVER': ('iTelescopePremium', 'From test_yaml.yml'), 'TELESCOP': ('iTelescope T31', 'From test_yaml.yml'), 'TARGET': ('NGC 55', 'From test_yaml.yml'), 'OBSERVAT': ('iTelescope Siding Spring', 'Observatory.'), 'LAT-OBS': (-31.273333333333326, '[deg] Latitude of observatory.'), 'LON-OBS': (149.06972222222223, '[deg] Latitude of observatory.'), 'ALT-OBS': (1117.9999999999284, '[m] Height of observatory.'), 'OBJECT': ('NGC 55', 'Target of observation'), 'OBJNAME': ('NGC 55', 'Target of observation'), 'RA-OBJ': (3.7233417, '[deg] Right Ascension of target'), 'DEC-OBJ': (-39.1966278, '[deg] Declination of target')}
2022-10-01 08:15:38,468 | ApAddMetadata | INFO | Finished updating FITS header of Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits
2022-10-01 08:15:38,469 | ApAddMetadata | DEBUG | Finished processing Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits
(astro38) azathoth/ ~/Tmp/iTelescopeScratch/Plan-40-NGC55  08:15:39$ python3 ~/git/AstroPhotography/AstroPhotography/scripts/ap_add_metadata.py --target "NGC 55" -l DEBUG Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits  --mode=yamlkeyval --yamlfile=test_yaml.yml 
2022-10-01 08:19:47,665 | ApAddMetadata | INFO | Adding metadata to Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits, mode=yamlkeyval.
2022-10-01 08:19:47,666 | ApAddMetadata | INFO | Reading YaML file test_yaml.yml
2022-10-01 08:19:47,684 | ApAddMetadata | DEBUG | Adding OBSERVER=iTelescopePremium to FITS header.
2022-10-01 08:19:47,684 | ApAddMetadata | DEBUG | Adding TELESCOP=iTelescope T31 to FITS header.
2022-10-01 08:19:47,755 | ApAddMetadata | DEBUG | Telescope iTelescope T31, iTelescope Siding Spring
2022-10-01 08:19:47,755 | ApAddMetadata | DEBUG | Adding TARGET=NGC 55 to FITS header.
2022-10-01 08:19:47,791 | ApAddMetadata | INFO | Loading extension 0 of FITS file Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits
2022-10-01 08:19:47,891 | ApAddMetadata | WARNING | FITS header does not contain these optional keywords: DATE-OBS
2022-10-01 08:19:47,892 | ApAddMetadata | WARNING | Can not compute AIRMASS at start of observation without DATE-OBS value.
2022-10-01 08:19:47,893 | ApAddMetadata | DEBUG | FITS header keywords to be added to output: {'OBSERVER': ('iTelescopePremium', 'From test_yaml.yml'), 'TELESCOP': ('iTelescope T31', 'From test_yaml.yml'), 'TARGET': ('NGC 55', 'From test_yaml.yml'), 'OBSERVAT': ('iTelescope Siding Spring', 'Observatory.'), 'LAT-OBS': (-31.273333333333326, '[deg] Latitude of observatory.'), 'LON-OBS': (149.06972222222223, '[deg] Latitude of observatory.'), 'ALT-OBS': (1117.9999999999284, '[m] Height of observatory.'), 'OBJECT': ('NGC 55', 'Target of observation'), 'OBJNAME': ('NGC 55', 'Target of observation'), 'RA-OBJ': (3.7233417, '[deg] Right Ascension of target'), 'DEC-OBJ': (-39.1966278, '[deg] Declination of target')}
2022-10-01 08:19:48,187 | ApAddMetadata | INFO | Finished updating FITS header of Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits
2022-10-01 08:19:48,188 | ApAddMetadata | DEBUG | Finished processing Calibrated-iTelescope-Whale_Galaxy_NGC_55-900s-Red-5.fits