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-39592: Add support for Auxtel/LATISS and add associated tests. #112

Merged
merged 15 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
34 changes: 34 additions & 0 deletions tests/config/fgcmBuildFromIsolatedStarsLatiss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os
from lsst.obs.lsst.filters import LATISS_FILTER_DEFINITIONS

# The filterMap and bands are for the small subset of bands used in the tests
config.physicalFilterMap = {
'SDSSg_65mm~empty': 'g',
'SDSSr_65mm~empty': 'r',
'SDSSi_65mm~empty': 'i',
}
config.requiredBands = ['g', 'r']
config.primaryBands = ['r']
# The coarseNside is set appropriate to the area of the test data
config.coarseNside = 64
# The tests are done with only the brightest reference stars
config.fgcmLoadReferenceCatalog.referenceSelector.signalToNoise.minimum = 50.0

config.instFluxField = 'apFlux_35_0_instFlux'
config.apertureInnerInstFluxField = 'apFlux_35_0_instFlux'
config.apertureOuterInstFluxField = 'apFlux_50_0_instFlux'

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

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.sourceSelector["science"].signalToNoise.fluxField = "apFlux_35_0_instFlux"
config.sourceSelector["science"].signalToNoise.errField = "apFlux_35_0_instFluxErr"
config.fgcmLoadReferenceCatalog.load(os.path.join(configDir, 'filterMapLatiss.py'))
config.fgcmLoadReferenceCatalog.applyColorTerms = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be set to True as of DM-40556?

config.fgcmLoadReferenceCatalog.referenceSelector.doSignalToNoise = True
config.fgcmLoadReferenceCatalog.referenceSelector.signalToNoise.fluxField = 'i_flux'
config.fgcmLoadReferenceCatalog.referenceSelector.signalToNoise.errField = 'i_fluxErr'
Copy link
Contributor

Choose a reason for hiding this comment

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

New file...mixes single/double quotes.

Also, just checking if you still want this to be i?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the selection on the reference catalog, and it's what we use in the regular data for the ATLAS Refcat2, so I think that the answer is yes.

108 changes: 108 additions & 0 deletions tests/config/fgcmFitCycleLatiss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import lsst.fgcmcal as fgcmcal

config.outfileBase = 'TestFgcm'
# Use these bands and fit them.
# g band does not have any observations in tests, this ensures
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this true?

# that the code performs properly when there are missing 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
# Only require r, i observations for a star to be a calibration star.
Copy link
Contributor

Choose a reason for hiding this comment

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

"r, i" -> "g, r"?

config.requiredBands = ['g', 'r']
# Do 5 iterations in multi-cycle run mode.
config.maxIterBeforeFinalCycle = 5
config.nCore = 1
config.cycleNumber = 0
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 = []
Copy link
Contributor

Choose a reason for hiding this comment

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

Hhmmm...how does this differ from the default of default=(0.0,)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You really want to define the start and end points, and it logs a warning if you don't; I have the default be something that should be overridden.

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 = 5.0
config.autoHighCutNSig = 5.0
# Fit aperture corrections with only 2 bins to exercise the code.
config.aperCorrFitNBins = 2
config.aperCorrInputSlopeDict = {'g': -1.0,
'r': -1.0,
'i': -1.0}
# Define the band to SED constants approximately so they work
# for data that only has r, i observations.
Copy link
Contributor

Choose a reason for hiding this comment

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

"r, i" -> "g, r"?

config.sedboundaryterms = fgcmcal.SedboundarytermDict()
config.sedboundaryterms.data['gr'] = fgcmcal.Sedboundaryterm(primary='g',
secondary='r')
config.sedterms = fgcmcal.SedtermDict()
config.sedterms.data['g'] = fgcmcal.Sedterm(primaryTerm='gr', secondaryTerm=None,
extrapolated=False, constant=0.0)
config.sedterms.data['r'] = fgcmcal.Sedterm(primaryTerm='gr', secondaryTerm=None,
extrapolated=False, constant=1.0)
config.sedterms.data['i'] = fgcmcal.Sedterm(primaryTerm='gr', secondaryTerm=None,
extrapolated=False, constant=0.75)
# Define good stars with an r-i color cut.
config.starColorCuts = ('g,r,-0.50,2.25',)
Copy link
Contributor

Choose a reason for hiding this comment

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

Spaces after commas (as below).

I see g and r (no i)...

config.refStarColorCuts = ('g, r, -0.50, 2.25',)
config.useExposureReferenceOffset = True
config.precomputeSuperStarInitialCycle = False
config.superStarSubCcdDict = {'g': True,
'r': True,
'i': True}
config.superStarPlotCcdResiduals = True
# Allow calibration to work with just 1 exposure on a night.
config.minExpPerNight = 1
# 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 = 50
config.nExpPerRun = 2
# Define r-i color as the primary way to split by color.
config.colorSplitBands = ['g', 'r']
Copy link
Contributor

Choose a reason for hiding this comment

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

I see g and r (no i)...

config.freezeStdAtmosphere = True
# For tests, do low-order per-ccd polynomial.
config.superStarSubCcdChebyshevOrder = 1
config.ccdGraySubCcdDict = {'g': False,
'r': False,
'i': False}
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 = False
# 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 = 2.04
config.deltaAperOuterRadiusArcsec = 2.89
config.doComputeDeltaAperPerVisit = True
config.doComputeDeltaAperMap = True
config.doComputeDeltaAperPerCcd = True
6 changes: 6 additions & 0 deletions tests/config/fgcmMakeLutLatiss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
config.physicalFilters = ['SDSSg_65mm~empty', 'SDSSr_65mm~empty', 'SDSSi_65mm~empty']
config.atmosphereTableName = 'fgcm_atm_lsst2_test'

config.filterTransmissionIsUnbounded = False
config.opticsTransmissionIsUnbounded = False
config.sensorTransmissionIsUnbounded = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Could just leave these out now?

21 changes: 21 additions & 0 deletions tests/config/fgcmOutputProductsLatiss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os.path


config.connections.cycleNumber = 2

config.doReferenceCalibration = True
config.referencePixelizationMinStars = 20
config.referenceMinMatch = 15

from lsst.obs.lsst.filters import LATISS_FILTER_DEFINITIONS
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you not use this (rather than set explicitly below)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I only want to define the set of filters that we're using, rather than all possible filters.


config.physicalFilterMap = {
'SDSSg_65mm~empty': 'g',
'SDSSr_65mm~empty': 'r',
'SDSSi_65mm~empty': 'i',
}

config.photoCal.applyColorTerms = False
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you turn this on now (as of DM-40556)?

config.photoCal.photoCatName = 'atlas_refcat2_20220201'

config.connections.refCat = 'atlas_refcat2_20220201'
6 changes: 6 additions & 0 deletions tests/config/filterMapLatiss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
for source, target in [
("SDSSg_65mm~empty", "g"),
("SDSSr_65mm~empty", "r"),
("SDSSi_65mm~empty", "i"),
]:
config.filterMap[source] = target
5 changes: 5 additions & 0 deletions tests/pipelines/fgcmBuildFromIsolatedStarsLatiss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Build fgcm input stars
instrument: lsst.obs.lsst.Latiss
tasks:
fgcmBuildFromIsolatedStars:
class: lsst.fgcmcal.fgcmBuildFromIsolatedStars.FgcmBuildFromIsolatedStarsTask
5 changes: 5 additions & 0 deletions tests/pipelines/fgcmFitCycleLatiss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Perform an fgcmcal fit cycle
instrument: lsst.obs.lsst.Latiss
tasks:
fgcmFitCycle:
class: lsst.fgcmcal.fgcmFitCycle.FgcmFitCycleTask
12 changes: 12 additions & 0 deletions tests/pipelines/fgcmFullPipelineLatiss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
description: Full fgcmcal pipeline
instrument: lsst.obs.lsst.Latiss
tasks:
fgcmBuildFromIsolatedStars:
class: lsst.fgcmcal.fgcmBuildFromIsolatedStars.FgcmBuildFromIsolatedStarsTask
fgcmFitCycle:
class: lsst.fgcmcal.fgcmFitCycle.FgcmFitCycleTask
config:
doMultipleCycles: true
multipleCyclesFinalCycleNumber: 2
fgcmOutputProducts:
class: lsst.fgcmcal.fgcmOutputProducts.FgcmOutputProductsTask
4 changes: 4 additions & 0 deletions tests/pipelines/fgcmMakeLutLatiss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
description: Make fgcmcal look-up table
instrument: lsst.obs.lsst.Latiss
tasks:
fgcmMakeLut: lsst.fgcmcal.fgcmMakeLut.FgcmMakeLutTask
5 changes: 5 additions & 0 deletions tests/pipelines/fgcmOutputProductsLatiss.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Output fgcmcal products
instrument: lsst.obs.lsst.Latiss
tasks:
fgcmOutputProducts:
class: lsst.fgcmcal.fgcmOutputProducts.FgcmOutputProductsTask
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 all these pipelines differ from the HSC versions only by the imported instrument. Would making a bas e (or ingredients file?) make sense/be worth it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe when I add a third test camera, but with 2 it's definitely not worth it (yet) to make a whole new directory structure just for test configs.