Changeset 17930 for branches/eam_branch_20080511/ppSim/src/ppSimLoadSpots.c
- Timestamp:
- Jun 5, 2008, 1:37:24 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080511/ppSim/src/ppSimLoadSpots.c
r17707 r17930 1 1 # include "ppSim.h" 2 2 3 bool ppSimLoadSpots (pmFPA *fpa, pmConfig *config) { 3 // need to specify an alternative CATDIR for the force positions 4 bool ppSimLoadSpots (psArray *spots, pmFPA *fpa, pmConfig *config) { 4 5 5 # if (0) 6 bool status; 6 7 7 bool mdok; 8 assert (stars); 8 psMetadata *recipe = psMetadataLookupMetadata(&status, config->recipes, PPSIM_RECIPE); // Recipe 9 9 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 13 11 if (!forcedPhot) return true; 14 12 15 // Read catalogue stars using psastro 16 // XXX probably need to modify this... 13 // We read the catalogue stars using psastroLoadRefstars 17 14 psMetadata *astroRecipe = psMetadataLookupPtr(NULL, config->recipes, PSASTRO_RECIPE); 18 15 if (!astroRecipe) { … … 20 17 return NULL; 21 18 } 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) 22 23 23 24 // Size of FPA … … 44 45 // convert the pmAstromObj sources to the storage format used by the CMF files 45 46 46 long oldSize = s tars->n;47 s tars = psArrayRealloc (stars,refStars->n);47 long oldSize = spots->n; 48 spots = psArrayRealloc (spots, oldSize + refStars->n); 48 49 49 50 // Conversion loop 50 51 for (long i = 0; i < refStars->n; i++) { 51 ppSimStar *s tar= ppSimStarAlloc ();52 ppSimStar *spot = ppSimStarAlloc (); 52 53 53 54 pmAstromObj *ref = refStars->data[i]; // Reference star 54 s tar->ra = ref->sky->r; // RA of star55 s tar->dec = ref->sky->d; // Dec of star56 s tar->mag = ref->Mag; // Magnitude of star55 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 57 58 58 59 // Apply rotation, make FPA center of boresite 59 60 // convert the ra,dec to x,y using examples in psastro. 60 // s tar->x = cos(pa) * xi - sin(pa) * eta + x0fpa;61 // s tar->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; 62 63 63 s tars->data[oldSize + i] = star;64 spots->data[oldSize + i] = star; 64 65 65 psTrace("ppSim", 10, "Adding catalogue star: %.1f,%.1f --> %.2f\n", s tar->x, star->y, star->flux);66 psTrace("ppSim", 10, "Adding catalogue star: %.1f,%.1f --> %.2f\n", spot->x, spot->y, ref->Mag); 66 67 } 67 68 # endif69 68 70 69 // XXX these need to be saved on PSPHOT.INPUT.CMF
Note:
See TracChangeset
for help on using the changeset viewer.
