IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

working on loading force phot positions

File:
1 edited

Legend:

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