Skip to content

Commit

Permalink
Add script to put LATISS crosstalk matrix in obs_lsst_data.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Oct 7, 2024
1 parent d83ce7a commit 97e1bf7
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions python/lsst/obs/lsst/script/write_latiss_crosstalk_coeffs.py
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)

0 comments on commit 97e1bf7

Please sign in to comment.