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

Effective exposure times of backup program #2370

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

segasai
Copy link
Contributor

@segasai segasai commented Sep 11, 2024

Following recent discussion on slack @schlafly

This is a PR (in development) addressing some issues with the effective exposure times of backup program

At the moment that just does removes the dust extinction correction when computing the tsnr2 for gbbackup/backup tracers.

I would appreciate here any suggestions on the easiest way to test the effect of changes of tsnr.py on individual exposures without running the full pipeline. That would help understand the effect of changes.

@weaverba137
Copy link
Member

I recommend taking another look at PR #1815 as part of this.

@segasai
Copy link
Contributor Author

segasai commented Sep 11, 2024

Yes, I thanks, I was aware of the other PR, but since it was a one-liner PR (like this one ATM), I decided to open a separate one. But I agree this should supersede #1815.

Following up on specific 1815 discussions

From my understanding when we update the nominal flux we need to rerun the:
https://github.com/desihub/desispec/blob/37e454d8ace16b6337a04bac8b8e58ed2646496d/py/desispec/scripts/calibrate_tsnr_ensemble.py

(i.e. #1274 and
https://desi.lbl.gov/svn/code/desimodel/trunk/data/tsnr/README
)

@araichoor
Copy link
Contributor

I ve to carefully read the -- long and rich! -- slack thread about that, so sorry if I m adding noise here.

but from what I understood from skimming it, the goal is to have the backup tiles observed to a given efftime_spec, with discarding the ebv factor, right?

if so, I kind of feel that it may be better to tackle that at the per-{exposure,tile} information, rather than at the per-fiber, no?
i.e. to remove the ebv factor in the per-{exposure,tile} efftime_spec for backup tile.
also, changing it at the per-spectrum level will create a change for mainbackup fibers only after this pr, which could make people using the data tripped on that; changing it at the per-tile level is much less "risky" I feel, as it would mostly affect operations only - and some tile selection based on efftime_spec.

one would have to double-check, but I think that the offline efftime_spec info used by nts is the per-tile one.
this per-tile info comes from the tile_qa.py script, here I think:

# tile EFFTIME is median of efftime of fibers that are good in all exposures
always_good_fibers = ((or_qafiberstatus&bad_fibers_mask)==0)
if np.any(always_good_fibers):
tile_efftime = np.median(tile_fiberqa_table["EFFTIME_SPEC"][always_good_fibers])
else:
tile_efftime = 0.0

and it is a combination of the information in per-exposure level:

# fiber EFFTIME is only counted for good data (per exposure and fiber)
tile_fiberqa_table["EFFTIME_SPEC"]=np.zeros(targetids.size,dtype=exposure_fiberqa_tables["EFFTIME_SPEC"].dtype)
for i,tid in enumerate(targetids) :
jj = (exposure_fiberqa_tables["TARGETID"]==tid)
tile_fiberqa_table["EFFTIME_SPEC"][i] = np.sum(exposure_fiberqa_tables['EFFTIME_SPEC'][jj]*((exposure_fiberqa_tables['QAFIBERSTATUS'][jj]&bad_fibers_mask)==0))

the script for the per-exposure if exposure_qa.py.

what I suggest would be to add few lines in tile_qa.py - and possibly the same in exposure_qa.py, after the per-{exposure,tile} computation, saying "if (main?) backup tile, then remove (or add?) the ebv factor".

would that make sense?

@segasai
Copy link
Contributor Author

segasai commented Sep 11, 2024

Thanks for the comment @araichoor !
One of the goals is indeed to remove the ebv factor, but another is to make sure that the TSNR2 are computed for brighter 'templates'. (there could be other things there as well, as I may not have a full understanding of the issue)

I personally don't have an opinion on 'riskiness' of the change as I am less familiar with operational side of things. From user standpoint, it obviously would be good if the TSNR2/EFFTIMEs for individual fibers were consistent with what is done when planning the observations, but maybe that's not really achievable, given that we are potentially planning to make the change in the calculation of those for backup, so there will be always inconsistency for past vs new observations.

@deisenstein
Copy link

deisenstein commented Sep 11, 2024 via email

@schlafly
Copy link
Contributor

I'm really embarrassed that I don't know what gpbbackup is. When do we set that? I'm not aware of any gpbbackup tiles in the tiles file. Reflecting a little more, maybe that's "GFA pass band" and is used for the offline EFFTIME estimates that are most turned to match what we get from the GFAs (i.e., for checking the results from the exposure time calculator).

I think @sbailey or @akremin would be the best references on how to rerun the tsnr code for a handful of files to see what things look like.

I think I would be in favor of changing it at the per-fiber level, and keeping the tile derived quantities as medians of the fiber derived quantities. The biggest issue with that approach would be that we would have some cases where the same target is observed in the backup and bright tiles, and has apparently lower EFFTIME in the bright tile and higher EFFTIME in the backup tile, but only because the EFFTIMEs mean something different. But I think that's okay because we are explicitly saying we want the EFFTIMEs to mean something different in these cases!

I also think that you don't need to make "brighter templates"---IIRC the templates just care about the wavelength dependence and not the magnitude---and instead the earlier PR should be doing enough there, albeit after the calibration from TSNR2 to EFFTIME is changed.

After we merge something like this we will definitely have a time in daily when past backup EFFTIMEs mean something different from new backup EFFTIMEs. We could consider updating the past backup EFFTIMEs, or just move forward and update them as part of the next DR.

Daniel, I think I agree with everything you say, but I think all of the machinery is there to support what you want, and it's just a matter of picking the right source flux in the EFFTIME calculation---e.g., 18th mag, or 16th. I agree with you that this ends up being a trade with respect to how much effective time we get for the faint vs. the bright stars in different conditions, and that we just have to accept that there will be a trade there.

I also agree that in principle we could ~give up on the ETC and just accept that it will observe each backup tile to ~600 s and then get the EFFTIMEs right only in the offline pipeline. It would be better to keep both in sync, though.

@schlafly
Copy link
Contributor

@julienguy thinks that it should be straightforward to generate TSNR2s for representative data; pinging him here. He also knows about the TSNR2 <-> EFFTIME calibration.

@deisenstein
Copy link

deisenstein commented Sep 20, 2024 via email

@deisenstein
Copy link

Adding the figures here:

Here are the G=16 figs:

Backup_snr16_exptime.pdf

Backup_snr16_hist.pdf

Comparison to G=17.75

Backup_snr16_snr18.pdf

Here are the G=17.75 figs:

Backup_snr18_exptime.pdf

Backup_snr18_hist.pdf

Here is G=17.75 for the cases where we have only one exposure

Backup_snr18_exptime_nexp1.pdf

Backup_snr18_hist_nexp1.pdf

And here's the Bright data at G=18.75.

Bright_snr19_hist.pdf

@deisenstein
Copy link

Trying again, sorry:

G=16 plots:

Backup_snr16_exptime

Backup_snr16_hist

G=17.75 plots:

Backup_snr18_exptime

Backup_snr18_hist

Comparison of the two:

Backup_snr16_snr18

G=17.75, limited to tiles with only one exposure/visit:

Backup_snr18_hist_nexp1

Backup_snr18_exptime_nexp1

MWS G=18.75:

Bright_snr19_hist

@segasai
Copy link
Contributor Author

segasai commented Sep 20, 2024

Thank you Daniel!

Just a followup/extension from what you've done. I've taken first exposure (cframe) of backup tiles that are repeated vs are considered done after first exposure.
Here's how the SN(R) depends on magnitude for both:

image

The notebook used to produce the plots is on NERSC here:
https://data.desi.lbl.gov/desi/users/koposov/backup_investigation/

From my point of view if we require something equivalent ot SN(R) = 5-7 at G=18, that will significantly reduce the number of required repeats, while still being scientifically useful.

@deisenstein
Copy link

deisenstein commented Sep 20, 2024 via email

@segasai
Copy link
Contributor Author

segasai commented Sep 20, 2024

Looking at specifically very first exposure of the night.

image

It seems that when they are marked for repeats they are typically significantly worse than usual:

Overall given the tight sequence for the tiles requiring just one exposure and the fact that exposures on tiles requiring repeats always are below in the SNR vs mag space tells me that we maybe can really just adjust the GOALTIME for backup, and this will fix the original problem.

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.

5 participants