IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 18, 2007, 12:28:16 PM (19 years ago)
Author:
eugene
Message:

a variety of fixes to get psastro working in chip and mosaic mode

  • various memory leaks
  • when loading mosaic data, the modification of the WCS for the common focal-plane scale was getting the offset wrong (fixed in psModules)
  • added some debugging dump; more plots still needed
  • error handling in psastroMosaicAstrom
  • loading chip and fpa dimensions from concepts
  • now reading chip concepts when reading objects (in psModules)
  • now supplying region and subdivisions for gradient measurements
  • grid search is now optional

-

File:
1 edited

Legend:

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

    r11470 r12492  
    1010
    1111    bool status;
     12    pmAstromStats *gridStats = NULL;
     13    pmAstromStats *stats = NULL;
    1214
    1315    // supplied radius is in pixels
     
    2527    REQUIRED_RECIPE_VALUE (int minNstar, "PSASTRO.MIN.NSTAR", S32, "failed to find single-chip min allowed stars\n");
    2628
    27     // find initial offset / rotation
    28     pmAstromStats *gridStats = pmAstromGridMatch (rawstars, refstars, recipe);
    29     if (gridStats == NULL) {
    30         psLogMsg ("psastro", 3, "failed to find a grid match solution\n");
    31         return false;
     29    // do we need to get a rough initial match?
     30    REQUIRED_RECIPE_VALUE (bool gridSearch, "PSASTRO.GRID.SEARCH", Bool, "failed to find chip grid-search option\n");
     31
     32    if (gridSearch) {
     33        // find initial offset / rotation
     34        gridStats = pmAstromGridMatch (rawstars, refstars, recipe);
     35        if (gridStats == NULL) {
     36            psLogMsg ("psastro", 3, "failed to find a grid match solution\n");
     37            return false;
     38        }
     39        psLogMsg ("psastro", 3, "basic grid search result - offset: %f,%f pixels, rotation: %f deg\n", gridStats->offset.x, gridStats->offset.y, DEG_RAD*gridStats->angle);
     40
     41        // tweak the position by finding peak of matches stars
     42        stats = pmAstromGridTweak (rawstars, refstars, recipe, gridStats);
     43        if (stats == NULL) {
     44            psLogMsg ("psastro", 3, "failed to measure tweaked grid solution\n");
     45            psFree (gridStats);
     46            return false;
     47        }
     48        psLogMsg ("psastro", 3, "tweak grid search result - offset: %f,%f pixels, rotation: %f deg\n", stats->offset.x, stats->offset.y, DEG_RAD*stats->angle);
     49
     50        // adjust the chip.toFPA terms only
     51        pmAstromGridApply (chip->toFPA, stats);
     52        psastroUpdateChipToFPA (fpa, chip, rawstars, refstars);
    3253    }
    33     psLogMsg ("psastro", 3, "basic grid search result - offset: %f,%f pixels, rotation: %f deg\n", gridStats->offset.x, gridStats->offset.y, DEG_RAD*gridStats->angle);
    34 
    35     // tweak the position by finding peak of matches stars
    36     pmAstromStats *stats = pmAstromGridTweak (rawstars, refstars, recipe, gridStats);
    37     if (stats == NULL) {
    38         psLogMsg ("psastro", 3, "failed to measure tweaked grid solution\n");
    39         return false;
    40     }
    41     psLogMsg ("psastro", 3, "tweak grid search result - offset: %f,%f pixels, rotation: %f deg\n", stats->offset.x, stats->offset.y, DEG_RAD*stats->angle);
    42 
    43     // adjust the chip.toFPA terms only
    44     pmAstromGridApply (chip->toFPA, stats);
    45     psastroUpdateChipToFPA (fpa, chip, rawstars, refstars);
    4654
    4755    // use small radius to match stars
     
    4957    if (match == NULL) {
    5058        psLogMsg ("psastro", 3, "failed to find radius-matched sources\n");
     59        psFree (stats);
     60        psFree (gridStats);
    5161        return false;
    5262    }
     
    8595    if (!results) {
    8696        psLogMsg ("psastro", 3, "failed to perform the matched fit\n");
     97        psFree (match);
     98        psFree (stats);
     99        psFree (fitStats);
     100        psFree (gridStats);
    87101        return false;
    88102    }
Note: See TracChangeset for help on using the changeset viewer.