IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 8, 2011, 3:02:58 PM (15 years ago)
Author:
rhenders
Message:

now taking config XML doc as constructor arg; now copying FITS file locally instead of accessing over the network

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/fits.py

    r31832 r31849  
    33import os
    44import re
    5 
     5import shutil
    66
    77'''
     
    1515
    1616    '''
    17     def __init__(self, logger, path):
     17    def __init__(self, logger, doc, originalPath):
    1818
    19        self.path = path
     19       self.originalPath = originalPath
    2020       self.logger = logger
     21       self.doc = doc
     22       self.localDir = self.doc.find("localOutPath").text
    2123
    2224       # does it exist?
    23        if not os.path.isfile(self.path):
    24            self.logger.error("Cannot read file at '" + self.path + "'")
     25       if not os.path.isfile(self.originalPath):
     26           self.logger.error("Cannot read file at '" + self.originalPath + "'")
    2527           return
    2628
    27        self.file = open(self.path)
     29       self.logger.infoPair("FITS file", self.originalPath)
     30       self.localCopyPath = self.localDir + "/temp.fits"
     31       shutil.copy2(self.originalPath, self.localCopyPath)
     32
     33       self.file = open(self.localCopyPath)
    2834       self.header = self.parseHeader()
    29        self.logger.info("Read primary header and found " + str(len(self.header)) + " header cards")
     35       self.logger.infoPair("FITS local copy", self.localCopyPath)
     36       self.logger.infoPair("FITS primary header", "%d cards found" % len(self.header))
    3037       self.rewindToStart()
     38
     39    '''
     40    Returns the path to this FITS file
     41    '''
     42    def getPath(self):
     43        return self.localCopyPath
    3144
    3245    '''
Note: See TracChangeset for help on using the changeset viewer.