IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 1, 2005, 2:21:14 PM (21 years ago)
Author:
Paul Price
Message:

Rough draft of pmFPAMorph working

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/scripts/src/test_pmFPARead.c

    r4395 r4694  
    2626
    2727    (void)psTraceSetLevel(".", 0);
     28    (void)psTraceSetLevel("readExtension", 10);
    2829    (void)psTraceSetLevel("readMultipleRegions", 0);
    2930    (void)psTraceSetLevel("portions", 0);
    30     (void)psTraceSetLevel("pmFPARead", 10);
     31    (void)psTraceSetLevel("pmFPAPrint", 10);
    3132    (void)psTraceSetLevel("pmFPAfromHeader", 10);
    3233    (void)psTraceSetLevel("pmCameraFromHeader", 10);
    33 
     34    (void)psTraceSetLevel("pmFPAMorph", 10);
     35    (void)psTraceSetLevel("spliceCells", 10);
    3436
    3537
     
    5355    psMetadata *camera = pmCameraFromHeader(header, ipprc);
    5456
    55     papFPA *fpa = pmFPARead(fits, camera, NULL);
     57    papFPA *fpa = pmFPAConstruct(camera, NULL);
     58
     59    // Cut off a lot of the chips so I can fit things in memory
     60    {
     61        psArray *chips = fpa->chips;
     62        papChip *chip = chips->data[0];
     63        psFree(chips);
     64        chips = psArrayAlloc(1);
     65        chips->data[0] = chip;
     66    }
     67
     68    (void)pmFPARead(fpa, fits);
    5669    (void)pmFPAPrint(fpa);
    5770
    58     printf("Test: %d %d\n", psCellGetValueS32(fpa, "ccd15", "left", "CELL.XPARITY"),
    59            psCellGetValueS32(fpa, "ccd15", "right", "CELL.XPARITY"));
    60     printf("Test: %d %d\n", psCellGetValueS32(fpa, "ccd15", "left", "CELL.YPARITY"),
    61            psCellGetValueS32(fpa, "ccd15", "right", "CELL.YPARITY"));
    62     printf("Test: %d %d\n", psCellGetValueS32(fpa, "ccd15", "left", "CELL.YPARITY"),
    63            psCellGetValueS32(fpa, "ccd15", "right", "CELL.YPARITY"));
     71    // Morph to a splice image
     72    psMetadata *newCamera = psMetadataConfigParse(NULL, &badLines, "megacam_splice.config", true);
     73    papFPA *newfpa = pmFPAConstruct(newCamera, NULL);
     74
     75    // Cut off a lot of the chips so I can fit things in memory
     76    {
     77        psArray *chips = newfpa->chips;
     78        papChip *chip = chips->data[0];
     79        psFree(chips);
     80        chips = psArrayAlloc(1);
     81        chips->data[0] = chip;
     82    }
     83
     84    pmFPAPrint(newfpa);
     85    pmFPAMorph(newfpa, fpa, 0, 0);
     86    pmFPAPrint(newfpa);
     87
     88#if 0
     89    // Write out
     90    psFits *newfits = psFitsAlloc("test.fits");
     91    pmFPAWrite(fits, newfpa);
     92    psFree(newfits);
     93#endif
     94
     95#if 1
     96    psArray *chips = newfpa->chips;
     97    for (int i = 0; i < chips->n; i++) {
     98        papChip *chip = chips->data[i]; // Chip of interest
     99        psArray *cells = chip->cells;   // Array of cells
     100
     101        if (chip->extname) {
     102            psFits *fp = psFitsAlloc(chip->extname);
     103            psFitsWriteImage(fp, chip->header, chip->pixels->data[i], i);
     104            psFree(fp);
     105        }
     106
     107        for (int j = 0; j < cells->n; j++) {
     108            papCell *cell = cells->data[j]; // Cell of interest
     109
     110            if (cell->extname) {
     111                psFits *fp = psFitsAlloc(cell->extname);
     112                psFitsWriteImage(fp, cell->header, cell->pixels->data[i], i);
     113                psFree(fp);
     114            }
     115        }
     116    }
     117#endif
     118
     119    psFree(newfpa);
     120    psFree(newCamera);
    64121
    65122    // Tidy up
Note: See TracChangeset for help on using the changeset viewer.