HiPERCAM / hipercam

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

reduce crashing in moveApers #45

Closed StuartLittlefair closed 6 years ago

StuartLittlefair commented 6 years ago
Frame 66068: 2018-06-07T04:36:22.0188270 [NOK]
CCD 3, mean x,y shift from reference aperture(s) = -0.04, -0.24
CCD 2, mean x,y shift from reference aperture(s) = -0.01, -0.16
CCD 4, mean x,y shift from reference aperture(s) = -0.22, -0.29
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 "../reduce.py", line 3027, in ccdproc
    moveApers(cnam, ccd, flat, rflat, ccdaper, ccdwins, rfile, store)
  File "../reduce.py", line 1583, 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=1825, lly=1, nx=12, ny=9, xbin=8, ybin=8, head='NCYCLE  =                    1                                                  \\nREFLECT =                    T                                                  \\nDSTATUS =                    T                                                  \\nMJDUTC  =    58276.19192140125                                                  \\nGOODTIME=                    F                                                  \\nEXPTIME =            0.0019917                                                  ')" has no overlap with region = (1997.46,2021.46,18.91,42.91)
"""

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

Traceback (most recent call last):
  File "../reduce.py", line 3040, in <module>
    reduce()
  File "../reduce.py", line 754, 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=1825, lly=1, nx=12, ny=9, xbin=8, ybin=8, head='NCYCLE  =                    1                                                  \\nREFLECT =                    T                                                  \\nDSTATUS =                    T                                                  \\nMJDUTC  =    58276.19192140125                                                  \\nGOODTIME=                    F                                                  \\nEXPTIME =            0.0019917                                                  ')" has no overlap with region = (1997.46,2021.46,18.91,42.91)
trmrsh commented 6 years ago

I think I need to prevent it getting into this state in the first place, i.e I should limit the maximum shift. Quite tricky to ensure in the general case with multiple reference stars.

trmrsh commented 6 years ago

Stu, I have put some checks on the positions from the moving aperture section such that the error condition is raised in any aperture moves too close to edge of a window. I believe that this should prevent reduce getting into this state. Do you have a convenient test set of data? NB I haven't tested this!!

StuartLittlefair commented 6 years ago

I have a test set, but it's far from convenient - it's the MAXI 1820 dataset and it takes a long time to copy anywhere, let alone reduce! Maybe you can publish to a branch on GitHub and I can fetch that branch and test it here?

trmrsh commented 6 years ago

thought it might be. Like an idiot I have just implemented it on the main branch. Is this the maxi dataset from a while back? I have the data, so perhaps just send me the aperture file etc

StuartLittlefair commented 6 years ago

not a problem, I'll try the code you've got on the master branch

StuartLittlefair commented 6 years ago

Problems....

"""
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 3039, in ccdproc
    moveApers(cnam, ccd, flat, rflat, ccdaper, ccdwins, rfile, store)
  File "/Users/sl/anaconda3/lib/python3.6/site-packages/hipercam/scripts/reduce.py", line 1794, in moveApers
    'Fitted position ({:.1f},{:.1f}) too close or outside window = {!s}'.format(x,y,fwdata.winhead())
TypeError: 'Winhead' object is not callable
"""
StuartLittlefair commented 6 years ago

above bug fixed in https://github.com/HiPERCAM/hipercam/commit/d2c60b28a0142f694cab21a82831dace51354088