Changeset 5509
- Timestamp:
- Nov 12, 2005, 9:58:04 AM (20 years ago)
- Location:
- trunk/psastro/src
- Files:
-
- 4 edited
-
psastro.c (modified) (2 diffs)
-
psastro.h (modified) (1 diff)
-
psastroBuildFPA.c (modified) (4 diffs)
-
psastroUtils.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastro.c
r5505 r5509 14 14 15 15 // simple layout interpretation, basic WCS conversion 16 psFPA *fpa = psastroBuildFPA (header, config);16 psFPA *fpa = psastroBuildFPA (header, rawstars); 17 17 18 18 // limit fit to bright stars only 19 ps Array *subset = pspsastroSelectBrightStars (config, rawstars);19 psFPA *subset = psastroSelectBrightStars (fpa, config); 20 20 21 21 // use the header & config info to project rawstars on the focal plane 22 psastroProjectRawstars (subset , header, config);22 psastroProjectRawstars (subset); 23 23 24 24 // load the corresponding reference data (DVO command) … … 26 26 27 27 // use the header & config info to project refstars on the focal plane 28 psastroProjectRefstars (refstars, header, config);28 psastroProjectRefstars (refstars, subset); 29 29 30 // find initial offset / rotation 31 stat = pmAstromGridMatch (subset, refstars, config); 32 33 pmAstromModifyFPA (fpa, stat); 34 35 // use fit result to re-project rawstars 36 psastroProjectRawstars (fpa, subset); 37 psastroProjectRefstars (fpa, refstars); 38 39 // use small radius to match stars 40 match = pmAstromRadiusMatch (rawstars, refstars, options); 41 42 // fit astrometric terms 43 output = pmAstromMatchedListFit (fpa, subset, refstars, match, options); 30 // fpa and subset point to the same astrometry terms 31 psastroChipAstrom (refstars, subset); 44 32 45 33 // write out data (cmp file) 46 psastroWriteCMP (fpa, header, rawstars,argv[2]);34 psastroWriteCMP (fpa, argv[2]); 47 35 48 36 exit (0); -
trunk/psastro/src/psastro.h
r5506 r5509 38 38 int colBins; ///< Amount of binning in x-dimension 39 39 int rowBins; ///< Amount of binning in y-dimension 40 psArray * objects; ///< sources detected / measured on readout40 psArray *stars; ///< sources detected / measured on readout 41 41 } 42 42 pmReadout; -
trunk/psastro/src/psastroBuildFPA.c
r5506 r5509 1 1 # include "psastro.h" 2 2 3 pmFPA *psastroBuildFPA (psMetadata *header, ps Metadata *config) {3 pmFPA *psastroBuildFPA (psMetadata *header, psArray *stars) { 4 4 5 5 // this function constructs a basic template pmFPA structure based on the information in the header … … 30 30 31 31 pmCell *cell = pmCellAlloc (); 32 cell->chip = chip; // assign parent chip (view only; don't free)33 cell->header = header; 32 cell->chip = chip; // assign parent chip (view only; don't free) 33 cell->header = header; // XXX EAM : extend this function to take more than header 34 34 35 35 pmCellInterpretWCS (cell, header); … … 39 39 40 40 pmReadout *readout = pmReadoutAlloc (); 41 readout->stars = stars; // XXX EAM : need more than one stars... 42 41 43 cells->readouts->data[j] = readout; 42 44 } … … 143 145 // XXX EAM : if fpa->toSky and fpa->toTPA are already defined, then the 144 146 // toFPA must be modified to match the crval(i), scale(i) and crpix(i) 147 // scale = scale(i)/scale(0) (i == chip #) 148 // project crval1(0),crval2(0 using projection 145 149 146 150 // XXX EAM : psPlaneTransformAlloc uses nTerm not nOrder (bug 581) -
trunk/psastro/src/psastroUtils.c
r5505 r5509 69 69 } 70 70 71 psArray *psastroSelectBrightStars (p sMetadata *config, psArray *stars) {72 73 stars = psArraySort (stars, psastroSortByMag);71 psArray *psastroSelectBrightStars (pmFPA *inFPA, psMetadata *config) { 72 73 pmFPA *sbFPA = pmFPACopy (fpa); 74 74 75 75 // add exclusions for objects on some basis? 76 76 int MAX_NSTARS = pmMetadataLookupS32 (&status, config, "MAX_NSTARS"); 77 77 78 nSubset = PS_MIN (MAX_NSTARS, stars->n); 79 80 psArray *subset = psArrayAlloc (nSubset); 81 82 for (int i = 0; i < nSubset; i++) { 83 subset->data[i] = stars->data[i]; 84 } 85 78 for (int i = 0; i < inFPA->chips->n; i++) { 79 pmChip *inChip = inFPA->chips->data[i]; 80 pmChip *sbChip = sbFPA->chips->data[i]; 81 for (int j = 0; j < Ncells; j++) { 82 pmCell *inCell = inChip->cells->data[j]; 83 o pmCell *sbCell = sbChip->cells->data[j]; 84 for (int k = 0; k < Nreadouts; k++) { 85 pmReadout *inReadout = inCell->readouts->data[k]; 86 pmReadout *sbReadout = sbCell->readouts->data[k]; 87 88 inReadout->stars = psArraySort (inReadout->stars, psastroSortByMag); 89 90 nSubset = PS_MIN (MAX_NSTARS, stars->n); 91 92 psArray *subset = psArrayAlloc (nSubset); 93 94 for (int i = 0; i < nSubset; i++) { 95 subset->data[i] = inReadout->stars->data[i]; 96 } 97 sbReadout->stars = subset; 98 } 99 } 100 } 86 101 return (subset); 87 102 } … … 133 148 } 134 149 150 pmFPA *pmFPACopy (pmFPA *inFPA) { 151 152 pmFPA *fpa = pmFPAAlloc (); 153 154 fpa->toSky = psMemCopy (inFPA->toSky); 155 fpa->toTPA = psMemCopy (inFPA->toTPA); 156 fpa->fromTPA = psMemCopy (inFPA->fromTPA); 157 158 fpa->chips = psArrayAlloc (inFPA->chips->n); 159 for (int i = 0; i < inFPA->chips->n; i++) { 160 161 pmChip *inChip = inFPA->chips->data[i]; 162 163 pmChip *chip = pmChipAlloc (); 164 chip->fpa = fpa; // assign parent fpa (view only; don't free) 165 166 chip->toFPA = psMemCopy (inChip->toFPA); 167 chip->fromFPA = psMemCopy (inChip->fromFPA); 168 169 chip->cells = psArrayAlloc (inChip->cells->n); 170 for (int j = 0; j < Ncells; j++) { 171 172 pmCell *inCell = inChip->cells->data[j]; 173 174 pmCell *cell = pmCellAlloc (); 175 cell->chip = chip; // assign parent chip (view only; don't free) 176 177 cell->header = psMemCopy (inCell->header); 178 cell->toChip = psMemCopy (inCell->toChip); 179 180 cell->readouts = psArrayAlloc (inCell); 181 for (int k = 0; k < Nreadouts; k++) { 182 183 pmReadout *inReadout = inCell->readouts->data[k]; 184 185 pmReadout *readout = pmReadoutAlloc (); 186 187 *readout = *inReadout; 188 readout->stars = NULL; 189 190 cell->readouts->data[k] = readout; 191 } 192 chip->cells->data[j] = cell; 193 } 194 fpa->chips->data[i] = chip; 195 } 196 return (fpa); 197 } 198 199 bool psastroProjectRawstars (pmFPA *fpa) { 200 201 for (int i = 0; i < fpa->chips->n; i++) { 202 pmChip *chip = fpa->chips->data[i]; 203 for (int j = 0; j < chip->cells->n; j++) { 204 pmCell *cell = chip->cells->data[j]; 205 for (int k = 0; k < cell->readouts->n; k++) { 206 pmReadout *readout = cell->readouts->data[k]; 207 for (int m = 0; m < readout->stars->n; m++) { 208 pmAstromObj *star = readout->data[m]; 209 // apply readout offsets 210 // apply cell PlaneTransform 211 // apply chip PlaneTransform 212 psPlaneTransformApply (star-> 213 214 } 215 chip->cells->data[j] = cell; 216 } 217 fpa->chips->data[i] = chip; 218 } 219 return (fpa); 220 } 221 222 bool psastroChipAstrom (psArray *refstars, pmFPA *subset) { 223 224 // do this loop over the readouts 225 226 // find initial offset / rotation 227 stat = pmAstromGridMatch (subset, refstars, config); 228 229 pmAstromModifyFPA (fpa, stat); 230 231 // use fit result to re-project rawstars 232 psastroProjectRawstars (fpa, subset); 233 psastroProjectRefstars (fpa, refstars); 234 235 // use small radius to match stars 236 match = pmAstromRadiusMatch (rawstars, refstars, options); 237 238 // fit astrometric terms 239 output = pmAstromMatchedListFit (fpa, subset, refstars, match, options); 240 } 241
Note:
See TracChangeset
for help on using the changeset viewer.
