Changeset 27838 for branches/tap_branches/psastro/src/psastroLoadRefstars.c
- Timestamp:
- May 3, 2010, 8:41:49 AM (16 years ago)
- Location:
- branches/tap_branches
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
psastro/src/psastroLoadRefstars.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/tap_branches
- Property svn:mergeinfo changed
-
branches/tap_branches/psastro/src/psastroLoadRefstars.c
r24805 r27838 1 1 /** @file psastroLoadRefstars.c 2 2 * 3 * @brief 3 * @brief 4 4 * 5 5 * @ingroup libpsastro … … 50 50 return false; 51 51 } 52 53 // the name in the recipe may be one of: 54 // (A) the actual directory name 55 // (B) a reference to the name in the PSASTRO.CATDIRS folder in site.config 56 // (C) a reference to a folder in the PSASTRO.CATDIRS folder in site.config, containing multiple copy locations 52 57 char *catdir_virtual = psMetadataLookupStr(&status, catdirs, catdir_recipe); 58 59 psMetadata *catdir_folder = psMetadataLookupMetadata(&status, catdirs, catdir_recipe); 60 if (catdir_folder) { 61 // randomly choose one of the entries 62 psLogMsg ("psastro", 3, "choosing catdir_folder\n"); 63 int nEntry = catdir_folder->list->n; 64 65 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); 66 double frnd = psRandomUniform(rng); 67 int entry = PS_MIN(nEntry - 1, PS_MAX(0, nEntry * frnd)); 68 psFree(rng); 69 70 psMetadataItem *item = psListGet(catdir_folder->list, entry); 71 assert (item); 72 if (item->type != PS_DATA_STRING) { 73 psError(PSASTRO_ERR_CONFIG, true, "Invalid entry in PSASTRO.CATDIR folder: %s\n", item->name); 74 return false; 75 } 76 catdir_virtual = item->data.str; 77 } 78 53 79 char *catdir = (catdir_virtual == NULL) ? catdir_recipe : catdir_virtual; 54 80 … … 56 82 psString CATDIR = pmConfigConvertFilename(catdir, config, false, false); // Resolved filename 57 83 PS_ASSERT (CATDIR, NULL); 84 85 psLogMsg ("psastro", 3, "looking up reference objects in %s\n", CATDIR); 58 86 59 87 char *getstarCommand = psStringCopy(psMetadataLookupStr(NULL, recipe, "DVO.GETSTAR")); … … 106 134 psTrace ("psastro", 3, "%s\n", getstarCommand); 107 135 136 psLogMsg("psastro", PS_LOG_INFO, "getstar command: %s", getstarCommand); 137 108 138 // XXX use psPipe: catch stderr, stdout, allow for Nsec timeout... 109 139 // use fork to add timeout capability … … 133 163 // assert (outfile); 134 164 // for (int nn = 0; nn < refstars->n; nn++) { 135 // pmAstromObj *ref = refstars->data[nn];136 // fprintf (outfile, "%lf %lf\n", ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD);165 // pmAstromObj *ref = refstars->data[nn]; 166 // fprintf (outfile, "%lf %lf\n", ref->sky->r*PS_DEG_RAD, ref->sky->d*PS_DEG_RAD); 137 167 // } 138 168 // fclose (outfile); … … 190 220 ref->sky->d = RAD_DEG*psMetadataLookupF32 (&status, row, "DEC"); 191 221 ref->Mag = 0.001*psMetadataLookupS32 (&status, row, "MAG"); // ELIXIR uses millimags 192 ref->Color = 0.0;222 ref->Color = 0.0; 193 223 } else { 194 224 ref->sky->r = RAD_DEG*psMetadataLookupF64 (&status, row, "RA"); 195 225 ref->sky->d = RAD_DEG*psMetadataLookupF64 (&status, row, "DEC"); 196 226 ref->Mag = psMetadataLookupF32 (&status, row, "MAG"); // PANSTARRS uses mags 197 ref->Color = 0.0;227 ref->Color = 0.0; 198 228 } 199 229 … … 232 262 float MagC1 = psMetadataLookupF32 (&status, row, "MAG_C1"); 233 263 float MagC2 = psMetadataLookupF32 (&status, row, "MAG_C2"); 234 if (!isnan(MagC1) && !isnan(MagC2)) {235 ref->Color = MagC1 - MagC2;236 } else {237 // XXX save the color and the slope in the table header?238 ref->Color = 0.0;239 }264 if (!isnan(MagC1) && !isnan(MagC2)) { 265 ref->Color = MagC1 - MagC2; 266 } else { 267 // XXX save the color and the slope in the table header? 268 ref->Color = 0.0; 269 } 240 270 241 271 // XXX VERY temporary hack to avoid M31 bulge
Note:
See TracChangeset
for help on using the changeset viewer.
