genghisken / psat-server

Core python3 and C++ code for ATLAS and Pan-STARRS science servers
MIT License
1 stars 0 forks source link

Stamp generation OSError when opening FITS file #2

Open genghisken opened 2 years ago

genghisken commented 2 years ago

Code needs a try/except clause around opening the FITS file. Don't know why it fails, but it occasionally does with the following error. Need to get to the bottom of why the FITS file is not valid, but in the meantime a quick fix is to add the exception on line 713.

Waiting for jobs to complete...
Process Process-46:
Traceback (most recent call last):
  File "/usr/local/swtools/python/atls/anaconda3/envs/atlas37/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/local/swtools/python/atls/anaconda3/envs/atlas37/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/ps1code/gitrelease/psat-server/psat-server/scripts/stamps/python/makeATLASStampsMultiprocess.py", line 90, in workerStampCutter
    objectsForUpdate = makeATLASObjectPostageStamps3(conn, listFragment, PSSImageRootLocation, limit = limit, mostRecent = mostRecent, nonDets = nondetections, discoveryLimit = discoverylimit, lastDetectionLimit=lastdetectionlimit, requestType = requestType, ddc = ddc, wpwarp = wpwarp, options = options)
  File "/usr/local/ps1code/gitrelease/psat-server/psat-server/scripts/stamps/python/makeATLASStamps.py", line 637, in makeATLASObjectPostageStamps3
    status, rot = imu.getMonstaPostageStamp(imageFilenames[imageType], absoluteLocalImageName, x, y, dx)
  File "/usr/local/ps1code/gitrelease/psat-server/psat-server/scripts/stamps/python/image_utils.py", line 713, in getMonstaPostageStamp
    h = pf.open(filename)
  File "/usr/local/swtools/python/atls/anaconda3/envs/atlas37/lib/python3.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 174, in fitsopen
    lazy_load_hdus, ignore_missing_simple, **kwargs)
  File "/usr/local/swtools/python/atls/anaconda3/envs/atlas37/lib/python3.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 411, in fromfile
    lazy_load_hdus=lazy_load_hdus, **kwargs)
  File "/usr/local/swtools/python/atls/anaconda3/envs/atlas37/lib/python3.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 1090, in _readfrom
    raise OSError('No SIMPLE card found, this file does not '
OSError: No SIMPLE card found, this file does not appear to be a valid FITS file