kammerje / fouriever

A single toolkit for calibrations, correlations, and companion search for kernel-phase, aperture masking, and long-baseline interferometry data.
6 stars 6 forks source link

KLIP calibration of visibilities and closure phases #2

Closed tomasstolker closed 2 years ago

tomasstolker commented 2 years ago

Hi @kammerje,

I have been looking into the KLIP calibration of the visibilities and closure phases of a SPHERE/SAM dataset. I simply added an if statement in the project method, check the content of the FITS files for the OI_VIS2 and OI_T3 extensions, and follow your implementation for kernel phase.

It runs but please check on your earliest convenience. I was in particular not sure about what to do with VIS2ERR and T3PHIERR. I saw that the kernel phase uncertainties (KP-SIGM?) are projected onto the principal components but I wasn't sure if this can be done with the V2 and CP uncertainties?

I was also expecting that after the projection of the science data on the calibration components this would get subtracted from the science data, but that does not seem to be needed with the kernel phase at least? Sorry if I have misunderstood how this works... Your feedback is very welcome 😊.

For the 2018 epoch of HD 142527, I get currently a higher chi2 when using K_klip=10 (right) compared to using the regular calibration (left). Probably there is still an issue, e.g. related to the uncertainties.

sphere_sam

I also made a slight update with the functions that read in FITS files. Whenever the argument for the filenames is set to None, it simply reads in all the FITS files in the directory that is given as input. For example, setting the directory of idir in uvfit together with fitsfiles=None.

Let me know what you think and feel free to make changes directly to this branch.

tomasstolker commented 2 years ago

Thanks again for your KLIP implementation on the develop branch! Seems to work well 👍! And while going through your code and paper I think that it answered most of my questions 😊. There is one part that I don't fully understand but we can discuss this some time offline.

I will close this PR since it isn't needed anymore. Looking forward to the next release!