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

handle missing cframe in tsnr2 summing #1665

Merged
merged 1 commit into from Feb 8, 2022
Merged

handle missing cframe in tsnr2 summing #1665

merged 1 commit into from Feb 8, 2022

Conversation

araichoor
Copy link
Contributor

This PR is a simple suggested fix for issue #1664.
I let @julienguy review.

My understanding is that for each fiber of a given petal, we get the TSNR2 with summing the values over the three cameras, i.e.: TSNR2 = TSNR2_ELG_B+TSNR2_ELG_R+TSNR2_ELG_Z (using ELG here)

tsnr2_for_efftime_vals = np.zeros(entries.size)
for band in ["B","R","Z"] :
camera="{}{}".format(band.lower(),spectro)
cframe_filename=findfile('cframe',night,expid,camera,specprod_dir=specprod_dir)
scores = fitsio.read(cframe_filename,"SCORES")
tsnr2_for_efftime_vals += scores[tsnr2_for_efftime_key+"_"+band]
target_type=tsnr2_for_efftime_key.split("_")[1].upper()
efftime = tsnr2_to_efftime(tsnr2_for_efftime_vals,target_type)

(entries are the 500 indexes of the fibers for the considered petal).

This fix will just ignore a camera if the cframe file is missing.
In the issue case (z-camera missing for petal=7), we will have for petal=7: TSNR2 = TSNR2_ELG_B+TSNR2_ELG_R, and this will result in a lower efftime:

>>> d = Table.read("/global/cfs/cdirs/desi/users/raichoor/tmpdir/exposures/20210406/00083716/exposure-qa-00083716.fits","FIBERQA")
>>> for p in range(10): print("{}\t{:.0f}s".format(p, d["EFFTIME_SPEC"][d["PETAL_LOC"] == p].mean()))
... 
0	698s
1	790s
2	839s
3	690s
4	855s
5	707s
6	963s
7	148s
8	663s
9	723s

Is that what we want?

@julienguy
Copy link
Contributor

yes, thanks. I am merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants