-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to put LATISS crosstalk matrix in obs_lsst_data.
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
python/lsst/obs/lsst/script/write_latiss_crosstalk_coeffs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# This file is part of obs_lsst. | ||
# | ||
# Developed for the LSST Data Management System. | ||
# This product includes software developed by the LSST Project | ||
# (https://www.lsst.org). | ||
# See the COPYRIGHT file at the top-level directory of this distribution | ||
# for details of code ownership. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
import re | ||
import os | ||
import dateutil.parser | ||
from lsst.daf.butler import Butler | ||
import lsst.utils | ||
|
||
|
||
crosstalk_run = "u/czw/DM-37819/crosstalkGen.20230601a/20230601T201929Z" | ||
|
||
butler = Butler("/repo/embargo") | ||
|
||
camera = butler.get("camera", instrument="LATISS", collections=["LATISS/calib"]) | ||
crosstalk = butler.get("crosstalk", instrument="LATISS", detector=0, collections=[crosstalk_run]) | ||
|
||
det = camera[0] | ||
name = det.getName() | ||
|
||
# Make this valid for all time. | ||
valid_start = "1970-01-01T00:00:00" | ||
valid_date = dateutil.parser.parse(valid_start) | ||
datestr = "".join(re.split(r"[:-]", valid_date.isoformat())) | ||
directory = lsst.utils.getPackageDir("obs_lsst_data") | ||
out_path = os.path.join(directory, "latiss", "crosstalk", name.lower()) | ||
os.makedirs(out_path, exist_ok=True) | ||
out_file = os.path.join(out_path, datestr + ".ecsv") | ||
|
||
crosstalk.updateMetadata( | ||
camera=camera, | ||
detector=det, | ||
setCalibId=True, | ||
setCalibInfo=True, | ||
CALIBDATE=valid_start, | ||
) | ||
|
||
crosstalk.writeText(out_file) |