IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 5, 2008, 5:16:44 PM (18 years ago)
Author:
eugene
Message:

split fake and force photometry into separate functions and separate mosaicked images

File:
1 edited

Legend:

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

    r17935 r17958  
    99    bool status;
    1010
    11     psArray *spots = psArrayAllocEmpty (1);
    12     psMetadataAddPtr (fpa->analysis, PS_LIST_TAIL, "FORCED.SPOTS", PS_META_REPLACE, "forced photometry positions", spots);
    13     psFree (spots); // free the extra (local) reference; a copy remains on fpa->analysis
    1411
    1512    psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSIM_RECIPE); // Recipe
    1613
    1714    bool forcedPhot = psMetadataLookupBool(&status, recipe, "FORCED.PHOT"); // Density of fakes
    18     if (!forcedPhot) return true;
     15    if (!forcedPhot) {
     16        psArray *spots = psArrayAllocEmpty (1);
     17        psMetadataAddArray (fpa->analysis, PS_LIST_TAIL, "FORCED.SPOTS", PS_META_REPLACE, "forced photometry positions", spots);
     18        psFree (spots); // free the extra (local) reference; a copy remains on fpa->analysis
     19        return true;
     20    }
    1921
    2022    // We read the catalogue stars using psastroLoadRefstars
     
    3032
    3133    char *catdir = psMetadataLookupStr(NULL, recipe, "FORCED.CATDIR");
    32     char *photcode = psMetadataLookupStr(NULL, recipe, "FORCED.PHOTCODE");
    33     float MAGmax = 100.0;
    3434
    3535    // Size of FPA
     
    4747    psMetadataAddF32(astroRecipe, PS_LIST_TAIL, "DEC_MAX", PS_META_REPLACE, "", dec0 + radius);
    4848   
    49     // XXX these two values are somewhat bogus: can we have psastroLoadRefstars optionally ignore photcode and MAGmax?
    50     psMetadataAddStr(astroRecipe, PS_LIST_TAIL, "DVO.GETSTAR.PHOTCODE",  PS_META_REPLACE, "", photcode);
    51     psMetadataAddF32(astroRecipe, PS_LIST_TAIL, "DVO.GETSTAR.MAG.MAX",  PS_META_REPLACE, "", MAGmax);
     49    // tell psastroLoadRefstars to ignore photcode and maglim
     50    psMetadataAddStr(astroRecipe, PS_LIST_TAIL, "DVO.GETSTAR.PHOTCODE",  PS_META_REPLACE, "", "NONE");
     51    psMetadataAddF32(astroRecipe, PS_LIST_TAIL, "DVO.GETSTAR.MAG.MAX",  PS_META_REPLACE, "", NAN);
    5252
    53     psArray *refStars = psastroLoadRefstars(config);
    54     if (!refStars || refStars->n == 0) {
     53    // load refstars from the catalog
     54    psArray *spots = psastroLoadRefstars(config);
     55    if (!spots || spots->n == 0) {
    5556        psError(PS_ERR_UNKNOWN, false, "Unable to find reference stars.");
    56         psFree(refStars);
     57        psFree(spots);
    5758        return false;
    5859    }
    59     psLogMsg("ppSim", PS_LOG_INFO, "Adding %ld reference stars", refStars->n);
     60    psLogMsg("ppSim", PS_LOG_INFO, "Adding %ld reference stars", spots->n);
    6061
    61     // convert the pmAstromObj sources to the storage format used by the CMF files
    62     psArrayRealloc (spots, refStars->n);
    63     for (long i = 0; i < refStars->n; i++) {
    64         ppSimStar *spot = ppSimStarAlloc ();
    65 
    66         pmAstromObj *ref = refStars->data[i]; // Reference star
    67         spot->ra  = ref->sky->r; // RA of star
    68         spot->dec = ref->sky->d; // Dec of star
    69         spot->mag = ref->Mag;       // Magnitude of star
    70 
    71         // Apply rotation, make FPA center of boresite
    72         // convert the ra,dec to x,y using examples in psastro.
    73         // spot->x = cos(pa) * xi - sin(pa) * eta + x0fpa;
    74         // spot->y = sin(pa) * xi + cos(pa) * eta + y0fpa;
    75 
    76         spots->data[i] = spot;
    77 
    78         psTrace("ppSim", 10, "Adding catalogue star: %.1f,%.1f --> %.2f\n", spot->x, spot->y, ref->Mag);
    79     }
     62    psMetadataAddArray (fpa->analysis, PS_LIST_TAIL, "FORCED.SPOTS", PS_META_REPLACE, "forced photometry positions", spots);
     63    psFree (spots); // free the extra (local) reference; a copy remains on fpa->analysis
    8064
    8165    return true;
Note: See TracChangeset for help on using the changeset viewer.