IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13832


Ignore:
Timestamp:
Jun 14, 2007, 8:58:44 AM (19 years ago)
Author:
eugene
Message:

count total number of stars, skip astrometry if we have no stars

Location:
trunk/psastro/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastro.h

    r12806 r13832  
    3030bool              psastroConvertReadout (pmReadout *readout, psMetadata *recipe);
    3131psArray          *pmSourceToAstromObj (psArray *sources);
    32 bool              psastroAstromGuess (pmConfig *config);
     32bool              psastroAstromGuess (int *nStars, pmConfig *config);
    3333
    3434psPlaneDistort   *psPlaneDistortIdentity ();
  • trunk/psastro/src/psastroAnalysis.c

    r12806 r13832  
    33bool psastroAnalysis (pmConfig *config) {
    44
     5    int nStars;
     6
    57    // interpret the available initial astrometric information
    68    // apply the initial guess
    7     if (!psastroAstromGuess (config)) {
     9    if (!psastroAstromGuess (&nStars, config)) {
    810        psError (PSASTRO_ERR_UNKNOWN, false, "failed to determine initial astrometry guess\n");
    911        return false;
     12    }
     13    if (nStars == 0) {
     14        psLogMsg ("psastro", 2, "skipping astrometry analysis : no stars\n");
     15        return true;
    1016    }
    1117
  • trunk/psastro/src/psastroAstromGuess.c

    r12806 r13832  
    77// headers corresponding to the chips.
    88
    9 bool psastroAstromGuess (pmConfig *config) {
     9bool psastroAstromGuess (int *nStars, pmConfig *config) {
    1010
    1111    bool newFPA = true;
     
    2222    pmCell *cell = NULL;
    2323    pmReadout *readout = NULL;
     24
     25    *nStars = 0;
    2426
    2527    // select the current recipe
     
    9294                if (rawstars == NULL) { continue; }
    9395
     96                *nStars += rawstars->n;
    9497                for (int i = 0; i < rawstars->n; i++) {
    9598                    pmAstromObj *raw = rawstars->data[i];
     
    122125    }
    123126
     127    // how many total sources are available to us?
     128    psMetadataAddS32 (recipe, PS_LIST_TAIL, "NTOTSTAR",  PS_META_REPLACE, "", *nStars);
     129    if (*nStars == 0) {
     130        psLogMsg ("psastro", 2, "no sources available for astrometry\n");
     131        return true;
     132    }
     133
    124134    psLogMsg ("psastro", 2, "loaded raw data from %f,%f to %f,%f\n",
    125135              DEG_RAD*RAmin, DEG_RAD*DECmin,
    126136              DEG_RAD*RAmax, DEG_RAD*DECmax);
    127137
    128     psMetadataAdd (recipe, PS_LIST_TAIL, "RA_MIN",  PS_DATA_F32 | PS_META_REPLACE, "", RAmin);
    129     psMetadataAdd (recipe, PS_LIST_TAIL, "RA_MAX",  PS_DATA_F32 | PS_META_REPLACE, "", RAmax);
    130     psMetadataAdd (recipe, PS_LIST_TAIL, "DEC_MIN", PS_DATA_F32 | PS_META_REPLACE, "", DECmin);
    131     psMetadataAdd (recipe, PS_LIST_TAIL, "DEC_MAX", PS_DATA_F32 | PS_META_REPLACE, "", DECmax);
     138    psMetadataAddF32 (recipe, PS_LIST_TAIL, "RA_MIN", PS_META_REPLACE, "", RAmin);
     139    psMetadataAddF32 (recipe, PS_LIST_TAIL, "RA_MAX", PS_META_REPLACE, "", RAmax);
     140    psMetadataAddF32 (recipe, PS_LIST_TAIL, "DEC_MIN", PS_META_REPLACE, "", DECmin);
     141    psMetadataAddF32 (recipe, PS_LIST_TAIL, "DEC_MAX", PS_META_REPLACE, "", DECmax);
    132142
    133143    psFree (view);
Note: See TracChangeset for help on using the changeset viewer.