IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 22, 2009, 2:57:41 PM (16 years ago)
Author:
eugene
Message:

various fixes to psastro:

1) added bootstrap resampling to zero point error analysis
2) added iterative clump removal from refstars and rawstars
3) added unique reference match option
4) some improved visualizations
5) improved mosaic iterations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroRemoveClumps.c

    r21422 r26259  
    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}
     69
     70psArray *psastroRemoveClumpsIterate (psArray *input, int scale, int nIter) {
     71
     72    psArray *newset = psMemIncrRefCounter (input);
     73    for (int i = 0; i < nIter; i++) {
     74        psArray *subset = psastroRemoveClumps (newset, 150);
     75        psFree (newset);
     76        newset = subset;
     77    }
     78    return newset;
     79}   
    1480
    1581/**
Note: See TracChangeset for help on using the changeset viewer.