Changeset 26167
- Timestamp:
- Nov 16, 2009, 6:35:43 PM (17 years ago)
- Location:
- branches/eam_branches/20091113/psastro/src
- Files:
-
- 20 edited
-
psastro.h (modified) (1 diff)
-
psastroAnalysis.c (modified) (1 diff)
-
psastroChipAstrom.c (modified) (4 diffs)
-
psastroChooseRefstars.c (modified) (1 diff)
-
psastroDemoDump.c (modified) (1 diff)
-
psastroFixChips.c (modified) (1 diff)
-
psastroFixChipsTest.c (modified) (1 diff)
-
psastroLoadGhosts.c (modified) (1 diff)
-
psastroMaskUpdates.c (modified) (1 diff)
-
psastroMosaicFPtoTP.c (modified) (2 diffs)
-
psastroMosaicGetGrads.c (modified) (1 diff)
-
psastroMosaicGradients.c (modified) (1 diff)
-
psastroMosaicOneChip.c (modified) (2 diffs)
-
psastroMosaicSetMatch.c (modified) (1 diff)
-
psastroOneChipFit.c (modified) (2 diffs)
-
psastroOneChipGrid.c (modified) (1 diff)
-
psastroRefstarSubset.c (modified) (3 diffs)
-
psastroRemoveClumps.c (modified) (1 diff)
-
psastroUtils.c (modified) (2 diffs)
-
psastroZeroPoint.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091113/psastro/src/psastro.h
r26133 r26167 87 87 psArray *psastroRemoveClumps (psArray *input, int scale); 88 88 psArray *psastroRemoveClumpsIterate (psArray *input, int scale, int nIter); 89 bool psastroRemoveClumpsRawstars (pmConfig *config); 89 90 90 91 91 92 // utility functions: 92 bool psastroUpdateChipToFPA (pmFPA *fpa, pmChip *chip , psArray *rawstars, psArray *refstars);93 bool psastroUpdateChipToFPA (pmFPA *fpa, pmChip *chip); 93 94 bool psastroWriteStars (char *filename, psArray *sources); 94 95 bool psastroWriteTransform (psPlaneTransform *map); -
branches/eam_branches/20091113/psastro/src/psastroAnalysis.c
r24647 r26167 69 69 } 70 70 71 if (!psastroRemoveClumpsRawstars(config)) { 72 psError (PSASTRO_ERR_UNKNOWN, false, "failed to remove RAWSTAR clumps\n"); 73 return false; 74 } 75 71 76 // load the reference stars overlapping the data stars 72 77 psArray *refs = psastroLoadRefstars(config, "PSASTRO.INPUT"); -
branches/eam_branches/20091113/psastro/src/psastroChipAstrom.c
r26136 r26167 56 56 57 57 // select the raw objects for this readout 58 psArray *rawstarsAll = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.RAWSTARS"); 59 if (rawstarsAll == NULL) { continue; } 60 psArray *rawstars = psastroRemoveClumpsIterate(rawstarsAll, 150, 3); 58 psArray *rawstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.RAWSTARS.SUBSET"); 59 if (rawstars == NULL) { continue; } 61 60 62 61 // select the raw objects for this readout 63 psArray *refstarsAll = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS"); 64 if (refstarsAll == NULL) { continue; } 65 psArray *refstars = psastroRemoveClumpsIterate(refstarsAll, 150, 2); 62 psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS.SUBSET"); 63 if (refstars == NULL) { continue; } 66 64 67 65 // the absolute minimum number of stars is 4 (for order = 1) … … 69 67 readout->data_exists = false; 70 68 psLogMsg ("psastro", 3, "insufficient rawstars (%ld) or refstars (%ld)", rawstars->n, refstars->n); 71 psFree (rawstars);72 psFree (refstars);73 69 continue; 74 70 } … … 87 83 readout->data_exists = false; 88 84 psLogMsg ("psastro", 3, "failed to find a solution\n"); 89 psFree (rawstars);90 psFree (refstars);91 85 continue; 92 86 } … … 95 89 readout->data_exists = false; 96 90 psLogMsg ("psastro", 3, "failed to find a solution\n"); 97 psFree (rawstars);98 psFree (refstars);99 91 continue; 100 92 } 101 102 psFree (rawstars);103 psFree (refstars);104 93 105 94 numGoodRO++; -
branches/eam_branches/20091113/psastro/src/psastroChooseRefstars.c
r24806 r26167 134 134 135 135 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.REFSTARS", PS_DATA_ARRAY, "astrometry matches", refstars); 136 137 // generate a reduced subset excluding the clumps 138 // XXX do we need both REFSTARS and SUBSET? 139 psArray *subset = psastroRemoveClumpsIterate(refstars, 150, 3); 140 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.REFSTARS.SUBSET", PS_DATA_ARRAY, "astrometry objects", subset); 141 136 142 psFree (refstars); 143 psFree (subset); 137 144 psFree (extent); 138 145 139 146 if (matchLumFunc) { 140 // in this case, no PSASTRO.REFSTARS is added to readout->analysis 147 // limit the total magnitude range of PSASTRO.REFSTARS.SUBSET based on 148 // overlapping luminosity functions 141 149 if (!psastroRefstarSubset (readout)) { 142 150 psError(PSASTRO_ERR_DATA, false, "Can't determine an appropriate refstar subset\n"); -
branches/eam_branches/20091113/psastro/src/psastroDemoDump.c
r21409 r26167 160 160 161 161 // select the raw objects for this readout 162 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS ");162 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS.SUBSET"); 163 163 if (rawstars == NULL) continue; 164 164 165 165 // select the raw objects for this readout 166 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS ");166 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS.SUBSET"); 167 167 if (refstars == NULL) continue; 168 168 psTrace ("psastro", 4, "Trying %ld refstars\n", refstars->n); -
branches/eam_branches/20091113/psastro/src/psastroFixChips.c
r21422 r26167 319 319 } 320 320 321 psastroUpdateChipToFPA (input->fpa, obsChip , rawstars, refstars);321 psastroUpdateChipToFPA (input->fpa, obsChip); 322 322 323 323 // XXX update the header with info to reflect the failure -
branches/eam_branches/20091113/psastro/src/psastroFixChipsTest.c
r23989 r26167 246 246 } 247 247 248 psastroUpdateChipToFPA (fpa, chip , rawstars, refstars);248 psastroUpdateChipToFPA (fpa, chip); 249 249 250 250 // XXX skip the re-fit step for a test -
branches/eam_branches/20091113/psastro/src/psastroLoadGhosts.c
r24650 r26167 119 119 if (! readout->data_exists) { continue; } 120 120 121 // select the raw objects for this readout (loaded in psastroExtract.c) 121 // select the raw objects for this readout (loaded in psastroChooseRefstars.c) 122 // XXX : note that we place limits on the refstar sample in psastroChooseRefstars.c: 123 // 1) on chip and 2) < PSASTRO.MAX.NREF. magnitude limits and clump exclusion are only 122 124 psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS"); 123 125 if (refstars == NULL) { continue; } -
branches/eam_branches/20091113/psastro/src/psastroMaskUpdates.c
r24701 r26167 182 182 183 183 // select the raw objects for this readout 184 // XXX : note that we place limits on the refstar sample in psastroChooseRefstars.c: 185 // 1) on chip and 2) < PSASTRO.MAX.NREF. magnitude limits and clump exclusion are only 186 // applied to the SUBSETs 184 187 psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS"); 185 188 if (!refstars) continue; -
branches/eam_branches/20091113/psastro/src/psastroMosaicFPtoTP.c
r21409 r26167 45 45 46 46 // select the raw objects for this readout 47 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS ");47 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS.SUBSET"); 48 48 if (rawstars == NULL) { continue; } 49 49 50 50 // select the raw objects for this readout 51 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS ");51 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS.SUBSET"); 52 52 if (refstars == NULL) { continue; } 53 53 … … 126 126 } 127 127 128 // apply the rotation and scale to all stars in PSASTRO.REFSTARS (also adjusts 129 // PSASTRO.REFSTARS.SUBSET since they are the same pointers) 128 130 bool psastroMosaicApplyRotAndScale (pmFPA *fpa, psPlaneTransform *TPtoFP) { 129 131 -
branches/eam_branches/20091113/psastro/src/psastroMosaicGetGrads.c
r15671 r26167 27 27 28 28 // select the raw objects for this readout 29 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS ");29 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS.SUBSET"); 30 30 if (rawstars == NULL) { continue; } 31 31 32 32 // select the raw objects for this readout 33 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS ");33 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS.SUBSET"); 34 34 if (refstars == NULL) { continue; } 35 35 -
branches/eam_branches/20091113/psastro/src/psastroMosaicGradients.c
r21409 r26167 48 48 49 49 // select the raw objects for this readout 50 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS ");50 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS.SUBSET"); 51 51 if (rawstars == NULL) { continue; } 52 52 53 53 // select the raw objects for this readout 54 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS ");54 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS.SUBSET"); 55 55 if (refstars == NULL) { continue; } 56 56 -
branches/eam_branches/20091113/psastro/src/psastroMosaicOneChip.c
r24037 r26167 31 31 32 32 // select the raw objects for this readout 33 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS ");33 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS.SUBSET"); 34 34 if (rawstars == NULL) return false; 35 35 36 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS ");36 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS.SUBSET"); 37 37 if (refstars == NULL) return false; 38 38 … … 162 162 163 163 // determine fromFPA transformation and apply new transformation to raw & ref stars 164 psastroUpdateChipToFPA (fpa, chip , rawstars, refstars);164 psastroUpdateChipToFPA (fpa, chip); 165 165 166 166 //plot results -
branches/eam_branches/20091113/psastro/src/psastroMosaicSetMatch.c
r21422 r26167 58 58 59 59 // select the raw objects for this readout 60 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS ");60 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS.SUBSET"); 61 61 if (rawstars == NULL) { continue; } 62 62 63 63 // select the raw objects for this readout 64 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS ");64 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS.SUBSET"); 65 65 if (refstars == NULL) { continue; } 66 66 psTrace ("psastro", 4, "Trying %ld refstars\n", refstars->n); -
branches/eam_branches/20091113/psastro/src/psastroOneChipFit.c
r26134 r26167 118 118 // determine fromFPA transformation and apply new transformation to raw & ref stars 119 119 // this applies the transformation to all stars (including subset) 120 psastroUpdateChipToFPA (fpa, chip , rawstars, refstars);120 psastroUpdateChipToFPA (fpa, chip); // updates PSASTRO.RAWSTARS and PSASTRO.REFSTARS 121 121 122 122 // toSky converts from FPA & TPA units (microns) to sky units (radians) … … 171 171 psMetadataAddF32 (updates, PS_LIST_TAIL, "EQUINOX", PS_META_REPLACE, "equinox of ref catalog", 2000.0); // XXX this is bogus: should be defined based on equinox of refstars 172 172 173 // XXX drop from here : determine fromFPA transformation and apply new transformation to raw & ref stars174 // psastroUpdateChipToFPA (fpa, chip, rawstars, refstars);175 176 173 // XXX check if we correctly applied the new transformation: 177 174 if (psTraceGetLevel("psastro.dump") > 0) { -
branches/eam_branches/20091113/psastro/src/psastroOneChipGrid.c
r26135 r26167 59 59 // adjust the chip.toFPA terms only 60 60 pmAstromGridApply (chip->toFPA, stats); 61 psastroUpdateChipToFPA (fpa, chip , rawstars, refstars);61 psastroUpdateChipToFPA (fpa, chip); // updates PSASTRO.RAWSTARS and PSASTRO.REFSTARS 62 62 psFree (gridStats); 63 63 psFree (gridStars); -
branches/eam_branches/20091113/psastro/src/psastroRefstarSubset.c
r21409 r26167 16 16 17 17 // select the raw objects for this readout 18 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS ");18 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS.SUBSET"); 19 19 if (rawstars == NULL) { 20 20 psError(PSASTRO_ERR_DATA, false, "missing rawstars in psastroRefstarSubset\n"); … … 23 23 24 24 // select the raw objects for this readout 25 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS ");25 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS.SUBSET"); 26 26 if (refstars == NULL) { 27 27 psError(PSASTRO_ERR_DATA, false, "missing refstars in psastroRefstarSubset\n"); … … 74 74 psLogMsg ("psastro", 4, "keeping %ld of %ld reference stars\n", subset->n, refstars->n); 75 75 76 psMetadataRemoveKey (readout->analysis, "PSASTRO.REFSTARS ");77 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.REFSTARS ", PS_DATA_ARRAY, "astrometry matches", subset);76 psMetadataRemoveKey (readout->analysis, "PSASTRO.REFSTARS.SUBSET"); 77 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.REFSTARS.SUBSET", PS_DATA_ARRAY, "astrometry matches", subset); 78 78 79 79 if (psTraceGetLevel("psastro.dump") > 0) { -
branches/eam_branches/20091113/psastro/src/psastroRemoveClumps.c
r26132 r26167 12 12 13 13 # include "psastroInternal.h" 14 15 bool psastroRemoveClumpsRawstars (pmConfig *config) { 16 17 bool status; 18 19 pmChip *chip = NULL; 20 pmCell *cell = NULL; 21 pmReadout *readout = NULL; 22 23 // select the current recipe 24 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSASTRO_RECIPE); 25 if (!recipe) { 26 psError(PSASTRO_ERR_CONFIG, true, "Can't find PSASTRO recipe"); 27 return false; 28 } 29 30 // select the input data sources 31 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PSASTRO.INPUT"); 32 if (!input) { 33 psError(PSASTRO_ERR_CONFIG, true, "Can't find input data"); 34 return false; 35 } 36 37 pmFPAview *view = pmFPAviewAlloc (0); 38 pmFPA *fpa = input->fpa; 39 40 while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) { 41 psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process); 42 if (!chip->process || !chip->file_exists) { continue; } 43 44 while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) { 45 psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 46 if (!cell->process || !cell->file_exists) { continue; } 47 if (!chip->fromFPA) { continue; } 48 49 // process each of the readouts 50 while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) { 51 if (! readout->data_exists) { continue; } 52 53 // select the raw objects for this readout 54 psArray *rawstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.RAWSTARS"); 55 if (rawstars == NULL) { continue; } 56 57 // generate a reduced subset excluding the clumps 58 // XXX do we need both RAWSTARS and SUBSET? 59 // XXX put these parameters in the recipe, please 60 psArray *subset = psastroRemoveClumpsIterate(rawstars, 150, 3); 61 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.RAWSTARS.SUBSET", PS_DATA_ARRAY, "astrometry objects", subset); 62 psFree (subset); 63 } 64 } 65 } 66 psFree (view); 67 return true; 68 } 14 69 15 70 psArray *psastroRemoveClumpsIterate (psArray *input, int scale, int nIter) { -
branches/eam_branches/20091113/psastro/src/psastroUtils.c
r21422 r26167 106 106 } 107 107 108 bool psastroUpdateChipToFPA (pmFPA *fpa, pmChip *chip , psArray *rawstars, psArray *refstars) {108 bool psastroUpdateChipToFPA (pmFPA *fpa, pmChip *chip) { 109 109 110 110 psRegion *region = pmChipPixels (chip); … … 114 114 psFree (region); 115 115 116 for (int i = 0; i < rawstars->n; i++) { 117 pmAstromObj *raw = rawstars->data[i]; 118 119 psPlaneTransformApply (raw->FP, chip->toFPA, raw->chip); 120 psPlaneTransformApply (raw->TP, fpa->toTPA, raw->FP); 121 psDeproject (raw->sky, raw->TP, fpa->toSky); 122 } 123 124 for (int i = 0; i < refstars->n; i++) { 125 pmAstromObj *ref = refstars->data[i]; 126 psPlaneTransformApply (ref->chip, chip->fromFPA, ref->FP); 116 // loop over cells in this chip 117 for (int nCell = 0; nCell < chip->cells->n; nCell++) { 118 pmCell *cell = chip->cells->data[nCell]; 119 if (!cell->process || !cell->file_exists) { continue; } 120 121 // loop over readouts in this cell 122 for (int nRead = 0; nRead < cell->readouts->n; nRead++) { 123 pmReadout *readout = cell->readouts->data[nRead]; 124 if (! readout->data_exists) { continue; } 125 126 // select the raw objects for this readout 127 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS"); 128 if (rawstars) { 129 for (int i = 0; i < rawstars->n; i++) { 130 pmAstromObj *raw = rawstars->data[i]; 131 psPlaneTransformApply (raw->FP, chip->toFPA, raw->chip); 132 psPlaneTransformApply (raw->TP, fpa->toTPA, raw->FP); 133 psDeproject (raw->sky, raw->TP, fpa->toSky); 134 } 135 } 136 137 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS"); 138 if (refstars) { 139 for (int i = 0; i < refstars->n; i++) { 140 pmAstromObj *ref = refstars->data[i]; 141 psPlaneTransformApply (ref->chip, chip->fromFPA, ref->FP); 142 } 143 } 144 } 127 145 } 128 146 -
branches/eam_branches/20091113/psastro/src/psastroZeroPoint.c
r25906 r26167 113 113 114 114 // select the raw objects for this readout 115 psArray *rawstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.RAWSTARS ");115 psArray *rawstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.RAWSTARS.SUBSET"); 116 116 if (rawstars == NULL) return dMag; 117 117 118 118 // select the raw objects for this readout 119 psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS ");119 psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS.SUBSET"); 120 120 if (refstars == NULL) return dMag; 121 121
Note:
See TracChangeset
for help on using the changeset viewer.
