Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculate throughput corrections in a separate function and save the them to disk. change default to use sky correction #939

Merged
merged 2 commits into from Apr 2, 2020

Conversation

akremin
Copy link
Member

@akremin akremin commented Mar 31, 2020

Moved calculation of throughput corrections into a separate function and save the factors to skymodel files.

This includes the creation of a new function in sky.py called calculate_throuhput_corrections() that is run at the end of compute_sky().

subtract_sky() uses the values, which are saved in a 1D array in skymodel. The index corresponds to the fiber number. Its value is 1 by default. The array is stored in skymodel.throughput_corrections

The array is saved in a new HDU within the skymodel fits file labeled THRPUTCORR. If that exists in a loaded file, it is assigned to skymodel.throughput_corrections otherwise None is assigned.

This PR also changes the default of the pipeline to use sky corrections in fiber throughput. It changes the input flag of procexp (desi_process_exposure) to --no-sky-throughput-correction and removes the use of the previous flag from desi_proc.

Checked with:
srun -N 1 -n 2 -c 32 /global/homes/k/kremin/workspace/default_skycorrect/desispec/bin/desi_proc --cameras 1 -n 20200314 -e 55444 --mpi --traceshift

It runs to completion.

The results are in:
/global/cfs/cdirs/desi/spectro/redux/kremin/exposures/20200314/00055444

@akremin akremin requested a review from sbailey March 31, 2020 02:51
@julienguy
Copy link
Contributor

Good for me.

@akremin
Copy link
Member Author

akremin commented Mar 31, 2020

This addresses issue #938

Copy link
Contributor

@sbailey sbailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't found the cause of the problem, but the throughput corrections don't look right:
image
image
I suspect that it is something to do with assumptions about fiber ordering, or maybe not applying correct order of calibs and masking prior to calculating throughput correction. Please investigate. It might be useful to go back to master and make a minimal change to save the original throughput correction in the sframe file, for comparison to this refactored throughput correction that is stored with the sky model itself (which in principle is better, but both the magnitude and structure are off here).

Other comments inline too.

py/desispec/scripts/procexp.py Outdated Show resolved Hide resolved
py/desispec/sky.py Outdated Show resolved Hide resolved
py/desispec/sky.py Show resolved Hide resolved
@akremin akremin self-assigned this Mar 31, 2020
@sbailey sbailey mentioned this pull request Apr 1, 2020
@akremin
Copy link
Member Author

akremin commented Apr 2, 2020

If the above is completely due to the wavelength miscalibration seen in test reductions, then this PR is independent of that. I've discovered that the wavelength miscalibration is already present in master, which I've reported here: #941 .

A glance at the r1 throughput values show what seem to be more reasonable results:

image

New test exposures where that issue has been negated can be found in the same data directory (note that it's a different exposure than the original post):

/global/cfs/cdirs/desi/spectro/redux/kremin/preproc/20200314/0005545
/global/cfs/cdirs/desi/spectro/redux/kremin/exposures/20200314/0005545

@akremin akremin requested a review from sbailey April 2, 2020 17:33
@akremin akremin added this to In progress in Data Release 20.4 via automation Apr 2, 2020
@akremin akremin dismissed sbailey’s stale review April 2, 2020 19:12

All issues resolved except the wavelength issue that is already in master. Closing this and opening a new PR for that.

@akremin akremin merged commit 8ccf999 into master Apr 2, 2020
Data Release 20.4 automation moved this from In progress to Done Apr 2, 2020
@akremin akremin deleted the default_skycorrect branch April 2, 2020 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants