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 'focalPlaneSigmaClip': config.focalPlaneSigmaClip,
162 'ccdGraySubCCDDict': dict(config.ccdGraySubCcdDict),
163 'ccdGraySubCCDChebyshevOrder': config.ccdGraySubCcdChebyshevOrder,
164 'ccdGraySubCCDTriangular': config.ccdGraySubCcdTriangular,
165 'ccdGrayFocalPlaneDict': dict(config.ccdGrayFocalPlaneDict),
166 'ccdGrayFocalPlaneChebyshevOrder': config.ccdGrayFocalPlaneChebyshevOrder,
167 'ccdGrayFocalPlaneFitMinCcd': config.ccdGrayFocalPlaneFitMinCcd,
168 'cycleNumber': config.cycleNumber,
169 'maxIter': maxIter,
170 'deltaMagBkgOffsetPercentile': config.deltaMagBkgOffsetPercentile,
171 'deltaMagBkgPerCcd': config.deltaMagBkgPerCcd,
172 'UTBoundary': config.utBoundary,
173 'washMJDs': config.washMjds,
174 'epochMJDs': config.epochMjds,
175 'coatingMJDs': config.coatingMjds,
176 'minObsPerBand': config.minObsPerBand,
177 'latitude': config.latitude,
178 'defaultCameraOrientation': config.defaultCameraOrientation,
179 'brightObsGrayMax': config.brightObsGrayMax,
180 'minStarPerCCD': config.minStarPerCcd,
181 'minCCDPerExp': config.minCcdPerExp,
182 'maxCCDGrayErr': config.maxCcdGrayErr,
183 'minStarPerExp': config.minStarPerExp,
184 'minExpPerNight': config.minExpPerNight,
185 'expGrayInitialCut': config.expGrayInitialCut,
186 'expFwhmCutDict': dict(config.expFwhmCutDict),
187 'expGrayPhotometricCutDict': dict(config.expGrayPhotometricCutDict),
188 'expGrayHighCutDict': dict(config.expGrayHighCutDict),
189 'expGrayRecoverCut': config.expGrayRecoverCut,
190 'expVarGrayPhotometricCutDict': dict(config.expVarGrayPhotometricCutDict),
191 'expGrayErrRecoverCut': config.expGrayErrRecoverCut,
192 'refStarSnMin': config.refStarSnMin,
193 'refStarOutlierNSig': config.refStarOutlierNSig,
194 'applyRefStarColorCuts': config.applyRefStarColorCuts,
195 'refStarMaxFracUse': config.refStarMaxFracUse,
196 'useExposureReferenceOffset': config.useExposureReferenceOffset,
197 'illegalValue': FGCM_ILLEGAL_VALUE,
198 'starColorCuts': starColorCutList,
199 'refStarColorCuts': refStarColorCutList,
200 'aperCorrFitNBins': config.aperCorrFitNBins,
201 'aperCorrInputSlopeDict': dict(config.aperCorrInputSlopeDict),
202 'sedBoundaryTermDict': config.sedboundaryterms.toDict()['data'],
203 'sedTermDict': config.sedterms.toDict()['data'],
204 'colorSplitBands': list(config.colorSplitBands),
205 'sigFgcmMaxErr': config.sigFgcmMaxErr,
206 'sigFgcmMaxEGrayDict': dict(config.sigFgcmMaxEGrayDict),
207 'ccdGrayMaxStarErr': config.ccdGrayMaxStarErr,
208 'approxThroughputDict': dict(config.approxThroughputDict),
209 'sigmaCalRange': list(config.sigmaCalRange),
210 'sigmaCalFitPercentile': list(config.sigmaCalFitPercentile),
211 'sigmaCalPlotPercentile': list(config.sigmaCalPlotPercentile),
212 'sigma0Phot': config.sigma0Phot,
213 'mapLongitudeRef': config.mapLongitudeRef,
214 'mapNSide': config.mapNSide,
215 'varNSig': 100.0,
216 'varMinBand': 2,
217 'useRetrievedPwv': False,
218 'useNightlyRetrievedPwv': False,
219 'pwvRetrievalSmoothBlock': 25,
220 'useQuadraticPwv': config.useQuadraticPwv,
221 'useRetrievedTauInit': False,
222 'tauRetrievalMinCCDPerNight': 500,
223 'modelMagErrors': config.modelMagErrors,
224 'instrumentParsPerBand': config.instrumentParsPerBand,
225 'instrumentSlopeMinDeltaT': config.instrumentSlopeMinDeltaT,
226 'fitMirrorChromaticity': config.fitMirrorChromaticity,
227 'fitCCDChromaticityDict': dict(config.fitCcdChromaticityDict),
228 'useRepeatabilityForExpGrayCutsDict': dict(config.useRepeatabilityForExpGrayCutsDict),
229 'autoPhotometricCutNSig': config.autoPhotometricCutNSig,
230 'autoHighCutNSig': config.autoHighCutNSig,
231 'deltaAperInnerRadiusArcsec': config.deltaAperInnerRadiusArcsec,
232 'deltaAperOuterRadiusArcsec': config.deltaAperOuterRadiusArcsec,
233 'deltaAperFitMinNgoodObs': config.deltaAperFitMinNgoodObs,
234 'deltaAperFitPerCcdNx': config.deltaAperFitPerCcdNx,
235 'deltaAperFitPerCcdNy': config.deltaAperFitPerCcdNy,
236 'deltaAperFitSpatialNside': config.deltaAperFitSpatialNside,
237 'doComputeDeltaAperExposures': config.doComputeDeltaAperPerVisit,
238 'doComputeDeltaAperStars': config.doComputeDeltaAperPerStar,
239 'doComputeDeltaAperMap': config.doComputeDeltaAperMap,
240 'doComputeDeltaAperPerCcd': config.doComputeDeltaAperPerCcd,
241 'printOnly': False,
242 'quietMode': config.quietMode,
243 'randomSeed': config.randomSeed,
244 'outputStars': False,
245 'outputPath': os.path.abspath('.'),
246 'clobber': True,
247 'useSedLUT': False,
248 'resetParameters': resetFitParameters,
249 'doPlots': doPlots,
250 'outputFgcmcalZpts': True,
251 'outputZeropoints': outputZeropoints}
252
253 return configDict
254
255