IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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) {
Note: See TracChangeset for help on using the changeset viewer.