50 lutFilterNames, tract=None, nCore=1, doPlots=False):
51 """
52 Make the FGCM fit cycle configuration dict
53
54 Parameters
55 ----------
56 config : `lsst.fgcmcal.FgcmFitCycleConfig`
57 Configuration object
58 log : `logging.Logger`
59 Log object.
60 camera : `lsst.afw.cameraGeom.Camera`
61 Camera from the butler
62 maxIter : `int`
63 Maximum number of iterations
64 resetFitParameters: `bool`
65 Reset fit parameters before fitting?
66 outputZeropoints : `bool`
67 Compute zeropoints for output?
68 lutFilterNames : array-like, `str`
69 Array of physical filter names in the LUT.
70 tract : `int`, optional
71 Tract number for extending the output file name for debugging.
72 Default is None.
73 nCore : `int`, optional
74 Number of cores to use.
75 doPlots : `bool`, optional
76 Make FGCM QA plots?
77
78 Returns
79 -------
80 configDict : `dict`
81 Configuration dictionary for fgcm
82 """
83
84 notFitBands = [b for b in config.bands if b not in config.fitBands]
85
86
87 starColorCutList = []
88 for ccut in config.starColorCuts:
89 if ccut == 'NO_DATA':
90
91 break
92 parts = ccut.split(',')
93 starColorCutList.append([parts[0], parts[1], float(parts[2]), float(parts[3])])
94
95
96 refStarColorCutList = []
97 for ccut in config.refStarColorCuts:
98 if ccut == 'NO_DATA':
99
100 break
101 parts = ccut.split(',')
102 refStarColorCutList.append([parts[0], parts[1], float(parts[2]), float(parts[3])])
103
104
105
106
107 if config.mirrorArea is None:
108 mirrorArea = np.pi*(camera.telescopeDiameter*100./2.)**2.
109 else:
110
111 mirrorArea = config.mirrorArea * 100.**2.
112
113 if config.cameraGain is None:
114
115 gains = [amp.getGain() for detector in camera for amp in detector.getAmplifiers()]
116 cameraGain = float(np.median(gains))
117 else:
118 cameraGain = config.cameraGain
119
120
121 filterToBand = {filterName: config.physicalFilterMap[filterName] for
122 filterName in lutFilterNames}
123
124 if tract is None:
125 outfileBase = config.outfileBase
126 else:
127 outfileBase = '%s-%06d' % (config.outfileBase, tract)
128
129 if config.aperCorrPerCcd:
130 if config.aperCorrUsePsfFwhm:
131 seeingField = 'PSFFWHM_DETECTOR'
132 else:
133 seeingField = 'DELTA_APER_DETECTOR'
134 seeingSubExposure = True
135 else:
136 if config.aperCorrUsePsfFwhm:
137 seeingField = 'PSFFWHM'
138 else:
139 seeingField = 'DELTA_APER'
140 seeingSubExposure = False
141
142
143 configDict = {'outfileBase': outfileBase,
144 'logger': log,
145 'exposureFile': None,
146 'obsFile': None,
147 'indexFile': None,
148 'lutFile': None,
149 'mirrorArea': mirrorArea,
150 'cameraGain': cameraGain,
151 'ccdStartIndex': camera[0].getId(),
152 'expField': FGCM_EXP_FIELD,
153 'ccdField': FGCM_CCD_FIELD,
154 'seeingField': seeingField,
155 'fwhmField': 'PSFFWHM',
156 'skyBrightnessField': 'SKYBACKGROUND',
157 'deepFlag': 'DEEPFLAG',
158 'bands': list(config.bands),
159 'fitBands': list(config.fitBands),
160 'notFitBands': notFitBands,
161 'requiredBands': list(config.requiredBands),
162 'filterToBand': filterToBand,
163 'logLevel': 'INFO',
164 'nCore': nCore,
165 'nStarPerRun': config.nStarPerRun,
166 'nStarPerGrayRun': config.nStarPerGrayRun,
167 'nObsPerRun': config.nObsPerRun,
168 'nObsPerGrayRun': config.nObsPerGrayRun,
169 'nExpPerRun': config.nExpPerRun,
170 'reserveFraction': config.reserveFraction,
171 'freezeStdAtmosphere': config.freezeStdAtmosphere,
172 'precomputeSuperStarInitialCycle': config.precomputeSuperStarInitialCycle,
173 'superStarSubCCDDict': dict(config.superStarSubCcdDict),
174 'superStarSubCCDChebyshevOrder': config.superStarSubCcdChebyshevOrder,
175 'superStarSubCCDTriangular': config.superStarSubCcdTriangular,
176 'superStarSigmaClip': config.superStarSigmaClip,
177 'superStarPlotCCDResiduals': config.superStarPlotCcdResiduals,
178 'superStarForceZeroMean': config.superStarForceZeroMean,
179 'focalPlaneSigmaClip': config.focalPlaneSigmaClip,
180 'ccdGraySubCCDDict': dict(config.ccdGraySubCcdDict),
181 'ccdGraySubCCDChebyshevOrder': config.ccdGraySubCcdChebyshevOrder,
182 'ccdGraySubCCDTriangular': config.ccdGraySubCcdTriangular,
183 'ccdGrayFocalPlaneDict': dict(config.ccdGrayFocalPlaneDict),
184 'ccdGrayFocalPlaneChebyshevOrder': config.ccdGrayFocalPlaneChebyshevOrder,
185 'ccdGrayFocalPlaneFitMinCcd': config.ccdGrayFocalPlaneFitMinCcd,
186 'ccdGrayFocalPlaneMaxStars': config.ccdGrayFocalPlaneMaxStars,
187 'cycleNumber': config.cycleNumber,
188 'maxIter': maxIter,
189 'deltaMagBkgOffsetPercentile': config.deltaMagBkgOffsetPercentile,
190 'deltaMagBkgPerCcd': config.deltaMagBkgPerCcd,
191 'UTBoundary': config.utBoundary,
192 'washMJDs': config.washMjds,
193 'epochMJDs': config.epochMjds,
194 'coatingMJDs': config.coatingMjds,
195 'minObsPerBand': config.minObsPerBand,
196 'latitude': config.latitude,
197 'defaultCameraOrientation': config.defaultCameraOrientation,
198 'brightObsGrayMax': config.brightObsGrayMax,
199 'minStarPerCCD': config.minStarPerCcd,
200 'minCCDPerExp': config.minCcdPerExp,
201 'maxCCDGrayErr': config.maxCcdGrayErr,
202 'minStarPerExp': config.minStarPerExp,
203 'minExpPerNight': config.minExpPerNight,
204 'expGrayInitialCut': config.expGrayInitialCut,
205 'expFwhmCutDict': dict(config.expFwhmCutDict),
206 'expGrayPhotometricCutDict': dict(config.expGrayPhotometricCutDict),
207 'expGrayHighCutDict': dict(config.expGrayHighCutDict),
208 'expGrayRecoverCut': config.expGrayRecoverCut,
209 'expVarGrayPhotometricCutDict': dict(config.expVarGrayPhotometricCutDict),
210 'expGrayErrRecoverCut': config.expGrayErrRecoverCut,
211 'refStarSnMin': config.refStarSnMin,
212 'refStarOutlierNSig': config.refStarOutlierNSig,
213 'applyRefStarColorCuts': config.applyRefStarColorCuts,
214 'refStarMaxFracUse': config.refStarMaxFracUse,
215 'useExposureReferenceOffset': config.useExposureReferenceOffset,
216 'illegalValue': FGCM_ILLEGAL_VALUE,
217 'starColorCuts': starColorCutList,
218 'refStarColorCuts': refStarColorCutList,
219 'aperCorrFitNBins': config.aperCorrFitNBins,
220 'aperCorrInputSlopeDict': dict(config.aperCorrInputSlopeDict),
221 'seeingSubExposure': seeingSubExposure,
222 'sedBoundaryTermDict': config.sedboundaryterms.toDict()['data'],
223 'sedTermDict': config.sedterms.toDict()['data'],
224 'colorSplitBands': list(config.colorSplitBands),
225 'sigFgcmMaxErr': config.sigFgcmMaxErr,
226 'sigFgcmMaxEGrayDict': dict(config.sigFgcmMaxEGrayDict),
227 'ccdGrayMaxStarErr': config.ccdGrayMaxStarErr,
228 'approxThroughputDict': dict(config.approxThroughputDict),
229 'sigmaCalRange': list(config.sigmaCalRange),
230 'sigmaCalFitPercentile': list(config.sigmaCalFitPercentile),
231 'sigmaCalPlotPercentile': list(config.sigmaCalPlotPercentile),
232 'sigma0Phot': config.sigma0Phot,
233 'mapLongitudeRef': config.mapLongitudeRef,
234 'mapNSide': config.mapNSide,
235 'varNSig': 100.0,
236 'varMinBand': 2,
237 'useNightlyRetrievedPwv': False,
238 'useQuadraticPwv': config.useQuadraticPwv,
239 'useRetrievedPwv': config.useRetrievedPwv,
240 'pwvRetrievalSmoothBlock': config.retrievedPwvSmoothingBlock,
241 'retrievedPwvBands': list(config.retrievedPwvBands),
242 'useRetrievedTauInit': False,
243 'tauRetrievalMinCCDPerNight': 500,
244 'modelMagErrors': config.modelMagErrors,
245 'instrumentParsPerBand': config.instrumentParsPerBand,
246 'instrumentSlopeMinDeltaT': config.instrumentSlopeMinDeltaT,
247 'fitMirrorChromaticity': config.fitMirrorChromaticity,
248 'fitCCDChromaticityDict': dict(config.fitCcdChromaticityDict),
249 'useRepeatabilityForExpGrayCutsDict': dict(config.useRepeatabilityForExpGrayCutsDict),
250 'autoPhotometricCutNSig': config.autoPhotometricCutNSig,
251 'autoHighCutNSig': config.autoHighCutNSig,
252 'deltaAperInnerRadiusArcsec': config.deltaAperInnerRadiusArcsec,
253 'deltaAperOuterRadiusArcsec': config.deltaAperOuterRadiusArcsec,
254 'deltaAperFitMinNgoodObs': config.deltaAperFitMinNgoodObs,
255 'deltaAperFitPerCcdNx': config.deltaAperFitPerCcdNx,
256 'deltaAperFitPerCcdNy': config.deltaAperFitPerCcdNy,
257 'deltaAperFitSpatialNside': config.deltaAperFitSpatialNside,
258 'doComputeDeltaAperExposures': config.doComputeDeltaAperPerVisit,
259 'doComputeDeltaAperStars': config.doComputeDeltaAperPerStar,
260 'doComputeDeltaAperMap': config.doComputeDeltaAperMap,
261 'doComputeDeltaAperPerCcd': config.doComputeDeltaAperPerCcd,
262 'printOnly': False,
263 'quietMode': config.quietMode,
264 'randomSeed': config.randomSeed,
265 'outputStars': False,
266 'outputPath': os.path.abspath('.'),
267 'clobber': True,
268 'useSedLUT': False,
269 'resetParameters': resetFitParameters,
270 'doPlots': doPlots,
271 'outputFgcmcalZpts': True,
272 'outputZeropoints': outputZeropoints}
273
274 return configDict
275
276