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
CTE fix: fit offset per CCD sector as part of sky subtraction #1571
Conversation
In order to test the code for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to understand better how the pipeline flow worked and so I thought I'd stare at this PR. Please ignore because I'm probably way off base!
py/desispec/sky.py
Outdated
psf_filename = findfile('psf',frame.meta["NIGHT"],frame.meta["EXPID"],frame.meta["CAMERA"]) | ||
if not os.path.isfile(psf_filename) : | ||
log.error("No PSF file "+psf_filename) | ||
raise IOError("No PSF file "+psf_filename) | ||
log.info("Using PSF {}".format(psf_filename)) | ||
tset = read_xytraceset(psf_filename) | ||
|
||
tmp_fibers = np.arange(frame.nspec) | ||
tmp_x = np.zeros(frame.flux.shape,dtype=float) | ||
tmp_y = np.zeros(frame.flux.shape,dtype=float) | ||
for fiber in tmp_fibers : | ||
tmp_x[fiber] = tset.x_vs_wave(fiber=fiber,wavelength=frame.wave) | ||
tmp_y[fiber] = tset.y_vs_wave(fiber=fiber,wavelength=frame.wave) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies as I read desispec code for the first time. Does this duplicate lines 714+ below and not actually get used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. thank you.
I'm running a test prod on 20211222 and 20220102 using this branch in Notes to self (updated for second launch):
|
We will have to rerun this test prod after algorithmic changes. But it's interesting to see how the current implementation performs. |
I have committed a modified approach to the fit.
This change improves the result on sframe-r1-00115156.fits |
FTR I canceled the test prod and resubmitted with the lastest update, re-using the extractions from daily and re-processing only b1,r1,z1 . |
The original "skycte" has been replaced with a "skycte2" production in: /global/cfs/cdirs/desi/users/sjbailey/spectro/redux/skycte2 covering data on 20211222 and 20220102. sp1/r1 is the CCD with the CTE problem that hopefully is corrected with this test production. Please help evaluate. Night QA plots are at https://data.desi.lbl.gov/desi/users/sjbailey/spectro/redux/skycte2/nightqa/20211222/nightqa-20211222.html Note that this branch was before the fiberflat humidity corrections, so there will be sframesky residuals. |
The petal n(z) PDF failed to generate for both of these; I was hoping to see that P1 improved to its post-CTE-fix level after applying this PR. Any chance that's an easy fix? |
And the first thing I see comparing the sframes from the nightly and prod sframe images is that the prod sframe image is visually much noisier. It fixes the offsets on P1, so the part that should work is working, but despite the sframe images claiming to have the same scale, there's a lot of extra noise. That's not expected? |
I will turn that notebook I made to compare the ampbkg results to the original into a general script that allows comparison between original and new reductions.
Cheers,
Ashley
From: Eddie Schlafly ***@***.***>
Date: Tuesday, January 11, 2022 at 12:53 PM
To: desihub/desispec ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [desihub/desispec] Fit offset per CCD sector as part of sky subtraction (PR #1571)
The petal n(z) PDF failed to generate for both of these; I was hoping to see that P1 improved to its post-CTE-fix level after applying this PR. Any chance that's an easy fix?
—
Reply to this email directly, view it on GitHub<#1571 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADLSM5XRGQN4N6DMWX7CGODUVRVAJANCNFSM5LLA6XKA>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
@schlafly I ran the missing zmtl files and updated the night qa pages so that they now have the per-petal n(z) plots. |
I think here again it requires using only the exact same data in the comparison. I do so using this script (which I think can be used pretty generally for comparisons going forward): https://github.com/desihub/LSS/blob/master/Sandbox/comp_newspecwdaily.py
I find that for LRGs, the success rate (using Rongpu's criteria) is exactly the same in all petals except for petal 1. In petal 1, it improves 1.4% (from 97.0 to 98.4, making it typical of the other petals).
I think we did indeed expect nothing to have changed at all except for in petal 1?
From: Eddie Schlafly ***@***.***>
Date: Tuesday, January 11, 2022 at 2:08 PM
To: desihub/desispec ***@***.***>
Cc: ashleyjross ***@***.***>, Comment ***@***.***>
Subject: Re: [desihub/desispec] Fit offset per CCD sector as part of sky subtraction (PR #1571)
Great. This makes clear that this branch fixes the r1 issue and repairs the redshift success rate.
[image]<https://user-images.githubusercontent.com/1417841/149005488-65a75ed3-0052-4887-8a06-eec1afb9e606.png>
[image]<https://user-images.githubusercontent.com/1417841/149005621-40f4dc75-6466-4845-9c95-b06b9ec52198.png>
(most prominent as dips in r1 redshift success rate on LRG, ELG, QSO targets, that go away in the new reduction)
However, the redshift success rate also drops by ~half a percent everywhere on all petals and all target classes, maybe due to the visibly increased noise in the sframe files, which I don't understand at all?
—
Reply to this email directly, view it on GitHub<#1571 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADLSM5XCWXI4KXP4D6BEHQDUVR54RANCNFSM5LLA6XKA>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Yes, good call. And yeah, if I actually blink the tileqa files with one another, they're identical except for P1, so that checks out. I don't understand why the sframe files look like they have pretty different noise levels, but maybe there's been some plotting change? |
Here's a plot of the results, using deltachi2 > 25 for ELGs (blue) and quasars (yellow) (but still using Rongpu's criteria for the LRGs in red).
[Chart, line chart Description automatically generated]
From: Eddie Schlafly ***@***.***>
Date: Tuesday, January 11, 2022 at 3:17 PM
To: desihub/desispec ***@***.***>
Cc: ashleyjross ***@***.***>, Comment ***@***.***>
Subject: Re: [desihub/desispec] Fit offset per CCD sector as part of sky subtraction (PR #1571)
Yes, good call. And yeah, if I actually blink the tileqa files with one another, they're identical except for P1, so that checks out. I don't understand why the sframe files look like they have pretty different noise levels, but maybe there's been some plotting change?
—
Reply to this email directly, view it on GitHub<#1571 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADLSM5QMRTR6G7DJIKPWSKLUVSF35ANCNFSM5LLA6XKA>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID: ***@***.***>
|
|
@schlafly I have plotted a few sframe spectra for the 2 prods and they are exactly the same for all cameras except for r1 of course where there is a tiny offset. So this change in the figure is due to the display not the data. And I don't know what was changed in the display. |
I agree it's weird. Though I notice that the sframesky-20211222.pdf file size is different for the two prods:
with the skycte2 one being "lighter" than the daily one (skycte has one page less, 10 instead of 11, but doesn t explain why it s ~twice lighter). looking at the file characteristics, I see that daily used |
Thanks for all the checks. This looks good as long as the corrections remain "opt-in" for specific fibers on specific date ranges. I'm not going to worry about the plotting grayscale differences. As Anand noted, this could arise from the different matplotlib version (old desiconda vs. new desiconda). |
Just to further confirm it likely is a display issue, I ran the script for one exposure with both prods, and the only visible change when flipping between the two pdf is for r1, as expected.
|
This PR adds an option to fit spectral offsets for fiber/wavelength corresponding to predefined CCD sectors as part of the sky subtraction. The idea is to use this tool to correct for the charge transfer issues that lead to a net offset in the spectral flux of some fibers and wavelength.
/global/cfs/cdirs/desi/users/jguy/teststand/desi_spectro_calib/spec/sm10/sm10-r.yaml
,--fit-offsets
todesi_compute_sky
desi_proc
Example:
to be compared with the same plot using the daily prod