HiPERCAM / hipercam

Python package for handling HiPERCAM data
4 stars 4 forks source link

reduce crashes when reference aperture fits failed #38

Closed StuartLittlefair closed 6 years ago

StuartLittlefair commented 6 years ago

On L1652 of reduce.py an exception is raised. We've had a few problems where the reference aperture fits failed; this crashes the reduction and it would be preferable if it just flagged the data and carried on going...

trmrsh commented 6 years ago

yes, agreed, will look at this too

trmrsh commented 6 years ago

OK, I have added some code to try to carry on (just sets all other apertures to a bad state and quits the routine). Should work I hope, but let me know if not.

StuartLittlefair commented 6 years ago

Cheers @trmrsh,

Thanks for the excellent bug fixing. That fix works a charm.

However, there's still a way that moveApers can crash the reduction - see below. This was pretty extreme case though - derotation whilst observing - so we can keep going without an urgent fix for this one...

multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/Users/sl/anaconda3/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/Users/sl/anaconda3/lib/python3.6/multiprocessing/pool.py", line 47, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/Users/sl/anaconda3/lib/python3.6/site-packages/hipercam/scripts/reduce.py", line 2974, in ccdproc
    moveApers(cnam, ccd, ccdaper, ccdwins, rfile, read, gain, store)
  File "/Users/sl/anaconda3/lib/python3.6/site-packages/hipercam/scripts/reduce.py", line 1562, in moveApers
    aper.x-shbox, aper.x+shbox, aper.y-shbox, aper.y+shbox
  File "/Users/sl/anaconda3/lib/python3.6/site-packages/hipercam/window.py", line 977, in window
    winh = self.winhead.window(xlo, xhi, ylo, yhi)
  File "/Users/sl/anaconda3/lib/python3.6/site-packages/hipercam/window.py", line 415, in window
    self.format(), xlo, xhi, ylo, yhi)
hipercam.core.HipercamError: "Winhead(llx=1025, lly=513, nx=256, ny=128, xbin=4, ybin=4, head='')" has no overlap with region = (1152.23,1294.23,-477.89,-335.89)
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/sl/anaconda3/bin/reduce", line 11, in <module>
    load_entry_point('hipercam==0.8.dev34+g55ea07d', 'console_scripts', 'reduce')()
  File "/Users/sl/anaconda3/lib/python3.6/site-packages/hipercam/scripts/reduce.py", line 730, in reduce
    allres = pool.starmap(ccdproc, arglist)
  File "/Users/sl/anaconda3/lib/python3.6/multiprocessing/pool.py", line 274, in starmap
    return self._map_async(func, iterable, starmapstar, chunksize).get()
  File "/Users/sl/anaconda3/lib/python3.6/multiprocessing/pool.py", line 644, in get
    raise self._value
hipercam.core.HipercamError: "Winhead(llx=1025, lly=513, nx=256, ny=128, xbin=4, ybin=4, head='')" has no overlap with region = (1152.23,1294.23,-477.89,-335.89)
trmrsh commented 6 years ago

OK, I will want to fix that as such de-rotations are common on the TNT where they come out of nowhere. I normall stop & re-start if I spot them coming. Going to tackle to makeflat issue for now.

trmrsh commented 6 years ago

With recent changes, I think this should be fixed, so I am closing this one out.