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-43033: Add fgcmcal configurations for ComCamSim ops rehearsal data #509

Merged
merged 5 commits into from
Mar 6, 2024
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
33 changes: 33 additions & 0 deletions config/comCamSim/fgcmBuildFromIsolatedStars.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os

physical_to_band = {
"g_01": "g",
"r_03": "r",
"i_06": "i",
}

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

config.coarseNside = 64

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

configDir = os.path.join(os.path.dirname(__file__))
config.physicalFilterMap = physical_to_band
config.doSubtractLocalBackground = True
config.sourceSelector["science"].flags.bad.append("localBackground_flag")
config.fgcmLoadReferenceCatalog.filterMap = {
"g": "lsst_g",
"r": "lsst_r",
"i": "lsst_i",
"g_01": "lsst_g",
"r_03": "lsst_r",
"i_06": "lsst_i",
}
config.fgcmLoadReferenceCatalog.applyColorTerms = False
config.fgcmLoadReferenceCatalog.referenceSelector.doSignalToNoise = True
config.fgcmLoadReferenceCatalog.referenceSelector.signalToNoise.fluxField = "lsst_i_flux"
config.fgcmLoadReferenceCatalog.referenceSelector.signalToNoise.errField = "lsst_i_fluxErr"
config.fgcmLoadReferenceCatalog.referenceSelector.signalToNoise.minimum = 50.0
107 changes: 107 additions & 0 deletions config/comCamSim/fgcmFitCycle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import lsst.fgcmcal as fgcmcal

physical_to_band = {
"g_01": "g",
"r_03": "r",
"i_06": "i",
}

config.outfileBase = "fgcmComCamSimCalibrations"
# The comcamsim survey uses g, r, i bands.
config.bands = ["g", "r", "i"]
config.fitBands = ["g", "r", "i"]
config.physicalFilterMap = physical_to_band
config.requiredBands = ["g", "r", "i"]

config.cycleNumber = 0
config.maxIterBeforeFinalCycle = 50
config.minCcdPerExp = 1
config.utBoundary = 0.0
config.washMjds = (0.0, )
# For now, define 1 observing epoch that encompasses everything.
config.epochMjds = (0.0, 100000.0)
config.coatingMjds = []
config.latitude = -30.2333
config.mirrorArea = 34.524
config.defaultCameraOrientation = 0.0
config.expGrayPhotometricCutDict = {"g": -0.05, "r": -0.05, "i": -0.05}
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.}
config.autoPhotometricCutNSig = 3.0
config.autoHighCutNSig = 3.0
# Fit aperture corrections with only 2 bins to exercise the code.
config.aperCorrFitNBins = 10
config.aperCorrInputSlopeDict = {"g": 0.0,
"r": 0.0,
"i": 0.0}

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.5, 1.5",)
# Use a tiny fraction of reference stars to test true self-calibration.
config.refStarMaxFracUse = 0.001
config.useExposureReferenceOffset = False
config.precomputeSuperStarInitialCycle = False
config.superStarSubCcdDict = {"g": True,
"r": True,
"i": True}
# Allow calibration to work with at least 10 exposures per night.
config.minExpPerNight = 10
# Allow calibration to work with very few stars per exposure.
config.minStarPerExp = 100
config.nStarPerRun = 5000
config.nExpPerRun = 100
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": True,
"r": True,
"i": True}
config.ccdGrayFocalPlaneFitMinCcd = 3
config.ccdGrayFocalPlaneChebyshevOrder = 2
config.modelMagErrors = True
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be False, based on the comment above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or the comment is copied from a test config where we don't have much coverage. Will fix comment.

# 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.05,
"r": 0.05,
"i": 0.05}
config.approxThroughputDict = {"g": 1.0,
"r": 1.0,
"i": 1.0}

config.deltaAperFitPerCcdNx = 16
config.deltaAperFitPerCcdNy = 16
config.doComputeDeltaAperPerVisit = False
config.doComputeDeltaAperMap = True
config.doComputeDeltaAperPerCcd = True
config.deltaAperInnerRadiusArcsec = 2.40
config.deltaAperOuterRadiusArcsec = 3.40
9 changes: 9 additions & 0 deletions config/comCamSim/fgcmMakeLut.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# List of filters to put into the look-up table (LUT)
config.physicalFilters = [
"g_01",
"r_03",
"i_06",
]

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

physical_to_band = {
"g_01": "g",
"r_03": "r",
"i_06": "i",
}

config.physicalFilterMap = physical_to_band
1 change: 0 additions & 1 deletion config/latiss/fgcmFitCycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
config.physicalFilterMap = LATISS_FILTER_DEFINITIONS.physical_to_band
config.requiredBands = ["g", "r", "i"]

config.nCore = 4
config.cycleNumber = 0
config.maxIterBeforeFinalCycle = 100
config.minCcdPerExp = 1
Expand Down