PyWiFeS / pipeline

The Python data reduction pipeline for WiFeS
6 stars 25 forks source link

run_flat_response: divide by zero warnings #55

Open bmiszalski opened 2 months ago

bmiszalski commented 2 months ago

When running run_flat_response on the test classical_20230922 dataset I get these warnings:

/usr/local/lib/python3.11/dist-packages/pywifes/pywifes.py:2244: RuntimeWarning: divide by zero encountered in log10
  curr_y = numpy.log10(curr_ff_rowwise_ave)
/usr/local/lib/python3.11/dist-packages/pywifes/pywifes.py:2296: RuntimeWarning: invalid value encountered in divide
  mid_lam_array, spatial_flat_spec/spec_norm,
Transforming data for Slitlet 1
/usr/local/lib/python3.11/dist-packages/pywifes/pywifes.py:2356: RuntimeWarning: divide by zero encountered in divide
  norm_func = (alt_y / (
/usr/local/lib/python3.11/dist-packages/pywifes/pywifes.py:2356: RuntimeWarning: invalid value encountered in divide
  norm_func = (alt_y / (

This may be worth investigating further.

CMartinezLombilla commented 1 month ago

Thank you for reporting, @bmiszalski. Yes, we were aware of these warnings... We fixed some of them a while ago. We've now fixed the remaining ones. It's an analytical issue that arises when some data arrays have zero or negative values, which might happen if there is any bad pixel or simply due to the Poissonian fluctuations of the detector response.
It seems to work fine now in our tests, so I'll close the issue. Please, let us know in case this happens again in any of your tests.

CMartinezLombilla commented 1 month ago

I'd better keep it open until we do a few more tests just in case :-) .