IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38956


Ignore:
Timestamp:
Oct 23, 2015, 6:06:25 PM (11 years ago)
Author:
mhuber
Message:

adding md5sum for frame,stack,diff,forcedwarpMeta (was working for frame+stack)

Location:
trunk/ippToPsps/jython
Files:
5 edited

Legend:

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

    r38954 r38956  
    112112       # MJD-OBS is the exposure start, EXTIME / 172800 = (EXPTIME sec / 84600 sec/day) / 2
    113113       self.obsTime = float(self.header['MJD-OBS']) + (float(self.header['EXPTIME']) / 172800.0)
    114      
     114   
     115       ## MEH md5sum options test
     116       self.md5sum = None
     117       self.md5sum = self.fits.getMd5sum()
     118       #self.md5sum = self.fits.getMd5sumShell()
     119       #self.md5sum = self.fits.getMd5sumFile()
     120 
    115121       # set up some defauts
    116122       self.totalNumPhotoRef = 0
     
    137143        sqlLine = sqlUtility("INSERT INTO FrameMeta (")
    138144
    139         # sqlLine.group("md5sum",               ' needs a number');
    140  
    141145        sqlLine.group("frameID",               str(self.expID));
    142146        sqlLine.group("frameName",             self.expName);
     
    148152        sqlLine.group("telescopeID",           "1");
    149153        sqlLine.group("analysisVer",           self.analysisVer);
     154        sqlLine.group("md5sum",                str(self.md5sum))
    150155        sqlLine.group("photoScat",             self.getKeyFloat(self.header, "%.8f", 'ZPT_ERR'));
    151156        sqlLine.group("expStart",              self.getKeyFloat(self.header, "%.10f", 'MJD-OBS'));
  • trunk/ippToPsps/jython/diffbatch.py

    r38954 r38956  
    7373       self.skycellName = {}
    7474       self.analysisVer = {}
     75       self.md5sum = {}
    7576       self.expTime = {}
    7677       self.obsTime = {}
     
    149150               self.skycellID[num] = -1
    150151
     152           ## MEH md5sum test
     153           self.md5sum[num] = self.fits[num].getMd5sum()
    151154
    152155       # drop the existing tables   
     
    219222        sqlLine.group("photoCalID",            self.photoCalID[num]);
    220223        sqlLine.group("analysisVer",           str(self.analysisVer[num]));
     224        sqlLine.group("md5sum",                str(self.md5sum[num]))
    221225        sqlLine.group("expTime",               self.expTime[num]);
    222226        sqlLine.group("ctype1",                self.getKeyValue(self.header[num], 'CTYPE1'));
  • trunk/ippToPsps/jython/fits.py

    r35417 r38956  
    44import re
    55import shutil
     6import hashlib
     7from subprocess import call, PIPE, Popen
    68
    79'''
     
    4244       # move file pointer back to the start of the file
    4345       self.rewindToStart()
     46
     47
     48    '''
     49    Get md5sum for file
     50    '''
     51    def getMd5sum(self):
     52        ## memory inefficient all at once read but should be ok...
     53        md5 = hashlib.md5(open(self.originalPath,'rb').read())
     54        return md5.hexdigest()
     55
     56    def getMd5sumShell(self):
     57        md5cmd = "md5sum %s" % (self.originalPath)
     58        md5 = Popen(md5cmd, shell=True, stdout=PIPE).stdout.read()
     59        return md5[0:32]
     60
     61    def getMd5sumFile(self):
     62        ## unclear if rb by default for file so maybe not best
     63        md5 = hashlib.md5(self.file.read())
     64        ## if used, then need to move file pointer back to the start of the file for others to use
     65        self.rewindToStart()
     66        return md5.hexdigest()
    4467
    4568    '''
  • trunk/ippToPsps/jython/forcedwarpbatch.py

    r38954 r38956  
    7878       self.expTime = {}
    7979       self.analysisVer = {}
     80       set.md5sum = {}
    8081       self.tessName = {}
    8182       self.obsTime = {}
     
    198199           #except: raise
    199200
     201           ## MEH md5sum test
     202           self.md5sum[num] = self.fits[num].getMd5sum()
    200203
    201204           self.logger.infoPair("calculating ObsTime","ok")
     
    265268        sqlLine.group("photoCalID",     photoCalID)
    266269        sqlLine.group("analysisVer",    str(self.analysisVer[num]))
     270        sqlLine.group("md5sum",         str(self.md5sum[num]))
    267271        sqlLine.group("expTime",        self.expTime[num])
    268272# no astrometry calibration for forced warp
  • trunk/ippToPsps/jython/stackbatch.py

    r38954 r38956  
    6363       self.fits = {}
    6464       self.headerSet = {}
     65       self.md5sum = {}
    6566
    6667       # we have two sets of imageIDs here:
     
    112113           self.logger.infoPair(filter + " imageID = ", imageID)       
    113114           self.imageIDs[filter] = imageID
     115
     116           ## MEH -- md5sum test
     117           self.md5sum[filter] = self.fits[filter].getMd5sum()
    114118
    115119       # did we find any valid stacks?
     
    281285        sqlLine.group("photoCalID",         photoCalID)
    282286        sqlLine.group("analysisVer",        str(self.analysisVer))
     287        sqlLine.group("md5sum",             str(self.md5sum[filter]))
    283288        sqlLine.group("detectionThreshold", detectionThreshold)
    284289        sqlLine.group("expTime",            self.getKeyFloat(header, "%.5f", 'EXPTIME')) 
Note: See TracChangeset for help on using the changeset viewer.