anand0xff / ImPlaneIA

Tools for fitting (image plane fringes), calibrating, and analyzing NRM data across multiple instruments and modes
BSD 3-Clause "New" or "Revised" License
7 stars 4 forks source link

Error when using correct_fitsfiles on stage 2 files #36

Open tomasstolker opened 9 months ago

tomasstolker commented 9 months ago

Thanks a lot for providing this tool!

I am running into the following error with ImPlaneIA, when using the correct_fitsfiles on a set of stage 2 _calints.fits files.

Any idea what the issue might be?

Identified 540338 NaN pixels to correct
   The following values do not include the reference pixels:
      368763 pixels flagged in DQ array
      -2011755 pixels flagged DO_NOT_USE or JUMP_DET
      -6.23 percent of all pixels flagged
      -398.60 pixels (average) flagged per integration
/Users/tomasstolker/applications/ImPlaneIA/nrm_analysis/misctools/run_bp_fix.py:328: FutureWarning: Unlike other reduction functions (e.g. `skew`, `kurtosis`), the default behavior of `mode` typically preserves the axis it acts along. In SciPy 1.11.0, this behavior will change: the default value of `keepdims` will become False, the `axis` over which the statistic is taken will be eliminated, and the value None will no longer be accepted. Set `keepdims` to True or False to avoid this warning.
  xh = min(imsz[1] - stats.mode(ww_max[:, 0]).mode, stats.mode(ww_max[:, 0]).mode - nrefrow) # the bottom 4 rows are reference pixels
/Users/tomasstolker/applications/ImPlaneIA/nrm_analysis/misctools/run_bp_fix.py:329: FutureWarning: Unlike other reduction functions (e.g. `skew`, `kurtosis`), the default behavior of `mode` typically preserves the axis it acts along. In SciPy 1.11.0, this behavior will change: the default value of `keepdims` will become False, the `axis` over which the statistic is taken will be eliminated, and the value None will no longer be accepted. Set `keepdims` to True or False to avoid this warning.
  yh = min(imsz[2] - stats.mode(ww_max[:, 1]).mode, stats.mode(ww_max[:, 1]).mode - 0)
      Cropping all frames to -4x-4 pixels
      FOV = -0.3 arcsec, Fourier sampling = -3.786 m/pix
      F480M: 4.817 to 4.986 micron
Traceback (most recent call last):
  File "run_implane.py", line 3, in <module>
    correct_fitsfiles(indir='stage2', odir='bp_corrected', pattern='*_calints.fits', show=0, save=True)
  File "/Users/tomasstolker/applications/ImPlaneIA/nrm_analysis/misctools/run_bp_fix.py", line 494, in correct_fitsfiles
    fix_bad_pixels(indir=indir,
  File "/Users/tomasstolker/applications/ImPlaneIA/nrm_analysis/misctools/run_bp_fix.py", line 339, in fix_bad_pixels
    cvis = calcsupport(filt, 2 * sh, pupil=pupil)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tomasstolker/applications/ImPlaneIA/nrm_analysis/misctools/run_bp_fix.py", line 94, in calcsupport
    detimage = np.zeros((sqfov_npix, sqfov_npix), float)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: negative dimensions are not allowed
kammerje commented 3 months ago

@tomasstolker It works for me using the centering_RC branch.