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