Changeset 17958 for branches/eam_branch_20080511/ppSim/src/ppSimLoadSpots.c
- Timestamp:
- Jun 5, 2008, 5:16:44 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080511/ppSim/src/ppSimLoadSpots.c
r17935 r17958 9 9 bool status; 10 10 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->analysis14 11 15 12 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSIM_RECIPE); // Recipe 16 13 17 14 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 } 19 21 20 22 // We read the catalogue stars using psastroLoadRefstars … … 30 32 31 33 char *catdir = psMetadataLookupStr(NULL, recipe, "FORCED.CATDIR"); 32 char *photcode = psMetadataLookupStr(NULL, recipe, "FORCED.PHOTCODE");33 float MAGmax = 100.0;34 34 35 35 // Size of FPA … … 47 47 psMetadataAddF32(astroRecipe, PS_LIST_TAIL, "DEC_MAX", PS_META_REPLACE, "", dec0 + radius); 48 48 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); 52 52 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) { 55 56 psError(PS_ERR_UNKNOWN, false, "Unable to find reference stars."); 56 psFree( refStars);57 psFree(spots); 57 58 return false; 58 59 } 59 psLogMsg("ppSim", PS_LOG_INFO, "Adding %ld reference stars", refStars->n);60 psLogMsg("ppSim", PS_LOG_INFO, "Adding %ld reference stars", spots->n); 60 61 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 80 64 81 65 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
