Changeset 41510 for trunk/pswarp/src/pswarpLoopBackground.c
- Timestamp:
- Mar 3, 2021, 3:05:40 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/pswarp/src/pswarpLoopBackground.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pswarp/src/pswarpLoopBackground.c
r40354 r41510 55 55 if (!status) { 56 56 psError(PSWARP_ERR_DATA, true, "number of inputs is not defined (programming error)"); 57 psFree (view); 57 58 return false; 58 59 } … … 90 91 pmFPAviewReset (view); 91 92 92 pmFPAview *view = pmFPAviewAlloc(0);93 if (!pmFPAfileIOChecks(config, view , PM_FPA_BEFORE)) {93 pmFPAview *viewT2 = pmFPAviewAlloc(0); 94 if (!pmFPAfileIOChecks(config, viewT2, PM_FPA_BEFORE)) { 94 95 psError(psErrorCodeLast(), false, "Unable to read files."); 96 psFree (viewT2); 95 97 goto FAIL; 96 98 } 97 99 98 100 pmChip *chip; 99 while ((chip = pmFPAviewNextChip (view , input->fpa, 1)) != NULL) {101 while ((chip = pmFPAviewNextChip (viewT2, input->fpa, 1)) != NULL) { 100 102 if (!chip->process || !chip->file_exists) { continue; } 101 if (!pmFPAfileIOChecks(config, view , PM_FPA_BEFORE)) {103 if (!pmFPAfileIOChecks(config, viewT2, PM_FPA_BEFORE)) { 102 104 psError(psErrorCodeLast(), false, "Unable to read files."); 105 psFree (viewT2); 103 106 goto FAIL; 104 107 } … … 107 110 double xBin = NAN; 108 111 double yBin = NAN; 109 pswarpGetInputScales (&xBin, &yBin, config, view , chip);112 pswarpGetInputScales (&xBin, &yBin, config, viewT2, chip); 110 113 double fluxRatio = xBin * yBin / (float) (xGrid * yGrid); 111 114 112 if (!pswarpModifyChipAstrom (config, view , chip, astrom, bilevelAstrometry, xBin, yBin)) {115 if (!pswarpModifyChipAstrom (config, viewT2, chip, astrom, bilevelAstrometry, xBin, yBin)) { 113 116 psError(psErrorCodeLast(), false, "failed to set BKGMODEL astrometry."); 117 psFree (viewT2); 114 118 goto FAIL; 115 119 } 116 120 117 121 pmCell *cell; 118 while ((cell = pmFPAviewNextCell (view , input->fpa, 1)) != NULL) {119 psTrace ("pswarp", 4, "ACell %d: %x %x %d\n", view ->cell, cell->file_exists, cell->process,psErrorCodeLast());122 while ((cell = pmFPAviewNextCell (viewT2, input->fpa, 1)) != NULL) { 123 psTrace ("pswarp", 4, "ACell %d: %x %x %d\n", viewT2->cell, cell->file_exists, cell->process,psErrorCodeLast()); 120 124 if (!cell->process || !cell->file_exists) { continue; } 121 if (!pmFPAfileIOChecks (config, view , PM_FPA_BEFORE)) {125 if (!pmFPAfileIOChecks (config, viewT2, PM_FPA_BEFORE)) { 122 126 psError(psErrorCodeLast(), false, "Unable to read files."); 127 psFree (viewT2); 123 128 goto FAIL; 124 129 } … … 126 131 // process each of the readouts 127 132 pmReadout *readout; 128 while ((readout = pmFPAviewNextReadout(view , input->fpa, 1)) != NULL) {129 if (!pmFPAfileIOChecks(config, view , PM_FPA_BEFORE)) {133 while ((readout = pmFPAviewNextReadout(viewT2, input->fpa, 1)) != NULL) { 134 if (!pmFPAfileIOChecks(config, viewT2, PM_FPA_BEFORE)) { 130 135 psError(psErrorCodeLast(), false, "Unable to read files."); 136 psFree (viewT2); 131 137 goto FAIL; 132 138 } … … 136 142 137 143 if (astrom != input) { 138 pmReadout *astromRO = pmFPAviewThisReadout(view, astrom->fpa); // Readout for astrometry 139 if ((!refcat)&&(astromRO)) { 140 if ((astromRO->parent->parent->hdu->header)&&(output->fpa->analysis)) { 141 psMetadataItem *refItem = psMetadataLookup(astromRO->parent->parent->hdu->header, "PSREFCAT"); 142 if (refItem) { 143 refcat = psMetadataLookupStr(NULL, astromRO->parent->parent->hdu->header, "PSREFCAT"); 144 psMetadataAddStr(output->fpa->analysis, PS_LIST_TAIL, "REFERENCE_CATALOG", PS_META_REPLACE, 145 "Reference catalog used for calibration.", refcat); 146 } 144 pmReadout *astromRO = pmFPAviewThisReadout(viewT2, astrom->fpa); // Readout for astrometry 145 if ((!refcat)&&(astromRO)) { 146 if ((astromRO->parent->parent->hdu->header)&&(output->fpa->analysis)) { 147 psMetadataItem *refItem = psMetadataLookup(astromRO->parent->parent->hdu->header, "PSREFCAT"); 148 if (refItem) { 149 refcat = psMetadataLookupStr(NULL, astromRO->parent->parent->hdu->header, "PSREFCAT"); 150 psMetadataAddStr(output->fpa->analysis, PS_LIST_TAIL, "REFERENCE_CATALOG", PS_META_REPLACE, 151 "Reference catalog used for calibration.", refcat); 152 } 153 } 147 154 } 148 }149 155 } 150 156 … … 159 165 pswarpTransformToTarget (output->fpa, readout, config, true); 160 166 161 if (!pmFPAfileIOChecks (config, view , PM_FPA_AFTER)) { // Readout167 if (!pmFPAfileIOChecks (config, viewT2, PM_FPA_AFTER)) { // Readout 162 168 psError(psErrorCodeLast(), false, "Unable to close files."); 169 psFree (viewT2); 163 170 goto FAIL; 164 171 } 165 172 } 166 173 167 if (!pmFPAfileIOChecks (config, view , PM_FPA_AFTER)) { // Cell174 if (!pmFPAfileIOChecks (config, viewT2, PM_FPA_AFTER)) { // Cell 168 175 psError(psErrorCodeLast(), false, "Unable to close files."); 176 psFree (viewT2); 169 177 goto FAIL; 170 178 } 171 179 } 172 180 173 if (!pmFPAfileIOChecks (config, view , PM_FPA_AFTER)) { // Chip181 if (!pmFPAfileIOChecks (config, viewT2, PM_FPA_AFTER)) { // Chip 174 182 psError(psErrorCodeLast(), false, "Unable to close files."); 183 psFree (viewT2); 175 184 goto FAIL; 176 185 } 177 186 } 178 187 179 if (!pmFPAfileIOChecks (config, view , PM_FPA_AFTER)) { // FPA188 if (!pmFPAfileIOChecks (config, viewT2, PM_FPA_AFTER)) { // FPA 180 189 psError(psErrorCodeLast(), false, "Unable to close files."); 190 psFree (viewT2); 181 191 goto FAIL; 182 192 } … … 184 194 if (!pswarpUpdateMetadata (output->fpa, skycell->fpa, input->fpa, astrom->fpa, config, false)) { 185 195 psError(psErrorCodeLast(), false, "problem generating statistics."); 196 psFree (viewT2); 186 197 goto FAIL; 187 198 } 199 psFree (viewT2); 188 200 } 189 201
Note:
See TracChangeset
for help on using the changeset viewer.
