Changeset 9627 for trunk/psastro/src/psastroRefstarSubset.c
- Timestamp:
- Oct 18, 2006, 8:44:12 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psastro/src/psastroRefstarSubset.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psastro/src/psastroRefstarSubset.c
r9587 r9627 5 5 // select the raw objects for this readout 6 6 psArray *rawstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.RAWSTARS"); 7 if (rawstars == NULL) { continue; } 7 if (rawstars == NULL) { 8 psError(PSASTRO_ERR_DATA, false, "missing rawstars in psastroRefstarSubset\n"); 9 return false; 10 } 8 11 9 12 // select the raw objects for this readout 10 13 psArray *refstars = psMetadataLookupPtr (NULL, readout->analysis, "PSASTRO.REFSTARS"); 11 if (refstars == NULL) { continue; } 14 if (refstars == NULL) { 15 psError(PSASTRO_ERR_DATA, false, "missing refstars in psastroRefstarSubset\n"); 16 return false; 17 } 12 18 13 19 // calculate luminosity functions for rawstars and refstars … … 15 21 // is needed... 16 22 pmLumFunc *rawfunc = psastroLuminosityFunction (rawstars); 23 if (rawfunc == NULL) { 24 psError(PSASTRO_ERR_DATA, false, "error measuring rawstar luminosity function\n"); 25 return NULL; 26 } 17 27 pmLumFunc *reffunc = psastroLuminosityFunction (refstars); 28 if (reffunc == NULL) { 29 psError(PSASTRO_ERR_DATA, false, "error measuring refstar luminosity function\n"); 30 return NULL; 31 } 32 33 // XXXX test 34 // psFree (rawfunc); 35 // psFree (reffunc); 36 // return true; 18 37 19 38 // what is the offset between the two lines at the average magnitude? 20 mRef = 0.5*(reffunc->mMin + reffunc->mMax);21 logRho = mRef * reffunc->slope + reffunc->offset;22 mRaw = (logRho - rawfunc->offset) / rawfunc->slope;39 double mRef = 0.5*(reffunc->mMin + reffunc->mMax); 40 double logRho = mRef * reffunc->slope + reffunc->offset; 41 double mRaw = (logRho - rawfunc->offset) / rawfunc->slope; 23 42 24 43 psLogMsg ("psastro", 4, "mRef: %f, logRho: %f, mRaw: %f\n", mRef, logRho, mRaw); 25 44 26 mRefMax = rawfunc->mMax - mRaw + mRef;45 double mRefMax = rawfunc->mMax - mRaw + mRef; 27 46 psLogMsg ("psastro", 4, "clipping stars fainter than %f\n", mRefMax); 28 47 … … 31 50 pmAstromObj *ref = refstars->data[i]; 32 51 if (ref->Mag > mRefMax) continue; 33 psArrayAdd (subset, ref);52 psArrayAdd (subset, 100, ref); 34 53 } 35 54 36 psLogMsg ("psastro", 4, "keeping % d of %d reference stars\n", subset->n, refstars->n);55 psLogMsg ("psastro", 4, "keeping %ld of %ld reference stars\n", subset->n, refstars->n); 37 56 38 57 psMetadataRemoveKey (readout->analysis, "PSASTRO.REFSTARS"); 39 58 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSASTRO.REFSTARS", PS_DATA_ARRAY, "astrometry matches", subset); 40 59 60 psFree (rawfunc); 61 psFree (reffunc); 62 psFree (subset); 63 41 64 return true; 42 65 }
Note:
See TracChangeset
for help on using the changeset viewer.
