njcuk9999 / apero-drs

A PipelinE to Reduce Observations - The DRS for SPIRou (CFHT)
MIT License
12 stars 0 forks source link

Bugs in POLAR code #681

Closed edermartioli closed 1 year ago

edermartioli commented 2 years ago

There has been some bug fixes reported in the polar code that need to be propagated to APERO. The fixes are already implemented in the Eder's prototypes on https://github.com/edermartioli/spirou-polarimetry

Here's the description of the bugs:

  1. The polarimetry ratio method has an additional factor of 2 in the denominator of the exponent in three instances that need to be removed. For example, in the line below:

    -----------------------------------------------------------------

    # STEP 4 - calculate the quantity R
    #          (Part of Eq #24 on page 998 of Bagnulo et al. 2009)
    # -----------------------------------------------------------------
    rr = (r1 * r2) ** (1.0 / (2 * nexp))

    it should be fixed to the following : rr = (r1 * r2) ** (1.0 / nexp)

  2. The recon spectrum needs to include the OH emission lines. An approach using the data without OH measurements was implemented. Since APERO keeps track of the OH spectrum, it could probably use the actual measured OH spectrum instead of using the fix implemented in the prototype.

  3. The "FLAT" arrays were masked and this was causing problems in the interpolation for continuum removal. I am not sure if this was fixed in APERO but I remember Neil saying that APERO has its own routines to perform interpolation that deals with NaNs, so it's probably been fixed already.

njcuk9999 commented 2 years ago

So for:

point 1: if you can make a branch from v0.7.242-working and make a pull request I can add that straight in!

point 2: it should be possible to get the OH spectrum, however, it's not scaled to the data (as far as I know) so how would you be using the OH spectrum?

point 3: I'm not sure about this but we could check this together

njcuk9999 commented 2 years ago

@edermartioli we should address these points asap as well as update some of the constants (that you mentioned may have changed while writing the paper)

edermartioli commented 2 years ago

@njcuk9999 I created a new branch v0.7.248-working-Eder-polar-fixes where I implemented point 1. Point 2 is more tricky since it deals with different input files (e.fits and t.fits), so I think it would be better to do a quick zoom meeting to sort this out. Point 3 may not be an issue, but we can also talk about it during the meeting.

njcuk9999 commented 2 years ago

So from our meeting, I'll check with Gl388 number of exposure vs number of polar / 4