IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9699


Ignore:
Timestamp:
Oct 20, 2006, 5:26:12 PM (20 years ago)
Author:
Paul Price
Message:

Printing ourselves, instead of using psTrace, so that we can actually print to the desired file descriptor.

Location:
trunk/psModules/src/camera
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAConstruct.c

    r9588 r9699  
    797797
    798798
     799// Print spaces to indent
     800#define INDENT(FILE, LEVEL) \
     801{ \
     802    for (int i = 0; i < (LEVEL); i++) { \
     803        fprintf(FILE, " "); \
     804    } \
     805}
     806
    799807void pmFPAPrint(FILE *fd, const pmFPA *fpa, bool header, bool concepts)
    800808{
    801809    PS_ASSERT_PTR_NON_NULL(fpa,);
    802810
    803     psTrace("psModules.camera", 1, "FPA:\n");
     811    IDENT(fd, 1);
     812    fprintf(fd,  1, "FPA:\n");
    804813    if (fpa->hdu) {
    805814        pmHDUPrint(fd, fpa->hdu, 2, header);
     
    812821    // Iterate over the FPA
    813822    for (int i = 0; i < chips->n; i++) {
    814         psTrace("psModules.camera", 3, "Chip: %d\n", i);
     823        INDENT(fd, 3);
     824        fprintf(fd, "Chip: %d\n", i);
    815825        pmChip *chip = chips->data[i]; // The chip
    816826        if (chip->hdu) {
     
    824834        psArray *cells = chip->cells;   // Array of cells
    825835        for (int j = 0; j < cells->n; j++) {
    826             psTrace("psModules.camera", 5, "Cell: %d\n", j);
     836            INDENT(fd, 5);
     837            fprintf(fd, "Cell: %d\n", j);
    827838            pmCell *cell = cells->data[j]; // The cell
    828839            if (cell->hdu) {
     
    836847            for (int k = 0; k < readouts->n; k++) {
    837848                pmReadout *readout = readouts->data[k]; // The readout
    838                 psTrace("psModules.camera", 6, "Readout %d:\n", k);
    839                 psTrace("psModules.camera", 7, "row0: %d\n", readout->row0);
    840                 psTrace("psModules.camera", 7, "col0: %d\n", readout->col0);
     849                INDENT(fd, 6);
     850                fprintf(fd, "Readout %d:\n", k);
     851                INDENT(fd, 7);
     852                fprintf(fd, "col0: %d\n", readout->col0);
     853                INDENT(fd, 7);
     854                fprintf(fd, "row0: %d\n", readout->row0);
    841855                psImage *image = readout->image; // The image
    842856                psList *bias = readout->bias; // The list of bias images
    843857                if (image) {
    844                     psTrace("psModules.camera", 7, "Image: [%d:%d,%d:%d] (%dx%d)\n", image->col0, image->col0 +
     858                    INDENT(fd, 7);
     859                    fprintf(fd, "Image: [%d:%d,%d:%d] (%dx%d)\n", image->col0, image->col0 +
    845860                            image->numCols, image->row0, image->row0 + image->numRows, image->numCols,
    846861                            image->numRows);
     
    850865                    psImage *biasImage = NULL; // Bias image from iteration
    851866                    while ((biasImage = psListGetAndIncrement(biasIter))) {
    852                         psTrace("psModules.camera", 7, "Bias:  [%d:%d,%d:%d] (%dx%d)\n", biasImage->col0,
     867                        INDENT(fd, 7);
     868                        fprintf(fd, "Bias:  [%d:%d,%d:%d] (%dx%d)\n", biasImage->col0,
    853869                                biasImage->col0 + biasImage->numCols, biasImage->row0,
    854870                                biasImage->row0 + biasImage->numRows, biasImage->numCols, biasImage->numRows);
  • trunk/psModules/src/camera/pmHDUUtils.c

    r9608 r9699  
    8080}
    8181
     82// Print spaces to indent
     83#define INDENT(FILE, LEVEL) \
     84{ \
     85    for (int i = 0; i < (LEVEL); i++) { \
     86        fprintf(FILE, " "); \
     87    } \
     88}
     89
    8290void pmHDUPrint(FILE *fd, const pmHDU *hdu, int level, bool header)
    8391{
    8492    PS_ASSERT_PTR_NON_NULL(hdu,);
    8593
    86     #ifndef PS_NO_TRACE
    87 
     94    INDENT(fd, level);
    8895    if (hdu->blankPHU) {
    89         psTrace("psModules.camera", level, "HDU: (PHU)\n");
     96        fprintf(fd, "HDU: (PHU)\n");
    9097    } else {
    91         psTrace("psModules.camera", level, "HDU: %s\n", hdu->extname);
     98        fprintf(fd, "HDU: %s\n", hdu->extname);
    9299    }
    93100
    94     psTrace("psModules.camera", level + 1, "Format: %p\n", hdu->format);
     101    INDENT(fd, level + 1);
     102    fprintf(fd, "Format: %p\n", hdu->format);
    95103    if (header) {
     104        INDENT(fd, level + 1);
    96105        if (hdu->header) {
    97             psTrace("psModules.camera", level + 1, "Header:\n");
     106            fprintf(fd, "Header:\n");
    98107            psMetadataPrint(fd, hdu->header, level + 2);
    99108        } else {
    100             psTrace("psModules.camera", level + 1, "No header.\n");
     109            fprintf(fd, "No header.\n");
    101110        }
    102111    }
    103112
     113    INDENT(fd, level + 1);
    104114    if (hdu->images) {
    105         psTrace("psModules.camera", level + 1, "Images:\n");
     115        fprintf(fd, "Images:\n");
    106116        for (long i = 0; i < hdu->images->n; i++) {
    107117            psImage *image = hdu->images->data[i]; // Image of interest
    108             psTrace("psModules.camera", level + 2, "%ld: %dx%d\n", i, image->numCols, image->numRows);
     118            INDENT(fd, level + 2);
     119            fprintf(fd, "%ld: %dx%d\n", i, image->numCols, image->numRows);
    109120        }
    110121    } else {
    111         psTrace("psModules.camera", level + 1, "NO images.\n");
     122        fprintf(fd, "NO images.\n");
    112123    }
    113124
     125    INDENT(fd, level + 1);
    114126    if (hdu->masks) {
    115         psTrace("psModules.camera", level + 1, "Masks:\n");
     127        fprintf(fd, "Masks:\n");
    116128        for (long i = 0; i < hdu->masks->n; i++) {
    117129            psImage *mask = hdu->masks->data[i]; // Mask of interest
    118             psTrace("psModules.camera", level + 2, "%ld: %dx%d\n", i, mask->numCols, mask->numRows);
     130            INDENT(fd, level + 2);
     131            fprintf(fd, "%ld: %dx%d\n", i, mask->numCols, mask->numRows);
    119132        }
    120133    } else {
    121         psTrace("psModules.camera", level + 1, "NO masks.\n");
     134        fprintf(fd, "NO masks.\n");
    122135    }
    123136
     137    INDENT(fd, level + 1);
    124138    if (hdu->weights) {
    125         psTrace("psModules.camera", level + 1, "Weights:\n");
     139        fprintf(fd, "Weights:\n");
    126140        for (long i = 0; i < hdu->masks->n; i++) {
    127141            psImage *weight = hdu->weights->data[i]; // Weight image of interest
    128             psTrace("psModules.camera", level + 2, "%ld: %dx%d\n", i, weight->numCols, weight->numRows);
     142            INDENT(fd, level + 2);
     143            fprintf(fd, "%ld: %dx%d\n", i, weight->numCols, weight->numRows);
    129144        }
    130145    } else {
    131         psTrace("psModules.camera", level + 1, "NO weights.\n");
     146        fprintf(fd, "NO weights.\n");
    132147    }
    133     #endif
    134148
    135149    return;
Note: See TracChangeset for help on using the changeset viewer.