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