Changeset 29935
- Timestamp:
- Dec 5, 2010, 9:33:17 PM (15 years ago)
- Location:
- trunk/psModules/src
- Files:
-
- 7 edited
-
camera/pmFPAFlags.c (modified) (2 diffs)
-
camera/pmFPAFlags.h (modified) (2 diffs)
-
camera/pmFPAfileIO.c (modified) (8 diffs)
-
config/pmConfigDump.c (modified) (1 diff)
-
detrend/pmNonLinear.c (modified) (4 diffs)
-
objects/pmSource.c (modified) (1 diff)
-
objects/pmSourcePhotometry.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAFlags.c
r15477 r29935 49 49 } 50 50 51 bool pmReadoutSetFileStatus(pmReadout *readout, bool status) 52 { 53 PS_ASSERT_PTR_NON_NULL(readout, false); 54 55 readout->file_exists = status; 56 return true; 57 } 58 59 bool pmFPAviewSetFileStatus (pmFPA *fpa, const pmFPAview *view, bool status) { 60 61 PS_ASSERT_PTR_NON_NULL(fpa, false); 62 PS_ASSERT_PTR_NON_NULL(view, false); 63 64 if (view->chip == -1) { 65 bool set = pmFPASetFileStatus (fpa, status); 66 return set; 67 } 68 69 if (view->chip >= fpa->chips->n) { 70 psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n); 71 return false; 72 } 73 pmChip *chip = fpa->chips->data[view->chip]; 74 75 if (view->cell == -1) { 76 bool set = pmChipSetFileStatus (chip, status); 77 return set; 78 } 79 80 if (view->cell >= chip->cells->n) { 81 psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n); 82 return false; 83 } 84 pmCell *cell = chip->cells->data[view->cell]; 85 86 if (view->readout == -1) { 87 bool set = pmCellSetFileStatus (cell, status); 88 return set; 89 } 90 91 if (view->readout >= cell->readouts->n) { 92 psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n); 93 return false; 94 } 95 pmReadout *readout = cell->readouts->data[view->readout]; 96 97 bool set = pmReadoutSetFileStatus (readout, status); 98 return set; 99 } 100 51 101 bool pmFPACheckFileStatus(const pmFPA *fpa) 52 102 { … … 125 175 for (int i = 0; i < cell->readouts->n; i++) { 126 176 pmReadout *readout = cell->readouts->data[i]; 127 readout->data_exists = status; 128 } 129 return true; 177 pmReadoutSetDataStatus(readout, status); 178 } 179 return true; 180 } 181 182 bool pmReadoutSetDataStatus (pmReadout *readout, bool status) 183 { 184 PS_ASSERT_PTR_NON_NULL(readout, false); 185 186 readout->data_exists = status; 187 return true; 188 } 189 190 bool pmFPAviewSetDataStatus (pmFPA *fpa, const pmFPAview *view, bool status) { 191 192 PS_ASSERT_PTR_NON_NULL(fpa, false); 193 PS_ASSERT_PTR_NON_NULL(view, false); 194 195 if (view->chip == -1) { 196 bool set = pmFPASetDataStatus (fpa, status); 197 return set; 198 } 199 200 if (view->chip >= fpa->chips->n) { 201 psError(PS_ERR_IO, true, "Requested chip == %d >= fpa->chips->n == %ld", view->chip, fpa->chips->n); 202 return false; 203 } 204 pmChip *chip = fpa->chips->data[view->chip]; 205 206 if (view->cell == -1) { 207 bool set = pmChipSetDataStatus (chip, status); 208 return set; 209 } 210 211 if (view->cell >= chip->cells->n) { 212 psError(PS_ERR_IO, true, "Requested cell == %d >= chip->cells->n == %ld", view->cell, chip->cells->n); 213 return false; 214 } 215 pmCell *cell = chip->cells->data[view->cell]; 216 217 if (view->readout == -1) { 218 bool set = pmCellSetDataStatus (cell, status); 219 return set; 220 } 221 222 if (view->readout >= cell->readouts->n) { 223 psError(PS_ERR_IO, true, "Requested readout == %d >= cell->readouds->n == %ld", view->readout, cell->readouts->n); 224 return false; 225 } 226 pmReadout *readout = cell->readouts->data[view->readout]; 227 228 bool set = pmReadoutSetDataStatus (readout, status); 229 return set; 130 230 } 131 231 -
trunk/psModules/src/camera/pmFPAFlags.h
r13190 r29935 34 34 ); 35 35 36 bool pmReadoutSetFileStatus(pmReadout *readout, bool status); 37 38 bool pmFPAviewSetFileStatus (pmFPA *fpa, const pmFPAview *view, bool status); 39 36 40 // Functions to check the file_exists flags 37 41 … … 65 69 ); 66 70 71 bool pmReadoutSetDataStatus (pmReadout *readout, bool status); 72 73 bool pmFPAviewSetDataStatus (pmFPA *fpa, const pmFPAview *view, bool status); 67 74 68 75 // Functions the check the data_exists flags -
trunk/psModules/src/camera/pmFPAfileIO.c
r29833 r29935 135 135 PS_ASSERT_PTR_NON_NULL(view, false); 136 136 137 // an internal file should not be sent here (should not be left on config->files)138 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false);139 140 137 // skip the following states 141 138 if (file->state & PM_FPA_STATE_INACTIVE) { … … 143 140 return true; 144 141 } 142 143 // an active internal file should not be sent here (should not be left on config->files) 144 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); 145 145 146 if (file->mode != PM_FPA_MODE_READ) { 146 147 psTrace("psModules.camera", 6, "skip read for %s, mode is not READ", file->name); … … 258 259 return true; 259 260 } 261 262 // an active internal file should not be returned to here 263 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); 264 260 265 if (file->mode != PM_FPA_MODE_WRITE) { 261 266 psTrace("psModules.camera", 6, "skip create for non-write file %s", file->name); 262 267 return true; 263 268 } 264 265 // an internal file should not be returned to here266 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false);267 269 268 270 // get the current level … … 335 337 } 336 338 339 // an ACTIVE internal file should not be sent here 340 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); 341 337 342 if (file->mode != PM_FPA_MODE_WRITE) { 338 343 psTrace("psModules.camera", 6, "skip write for %s, mode is not WRITE", file->name); 339 344 return true; 340 }341 342 // an internal file should not be returned to here343 if (file->mode == PM_FPA_MODE_INTERNAL) {344 psError(PS_ERR_IO, true, "File is mode PM_FPA_MODE_INTERNAL");345 return false;346 345 } 347 346 … … 523 522 PS_ASSERT_PTR_NON_NULL(view, false); 524 523 525 // an internal file should not be sent here (should not be left on config->files)526 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false);527 528 524 // skip the following states 529 525 if (file->state & PM_FPA_STATE_INACTIVE) { … … 531 527 return true; 532 528 } 529 533 530 if (file->state == PM_FPA_STATE_CLOSED) { 534 531 psTrace("psModules.camera", 6, "skip close for %s, files is closed", file->name); 535 532 return true; 536 533 } 534 535 // an active internal file should not be sent here (should not be left on config->files) 536 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); 537 537 538 538 // is current level == open level? … … 596 596 PS_ASSERT_PTR_NON_NULL(view, false); 597 597 598 // an internal file should not be sent here (should not be left on config->files)599 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false);600 601 598 if (file->state & PM_FPA_STATE_INACTIVE) { 602 599 psTrace("psModules.camera", 6, "skip free for %s, files is inactive", file->name); 603 600 return true; 604 601 } 602 603 // an active internal file should not be sent here (should not be left on config->files) 604 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); 605 605 606 606 // get the current level … … 746 746 } 747 747 748 // these are programming errors748 // an ACTIVE internal file should not be sent here 749 749 PS_ASSERT(file->mode != PM_FPA_MODE_NONE, false); 750 750 PS_ASSERT(file->mode != PM_FPA_MODE_INTERNAL, false); -
trunk/psModules/src/config/pmConfigDump.c
r27147 r29935 150 150 } 151 151 152 if (!psMetadataConfigWrite(config->user, resolved)) { 152 // check for Metadata compression options: 153 char *compressMode; 154 bool status = false; 155 if (config->camera) { 156 compressMode = psMetadataLookupStr(&status, config->camera, "METADATA.COMPRESSION"); 157 } 158 159 if (!psMetadataConfigWrite(config->user, resolved, compressMode)) { 153 160 psError(psErrorCodeLast(), false, "Unable to dump configuration to %s", filename); 154 161 psFree(resolved); -
trunk/psModules/src/detrend/pmNonLinear.c
r29833 r29935 332 332 return(0.0); 333 333 } 334 /* if (flux > correction_fluxes->data.F32[bin]) { */335 /* return(0.0); */336 /* } */337 334 338 335 for (int i = 0; i < correction_fluxes->n - 1; i++) { … … 347 344 } 348 345 349 /* PS_BIN_FOR_VALUE(bin,correction_fluxes,flux); */350 /* if ((bin < 0)||(bin > correction_fluxes->n)) { */351 /* return(1.0); */352 /* } */353 354 /* PS_BIN_INTERPOLATE(result,correction_fluxes,correction_factors,bin,flux); */355 346 if (!isfinite(result)) { 356 347 result = 0.0; 357 348 } 358 /* if (result <= 0) { */359 /* result = 1.0; */360 /* } */361 349 return(result); 362 350 } … … 372 360 return(0.0); 373 361 } 374 /* if (flux > correction_fluxes->data.F32[bin]) { */375 /* return(0.0); */376 /* } */377 362 378 363 for (int i = 0; i < correction_fluxes->n - 1; i++) { … … 389 374 } 390 375 391 /* PS_BIN_FOR_VALUE(bin,correction_fluxes,flux); */392 /* if ((bin < 0)||(bin > correction_fluxes->n)) { */393 /* return(1.0); */394 /* } */395 396 /* PS_BIN_INTERPOLATE(result,correction_fluxes,correction_factors,bin,flux); */397 376 if (!isfinite(result)) { 398 377 result = 0.0; 399 378 } 400 /* if (result <= 0) { */401 /* result = 1.0; */402 /* } */403 379 return(result); 404 380 } 405 406 407 -
trunk/psModules/src/objects/pmSource.c
r29546 r29935 189 189 // pixels. Modifying these pixels (ie, subtracting the model) will affect the pixels seen 190 190 // by all copies. 191 source->pixels = psImageCopyView(NULL, in->pixels);192 source->variance = psImageCopyView(NULL, in->variance);191 source->pixels = in->pixels ? psImageCopyView(NULL, in->pixels) : NULL; 192 source->variance = in->variance ? psImageCopyView(NULL, in->variance) : NULL; 193 193 source->maskView = in->maskView ? psImageCopyView(NULL, in->maskView) : NULL; 194 194 -
trunk/psModules/src/objects/pmSourcePhotometry.c
r29546 r29935 107 107 // XXX handle negative flux, low-significance 108 108 if (model->dparams->data.F32[PM_PAR_I0] > 0) { 109 SN = model->params->data.F32[PM_PAR_I0] / model->dparams->data.F32[PM_PAR_I0];109 SN = fabs(model->params->data.F32[PM_PAR_I0] / model->dparams->data.F32[PM_PAR_I0]); 110 110 source->errMag = 1.0 / SN; 111 111 } else { … … 331 331 } 332 332 if (apFluxOut) *apFluxOut = apFlux; 333 if (apFluxErr) *apFluxErr = sqrt( apFluxVar);333 if (apFluxErr) *apFluxErr = sqrt(fabs(apFluxVar)); 334 334 335 335 if (apFlux <= 0) {
Note:
See TracChangeset
for help on using the changeset viewer.
