IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 18, 2006, 8:44:12 AM (20 years ago)
Author:
eugene
Message:

select refstars by magnitude, fix various memory leaks, better error tests, fix luminosity function test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psastro/src/psastroLoadRefstars.c

    r9587 r9627  
    2020    float DECmin = DEG_RAD*psMetadataLookupF32(NULL, recipe, "DEC_MIN");
    2121    float DECmax = DEG_RAD*psMetadataLookupF32(NULL, recipe, "DEC_MAX");
     22    float MAGmax = psMetadataLookupF32(NULL, recipe, "MAG_MAX");
    2223
    2324    char *CATDIR = psMetadataLookupStr(NULL, recipe, "DVO.CATDIR");
     
    3839    close (fd);
    3940
     41    psTimerStart ("psastro");
     42
    4043    // use fork to add timeout capability
    4144    // use cfitsio |filename format to avoid tempFile
    4245    # if ELIXIR_MODE
    4346    if (CATDIR) {
    44         sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT elixir -D CATMODE mef -region %f %f %f %f -o %s", CATDIR, RAmin, DECmin, RAmax, DECmax, tempFile);
     47        sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT elixir -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", CATDIR, MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile);
    4548    } else {
    46         sprintf (tempLine, "getstar -D CATFORMAT elixir -D CATMODE mef -region %f %f %f %f -o %s", RAmin, DECmin, RAmax, DECmax, tempFile);
     49        sprintf (tempLine, "getstar -D CATFORMAT elixir -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile);
    4750    }
    4851    # else
    4952    if (CATDIR) {
    50         sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT panstarrs -D CATMODE mef -region %f %f %f %f -o %s", CATDIR, RAmin, DECmin, RAmax, DECmax, tempFile);
     53        sprintf (tempLine, "getstar -D CATDIR %s -D CATFORMAT panstarrs -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", CATDIR, MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile);
    5154    } else {
    52         sprintf (tempLine, "getstar -D CATFORMAT panstarrs -D CATMODE mef -region %f %f %f %f -o %s", RAmin, DECmin, RAmax, DECmax, tempFile);
     55        sprintf (tempLine, "getstar -D CATFORMAT panstarrs -D CATMODE mef -maglim %f -region %f %f %f %f -o %s", MAGmax, RAmin, DECmin, RAmax, DECmax, tempFile);
    5356    }
    5457    # endif
     
    6164    }
    6265
     66    psLogMsg ("psastro", 3, "ran getstar : %f sec\n", psTimerMark ("psastro"));
     67
    6368    // the output from getstar is a file with the Average table
    6469    psFits *fits = psFitsOpen (tempFile, "r");
     
    7075    # endif
    7176
     77    psTimerStart ("psastro");
    7278    psMetadata *header = psFitsReadHeader (NULL, fits);
    7379    psArray *table = psFitsReadTable (fits);
    7480    psFitsClose (fits);
     81
    7582    unlink (tempFile);
     83    psLogMsg ("psastro", 3, "read getstar output table : %f sec\n", psTimerMark ("psastro"));
    7684
    7785    // convert the Average table to the pmAstromObj entries
     86    psTimerStart ("psastro");
    7887    psArray *refs = psArrayAlloc (table->n);
    7988    for (int i = 0; i < table->n; i++) {
     
    98107    psFree (header);
    99108    psFree (table);
     109    psLogMsg ("psastro", 3, "converted table to pmAstromObj : %f sec\n", psTimerMark ("psastro"));
    100110
    101111    psTrace ("psastro", 3, "loaded %ld reference stars from (%10.6f,%10.6f) - (%10.6f,%10.6f)\n",
    102112             refs->n, RAmin, DECmin, RAmax, DECmax);
     113
    103114    return refs;
    104115}
Note: See TracChangeset for help on using the changeset viewer.