IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17930


Ignore:
Timestamp:
Jun 5, 2008, 1:37:24 AM (18 years ago)
Author:
eugene
Message:

working on loading force phot positions

Location:
branches/eam_branch_20080511/ppSim/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080511/ppSim/src/ppSimLoadForceSources.c

    r17901 r17930  
    1212    pmFPAfileActivate (config->files, true, "PSASTRO.OUT.REFSTARS");
    1313
    14     // this loop selects the matched stars for all chips
    15     while ((chip = pmFPAviewNextChip (view, fpa, 1)) != NULL) {
    16         psTrace ("psastro", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    17         if (!chip->process || !chip->file_exists) { continue; }
    18         if (!chip->fromFPA) { continue; }
    19 
    20         while ((cell = pmFPAviewNextCell (view, fpa, 1)) != NULL) {
    21             psTrace ("psastro", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);
    22             if (!cell->process || !cell->file_exists) { continue; }
    23 
    24             // process each of the readouts
    25             // XXX there can only be one readout per chip in astrometry, right?
    26             while ((readout = pmFPAviewNextReadout (view, fpa, 1)) != NULL) {
    27                 if (! readout->data_exists) { continue; }
     14    readout = pmFPAviewThisReadout (view, fpa);
     15    if (! readout->data_exists) { continue; }
    2816
    2917                // read WCS data from the corresponding header
  • branches/eam_branch_20080511/ppSim/src/ppSimLoadSpots.c

    r17707 r17930  
    11# include "ppSim.h"
    22
    3 bool ppSimLoadSpots (pmFPA *fpa, pmConfig *config) {
     3// need to specify an alternative CATDIR for the force positions
     4bool ppSimLoadSpots (psArray *spots, pmFPA *fpa, pmConfig *config) {
    45
    5 # if (0)
     6    bool status;
    67
    7     bool mdok;
    8     assert (stars);
     8    psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSIM_RECIPE); // Recipe
    99
    10     psMetadata *recipe = psMetadataLookupMetadata(&mdok, config->recipes, PPSIM_RECIPE); // Recipe
    11 
    12     bool forcedPhot = psMetadataLookupBool(&mdok, recipe, "FORCED.PHOT"); // Density of fakes
     10    bool forcedPhot = psMetadataLookupBool(&status, recipe, "FORCED.PHOT"); // Density of fakes
    1311    if (!forcedPhot) return true;
    1412
    15     // Read catalogue stars using psastro
    16     // XXX probably need to modify this...
     13    // We read the catalogue stars using psastroLoadRefstars
    1714    psMetadata *astroRecipe = psMetadataLookupPtr(NULL, config->recipes, PSASTRO_RECIPE);
    1815    if (!astroRecipe) {
     
    2017        return NULL;
    2118    }
     19
     20    float ra0     = psMetadataLookupF32(NULL, recipe, "RA");        // Boresight RA (radians)
     21    float dec0    = psMetadataLookupF32(NULL, recipe, "DEC");       // Boresight Dec (radians)
     22    float scale   = psMetadataLookupF32(NULL, recipe, "PIXEL.SCALE") * M_PI / 3600.0 / 180.0; // Plate scale (radians/pixel)
    2223
    2324    // Size of FPA
     
    4445    // convert the pmAstromObj sources to the storage format used by the CMF files
    4546
    46     long oldSize = stars->n;
    47     stars = psArrayRealloc (stars, refStars->n);
     47    long oldSize = spots->n;
     48    spots = psArrayRealloc (spots, oldSize + refStars->n);
    4849
    4950    // Conversion loop
    5051    for (long i = 0; i < refStars->n; i++) {
    51         ppSimStar *star = ppSimStarAlloc ();
     52        ppSimStar *spot = ppSimStarAlloc ();
    5253
    5354        pmAstromObj *ref = refStars->data[i]; // Reference star
    54         star->ra  = ref->sky->r; // RA of star
    55         star->dec = ref->sky->d; // Dec of star
    56         star->mag = ref->Mag;       // Magnitude of star
     55        spot->ra  = ref->sky->r; // RA of star
     56        spot->dec = ref->sky->d; // Dec of star
     57        spot->mag = ref->Mag;       // Magnitude of star
    5758
    5859        // Apply rotation, make FPA center of boresite
    5960        // convert the ra,dec to x,y using examples in psastro.
    60         // star->x = cos(pa) * xi - sin(pa) * eta + x0fpa;
    61         // star->y = sin(pa) * xi + cos(pa) * eta + y0fpa;
     61        // spot->x = cos(pa) * xi - sin(pa) * eta + x0fpa;
     62        // spot->y = sin(pa) * xi + cos(pa) * eta + y0fpa;
    6263
    63         stars->data[oldSize + i] = star;
     64        spots->data[oldSize + i] = star;
    6465
    65         psTrace("ppSim", 10, "Adding catalogue star: %.1f,%.1f --> %.2f\n", star->x, star->y, star->flux);
     66        psTrace("ppSim", 10, "Adding catalogue star: %.1f,%.1f --> %.2f\n", spot->x, spot->y, ref->Mag);
    6667    }
    67 
    68 # endif
    6968
    7069    // XXX these need to be saved on PSPHOT.INPUT.CMF
  • branches/eam_branch_20080511/ppSim/src/ppSimLoadStars.c

    r17672 r17930  
    1818    }
    1919
    20     // XXX push these into the recipe in ppSimArguments()
     20    // relevant metadata
    2121    float zp      = psMetadataLookupF32(NULL, recipe, "ZEROPOINT"); // Photometric zero point
    2222    float ra0     = psMetadataLookupF32(NULL, recipe, "RA");        // Boresight RA (radians)
  • branches/eam_branch_20080511/ppSim/src/ppSimLoop.c

    r17901 r17930  
    2727    int binning = psMetadataLookupS32(NULL, recipe, "BINNING"); // Binning in x and y
    2828
     29    psArray *spots = psArrayAllocEmpty (1);
    2930    psArray *stars = psArrayAllocEmpty (1);
    3031    psArray *galaxies = psArrayAllocEmpty (1);
    3132    if (type == PPSIM_TYPE_OBJECT) {
    3233        // Load forced-photometry positions
    33         if (!ppSimLoadSpots (fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");
     34        if (!ppSimLoadSpots (spots, fpa, config)) ESCAPE (PS_ERR_UNKNOWN, "failed to load forced-photometry spots");
    3435
    3536        // Load catalogue stars
Note: See TracChangeset for help on using the changeset viewer.