Changeset 10877
- Timestamp:
- Jan 2, 2007, 2:57:10 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/pmAstrometryDistortion.c
r10872 r10877 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $10 * @date $Date: 2007-01-0 1 21:05:09$9 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-01-03 00:57:10 $ 11 11 * 12 12 * Copyright 2006 Institute for Astronomy, University of Hawaii … … 77 77 int Ymax = Ymin + DY; 78 78 79 psStats *stats = NULL; 80 psVector *mask = NULL; 81 pmAstromGradient *grad = NULL; 82 79 83 psVector *L = psVectorAllocEmpty (100, PS_TYPE_F32); 80 84 psVector *M = psVectorAllocEmpty (100, PS_TYPE_F32); 81 85 psVector *dP = psVectorAllocEmpty (100, PS_TYPE_F32); 82 86 psVector *dQ = psVectorAllocEmpty (100, PS_TYPE_F32); 83 int Npts = 0;84 87 85 88 // XXX this is a bit inefficient: first sorting by X or Y could speed this up. 86 89 // XXX or assigning to a segment in a single pass first 87 90 // select the stars within this chip region 91 int Npts = 0; 88 92 for (int i = 0; i < matches->n; i++) { 89 93 … … 106 110 M->data.F32[Npts] = ref->FP->y; 107 111 108 dP->data.F32[Npts] = ref->TP->x - raw->TP->x; 109 dQ->data.F32[Npts] = ref->TP->y - raw->TP->y; 112 // P,Q = L,M + terms of order epsilon. 113 // measuring the gradient constrains thos terms 114 dP->data.F32[Npts] = ref->TP->x - raw->FP->x; 115 dQ->data.F32[Npts] = ref->TP->y - raw->FP->y; 110 116 111 117 psVectorExtend (L, 100, 1); … … 115 121 Npts++; 116 122 } 123 117 124 if (Npts < 5) 118 continue;125 goto skip; 119 126 120 127 // stats structure and mask for use in measuring the clipping statistic 121 128 // this analysis has too few data points to use the robust median method 122 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);123 psVector *mask = psVectorAlloc (Npts, PS_TYPE_MASK);129 stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 130 mask = psVectorAlloc (Npts, PS_TYPE_MASK); 124 131 psVectorInit (mask, 0); 125 132 126 pmAstromGradient *grad = pmAstromGradientAlloc ();133 grad = pmAstromGradientAlloc (); 127 134 128 135 // fit the collection of positions and offsets with a local 1st order gradient … … 130 137 // the mask is used to mark the points which pass / fail the fit 131 138 if (!psVectorClipFitPolynomial2D (local, stats, mask, 0xff, dP, NULL, L, M)) { 132 psFree (grad); 133 continue; 139 goto skip; 134 140 } 135 141 … … 141 147 // the mask is used to mark the points which pass / fail the fit 142 148 if (!psVectorClipFitPolynomial2D (local, stats, mask, 0xff, dQ, NULL, L, M)) { 143 psFree (grad); 144 continue; 149 goto skip; 145 150 } 146 151 … … 156 161 157 162 psArrayAdd (gradients, 100, grad); 163 164 skip: 158 165 psFree (grad); 159 166 psFree (stats); 160 167 psFree (mask); 161 } 162 } 168 psFree (L); 169 psFree (M); 170 psFree (dP); 171 psFree (dQ); 172 } 173 } 174 psFree (local); 163 175 return gradients; 164 176 } … … 191 203 M->data.F32[i] = grad->FP.y; 192 204 } 193 194 char key;195 pmKapaPlotVectorPair (L, M);196 fscanf (stdin, "%c", &key);197 198 pmKapaPlotVectorPair (L, dPdL);199 fscanf (stdin, "%c", &key);200 201 pmKapaPlotVectorPair (L, dPdM);202 fscanf (stdin, "%c", &key);203 204 pmKapaPlotVectorPair (L, dQdL);205 fscanf (stdin, "%c", &key);206 207 pmKapaPlotVectorPair (L, dQdM);208 fscanf (stdin, "%c", &key);209 205 210 206 // mask and stats structure for measuring the clipping statistic
Note:
See TracChangeset
for help on using the changeset viewer.
