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-40556: Add LATISS color terms and turn on by default in initial calibration. #470

Merged
merged 4 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions config/latiss/calibrate.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import os.path

from lsst.meas.astrom import FitAffineWcsTask
from lsst.meas.algorithms import ColorLimit

ObsConfigDir = os.path.dirname(__file__)

# Configure the photometry to use atlas_refcat2.
config.connections.photoRefCat = 'atlas_refcat2_20220201'
config.connections.photoRefCat = "atlas_refcat2_20220201"
config.photoRefObjLoader.load(os.path.join(ObsConfigDir, "filterMap.py"))

config.photoCal.match.referenceSelection.magLimit.fluxField = "r_flux"
colors = config.photoCal.match.referenceSelection.colorLimits
colors["g-r"] = ColorLimit(primary="g_flux", secondary="r_flux", minimum=0.4, maximum=2.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the fit is pretty sparse at g-r of 2 should the max be 1.4? (I dont feel strongly about this)

Also, do we need an r-i color limit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's sparse, but the color term is defined there and I don't want to get too thin on the ground or else some rapid processing might have trouble.
As for r-i, I went back and forth on this in my mind; I think that the g-r color range will make sure these are all well-behaved stars, but I guess we might need the other cut to make sure they don't have 🤪 i-band observations. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, I am in favor of rapid processing working.

I think it would be best if when calibrating r/i band data we reject stars beyond the range where that color term is defined but I imagine this will not effect latiss calibrations too much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The challenge is that we don't have the ability to do per-band configs. So it's all or nothing. 😬 I'm going to leave it like this; these aren't the most critical cuts (and there's outlier rejection anyway), and the "real" calibration with fgcmcal will be put into the pipeline very soon.


config.photoCal.applyColorTerms = True
config.photoCal.photoCatName="atlas_refcat2_20220201"
config.photoCal.colorterms.load(os.path.join(ObsConfigDir, "colorterms.py"))

# We often have very few sources due to smaller aperture so use affine task.
# We often have very few sources due to smaller aperture so use affine task.
config.astrometry.wcsFitter.retarget(FitAffineWcsTask)

# Note that the following two config values were validated on data taken in
Expand Down
37 changes: 37 additions & 0 deletions config/latiss/colorterms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from lsst.pipe.tasks.colorterms import Colorterm, ColortermDict


config.data = {
"atlas_refcat2*": ColortermDict(data={
"SDSSg_65mm~empty": Colorterm(
primary="g",
secondary="r",
c0=-0.09034144345111599,
c1=0.1710923238086337,
c2=-0.038260355621929296,
),
"SDSSr_65mm~empty": Colorterm(
primary="r",
secondary="i",
c0=0.0073632488906825045,
c1=-0.026620900037027242,
c2=-0.03203533692013322,
),
"SDSSi_65mm~empty": Colorterm(
primary="i",
secondary="r",
c0=0.016940180565664747,
c1=0.0610018330811135,
c2=-0.0722575356707918,
),
# The following two are blank until we have data to measure them.
"SDSSz_65mm~empty": Colorterm(
primary="z",
secondary="z",
),
"SDSSy_65mm~empty": Colorterm(
primary="y",
secondary="y",
),
}),
}
12 changes: 12 additions & 0 deletions config/latiss/filterMap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Mapping of camera filter name: reference catalog filter name
# This file is appropriate for ATLAS Refcat2.

for source, target in [
("SDSSg_65mm~empty", "g"),
("SDSSr_65mm~empty", "r"),
("SDSSi_65mm~empty", "i"),
("SDSSz_65mm~empty", "z"),
# ATLAS Refcat2 does not have y band.
("SDSSy_65mm~empty", "z"),
]:
config.filterMap[source] = target