Changeset 35512
- Timestamp:
- May 5, 2013, 2:20:46 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130419/pswarp
- Files:
-
- 11 edited
-
doc/notes.20130406.txt (modified) (1 diff)
-
src/Makefile.am (modified) (1 diff)
-
src/pswarp.c (modified) (3 diffs)
-
src/pswarp.h (modified) (2 diffs)
-
src/pswarpCleanup.c (modified) (2 diffs)
-
src/pswarpDefineLayout.c (modified) (2 diffs)
-
src/pswarpLoop.c (modified) (9 diffs)
-
src/pswarpMaskStats.c (modified) (2 diffs)
-
src/pswarpOverlaps.c (modified) (4 diffs)
-
src/pswarpPixelsLit.c (modified) (1 diff)
-
src/pswarpStatsFile.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130419/pswarp/doc/notes.20130406.txt
r35449 r35512 104 104 this with the filerules. 105 105 106 ** trouble running warp -> chip using astrometry from skycell (ok using astrom from warp) -
branches/eam_branches/ipp-20130419/pswarp/src/Makefile.am
r35424 r35512 50 50 pswarpTransformSources.c \ 51 51 pswarpTransformTile.c \ 52 pswarpUpdateStatistics.c \ 52 53 pswarpVersion.c \ 53 54 pswarpFiles.c -
branches/eam_branches/ipp-20130419/pswarp/src/pswarp.c
r35434 r35512 45 45 pswarpCleanup(config, statsFile); 46 46 } 47 48 # if (0)49 pswarpDumpOutput (config);50 exit (0);51 # endif52 53 47 // load and warp 54 48 if (!pswarpLoop(config, statsFile->md)) { 55 49 pswarpCleanup(config, statsFile); 56 50 } 57 pswarpDumpOutput (config);58 exit (0);59 51 60 52 # else … … 78 70 } 79 71 # endif 72 80 73 psLogMsg("pswarp", PS_LOG_INFO, "complete pswarp run: %f sec\n", psTimerMark("pswarp")); 81 74 pswarpCleanup(config, statsFile); … … 83 76 84 77 // NOTE: pswarpCleanup calls exit 78 79 // pswarpDumpOutput (config); 80 // exit (0); -
branches/eam_branches/ipp-20130419/pswarp/src/pswarp.h
r35449 r35512 189 189 } pswarpBounds; 190 190 191 bool pswarpFindOverlap (pmFPA * fpa, pswarpBounds *src, pswarpBounds *tgt);191 bool pswarpFindOverlap (pmFPA *input, pmFPA *output, pswarpBounds *src, pswarpBounds *tgt); 192 192 psProjection *pswarpLocalFrame (pmFPA *fpa); 193 193 pswarpBounds *pswarpMakeBounds (pmFPA *fpa, psProjection *frame); … … 199 199 bool pswarpTransformToTarget (pmFPA *output, pmReadout *input, pmConfig *config); 200 200 bool pswarpMakePSF (pmFPA *output); 201 bool pswarpUpdateStatistics (pmFPA *output, p mFPA *input, pmConfig *config);201 bool pswarpUpdateStatistics (pmFPA *output, psMetadata *stats, pmFPA *input, pmFPA *astrom, pmConfig *config); -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpCleanup.c
r35421 r35512 18 18 19 19 // Ensure everything is written out, at every level 20 pswarpFileActivation(config, detectorFiles, true); 20 pswarpFileActivation(config, detectorFiles, false); 21 pswarpFileActivation(config, photFiles, false); 22 pswarpFileActivation(config, independentFiles, false); 21 23 pswarpFileActivation(config, skycellFiles, true); 22 pswarpFileActivation(config, photFiles, true);23 pswarpFileActivation(config, independentFiles, true);24 24 25 if (!pswarpIOChecksAfter(config)) { 25 pmFPAfile *output = psMetadataLookupPtr(NULL, config->files, "PSWARP.OUTPUT"); 26 if (!output) { 27 psError(PSWARP_ERR_CONFIG, false, "Can't find output data!\n"); 28 pmFPAfileFreeSetStrict(false); 29 goto DONE; 30 } 31 32 pmFPAview *view = pmFPAviewAlloc(0); 33 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 34 psError(psErrorCodeLast(), false, "Unable to read files."); 35 pmFPAfileFreeSetStrict(false); 36 goto DONE; 37 } 38 pmChip *chip; 39 while ((chip = pmFPAviewNextChip (view, output->fpa, 1)) != NULL) { 40 psTrace ("pswarp", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 41 if (!chip->process || !chip->file_exists) { continue; } 42 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 43 psError(psErrorCodeLast(), false, "Unable to read files."); 44 pmFPAfileFreeSetStrict(false); 45 goto DONE; 46 } 47 pmCell *cell; 48 while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) { 49 psTrace ("pswarp", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 50 if (!cell->process || !cell->file_exists) { continue; } 51 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE) || 52 !pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) { 53 psError(psErrorCodeLast(), false, "Unable to read files."); 54 pmFPAfileFreeSetStrict(false); 55 goto DONE; 56 } 57 } 58 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) { 59 psError(psErrorCodeLast(), false, "Unable to write files."); 60 pmFPAfileFreeSetStrict(false); 61 goto DONE; 62 } 63 } 64 if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) { 26 65 psError(psErrorCodeLast(), false, "Unable to write files."); 27 exitValue = pswarpExitCode(exitValue);28 66 pmFPAfileFreeSetStrict(false); 67 goto DONE; 29 68 } 69 psFree(view); 30 70 31 71 if (!pswarpStatsFileSave (config, statsFile)) { … … 56 96 psLibFinalize(); 57 97 98 DONE: 58 99 exitValue = pswarpExitCode(exitValue); 59 100 exit (exitValue); -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpDefineLayout.c
r35434 r35512 53 53 54 54 // generate Lmin,max, Mmin,max for both datasets 55 fprintf (stderr, "srcBounds:\n");56 // pswarpBounds *srcBounds = pswarpMakeBounds (astrom->fpa, frame);57 55 pswarpBounds *srcBounds = pswarpMakeBounds (input->fpa, frame); 58 59 fprintf (stderr, "srcBounds:\n");60 56 pswarpBounds *tgtBounds = pswarpMakeBounds (skycell->fpa, frame); 61 57 62 pswarpFindOverlap (output->fpa, srcBounds, tgtBounds); 58 // find the output (tgt) chips which overlap the input (src) chips 59 pswarpFindOverlap (input->fpa, output->fpa, srcBounds, tgtBounds); 63 60 64 // XXX the loop below generates the output pixels. should this be deferred until 65 // we actually need them? 61 // The loop below generates the output pixels. XXX Should this be deferred until we 62 // actually need them? 63 66 64 // Generate the output chips (pixels on output->fpa, concepts from skycell->fpa) 67 65 pmFPAview *view = pmFPAviewAlloc(0); 66 67 // generate the output hdu and contents bits 68 pmFPAAddSourceFromFormat(output->fpa, output->format); 68 69 69 70 pmChip *chip; … … 115 116 cell->file_exists = true; 116 117 117 # if (0) 118 // ******* this chunk comes from pswarpLoop, but should be done when the output chip is generated 118 // copy the basic headers across from astrom ref to output 119 119 pmHDU *outHDU = pmHDUFromCell (cell); ///< HDU for the output warped image 120 120 outHDU->header = psMetadataCopy(outHDU->header, hdu->header); 121 121 pswarpVersionHeader(outHDU->header); 122 # endif123 122 } 124 123 } 125 126 // XXX not sure what this does...127 pmFPAviewReset (view);128 pmFPAAddSourceFromView(output->fpa, view, output->format);129 130 124 psFree (view); 131 125 return true; -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpLoop.c
r35434 r35512 36 36 if (!pswarpSetMaskBits(config)) { 37 37 psError(psErrorCodeLast(), false, "failed to set mask bits"); 38 return NULL;38 return false; 39 39 } 40 40 … … 83 83 // XXX pmFPAfileActivate(config->files, true, "PSWARP.OUTPUT.SOURCES"); 84 84 85 // Done with the detector side of things85 // the loops below load the input data 86 86 pswarpFileActivation(config, detectorFiles, true); 87 pswarpFileActivation(config, independentFiles, true); 87 88 // pswarpFileActivation(config, independentFiles, true); 88 89 89 90 pmFPAview *view = pmFPAviewAlloc(0); … … 95 96 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 96 97 psError(psErrorCodeLast(), false, "Unable to read files."); 97 goto DONE;98 goto FAIL; 98 99 } 99 100 … … 107 108 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 108 109 psError(psErrorCodeLast(), false, "Unable to read files."); 109 goto DONE;110 goto FAIL; 110 111 } 111 112 … … 116 117 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) { 117 118 psError(psErrorCodeLast(), false, "Unable to read files."); 118 goto DONE;119 goto FAIL; 119 120 } 120 121 … … 124 125 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 125 126 psError(psErrorCodeLast(), false, "Unable to read files."); 126 goto DONE;127 goto FAIL; 127 128 } 128 129 if (!readout->data_exists) { … … 145 146 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 146 147 psError(psErrorCodeLast(), false, "Unable to write files."); 147 goto DONE;148 goto FAIL; 148 149 } 149 150 } 150 151 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 151 152 psError(psErrorCodeLast(), false, "Unable to write files."); 152 goto DONE;153 goto FAIL; 153 154 } 154 155 } 155 156 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 156 157 psError(psErrorCodeLast(), false, "Unable to write files."); 157 goto DONE;158 goto FAIL; 158 159 } 159 160 } 160 161 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) { 161 162 psError(psErrorCodeLast(), false, "Unable to write files."); 162 goto DONE;163 goto FAIL; 163 164 } 164 165 … … 167 168 pswarpFileActivation(config, independentFiles, false); 168 169 169 // XXXX turn these on later .. pswarpUpdateStatistics (output); 170 if (!pswarpUpdateStatistics (output->fpa, stats, input->fpa, astrom->fpa, config)) { 171 psError(psErrorCodeLast(), false, "problem generating statistics."); 172 goto FAIL; 173 } 174 170 175 // XXXX turn these on later .. pswarpMakePSF (output); 171 172 176 // XXX have not yet written the output to disk 173 174 177 psFree(view); 175 176 DONE:177 178 return true; 179 180 FAIL: 181 psFree (view); 182 return false; 178 183 } 179 184 180 # if (0)181 185 // once the output fpa elements have been built, loop over the fpa and generate stats 182 186 // for each readout 183 bool pswarpUpdateStatistics (pmFPA *output, pmFPA *input, pmConfig *config) { 184 185 // output mask bits 186 psImageMaskType maskValue = psMetadataLookupImageMask(&status, recipe, "MASK.OUTPUT"); 187 psAssert (status, "MASK.OUTPUT was not defined"); 187 bool pswarpTransformToTarget (pmFPA *output, pmReadout *input, pmConfig *config) { 188 188 189 189 pmFPAview *view = pmFPAviewAlloc(0); … … 195 195 196 196 pmCell *cell; 197 while ((cell = pmFPAviewNextCell (view, output->fpa, 1)) != NULL) {198 psTrace ("pswarp", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);199 if (!cell->process || !cell->file_exists) { continue; }200 201 // process each of the readouts202 pmReadout *readout;203 while ((readout = pmFPAviewNextReadout(view, output->fpa, 1)) != NULL) {204 if (!readout->data_exists) {205 psWarning("No overlap between input and skycell.");206 if (stats) {207 psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,208 "No overlap between input and skycell", PSWARP_ERR_NO_OVERLAP);209 }210 psphotFilesActivate(config, false);211 psFree(cells);212 psFree(view);213 goto DONE;214 }215 216 if (!pswarpPixelsLit(readout, stats, config)) {217 psError(psErrorCodeLast(), false, "Unable to calculate pixel regions.");218 psFree(view);219 goto DONE;220 }221 bool doStats = psMetadataLookupBool(&mdok,recipe,"MASK.STATS");222 if (doStats) {223 if (!pswarpMaskStats(readout, stats, config)) {224 psError(psErrorCodeLast(), false, "Unable to calculate mask stats.");225 psFree(cells);226 psFree(view);227 goto DONE;228 }229 }230 231 // Set covariance matrix for output232 {233 psList *covariances = psMetadataLookupPtr(&mdok, output->analysis,234 PSWARP_ANALYSIS_COVARIANCES); // Covariance matrices235 psAssert(covariances, "Should be there");236 psArray *covars = psListToArray(covariances); // Array of covariance matrices237 psKernel *covar = psImageCovarianceAverage(covars);238 psFree(covars);239 psMetadataRemoveKey(output->analysis, PSWARP_ANALYSIS_COVARIANCES);240 241 // Correct covariance matrix scale for the mean (square root of the) Jacobian242 double jacobian = psMetadataLookupF64(NULL, output->analysis, PSWARP_ANALYSIS_JACOBIAN); // Jacobian243 int goodPixels = psMetadataLookupS32(NULL, output->analysis, PSWARP_ANALYSIS_GOODPIX); // Good pixels244 jacobian /= goodPixels;245 output->covariance = psImageCovarianceScale(covar, jacobian);246 psFree(covar);247 248 if (output->variance) {249 psImageCovarianceTransfer(output->variance, output->covariance);250 }251 }252 }253 254 // XXX need to get the input Cells for this output cell (save on the analysis somewhere255 // XXX skip this for now256 # if (0)257 psArray *inputCells = psMetadataLookupPtr (NULL, cell->analysis, "something");258 if (!pmConceptsAverageCells(cell, inputCells, NULL, NULL, false)) {259 psError(psErrorCodeLast(), false, "Unable to average cell concepts.");260 psFree(view);261 goto DONE;262 }263 # endif264 // XXX Is this too ad-hoc?265 psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC"); ///< Trim section266 trimsec->x0 = trimsec->x1 = trimsec->y0 = trimsec->y1 = 0; ///< All pixels267 268 }269 270 // Perform statistics on the output image271 if (stats) {272 // XXX this should be done at each level...273 if (!ppStatsFPA(stats, output->parent->parent->parent, view, maskValue, config)) {274 psWarning("Unable to perform statistics on warped image.");275 }276 }277 }278 if (!psMetadataCopy(output->concepts, input->concepts)) {279 psError(psErrorCodeLast(), false, "Unable to copy FPA concepts from input to output.");280 psFree(view);281 goto DONE;282 }283 284 // Update ZP from the astrometry285 {286 psMetadataItem *item = psMetadataLookup(outFPA->concepts, "FPA.ZP");287 item->data.F32 = psMetadataLookupF32(NULL, astrom->fpa->concepts, "FPA.ZP");288 }289 290 // need to update the chip and fpa level astrometry appropriate, see291 // code in psastro292 293 # if (0)294 // Add MD5 information for readout295 const char *chipName = psMetadataLookupStr(NULL, output->parent->parent->concepts, "CHIP.NAME");296 const char *cellName = psMetadataLookupStr(NULL, output->parent->concepts, "CELL.NAME");297 psString headerName = NULL; ///< Header name for MD5298 psStringAppend(&headerName, "MD5_%s_%s_%d", chipName, cellName, view->readout);299 psVector *md5 = psImageMD5(output->image); ///< md5 hash300 psString md5string = psMD5toString(md5); ///< String301 psFree(md5);302 psMetadataAddStr(hdu->header, PS_LIST_TAIL, headerName, PS_META_REPLACE,303 "Image MD5", md5string);304 psFree(md5string);305 psFree(headerName);306 # endif307 308 # if (0)309 if (!pmAstromWriteWCS(hdu->header, outFPA, outChip, WCS_NONLIN_TOL)) {310 psError(psErrorCodeLast(), false, "Unable to generate WCS header.");311 goto DONE;312 }313 # endif314 return true;315 }316 # endif317 318 # if (0)319 // We need a new PSF model for the warped frame. It would be good to generate this analytically, but320 // that's going to be tricky. We have a list of sources, so we use those to redetermine the PSF model.321 bool pswarpMakePSF (pmConfig *config) {322 323 // load the recipe324 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSWARP_RECIPE);325 if (!recipe) {326 psError(PSWARP_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);327 return false;328 }329 330 if (psMetadataLookupBool(&mdok, recipe, "PSF")) {331 pswarpFileActivation(config, photFiles, true);332 if (!pswarpIOChecksBefore(config)) {333 psError(psErrorCodeLast(), false, "Unable to read files.");334 goto DONE;335 }336 337 // supply the readout and fpa of interest to psphot338 pmFPAfile *photFile = psMetadataLookupPtr(NULL, config->files, "PSPHOT.INPUT");339 pmFPACopy(photFile->fpa, outFPA);340 341 pmFPAview *view = pmFPAviewAlloc(0); ///< View into skycell342 view->chip = view->cell = view->readout = 0;343 344 // grab the sources of interest from the storage location (pmFPAfile PSPHOT.INPUT.CMF)345 psArray *sources = psphotLoadPSFSources (config, view);346 if (!sources) {347 psError(psErrorCodeLast(), false, "No sources supplied to measure PSF");348 goto DONE;349 }350 351 pmModelClassSetLimits(PM_MODEL_LIMITS_STRICT);352 353 // measure the PSF using these sources354 if (!psphotReadoutFindPSF(config, view, "PSPHOT.INPUT", sources)) {355 // This is likely a data quality issue356 // XXX Split into multiple cases using error codes?357 psErrorStackPrint(stderr, "Unable to determine PSF");358 psWarning("Unable to determine PSF --- suspect bad data quality.");359 if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {360 psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,361 "Unable to determine PSF", psErrorCodeLast());362 }363 psErrorClear();364 psphotFilesActivate(config, false);365 }366 367 // Ensure seeing is carried over368 pmChip *photChip = pmFPAviewThisChip(view, photFile->fpa); // Chip with seeing369 psMetadataItem *item = psMetadataLookup(outChip->concepts, "CHIP.SEEING"); // Concept with seeing370 item->data.F32 = psMetadataLookupF32(NULL, photChip->concepts, "CHIP.SEEING");371 372 // XXX EAM : put this in a visualization function373 #if (TESTING)374 {375 #define PSF_SIZE 20 ///< Half-size of PSF376 #define PSF_FLUX 10000 ///< Central flux for PSF377 pmChip *photChip = pmFPAviewThisChip(view, photFile->fpa);378 pmPSF *psf = psMetadataLookupPtr(NULL, photChip->analysis, "PSPHOT.PSF");379 psImage *image = psImageAlloc(2 * PSF_SIZE + 1, 2 * PSF_SIZE + 1, PS_TYPE_F32);380 psImageInit(image, 0);381 pmModel *model = pmModelFromPSFforXY(psf, PSF_SIZE, PSF_SIZE, PSF_FLUX);382 pmModelAdd(image, NULL, model, PM_MODEL_OP_FULL, 0);383 psFree(model);384 psFits *fits = psFitsOpen("psf.fits", "w");385 psFitsWriteImage(fits, NULL, image, 0, NULL);386 psFitsClose(fits);387 psFree(image);388 }389 #endif390 391 psFree(view);392 }393 return true;394 }395 # endif396 397 // once the output fpa elements have been built, loop over the fpa and generate stats398 // for each readout399 bool pswarpTransformToTarget (pmFPA *output, pmReadout *input, pmConfig *config) {400 401 pmFPAview *view = pmFPAviewAlloc(0);402 403 pmChip *chip;404 while ((chip = pmFPAviewNextChip (view, output, 1)) != NULL) {405 psTrace ("pswarp", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);406 if (!chip->process || !chip->file_exists) { continue; }407 408 pmCell *cell;409 197 while ((cell = pmFPAviewNextCell (view, output, 1)) != NULL) { 410 198 psTrace ("pswarp", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpMaskStats.c
r28130 r35512 31 31 dynamicMaskVal,advisoryMaskVal)) { 32 32 psError(PS_ERR_UNKNOWN, false, "Unable to calculate masks for readout."); 33 return (false);33 return false; 34 34 } 35 35 psMetadataAddS32(stats, PS_LIST_TAIL,"MASKFRAC_NPIX", 0, … … 43 43 psMetadataAddF32(stats,PS_LIST_TAIL, "MASKFRAC_ADVISORY", 0, 44 44 "Fraction of pixels masked as an advisory", (float) Npix_advisory / Npix_valid); 45 return (true);45 return true; 46 46 } -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpOverlaps.c
r35434 r35512 45 45 if (!chip->process || !chip->file_exists) { 46 46 // this ensures one entry per chip (regardless of existence) 47 // XXX maybe not?pswarpBoundsAppend (bounds, NAN, NAN, NAN, NAN);47 pswarpBoundsAppend (bounds, NAN, NAN, NAN, NAN); 48 48 continue; 49 49 } … … 83 83 } 84 84 } 85 fprintf (stderr, "bounds %d : %f - %f, %f - %f\n", view->chip, Pmin, Pmax, Qmin, Qmax);85 // fprintf (stderr, "bounds %d : %f - %f, %f - %f\n", view->chip, Pmin, Pmax, Qmin, Qmax); 86 86 pswarpBoundsAppend (bounds, Pmin, Pmax, Qmin, Qmax); 87 87 } … … 164 164 } 165 165 166 bool pswarpFindOverlap (pmFPA * fpa, pswarpBounds *src, pswarpBounds *tgt) {166 bool pswarpFindOverlap (pmFPA *input, pmFPA *output, pswarpBounds *src, pswarpBounds *tgt) { 167 167 168 168 // we have the source and target bounds. loop over all output elements and check if any of the source 169 169 // elements overlap it. 170 170 171 assert (fpa->chips->n == tgt->Pmin->n); 172 173 for (int j = 0; j < fpa->chips->n; j++) { 174 pmChip *chip = fpa->chips->data[j]; 171 // also add the list if input (src) cells which land on each output (tgt) chip we do this 172 // by only identifying the input and output chips and adding all input chip cells to each 173 // output cell 174 175 assert (output->chips->n == tgt->Pmin->n); 176 assert (input->chips->n == src->Pmin->n); 177 178 for (int j = 0; j < output->chips->n; j++) { 179 pmChip *chip = output->chips->data[j]; 175 180 176 181 // we have src bounds … … 180 185 float Qmax = tgt->Qmax->data.F32[j]; 181 186 182 bool valid = false; 183 for (int i = 0; !valid && (i < src->Pmin->n); i++) { 187 psArray *inputChips = psArrayAllocEmpty(8); 188 189 bool hasOverlap = false; 190 for (int i = 0; i < src->Pmin->n; i++) { 184 191 // overlaps in P? 185 bool Pvalid = (Pmin < src->Pmax->data.F32[i]) && (Pmax > src->Pmin->data.F32[i]); 186 bool Qvalid = (Qmin < src->Qmax->data.F32[i]) && (Qmax > src->Qmin->data.F32[i]); 187 valid = Pvalid && Qvalid; 188 } 189 // if (valid) { 190 // fprintf (stderr, "chip %d is valid\n", j); 191 // } else { 192 // fprintf (stderr, "chip %d is NOT valid\n", j); 193 // } 194 chip->process = valid; 192 if (!isfinite(src->Pmin->data.F32[i])) continue; 193 if (!isfinite(src->Pmax->data.F32[i])) continue; 194 if (!isfinite(src->Qmin->data.F32[i])) continue; 195 if (!isfinite(src->Qmax->data.F32[i])) continue; 196 197 if (Pmin > src->Pmax->data.F32[i]) continue; 198 if (Pmax < src->Pmin->data.F32[i]) continue; 199 200 if (Qmin > src->Qmax->data.F32[i]) continue; 201 if (Qmax < src->Qmin->data.F32[i]) continue; 202 203 hasOverlap = true; 204 psArrayAdd (inputChips, 1, input->chips->data[i]); 205 } 206 chip->process = hasOverlap; 207 if (hasOverlap) { 208 // get the complete list of input cells for this set of input chips 209 // pmConceptsAverageCells needs a psList (not a psArray) 210 psList *inputCells = psListAlloc(NULL); 211 for (int nChip = 0; nChip < inputChips->n; nChip++) { 212 pmChip *inputChip = inputChips->data[nChip]; 213 for (int nCell = 0; nCell < inputChip->cells->n; nCell++) { 214 fprintf (stderr, "input %d, %d : output %d\n", nChip, nCell, j); 215 psListAdd (inputCells, PS_LIST_TAIL, inputChip->cells->data[nCell]); 216 } 217 } 218 219 // place the inputCells on each of the output cells 220 for (int nCell = 0; nCell < chip->cells->n; nCell++) { 221 pmCell *outputCell = chip->cells->data[nCell]; 222 psMetadataAddPtr(outputCell->analysis, PS_LIST_TAIL, "INPUT.CELLS", PS_DATA_LIST , "input cells touching this output cell", inputCells); 223 } 224 psFree (inputCells); 225 } 226 psFree (inputChips); 195 227 } 196 228 return true; -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpPixelsLit.c
r23688 r35512 64 64 for (int y = 0; y < numRows; y++) { 65 65 for (int x = 0; x < numCols; x++) { 66 if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskValue)) { 67 if (y > yMax) { 68 yMax = y; 69 } 70 if (y < yMin) { 71 yMin = y; 72 } 73 if (x > xMax) { 74 xMax = x; 75 } 76 if (x < xMin) { 77 xMin = x; 78 } 79 } 66 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] & maskValue) { continue; } 67 xMin = PS_MIN (xMin, x); 68 xMax = PS_MAX (xMax, x); 69 yMin = PS_MIN (yMin, y); 70 yMax = PS_MAX (yMax, y); 80 71 } 81 72 } 82 73 74 // XXX need to add these in a container appropriate to the element 83 75 if (stats) { 84 76 psMetadataAddS32(stats, PS_LIST_TAIL, "RANGE.XMIN", 0, "Minimum valid x value", xMin); -
branches/eam_branches/ipp-20130419/pswarp/src/pswarpStatsFile.c
r35421 r35512 37 37 38 38 pswarpStatsFile *statsFile = pswarpStatsFileAlloc (); 39 statsFile->name = name;39 statsFile->name = psMemIncrRefCounter(name); 40 40 41 41 if (!mdok) return statsFile; // XXX this is probably a config error, but treat as ok for now
Note:
See TracChangeset
for help on using the changeset viewer.
