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

DM-42828: Add camera team crosstalk nonlinearity results #523

Merged
merged 6 commits into from
Apr 29, 2024

Conversation

plazas
Copy link
Contributor

@plazas plazas commented Apr 12, 2024

No description provided.

@plazas plazas requested a review from czwa April 12, 2024 18:52
Copy link
Contributor

@czwa czwa left a comment

Choose a reason for hiding this comment

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

I think the coeffValid comment is the only thing that needs to be fixed. Do you have an idea of how large/how difficult it would be to shift the things being retrieved from butler into source files in the _data package would be? I would prefer they be there, so this script is portable (and safe against someone accidentally overwriting the collections).


# PTC in butler query-collections /sdf/group/rubin/repo/main
# u/snyder18/*crosstalk_analysis*
butlerPtc = Butler(repo, collections="u/lsstccs/ptc_13144_w_2023_22/20230607T013806Z")
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this is the collection Adam used while making his measurements, but it would be good to have a comment about that, as this is a different run than the two listed below.


for i, ref in enumerate(data_refs):
crosstalk_results = butler.get(ref)
for j in range(nAmp):
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this_ct_result = crosstalk_results[det_name][det_name] so the assignments below can avoid needing to break the keys up over multiple lines?

from lsst.ip.isr import CrosstalkCalib
import lsst.utils

repo = "/sdf/group/rubin/repo/main"
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be safer if the files were dumped from butler into the obs_lsst_data package, so this isn't location specific.

Copy link
Contributor

Choose a reason for hiding this comment

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

Commenting here that I'm not worried about this anymore.

c0_matrix[k, j, i] = 0.0
c1_matrix[k, j, i] = 0.0
continue
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this fail that we need a try/except block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From Adam: "when we take the images there are only a subset that have actual crosstalk measurements (since we need to readout at least a REB worth of images). So when I run the analysis there are some empty crosstalk datasets where there was no source detected for that specific amp pair."

if j == k:
c0_matrix[k, j, i] = 0.0
c1_matrix[k, j, i] = 0.0
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know that it's essential, but these should set the coeffValid entry to False. If we had made these calibrations with cp_pipe, they would be set that way (as a coefficient of zero should be smaller than its error), and it's good to be consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the diagonal coefficients (same amp), do we currently set them as invalid?

Copy link
Contributor

Choose a reason for hiding this comment

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

@plazas
Copy link
Contributor Author

plazas commented Apr 17, 2024

I think the coeffValid comment is the only thing that needs to be fixed. Do you have an idea of how large/how difficult it would be to shift the things being retrieved from butler into source files in the _data package would be? I would prefer they be there, so this script is portable (and safe against someone accidentally overwriting the collections).

@czwa I can do this. Do you want two scripts?: one to get the coefficients from Butler and then put them in fits files, and then another one to read those fits files and save them as ecvs? Or do you want this single script to keep doing what it's doing, but saving the coeffs in fits files after being retrieved from the Butler?

@timj
Copy link
Member

timj commented Apr 17, 2024

The standard approach is to create the ECSV files and store them in obs_lsst_data and then they become standard curated calibrations that can be loaded into any butler. The usual thing is that the ECSV files are read and then butler.put turns them into FITS to let them be read as fast as possible, but the files are small enough that storing them as text in git makes it easier.

@plazas
Copy link
Contributor Author

plazas commented Apr 17, 2024

The standard approach is to create the ECSV files and store them in obs_lsst_data and then they become standard curated calibrations that can be loaded into any butler. The usual thing is that the ECSV files are read and then butler.put turns them into FITS to let them be read as fast as possible, but the files are small enough that storing them as text in git makes it easier.

Thanks. This script is already getting the coefficients from the Butler and saving them as ecsv files in obs_lsst_data (there's another PR in there with this same ticket number). Is that sufficient in this case for this ticket, or should the butler.put step to turn them into fits files also be implemented?

@timj
Copy link
Member

timj commented Apr 17, 2024

If this is a standard IsrCalib class (which it should be) then it should already be storing as FITS in the butler when it's read from obs_lsst_data.

run_num = 13199

# Crosstalk from A. Snyder (UCDavis, 2024)
collections = "u/snyder18/{0}/crosstalk_analysis".format(run_num)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'm fine with leaving the source data in butler, as long as this is changed to explicitly point at the RUN collection (with the full date string at the end, as is done with the PTC collection).

@czwa
Copy link
Contributor

czwa commented Apr 17, 2024

My concern was that the source data would be lost, leaving us no way to regenerate these files if needed. I think ensuring that the script uses the RUN collection instead of the CHAINED collection ensures that we can find things. A lot of the other curated calibrations have no clear provenance, so I've pushed for the sources of those products to be included in the _data package. I think we're safer with things in Butler.

@timj
Copy link
Member

timj commented Apr 17, 2024

So long as write-curated-calibrations is using obs_lsst_data and not trying to find a specific butler that's fine. I assume there is a readme in obs_lsst_data that says where the data came from. ie the scripts that created the ECSV files from butler are part of the provenance but not something used regularly.

@czwa
Copy link
Contributor

czwa commented Apr 17, 2024

So long as write-curated-calibrations is using obs_lsst_data and not trying to find a specific butler that's fine. I assume there is a readme in obs_lsst_data that says where the data came from. ie the scripts that created the ECSV files from butler are part of the provenance but not something used regularly.

Yes, write-curated-calibrations is doing the standard thing (pull from obs_lsst_data, and write to the target butler). My concern was prompted by things like the transmission curves being based on an xls spreadsheet (where that one file and some email quotes are the only provenance we have). Pointing at the butler RUN collections should be stable and reproducible, so I think my concerns were inflated.

from lsst.ip.isr import CrosstalkCalib
import lsst.utils

repo = "/sdf/group/rubin/repo/main"
Copy link
Contributor

Choose a reason for hiding this comment

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

Commenting here that I'm not worried about this anymore.

@plazas plazas merged commit 5a4ba4b into main Apr 29, 2024
3 checks passed
@plazas plazas deleted the tickets/DM-42828 branch April 29, 2024 18:00
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

3 participants