Changeset 5509 for trunk/psastro/src/psastroUtils.c
- Timestamp:
- Nov 12, 2005, 9:58:04 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroUtils.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.
