IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 2, 2008, 4:11:48 PM (18 years ago)
Author:
Paul Price
Message:

Get IMNAXIS1,IMNAXIS2 from image if possible.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourceIO.c

    r19307 r19875  
    33 *  @author EAM, IfA
    44 *
    5  *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2008-09-02 19:06:17 $
     5 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2008-10-03 02:11:48 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    424424                pmConfigConformHeader(hdu->header, file->format);
    425425
    426                 // psFitsWriteBlank strips out the NAXISn keywords, forcing CFITSIO to take care of them
    427                 // save NAXIS1,NAXIS2 as IMNAXIS1,IMNAXIS2
    428                 int Nx = psMetadataLookupS32 (&status, hdu->header, "IMNAXIS1");
    429                 if (!status) {
    430                     Nx = psMetadataLookupS32 (&status, hdu->header, "NAXIS1");
    431                     if (status) {
    432                         psMetadataAddS32 (hdu->header, PS_LIST_TAIL, "IMNAXIS1", PS_META_REPLACE, "original image size (x-dir)", Nx);
    433                     } else {
    434                         fprintf (stderr, "header is missing NAXIS1!");
    435                     }
    436                 }
    437 
    438                 int Ny = psMetadataLookupS32 (&status, hdu->header, "IMNAXIS2");
    439                 if (!status) {
    440                     Ny = psMetadataLookupS32 (&status, hdu->header, "NAXIS2");
    441                     if (status) {
    442                         psMetadataAddS32 (hdu->header, PS_LIST_TAIL, "IMNAXIS2", PS_META_REPLACE, "original image size (y-dir)", Ny);
    443                     } else {
    444                         fprintf (stderr, "header is missing NAXIS2!");
    445                     }
    446                 }
     426                // psFitsWriteBlank strips out the NAXISn keywords, forcing CFITSIO to take care of them
     427                // save NAXIS1,NAXIS2 as IMNAXIS1,IMNAXIS2
     428                int numCols = 0, numRows = 0; // Size of image
     429                if (readout->image) {
     430                    numCols = readout->image->numCols;
     431                    numRows = readout->image->numRows;
     432                } else {
     433                    numCols = psMetadataLookupS32(&status, hdu->header, "IMNAXIS1");
     434                    if (!status) {
     435                        numCols = psMetadataLookupS32(&status, hdu->header, "NAXIS1");
     436                    }
     437                    numRows = psMetadataLookupS32(&status, hdu->header, "IMNAXIS2");
     438                    if (!status) {
     439                        numRows = psMetadataLookupS32(&status, hdu->header, "NAXIS2");
     440                    }
     441                }
     442
     443                if (numCols == 0 || numRows == 0) {
     444                    psWarning("Output source file has invalid IMNAXIS1, IMNAXIS2.");
     445                }
    447446
    448447                psFitsWriteBlank (file->fits, hdu->header, headname);
     
    906905
    907906        // XXX these are case-sensitive since the EXTYPE is case-sensitive
    908         if (file->type == PM_FPA_FILE_CMF) {
    909             if (!strcmp (exttype, "SMPDATA")) {
    910                 sources = pmSourcesRead_SMPDATA (file->fits, hdu->header);
    911             }
    912             if (!strcmp (exttype, "PS1_DEV_0")) {
    913                 sources = pmSourcesRead_PS1_DEV_0 (file->fits, hdu->header);
    914             }
    915             if (!strcmp (exttype, "PS1_DEV_1")) {
    916                 sources = pmSourcesRead_PS1_DEV_1 (file->fits, hdu->header);
    917             }
    918         }
     907        if (file->type == PM_FPA_FILE_CMF) {
     908            if (!strcmp (exttype, "SMPDATA")) {
     909                sources = pmSourcesRead_SMPDATA (file->fits, hdu->header);
     910            }
     911            if (!strcmp (exttype, "PS1_DEV_0")) {
     912                sources = pmSourcesRead_PS1_DEV_0 (file->fits, hdu->header);
     913            }
     914            if (!strcmp (exttype, "PS1_DEV_1")) {
     915                sources = pmSourcesRead_PS1_DEV_1 (file->fits, hdu->header);
     916            }
     917        }
    919918
    920919        psTrace("psModules.objects", 6, "read CMF table from %s : %s : %s", file->filename, headname, dataname);
Note: See TracChangeset for help on using the changeset viewer.