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-40555: Add configurations for running fgcmcal on LATISS photometric data #471

Merged
merged 4 commits into from
Sep 21, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions config/latiss/fgcmBuildFromIsolatedStars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
from lsst.obs.lsst.filters import LATISS_FILTER_DEFINITIONS


config.requiredBands = []
config.primaryBands = ["i", "r", "g", "z", "y"]

config.coarseNside = 64

config.minPerBand = 2
config.connections.ref_cat = "atlas_refcat2_20220201"

config.instFluxField="apFlux_35_0_instFlux"
config.sourceSelector["science"].signalToNoise.fluxField="apFlux_35_0_instFlux"

config.sourceSelector["science"].signalToNoise.errField="apFlux_35_0_instFluxErr"

config.apertureInnerInstFluxField="apFlux_35_0_instFlux"
config.apertureOuterInstFluxField="apFlux_50_0_instFlux"

configDir = os.path.join(os.path.dirname(__file__))
config.physicalFilterMap = LATISS_FILTER_DEFINITIONS.physical_to_band
config.doSubtractLocalBackground = True
config.sourceSelector["science"].flags.bad.append("localBackground_flag")
config.fgcmLoadReferenceCatalog.load(os.path.join(configDir, "filterMap.py"))
config.fgcmLoadReferenceCatalog.applyColorTerms = True
config.fgcmLoadReferenceCatalog.colorterms.load(os.path.join(configDir, 'colorterms.py'))
config.fgcmLoadReferenceCatalog.referenceSelector.doSignalToNoise = True
config.fgcmLoadReferenceCatalog.referenceSelector.signalToNoise.fluxField = "i_flux"
config.fgcmLoadReferenceCatalog.referenceSelector.signalToNoise.errField = "i_fluxErr"
config.fgcmLoadReferenceCatalog.referenceSelector.signalToNoise.minimum = 50.0
109 changes: 109 additions & 0 deletions config/latiss/fgcmFitCycle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import lsst.fgcmcal as fgcmcal


config.outfileBase = "FgcmLatissCalibrations"
# The default photometric survey so far uses g, r, i bands.
config.bands = ["g", "r", "i"]
config.fitBands = ["g", "r", "i"]
from lsst.obs.lsst.filters import LATISS_FILTER_DEFINITIONS
config.physicalFilterMap = LATISS_FILTER_DEFINITIONS.physical_to_band
config.requiredBands = ["g", "r", "i"]

config.nCore = 4
config.cycleNumber = 0
config.maxIterBeforeFinalCycle = 100
config.utBoundary = 0.0
config.washMjds = (0.0, )
# For tests, define 1 observing epoch that encompasses everything.
config.epochMjds = (0.0, 100000.0)
config.coatingMjds = []
config.latitude = -30.2333
# This is pi*(1.2/2.)**2.
config.mirrorArea = 1.13097
config.defaultCameraOrientation = 0.0
config.brightObsGrayMax = 0.5
config.expGrayInitialCut = -0.5
config.expGrayPhotometricCutDict = {"g": -0.5, "r": -0.5, "i": -0.5}
config.expGrayHighCutDict = {"g": 0.2, "r": 0.2, "i": 0.2}
config.expVarGrayPhotometricCutDict = {"g": 0.1**2.,
"r": 0.1**2.,
"i": 0.1**2.}
# For tests, make a broad cut for outliers.
config.autoPhotometricCutNSig = 3.0
config.autoHighCutNSig = 3.0
# Fit aperture corrections with only 2 bins to exercise the code.
config.aperCorrFitNBins = 0
config.aperCorrInputSlopeDict = {"g": 0.0,
"r": 0.0,
"i": 0.0}
# Define the band to SED constants approximately so they work
# for data that only has r, i observations.
config.sedboundaryterms = fgcmcal.SedboundarytermDict()
config.sedboundaryterms.data["gr"] = fgcmcal.Sedboundaryterm(primary="g",
secondary="r")
config.sedboundaryterms.data["ri"] = fgcmcal.Sedboundaryterm(primary="r",
secondary="i")
config.sedterms = fgcmcal.SedtermDict()
config.sedterms.data = {
"g": fgcmcal.Sedterm(primaryTerm="gr", secondaryTerm="ri", constant=1.5),
"r": fgcmcal.Sedterm(primaryTerm="gr", secondaryTerm="ri", constant=0.9),
"i": fgcmcal.Sedterm(primaryTerm="ri", secondaryTerm="gr", constant=0.5,
extrapolated=True, primaryBand="i", secondaryBand="r", tertiaryBand="g"),
}

# Define good stars with an r-i color cut.
config.starColorCuts = ("g, i, 0.50, 3.5",)
config.refStarColorCuts = ("g, i, 0.6, 1.1",)
config.useExposureReferenceOffset = True
config.precomputeSuperStarInitialCycle = False
config.superStarSubCcdDict = {"g": True,
"r": True,
"i": True}
config.superStarPlotCcdResiduals = False
# Allow calibration to work with just 1 exposure on a night.
config.minExpPerNight = 10
# Allow calibration to work with very few stars per exposure.
config.minStarPerExp = 5
# Allow calibration to work with small number of stars in processing batches.
config.nStarPerRun = 500
config.nExpPerRun = 100
# Define r-i color as the primary way to split by color.
config.colorSplitBands = ["g", "i"]
config.freezeStdAtmosphere = True
# For tests, do low-order per-ccd polynomial.
config.superStarSubCcdChebyshevOrder = 2
config.ccdGraySubCcdDict = {"g": True,
"r": True,
"i": True}
config.ccdGrayFocalPlaneDict = {"g": False,
"r": False,
"i": False}
config.ccdGrayFocalPlaneFitMinCcd = 1
config.ccdGrayFocalPlaneChebyshevOrder = 1
# Do not model the magnitude errors (use errors as reported).
config.modelMagErrors = True
# Fix the sigma_cal calibration noise to 0.003 mag.
config.sigmaCalRange = (0.003, 0.003)
# Do not fit instrumental parameters (mirror decay) per band.
config.instrumentParsPerBand = False
# Set the random seed for repeatability in fits.
config.randomSeed = 12345
# Do not use star repeatability metrics for selecting exposures.
# (Instead, use exposure repeatability metrics).
config.useRepeatabilityForExpGrayCutsDict = {"g": False,
"r": False,
"i": False}
config.sigFgcmMaxEGrayDict = {"g": 0.1,
"r": 0.1,
"i": 0.1}
config.approxThroughputDict = {"g": 1.0,
"r": 1.0,
"i": 1.0}

config.deltaAperFitPerCcdNx = 2
config.deltaAperFitPerCcdNy = 2
config.deltaAperInnerRadiusArcsec = 3.3493
config.deltaAperOuterRadiusArcsec = 4.78475
config.doComputeDeltaAperPerVisit = False
config.doComputeDeltaAperMap = False
config.doComputeDeltaAperPerCcd = False
11 changes: 11 additions & 0 deletions config/latiss/fgcmMakeLut.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# List of filters to put into the look-up table (LUT)
config.physicalFilters = [
"SDSSg_65mm~empty",
"SDSSr_65mm~empty",
"SDSSi_65mm~empty",
"SDSSz_65mm~empty",
"SDSSy_65mm~empty",
]

# FGCM name or filename of precomputed atmospheres
config.atmosphereTableName = 'fgcm_atm_lsst2'
4 changes: 4 additions & 0 deletions config/latiss/fgcmOutputProducts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config.connections.cycleNumber = 6

from lsst.obs.lsst.filters import LATISS_FILTER_DEFINITIONS
config.physicalFilterMap = LATISS_FILTER_DEFINITIONS.physical_to_band