- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pswarp/src/pswarpTransformSources.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/pswarp/src/pswarpTransformSources.c
r25758 r27838 31 31 32 32 // Transform sources 33 psArray *inSources = psMetadataLookupPtr(&mdok, input->analysis, "PSPHOT.SOURCES"); // Sources in source 33 pmDetections *inDetections = psMetadataLookupPtr(&mdok, input->analysis, "PSPHOT.DETECTIONS"); // Sources in source 34 if (!inDetections) return true; 35 psArray *inSources = inDetections->allSources; 34 36 if (!inSources) return true; 35 37 36 38 pswarpMapGrid *sourceGrid = pswarpMapGridFromImage(output, input, nGridX, nGridY); // Grid for sources 37 39 38 psArray *outSources = psMemIncrRefCounter(psMetadataLookupPtr(&mdok, output->analysis, "PSPHOT.SOURCES")); // Target sources 40 pmDetections *outDetections = psMemIncrRefCounter(psMetadataLookupPtr(&mdok, output->analysis, "PSPHOT.DETECTIONS")); // Target sources 41 if (!outDetections) { 42 outDetections = pmDetectionsAlloc(); 43 psMetadataAddPtr(output->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_DATA_ARRAY, "Warped sources", outDetections); 44 } 45 psArray *outSources = outDetections->allSources; 39 46 if (!outSources) { 40 outSources = psArrayAllocEmpty(SOURCE_ARRAY_BUFFER); 41 psMetadataAddPtr(output->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, 42 "Warped sources", outSources); 47 outDetections->allSources = psArrayAllocEmpty(SOURCE_ARRAY_BUFFER); 48 outSources = outDetections->allSources; 43 49 } 44 50 … … 54 60 55 61 int xGrid, yGrid; ///< Grid coordinates for local map 56 if (!pswarpMapGridSetGrid(sourceGrid, xIn + 0.5, yIn + 0.5, &xGrid, &yGrid)) {57 psError( PS_ERR_UNKNOWN, false, "Unable to get grid coordinates for source at %f,%f\n",62 if (!pswarpMapGridSetGrid(sourceGrid, xIn, yIn, &xGrid, &yGrid)) { 63 psError(psErrorCodeLast(), false, "Unable to get grid coordinates for source at %f,%f\n", 58 64 xIn, yIn); 59 psFree(out Sources);65 psFree(outDetections); 60 66 psFree(sourceGrid); 61 67 return false; … … 69 75 pswarpMap *map = sourceGrid->maps[xGrid][yGrid]; ///< Locally linear transformation 70 76 double xOut, yOut; ///< Output coordinates 71 if (!pswarpMapApply(&xOut, &yOut, map, xIn + 0.5, yIn + 0.5)) {72 psError( PS_ERR_UNKNOWN, false, "Unable to transform coordinates for source at %f,%f\n",77 if (!pswarpMapApply(&xOut, &yOut, map, xIn, yIn)) { 78 psError(psErrorCodeLast(), false, "Unable to transform coordinates for source at %f,%f\n", 73 79 xIn, yIn); 74 psFree(out Sources);80 psFree(outDetections); 75 81 psFree(sourceGrid); 76 82 return false; 77 83 } 78 xOut += output->image->col0 - 0.5;79 yOut += output->image->row0 - 0.5;84 xOut += output->image->col0; 85 yOut += output->image->row0; 80 86 if (xOut < minX || xOut > maxX || yOut < minY || yOut > maxY) { 81 87 // It's not in the output image … … 105 111 106 112 new->modelPSF = pmModelAlloc(source->modelPSF->type); 107 new->modelPSF->params->data.F32[PM_PAR_I0]=108 (isfinite(new->psfMag) ? pow(10.0, -0.4*new->psfMag) : NAN);109 new->modelPSF->dparams->data.F32[PM_PAR_I0]=110 (isfinite(new->psfMag) ? new->errMag*pow(10.0, -0.4*new->psfMag) : NAN);113 new->modelPSF->params->data.F32[PM_PAR_I0]= 114 (isfinite(new->psfMag) ? pow(10.0, -0.4*new->psfMag) : NAN); 115 new->modelPSF->dparams->data.F32[PM_PAR_I0]= 116 (isfinite(new->psfMag) ? new->errMag*pow(10.0, -0.4*new->psfMag) : NAN); 111 117 112 118 #if 0 … … 142 148 } 143 149 psFree(sourceGrid); 144 psFree(out Sources); // Drop reference150 psFree(outDetections); // Drop reference 145 151 return true; 146 152 }
Note:
See TracChangeset
for help on using the changeset viewer.
