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
113 gains = [amp.getGain() for detector in camera for amp in detector.getAmplifiers()]
114 cameraGain = float(np.median(gains))
115
116
117 filterToBand = {filterName: config.physicalFilterMap[filterName] for
118 filterName in lutFilterNames}
119
120 if tract is None:
121 outfileBase = config.outfileBase
122 else:
123 outfileBase = '%s-%06d' % (config.outfileBase, tract)
124
125
126 configDict = {'outfileBase': outfileBase,
127 'logger': log,
128 'exposureFile': None,
129 'obsFile': None,
130 'indexFile': None,
131 'lutFile': None,
132 'mirrorArea': mirrorArea,
133 'cameraGain': cameraGain,
134 'ccdStartIndex': camera[0].getId(),
135 'expField': FGCM_EXP_FIELD,
136 'ccdField': FGCM_CCD_FIELD,
137 'seeingField': 'DELTA_APER',
138 'fwhmField': 'PSFSIGMA',
139 'skyBrightnessField': 'SKYBACKGROUND',
140 'deepFlag': 'DEEPFLAG',
141 'bands': list(config.bands),
142 'fitBands': list(config.fitBands),
143 'notFitBands': notFitBands,
144 'requiredBands': list(config.requiredBands),
145 'filterToBand': filterToBand,
146 'logLevel': 'INFO',
147 'nCore': nCore,
148 'nStarPerRun': config.nStarPerRun,
149 'nExpPerRun': config.nExpPerRun,
150 'reserveFraction': config.reserveFraction,
151 'freezeStdAtmosphere': config.freezeStdAtmosphere,
152 'precomputeSuperStarInitialCycle': config.precomputeSuperStarInitialCycle,
153 'superStarSubCCDDict': dict(config.superStarSubCcdDict),
154 'superStarSubCCDChebyshevOrder': config.superStarSubCcdChebyshevOrder,
155 'superStarSubCCDTriangular': config.superStarSubCcdTriangular,
156 'superStarSigmaClip': config.superStarSigmaClip,
157 'superStarPlotCCDResiduals': config.superStarPlotCcdResiduals,
158 'focalPlaneSigmaClip': config.focalPlaneSigmaClip,
159 'ccdGraySubCCDDict': dict(config.ccdGraySubCcdDict),
160 'ccdGraySubCCDChebyshevOrder': config.ccdGraySubCcdChebyshevOrder,
161 'ccdGraySubCCDTriangular': config.ccdGraySubCcdTriangular,
162 'ccdGrayFocalPlaneDict': dict(config.ccdGrayFocalPlaneDict),
163 'ccdGrayFocalPlaneChebyshevOrder': config.ccdGrayFocalPlaneChebyshevOrder,
164 'ccdGrayFocalPlaneFitMinCcd': config.ccdGrayFocalPlaneFitMinCcd,
165 'cycleNumber': config.cycleNumber,
166 'maxIter': maxIter,
167 'deltaMagBkgOffsetPercentile': config.deltaMagBkgOffsetPercentile,
168 'deltaMagBkgPerCcd': config.deltaMagBkgPerCcd,
169 'UTBoundary': config.utBoundary,
170 'washMJDs': config.washMjds,
171 'epochMJDs': config.epochMjds,
172 'coatingMJDs': config.coatingMjds,
173 'minObsPerBand': config.minObsPerBand,
174 'latitude': config.latitude,
175 'defaultCameraOrientation': config.defaultCameraOrientation,
176 'brightObsGrayMax': config.brightObsGrayMax,
177 'minStarPerCCD': config.minStarPerCcd,
178 'minCCDPerExp': config.minCcdPerExp,
179 'maxCCDGrayErr': config.maxCcdGrayErr,
180 'minStarPerExp': config.minStarPerExp,
181 'minExpPerNight': config.minExpPerNight,
182 'expGrayInitialCut': config.expGrayInitialCut,
183 'expGrayPhotometricCutDict': dict(config.expGrayPhotometricCutDict),
184 'expGrayHighCutDict': dict(config.expGrayHighCutDict),
185 'expGrayRecoverCut': config.expGrayRecoverCut,
186 'expVarGrayPhotometricCutDict': dict(config.expVarGrayPhotometricCutDict),
187 'expGrayErrRecoverCut': config.expGrayErrRecoverCut,
188 'refStarSnMin': config.refStarSnMin,
189 'refStarOutlierNSig': config.refStarOutlierNSig,
190 'applyRefStarColorCuts': config.applyRefStarColorCuts,
191 'refStarMaxFracUse': config.refStarMaxFracUse,
192 'useExposureReferenceOffset': config.useExposureReferenceOffset,
193 'illegalValue': FGCM_ILLEGAL_VALUE,
194 'starColorCuts': starColorCutList,
195 'refStarColorCuts': refStarColorCutList,
196 'aperCorrFitNBins': config.aperCorrFitNBins,
197 'aperCorrInputSlopeDict': dict(config.aperCorrInputSlopeDict),
198 'sedBoundaryTermDict': config.sedboundaryterms.toDict()['data'],
199 'sedTermDict': config.sedterms.toDict()['data'],
200 'colorSplitBands': list(config.colorSplitBands),
201 'sigFgcmMaxErr': config.sigFgcmMaxErr,
202 'sigFgcmMaxEGrayDict': dict(config.sigFgcmMaxEGrayDict),
203 'ccdGrayMaxStarErr': config.ccdGrayMaxStarErr,
204 'approxThroughputDict': dict(config.approxThroughputDict),
205 'sigmaCalRange': list(config.sigmaCalRange),
206 'sigmaCalFitPercentile': list(config.sigmaCalFitPercentile),
207 'sigmaCalPlotPercentile': list(config.sigmaCalPlotPercentile),
208 'sigma0Phot': config.sigma0Phot,
209 'mapLongitudeRef': config.mapLongitudeRef,
210 'mapNSide': config.mapNSide,
211 'varNSig': 100.0,
212 'varMinBand': 2,
213 'useRetrievedPwv': False,
214 'useNightlyRetrievedPwv': False,
215 'pwvRetrievalSmoothBlock': 25,
216 'useQuadraticPwv': config.useQuadraticPwv,
217 'useRetrievedTauInit': False,
218 'tauRetrievalMinCCDPerNight': 500,
219 'modelMagErrors': config.modelMagErrors,
220 'instrumentParsPerBand': config.instrumentParsPerBand,
221 'instrumentSlopeMinDeltaT': config.instrumentSlopeMinDeltaT,
222 'fitMirrorChromaticity': config.fitMirrorChromaticity,
223 'fitCCDChromaticityDict': dict(config.fitCcdChromaticityDict),
224 'useRepeatabilityForExpGrayCutsDict': dict(config.useRepeatabilityForExpGrayCutsDict),
225 'autoPhotometricCutNSig': config.autoPhotometricCutNSig,
226 'autoHighCutNSig': config.autoHighCutNSig,
227 'deltaAperInnerRadiusArcsec': config.deltaAperInnerRadiusArcsec,
228 'deltaAperOuterRadiusArcsec': config.deltaAperOuterRadiusArcsec,
229 'deltaAperFitMinNgoodObs': config.deltaAperFitMinNgoodObs,
230 'deltaAperFitPerCcdNx': config.deltaAperFitPerCcdNx,
231 'deltaAperFitPerCcdNy': config.deltaAperFitPerCcdNy,
232 'deltaAperFitSpatialNside': config.deltaAperFitSpatialNside,
233 'doComputeDeltaAperExposures': config.doComputeDeltaAperPerVisit,
234 'doComputeDeltaAperStars': config.doComputeDeltaAperPerStar,
235 'doComputeDeltaAperMap': config.doComputeDeltaAperMap,
236 'doComputeDeltaAperPerCcd': config.doComputeDeltaAperPerCcd,
237 'printOnly': False,
238 'quietMode': config.quietMode,
239 'randomSeed': config.randomSeed,
240 'outputStars': False,
241 'outputPath': os.path.abspath('.'),
242 'clobber': True,
243 'useSedLUT': False,
244 'resetParameters': resetFitParameters,
245 'doPlots': doPlots,
246 'outputFgcmcalZpts': True,
247 'outputZeropoints': outputZeropoints}
248
249 return configDict
250
251