IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33688


Ignore:
Timestamp:
Apr 3, 2012, 5:22:13 PM (14 years ago)
Author:
rhenders
Message:

using new scratchDb method to determine list of filters and associated codes from the Photcodes table in order to populate the mags from the cps file

File:
1 edited

Legend:

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

    r33687 r33688  
    9696    def insertMags(self, cpsTable):
    9797
    98         # do this properly with photcode table
    99         filters = ['g', 'r', 'i', 'z', 'y']
     98        # list of all filters we are interested in
     99        allFilters = ['g', 'r', 'i', 'z', 'y']
    100100       
     101        # this loop looks into the DVO Photcodes tables and gets the 'CODE' for each the filters above that are listed
     102        filters = []
     103        for filter in allFilters:
     104            code = self.scratchDb.getCodeForThisFilter(filter)
     105            if code < 0: continue
     106            filters.append([code, filter])
     107       
     108        # the 'code' now defines the order in the cps file that the mags are listed for a given filter
    101109        for filter in filters:
    102110
    103             if filter == "g": index = 4
    104             elif filter == "r": index = 3
    105             elif filter == "i": index = 2
    106             elif filter == "z": index = 1
    107             elif filter == "y": index = 0
    108 
    109111            sql = "UPDATE Object \
    110                    JOIN " + cpsTable + " AS cps ON (cps.row = (Object.row*5)-" + str(index) + ") \
     112                   JOIN " + cpsTable + " AS cps ON (cps.row = (Object.row*5)-" + str(filter[0]) + ") \
    111113                   SET \
    112                    " + filter + "MeanMag = MAG, \
    113                    " + filter + "MeanMagErr = MAG_ERR"
     114                   " + filter[1] + "MeanMag = MAG, \
     115                   " + filter[1] + "MeanMagErr = MAG_ERR"
    114116
    115117            self.scratchDb.execute(sql)
Note: See TracChangeset for help on using the changeset viewer.