Skip to content

Commit

Permalink
Switch to using __file__ to reference other configs.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Apr 16, 2020
1 parent 5e9e604 commit 2440ce0
Show file tree
Hide file tree
Showing 68 changed files with 99 additions and 180 deletions.
3 changes: 1 addition & 2 deletions config/apPipe.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Config override for lsst.ap.pipe.ApPipeTask
import os.path
from lsst.utils import getPackageDir

subaruConfigDir = os.path.join(getPackageDir('obs_subaru'), 'config')
subaruConfigDir = os.path.dirname(__file__)

config.ccdProcessor.load(os.path.join(subaruConfigDir, "processCcd.py"))
3 changes: 1 addition & 2 deletions config/assembleCoadd.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os.path
from lsst.utils import getPackageDir

# Load configs shared between assembleCoadd and makeCoaddTempExp
config.load(os.path.join(getPackageDir("obs_subaru"), "config", "coaddBase.py"))
config.load(os.path.join(os.path.dirname(__file__), "coaddBase.py"))

config.doSigmaClip = False
config.subregionSize = (10000, 200) # 200 rows (since patch width is typically < 10k pixels)
Expand Down
5 changes: 2 additions & 3 deletions config/calibrate.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os.path

from lsst.utils import getPackageDir
from lsst.meas.algorithms import ColorLimit

ObsConfigDir = os.path.join(getPackageDir("obs_subaru"), "config")
ObsConfigDir = os.path.dirname(__file__)

bgFile = os.path.join(ObsConfigDir, "background.py")

Expand All @@ -14,7 +13,7 @@
for refObjLoader in (config.astromRefObjLoader,
config.photoRefObjLoader,
):
refObjLoader.load(os.path.join(getPackageDir("obs_subaru"), "config", "filterMap.py"))
refObjLoader.load(os.path.join(ObsConfigDir, "filterMap.py"))
# This is the Gen2 configuration option.
refObjLoader.ref_dataset_name = "ps1_pv3_3pi_20170110"

Expand Down
5 changes: 2 additions & 3 deletions config/charImage.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os.path

from lsst.utils import getPackageDir
from lsst.meas.algorithms import ColorLimit

ObsConfigDir = os.path.join(getPackageDir("obs_subaru"), "config")
ObsConfigDir = os.path.dirname(__file__)

bgFile = os.path.join(ObsConfigDir, "background.py")

Expand All @@ -28,7 +27,7 @@
config.measurePsf.psfDeterminer.name = "pca"

# Astrometry
config.refObjLoader.load(os.path.join(getPackageDir("obs_subaru"), "config", "filterMap.py"))
config.refObjLoader.load(os.path.join(ObsPackageDir, "filterMap.py"))
config.refObjLoader.ref_dataset_name = "ps1_pv3_3pi_20170110"

# Set to match defaults curretnly used in HSC production runs (e.g. S15B)
Expand Down
3 changes: 1 addition & 2 deletions config/characterizeImage.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os.path

from lsst.utils import getPackageDir
from lsst.meas.algorithms import ColorLimit

ObsConfigDir = os.path.join(getPackageDir("obs_subaru"), "config")
ObsConfigDir = os.path.dirname(__file__)

charImFile = os.path.join(ObsConfigDir, "charImage.py")
config.load(charImFile)
3 changes: 1 addition & 2 deletions config/coaddDriver.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Load from sub-configurations
import os.path

from lsst.utils import getPackageDir

from lsst.pipe.tasks.assembleCoadd import CompareWarpAssembleCoaddTask
config.assembleCoadd.retarget(CompareWarpAssembleCoaddTask)
Expand All @@ -10,7 +9,7 @@
("backgroundReference", "backgroundReference"),
("assembleCoadd", "compareWarpAssembleCoadd"),
("detectCoaddSources", "detectCoaddSources")):
path = os.path.join(getPackageDir("obs_subaru"), "config", filename + ".py")
path = os.path.join(os.path.dirname(__file__), filename + ".py")
if os.path.exists(path):
getattr(config, sub).load(path)

Expand Down
5 changes: 2 additions & 3 deletions config/compareWarpAssembleCoadd.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os.path
from lsst.utils import getPackageDir

# Load configs from base assembleCoadd
config.load(os.path.join(getPackageDir("obs_subaru"), "config", "assembleCoadd.py"))
# Load configs from base assembleCoadd
config.load(os.path.join(os.path.dirname(__file__), "assembleCoadd.py"))

# 200 rows (since patch width is typically < 10k pixels
config.assembleStaticSkyModel.subregionSize = (10000, 200)
5 changes: 2 additions & 3 deletions config/deblendCoaddSources.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Subaru-specific overrides for DeblendCoaddSourcesTask"""

import os.path
from lsst.utils import getPackageDir

config.singleBandDeblend.load(os.path.join(getPackageDir("obs_subaru"), "config", "singleBandDeblend.py"))
config.multiBandDeblend.load(os.path.join(getPackageDir("obs_subaru"), "config", "multiBandDeblend.py"))
config.singleBandDeblend.load(os.path.join(os.path.dirname(__file__), "singleBandDeblend.py"))
config.multiBandDeblend.load(os.path.join(os.path.dirname(__file__), "multiBandDeblend.py"))
5 changes: 2 additions & 3 deletions config/forcedPhotCcd.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os.path

from lsst.utils import getPackageDir

config.measurement.load(os.path.join(getPackageDir("obs_subaru"), "config", "apertures.py"))
config.measurement.load(os.path.join(getPackageDir("obs_subaru"), "config", "kron.py"))
config.measurement.load(os.path.join(os.path.dirname(__file__), "apertures.py"))
config.measurement.load(os.path.join(os.path.dirname(__file__), "kron.py"))

config.measurement.slots.gaussianFlux = None
9 changes: 4 additions & 5 deletions config/forcedPhotCoadd.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import os.path

from lsst.utils import getPackageDir
from lsst.meas.base import CircularApertureFluxAlgorithm

config.measurement.load(os.path.join(getPackageDir("obs_subaru"), "config", "apertures.py"))
config.measurement.load(os.path.join(getPackageDir("obs_subaru"), "config", "kron.py"))
config.measurement.load(os.path.join(getPackageDir("obs_subaru"), "config", "convolvedFluxes.py"))
config.load(os.path.join(getPackageDir("obs_subaru"), "config", "cmodel.py"))
config.measurement.load(os.path.join(os.path.dirname(__file__), "apertures.py"))
config.measurement.load(os.path.join(os.path.dirname(__file__), "kron.py"))
config.measurement.load(os.path.join(os.path.dirname(__file__), "convolvedFluxes.py"))
config.load(os.path.join(os.path.dirname(__file__), "cmodel.py"))

config.measurement.slots.gaussianFlux = None

Expand Down
3 changes: 1 addition & 2 deletions config/fringe.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from lsst.utils import getPackageDir
import os

configDir = os.path.join(getPackageDir("obs_subaru"), "config")
configDir = os.path.dirname(__file__)
bgFile = os.path.join(configDir, "background.py")

config.detection.background.load(bgFile)
Expand Down
3 changes: 1 addition & 2 deletions config/hsc/apPipe.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Config override for lsst.ap.pipe.ApPipeTask
import os.path
from lsst.utils import getPackageDir

hscConfigDir = os.path.join(getPackageDir('obs_subaru'), 'config', 'hsc')
hscConfigDir = os.path.dirname(__file__)

config.ccdProcessor.load(os.path.join(hscConfigDir, "processCcd.py"))
3 changes: 1 addition & 2 deletions config/hsc/assembleCoadd.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os.path
from lsst.utils import getPackageDir

# Load configs shared between assembleCoadd and makeCoaddTempExp
config.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "coaddBase.py"))
config.load(os.path.join(os.path.dirname(__file__), "coaddBase.py"))

config.doAttachTransmissionCurve = True
config.interpImage.transpose = True # Saturation trails are usually oriented east-west, so along rows
Expand Down
3 changes: 1 addition & 2 deletions config/hsc/bias.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os.path

from lsst.utils import getPackageDir

config.isr.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "isr.py"))
config.isr.load(os.path.join(os.path.dirname(__file__), "isr.py"))
config.isr.doBrighterFatter = False
config.isr.doStrayLight = False
3 changes: 1 addition & 2 deletions config/hsc/calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
"""
import os.path

from lsst.utils import getPackageDir

from lsst.meas.astrom import MatchOptimisticBConfig

ObsConfigDir = os.path.join(getPackageDir("obs_subaru"), "config", "hsc")
ObsConfigDir = os.path.dirname(__file__)

config.photoCal.colorterms.load(os.path.join(ObsConfigDir, 'colorterms.py'))
for refObjLoader in (config.astromRefObjLoader,
Expand Down
3 changes: 1 addition & 2 deletions config/hsc/charImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
"""
import os.path

from lsst.utils import getPackageDir

from lsst.meas.astrom import MatchOptimisticBConfig

ObsConfigDir = os.path.join(getPackageDir("obs_subaru"), "config", "hsc")
ObsConfigDir = os.path.join(os.path.dirname(__file__))

config.measurePsf.starSelector["objectSize"].widthMin = 0.9
config.measurePsf.starSelector["objectSize"].fluxMin = 4000
Expand Down
3 changes: 1 addition & 2 deletions config/hsc/characterizeImage.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os.path

from lsst.utils import getPackageDir
from lsst.meas.algorithms import ColorLimit

ObsConfigDir = os.path.join(getPackageDir("obs_subaru"), "config", "hsc")
ObsConfigDir = os.path.join(os.path.dirname(__file__))

charImFile = os.path.join(ObsConfigDir, "charImage.py")
config.load(charImFile)
7 changes: 3 additions & 4 deletions config/hsc/coaddAnalysis.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os.path

from lsst.utils import getPackageDir

config.colorterms.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "colorterms.py"))
config.refObjLoader.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "filterMap.py"))
config.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "srcSchemaMap.py"))
config.colorterms.load(os.path.join(os.path.dirname(__file__), "colorterms.py"))
config.refObjLoader.load(os.path.join(os.path.dirname(__file__), "filterMap.py"))
config.load(os.path.join(os.path.dirname(__file__), "srcSchemaMap.py"))
3 changes: 1 addition & 2 deletions config/hsc/coaddDriver.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Load from sub-configurations
import os.path

from lsst.utils import getPackageDir

for sub, filename in (("makeCoaddTempExp", "makeCoaddTempExp"),
("backgroundReference", "backgroundReference"),
("assembleCoadd", "compareWarpAssembleCoadd"),
("detectCoaddSources", "detectCoaddSources")):
path = os.path.join(getPackageDir("obs_subaru"), "config", "hsc", filename + ".py")
path = os.path.join(os.path.dirname(__file__), filename + ".py")
if os.path.exists(path):
getattr(config, sub).load(path)
5 changes: 2 additions & 3 deletions config/hsc/colorAnalysis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os.path

from lsst.utils import getPackageDir

config.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "srcSchemaMap.py"))
config.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "extinctionCoeffs.py"))
config.load(os.path.join(os.path.dirname(__file__), "srcSchemaMap.py"))
config.load(os.path.join(os.path.dirname(__file__), "extinctionCoeffs.py"))
7 changes: 3 additions & 4 deletions config/hsc/compareCoaddAnalysis.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os.path

from lsst.utils import getPackageDir

config.colorterms.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "colorterms.py"))
config.refObjLoader.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "filterMap.py"))
config.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "srcSchemaMap.py"))
config.colorterms.load(os.path.join(os.path.dirname(__file__), "colorterms.py"))
config.refObjLoader.load(os.path.join(os.path.dirname(__file__), "filterMap.py"))
config.load(os.path.join(os.path.dirname(__file__), "srcSchemaMap.py"))
7 changes: 3 additions & 4 deletions config/hsc/compareVisitAnalysis.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os.path

from lsst.utils import getPackageDir

config.refObjLoader.load(os.path.join(getPackageDir("obs_subaru"), "config", "filterMap.py"))
config.refObjLoader.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "filterMap.py"))
config.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "srcSchemaMap.py"))
config.refObjLoader.load(os.path.join(os.path.dirname(__file__), "..", "filterMap.py"))
config.refObjLoader.load(os.path.join(os.path.dirname(__file__), "filterMap.py"))
config.load(os.path.join(os.path.dirname(__file__), "srcSchemaMap.py"))
3 changes: 1 addition & 2 deletions config/hsc/compareWarpAssembleCoadd.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os.path
from lsst.utils import getPackageDir

# Load configs shared between assembleCoadd and makeCoaddTempExp
config.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "assembleCoadd.py"))
config.load(os.path.join(os.path.dirname(__file__), "assembleCoadd.py"))

config.assembleStaticSkyModel.doApplyExternalPhotoCalib = True
config.assembleStaticSkyModel.doApplyExternalSkyWcs = True
9 changes: 3 additions & 6 deletions config/hsc/convertRepo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os.path
from lsst.utils import getPackageDir
from lsst.obs.base.gen2to3 import ConvertRepoSkyMapConfig

# Register translators for data IDs. This is unfortunately a bit fragile; it
Expand All @@ -9,16 +8,14 @@
config.runs["raw"] = "raw/hsc"
config.runs["brightObjectMask"] = "masks/hsc"
config.skyMaps["hsc_rings_v1"] = ConvertRepoSkyMapConfig()
config.skyMaps["hsc_rings_v1"].load(os.path.join(getPackageDir("obs_subaru"), "config",
"makeSkyMap.py"))
config.skyMaps["hsc_rings_v1"].load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc",
"makeSkyMap.py"))
config.skyMaps["hsc_rings_v1"].load(os.path.join(os.path.dirname(__file__), "..", "makeSkyMap.py"))
config.skyMaps["hsc_rings_v1"].load(os.path.join(os.path.dirname(__file__), "makeSkyMap.py"))
# If there's no skymap in the root repo, but some dataset defined on
# tracts/patches is present there (i.e. brightObjectMask), assume this
# skymap.
config.rootSkyMapName = "hsc_rings_v1"

config.raws.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "ingest-gen3.py"))
config.raws.load(os.path.join(os.path.dirname(__file__), "ingest-gen3.py"))
config.refCats.append("ps1_pv3_3pi_20170110")
config.runs["ps1_pv3_3pi_20170110"] = "refcats"

Expand Down
3 changes: 1 addition & 2 deletions config/hsc/dark.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os.path

from lsst.utils import getPackageDir

config.isr.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "isr.py"))
config.isr.load(os.path.join(os.path.dirname(__file__), "isr.py"))

config.isr.doBias = True
config.repair.cosmicray.nCrPixelMax = 1000000
Expand Down
3 changes: 1 addition & 2 deletions config/hsc/displayCatalog.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os.path

from lsst.utils import getPackageDir

config.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "srcSchemaMap.py"))
config.load(os.path.join(os.path.dirname(__file__), "srcSchemaMap.py"))
3 changes: 1 addition & 2 deletions config/hsc/fgcmBuildStars.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import os.path

from lsst.utils import getPackageDir

config.minPerBand = 2
config.densityCutMaxPerPixel = 2000
Expand All @@ -21,7 +20,7 @@
'N387': 'g', 'N816': 'i', 'N921': 'z',
'N1010': 'y'}
config.fgcmLoadReferenceCatalog.applyColorTerms = True
hscConfigDir = os.path.join(getPackageDir("obs_subaru"), "config", "hsc")
hscConfigDir = os.path.join(os.path.dirname(__file__))
config.fgcmLoadReferenceCatalog.colorterms.load(os.path.join(hscConfigDir, 'colorterms.py'))
config.fgcmLoadReferenceCatalog.referenceSelector.doSignalToNoise = True
config.fgcmLoadReferenceCatalog.referenceSelector.signalToNoise.fluxField = 'i_flux'
Expand Down
14 changes: 3 additions & 11 deletions config/hsc/fgcmCalibrateTract.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import os.path

from lsst.utils import getPackageDir

config.fgcmBuildStars.load(os.path.join(getPackageDir('obs_subaru'),
'config',
'hsc',
config.fgcmBuildStars.load(os.path.join(os.path.dirname(__file__),
'fgcmBuildStars.py'))
config.fgcmFitCycle.load(os.path.join(getPackageDir('obs_subaru'),
'config',
'hsc',
config.fgcmFitCycle.load(os.path.join(os.path.dirname(__file__),
'fgcmFitCycle.py'))
config.fgcmOutputProducts.load(os.path.join(getPackageDir('obs_subaru'),
'config',
'hsc',
config.fgcmOutputProducts.load(os.path.join(os.path.dirname(__file__),
'fgcmOutputProducts.py'))
config.fgcmFitCycle.aperCorrFitNBins = 0
config.fgcmFitCycle.useRepeatabilityForExpGrayCutsDict = {'N387': True,
Expand Down
5 changes: 2 additions & 3 deletions config/hsc/flat.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import os.path

from lsst.utils import getPackageDir

config.isr.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "isr.py"))
config.isr.load(os.path.join(os.path.dirname(__file__), "isr.py"))

from lsst.obs.hsc.calibs import HscFlatCombineTask
config.combination.retarget(HscFlatCombineTask)
config.combination.vignette.load(os.path.join(getPackageDir("obs_subaru"), 'config', 'hsc', 'vignette.py'))
config.combination.vignette.load(os.path.join(os.path.dirname(__file__), 'vignette.py'))

config.isr.doBrighterFatter = False
config.isr.doStrayLight = False
3 changes: 1 addition & 2 deletions config/hsc/fringe.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os.path

from lsst.utils import getPackageDir

config.isr.load(os.path.join(getPackageDir("obs_subaru"), "config", "hsc", "isr.py"))
config.isr.load(os.path.join(os.path.dirname(__file__), "isr.py"))

config.isr.doBrighterFatter = False
1 change: 0 additions & 1 deletion config/hsc/isr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""
import os.path

from lsst.utils import getPackageDir
from lsst.obs.subaru.strayLight import SubaruStrayLightTask

config.datasetType = "raw"
Expand Down

0 comments on commit 2440ce0

Please sign in to comment.