IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26167


Ignore:
Timestamp:
Nov 16, 2009, 6:35:43 PM (17 years ago)
Author:
eugene
Message:

remove clumpfor raw and ref stars for entire run, save as SUBSET

Location:
branches/eam_branches/20091113/psastro/src
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091113/psastro/src/psastro.h

    r26133 r26167  
    8787psArray          *psastroRemoveClumps (psArray *input, int scale);
    8888psArray          *psastroRemoveClumpsIterate (psArray *input, int scale, int nIter);
     89bool              psastroRemoveClumpsRawstars (pmConfig *config);
    8990
    9091
    9192// utility functions:
    92 bool              psastroUpdateChipToFPA (pmFPA *fpa, pmChip *chip, psArray *rawstars, psArray *refstars);
     93bool              psastroUpdateChipToFPA (pmFPA *fpa, pmChip *chip);
    9394bool              psastroWriteStars (char *filename, psArray *sources);
    9495bool              psastroWriteTransform (psPlaneTransform *map);
  • branches/eam_branches/20091113/psastro/src/psastroAnalysis.c

    r24647 r26167  
    6969    }
    7070
     71    if (!psastroRemoveClumpsRawstars(config)) {
     72        psError (PSASTRO_ERR_UNKNOWN, false, "failed to remove RAWSTAR clumps\n");
     73        return false;
     74    }
     75
    7176    // load the reference stars overlapping the data stars
    7277    psArray *refs = psastroLoadRefstars(config, "PSASTRO.INPUT");
  • branches/eam_branches/20091113/psastro/src/psastroChipAstrom.c

    r26136 r26167  
    5656
    5757                // 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; }
    6160
    6261                // 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; }
    6664
    6765                // the absolute minimum number of stars is 4 (for order = 1)
     
    6967                    readout->data_exists = false;
    7068                    psLogMsg ("psastro", 3, "insufficient rawstars (%ld) or refstars (%ld)", rawstars->n, refstars->n);
    71                     psFree (rawstars);
    72                     psFree (refstars);
    7369                    continue;
    7470                }
     
    8783                    readout->data_exists = false;
    8884                    psLogMsg ("psastro", 3, "failed to find a solution\n");
    89                     psFree (rawstars);
    90                     psFree (refstars);
    9185                    continue;
    9286                }
     
    9589                    readout->data_exists = false;
    9690                    psLogMsg ("psastro", 3, "failed to find a solution\n");
    97                     psFree (rawstars);
    98                     psFree (refstars);
    9991                    continue;
    10092                }
    101 
    102                 psFree (rawstars);
    103                 psFree (refstars);
    10493
    10594                numGoodRO++;
  • branches/eam_branches/20091113/psastro/src/psastroChooseRefstars.c

    r24806 r26167  
    134134
    135135                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
    136142                psFree (refstars);
     143                psFree (subset);
    137144                psFree (extent);
    138145
    139146                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
    141149                    if (!psastroRefstarSubset (readout)) {
    142150                        psError(PSASTRO_ERR_DATA, false, "Can't determine an appropriate refstar subset\n");
  • branches/eam_branches/20091113/psastro/src/psastroDemoDump.c

    r21409 r26167  
    160160
    161161                // 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");
    163163                if (rawstars == NULL) continue;
    164164
    165165                // 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");
    167167                if (refstars == NULL) continue;
    168168                psTrace ("psastro", 4, "Trying %ld refstars\n", refstars->n);
  • branches/eam_branches/20091113/psastro/src/psastroFixChips.c

    r21422 r26167  
    319319        }
    320320
    321         psastroUpdateChipToFPA (input->fpa, obsChip, rawstars, refstars);
     321        psastroUpdateChipToFPA (input->fpa, obsChip);
    322322
    323323        // XXX update the header with info to reflect the failure
  • branches/eam_branches/20091113/psastro/src/psastroFixChipsTest.c

    r23989 r26167  
    246246        }
    247247
    248         psastroUpdateChipToFPA (fpa, chip, rawstars, refstars);
     248        psastroUpdateChipToFPA (fpa, chip);
    249249
    250250        // XXX skip the re-fit step for a test
  • branches/eam_branches/20091113/psastro/src/psastroLoadGhosts.c

    r24650 r26167  
    119119                if (! readout->data_exists) { continue; }
    120120
    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
    122124                psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS");
    123125                if (refstars == NULL) { continue; }
  • branches/eam_branches/20091113/psastro/src/psastroMaskUpdates.c

    r24701 r26167  
    182182
    183183                // 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
    184187                psArray *refstars = psMetadataLookupPtr (&status, readout->analysis, "PSASTRO.REFSTARS");
    185188                if (!refstars) continue;
  • branches/eam_branches/20091113/psastro/src/psastroMosaicFPtoTP.c

    r21409 r26167  
    4545
    4646                // 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");
    4848                if (rawstars == NULL) { continue; }
    4949
    5050                // 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");
    5252                if (refstars == NULL) { continue; }
    5353
     
    126126}
    127127
     128// apply the rotation and scale to all stars in PSASTRO.REFSTARS (also adjusts
     129// PSASTRO.REFSTARS.SUBSET since they are the same pointers)
    128130bool psastroMosaicApplyRotAndScale (pmFPA *fpa, psPlaneTransform *TPtoFP) {
    129131
  • branches/eam_branches/20091113/psastro/src/psastroMosaicGetGrads.c

    r15671 r26167  
    2727
    2828                // 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");
    3030                if (rawstars == NULL) { continue; }
    3131
    3232                // 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");
    3434                if (refstars == NULL) { continue; }
    3535
  • branches/eam_branches/20091113/psastro/src/psastroMosaicGradients.c

    r21409 r26167  
    4848
    4949                // 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");
    5151                if (rawstars == NULL) { continue; }
    5252
    5353                // 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");
    5555                if (refstars == NULL) { continue; }
    5656
  • branches/eam_branches/20091113/psastro/src/psastroMosaicOneChip.c

    r24037 r26167  
    3131
    3232    // 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");
    3434    if (rawstars == NULL) return false;
    3535
    36     psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS");
     36    psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS.SUBSET");
    3737    if (refstars == NULL) return false;
    3838
     
    162162
    163163    // determine fromFPA transformation and apply new transformation to raw & ref stars
    164     psastroUpdateChipToFPA (fpa, chip, rawstars, refstars);
     164    psastroUpdateChipToFPA (fpa, chip);
    165165
    166166    //plot results
  • branches/eam_branches/20091113/psastro/src/psastroMosaicSetMatch.c

    r21422 r26167  
    5858
    5959                // 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");
    6161                if (rawstars == NULL) { continue; }
    6262
    6363                // 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");
    6565                if (refstars == NULL) { continue; }
    6666                psTrace ("psastro", 4, "Trying %ld refstars\n", refstars->n);
  • branches/eam_branches/20091113/psastro/src/psastroOneChipFit.c

    r26134 r26167  
    118118        // determine fromFPA transformation and apply new transformation to raw & ref stars
    119119        // 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
    121121
    122122        // toSky converts from FPA & TPA units (microns) to sky units (radians)
     
    171171    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
    172172
    173     // XXX drop from here : determine fromFPA transformation and apply new transformation to raw & ref stars
    174     // psastroUpdateChipToFPA (fpa, chip, rawstars, refstars);
    175 
    176173    // XXX check if we correctly applied the new transformation:
    177174    if (psTraceGetLevel("psastro.dump") > 0) {
  • branches/eam_branches/20091113/psastro/src/psastroOneChipGrid.c

    r26135 r26167  
    5959    // adjust the chip.toFPA terms only
    6060    pmAstromGridApply (chip->toFPA, stats);
    61     psastroUpdateChipToFPA (fpa, chip, rawstars, refstars);
     61    psastroUpdateChipToFPA (fpa, chip); // updates PSASTRO.RAWSTARS and PSASTRO.REFSTARS
    6262    psFree (gridStats);
    6363    psFree (gridStars);
  • branches/eam_branches/20091113/psastro/src/psastroRefstarSubset.c

    r21409 r26167  
    1616
    1717  // 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");
    1919  if (rawstars == NULL)  {
    2020    psError(PSASTRO_ERR_DATA, false, "missing rawstars in psastroRefstarSubset\n");
     
    2323
    2424  // 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");
    2626  if (refstars == NULL)  {
    2727    psError(PSASTRO_ERR_DATA, false, "missing refstars in psastroRefstarSubset\n");
     
    7474  psLogMsg ("psastro", 4, "keeping %ld of %ld reference stars\n", subset->n, refstars->n);
    7575
    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);
    7878
    7979  if (psTraceGetLevel("psastro.dump") > 0) {
  • branches/eam_branches/20091113/psastro/src/psastroRemoveClumps.c

    r26132 r26167  
    1212
    1313# include "psastroInternal.h"
     14
     15bool 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}
    1469
    1570psArray *psastroRemoveClumpsIterate (psArray *input, int scale, int nIter) {
  • branches/eam_branches/20091113/psastro/src/psastroUtils.c

    r21422 r26167  
    106106}
    107107
    108 bool psastroUpdateChipToFPA (pmFPA *fpa, pmChip *chip, psArray *rawstars, psArray *refstars) {
     108bool psastroUpdateChipToFPA (pmFPA *fpa, pmChip *chip) {
    109109
    110110    psRegion *region = pmChipPixels (chip);
     
    114114    psFree (region);
    115115
    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        }
    127145    }
    128146
  • branches/eam_branches/20091113/psastro/src/psastroZeroPoint.c

    r25906 r26167  
    113113
    114114    // 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");
    116116    if (rawstars == NULL) return dMag;
    117117
    118118    // 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");
    120120    if (refstars == NULL) return dMag;
    121121
Note: See TracChangeset for help on using the changeset viewer.