IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34833 for trunk


Ignore:
Timestamp:
Dec 17, 2012, 11:32:03 AM (14 years ago)
Author:
heather
Message:

fixes for sa10

File:
1 edited

Legend:

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

    r34661 r34833  
    55
    66import stilts
     7import re
    78from java.lang import *
    89from java.sql import *
     
    143144    '''
    144145    def updateApFlxs(self, prefix, psfCondition):
     146        #properly -999 these to start with:
    145147
    146148        sql = "UPDATE StackApFlx AS a, SkyChip_xrad AS b SET \
    147         "+prefix+"flxR1=b.APER_FLUX_1 / " + str(self.expTime) + ", \
    148         "+prefix+"flxR1Err=b.APER_FLUX_ERR_1 / " + str(self.expTime) + ", \
    149         "+prefix+"flxR1Std=b.APER_FLUX_STDEV_1 / " + str(self.expTime) + ", \
    150         "+prefix+"flxR1Fill=b.APER_FILL_1, \
    151         "+prefix+"flxR2=b.APER_FLUX_2 / " + str(self.expTime) + ", \
    152         "+prefix+"flxR2Err=b.APER_FLUX_ERR_2 / " + str(self.expTime) + ", \
    153         "+prefix+"flxR2Std=b.APER_FLUX_STDEV_2 / " + str(self.expTime) + ", \
    154         "+prefix+"flxR2Fill=b.APER_FILL_2, \
    155         "+prefix+"flxR3=b.APER_FLUX_3 / " + str(self.expTime) + ", \
    156         "+prefix+"flxR3Err=b.APER_FLUX_ERR_3 / " + str(self.expTime) + ", \
    157         "+prefix+"flxR3Std=b.APER_FLUX_STDEV_3 / " + str(self.expTime) + ", \
    158         "+prefix+"flxR3Fill=b.APER_FILL_3, \
    159         "+prefix+"flxR4=b.APER_FLUX_4 / " + str(self.expTime) + ", \
    160         "+prefix+"flxR4Err=b.APER_FLUX_ERR_4 / " + str(self.expTime) + ", \
    161         "+prefix+"flxR4Std=b.APER_FLUX_STDEV_4 / " + str(self.expTime) + ", \
    162         "+prefix+"flxR4Fill=b.APER_FILL_4, \
    163         "+prefix+"flxR5=b.APER_FLUX_5 / " + str(self.expTime) + ", \
    164         "+prefix+"flxR5Err=b.APER_FLUX_ERR_5 / " + str(self.expTime) + ", \
    165         "+prefix+"flxR5Std=b.APER_FLUX_STDEV_5 / " + str(self.expTime) + ", \
    166         "+prefix+"flxR5Fill=b.APER_FILL_5, \
    167         "+prefix+"flxR6=b.APER_FLUX_6 / " + str(self.expTime) + ", \
    168         "+prefix+"flxR6Err=b.APER_FLUX_ERR_6 / " + str(self.expTime) + ", \
    169         "+prefix+"flxR6Std=b.APER_FLUX_STDEV_6 / " + str(self.expTime) + ", \
    170         "+prefix+"flxR6Fill=b.APER_FILL_6, \
    171         "+prefix+"flxR7=b.APER_FLUX_7 / " + str(self.expTime) + ", \
    172         "+prefix+"flxR7Err=b.APER_FLUX_ERR_7 / " + str(self.expTime) + ", \
    173         "+prefix+"flxR7Std=b.APER_FLUX_STDEV_7 / " + str(self.expTime) + ", \
    174         "+prefix+"flxR7Fill=b.APER_FILL_7, \
    175         "+prefix+"flxR8=b.APER_FLUX_8 / " + str(self.expTime) + ", \
    176         "+prefix+"flxR8Err=b.APER_FLUX_ERR_8 / " + str(self.expTime) + ", \
    177         "+prefix+"flxR8Std=b.APER_FLUX_STDEV_8 / " + str(self.expTime) + ", \
    178         "+prefix+"flxR8Fill=b.APER_FILL_8, \
    179         "+prefix+"flxR9=b.APER_FLUX_9 / " + str(self.expTime) + ", \
    180         "+prefix+"flxR9Err=b.APER_FLUX_ERR_9 / " + str(self.expTime) + ", \
    181         "+prefix+"flxR9Std=b.APER_FLUX_STDEV_9 / " + str(self.expTime) + ", \
    182         "+prefix+"flxR9Fill=b.APER_FILL_9, \
    183         "+prefix+"flxR10=b.APER_FLUX_10 / " + str(self.expTime) + ", \
    184         "+prefix+"flxR10Err=b.APER_FLUX_ERR_10 / " + str(self.expTime) + ", \
    185         "+prefix+"flxR10Std=b.APER_FLUX_STDEV_10 / " + str(self.expTime) + ", \
    186         "+prefix+"flxR10Fill=b.APER_FILL_10 \
    187         WHERE a.ippDetectID=b.IPP_IDET AND b.PSF_FWHM "+psfCondition
    188 
    189         self.scratchDb.execute(sql)
     149        "+prefix+"flxR1=-999, \
     150        "+prefix+"flxR1Err=-999, \
     151        "+prefix+"flxR1Std=-999, \
     152        "+prefix+"flxR1Fill=-999, \
     153        "+prefix+"flxR2=-999, \
     154        "+prefix+"flxR2Err=-999, \
     155        "+prefix+"flxR2Std=-999, \
     156        "+prefix+"flxR2Fill=-999, \
     157        "+prefix+"flxR3=-999, \
     158        "+prefix+"flxR3Err=-999, \
     159        "+prefix+"flxR3Std=-999, \
     160        "+prefix+"flxR3Fill=-999, \
     161        "+prefix+"flxR4=-999, \
     162        "+prefix+"flxR4Err=-999, \
     163        "+prefix+"flxR4Std=-999, \
     164        "+prefix+"flxR4Fill=-999, \
     165        "+prefix+"flxR5=-999, \
     166        "+prefix+"flxR5Err=-999, \
     167        "+prefix+"flxR5Std=-999, \
     168        "+prefix+"flxR5Fill=-999, \
     169        "+prefix+"flxR6=-999, \
     170        "+prefix+"flxR6Err=-999, \
     171        "+prefix+"flxR6Std=-999, \
     172        "+prefix+"flxR6Fill=-999, \
     173        "+prefix+"flxR7=-999, \
     174        "+prefix+"flxR7Err=-999, \
     175        "+prefix+"flxR7Std=-999, \
     176        "+prefix+"flxR7Fill=-999, \
     177        "+prefix+"flxR8=-999, \
     178        "+prefix+"flxR8Err=-999, \
     179        "+prefix+"flxR8Std=-999, \
     180        "+prefix+"flxR8Fill=-999, \
     181        "+prefix+"flxR9=-999, \
     182        "+prefix+"flxR9Err=-999, \
     183        "+prefix+"flxR9Std=-999, \
     184        "+prefix+"flxR9Fill=-999, \
     185        "+prefix+"flxR10=-999, \
     186        "+prefix+"flxR10Err=-999, \
     187        "+prefix+"flxR10Std=-999, \
     188        "+prefix+"flxR10Fill=-999 \
     189        WHERE a.ippDetectID=b.IPP_IDET "
     190        #self.logger.infoPair("sql", sql)
     191        self.scratchDb.execute(sql)
     192
     193
     194        #we have variable numbers of these columns. find out which are in use
     195        sql = "DESCRIBE SkyChip_xrad 'aper_fill_%'"
     196        rs = self.scratchDb.executeQuery(sql)
     197        rs.first()
     198        columns = []
     199        column = rs.getString(1)
     200        columns.append(column)
     201        while (rs.next()):
     202            column = rs.getString(1)
     203            columns.append(column)
     204        rs.close()
     205
     206        #use regex to leave just the numbers
     207
     208        numbers = []
     209        for column in columns:
     210            number = re.sub("APER_FILL_","",column)
     211            if (int(number) >= 1 and int(number) <=10):
     212                numbers.append(number)
     213                self.logger.infoPair("Aperture Numbers",number)
     214
     215        #generate the sql to do the necessary ops on the columns   
     216        sql = "UPDATE StackApFlx AS a, SkyChip_xrad AS b SET "
     217        cnt =0
     218        for number in numbers:
     219            if (cnt>0):
     220                sql=sql+" , "
     221            sql=sql+prefix+"flxR"+number+"=b.APER_FLUX_"+number +" / " + str(self.expTime) + ", "
     222            sql=sql+prefix+"flxR"+number+"Err=b.APER_FLUX_ERR_"+number +" / " + str(self.expTime) + ", "
     223            sql=sql+prefix+"flxR"+number+"Std=b.APER_FLUX_STDEV_"+number +" / " + str(self.expTime) + ", "
     224            sql=sql+prefix+"flxR"+number+"Fill=b.APER_FILL_"+number + " "
     225            cnt=cnt+1
     226           
     227        sql=sql+"WHERE a.ippDetectID=b.IPP_IDET AND b.PSF_FWHM "+psfCondition     
     228        self.scratchDb.execute(sql)
     229
     230        #self.logger.infoPair("sql",sql)
     231
     232        #sql = "UPDATE StackApFlx AS a, SkyChip_xrad AS b SET \
     233        #"+prefix+"flxR1=b.APER_FLUX_1 / " + str(self.expTime) + ", \
     234        #"+prefix+"flxR1Err=b.APER_FLUX_ERR_1 / " + str(self.expTime) + ", \
     235        #"+prefix+"flxR1Std=b.APER_FLUX_STDEV_1 / " + str(self.expTime) + ", \
     236        #"+prefix+"flxR1Fill=b.APER_FILL_1, \
     237        #"+prefix+"flxR2=b.APER_FLUX_2 / " + str(self.expTime) + ", \
     238        ##"+prefix+"flxR2Err=b.APER_FLUX_ERR_2 / " + str(self.expTime) + ", \
     239        #"+prefix+"flxR2Std=b.APER_FLUX_STDEV_2 / " + str(self.expTime) + ", \
     240        #"+prefix+"flxR2Fill=b.APER_FILL_2, \
     241        #"+prefix+"flxR3=b.APER_FLUX_3 / " + str(self.expTime) + ", \
     242        #"+prefix+"flxR3Err=b.APER_FLUX_ERR_3 / " + str(self.expTime) + ", \
     243        #"+prefix+"flxR3Std=b.APER_FLUX_STDEV_3 / " + str(self.expTime) + ", \
     244        #"+prefix+"flxR3Fill=b.APER_FILL_3, \
     245        #"+prefix+"flxR4=b.APER_FLUX_4 / " + str(self.expTime) + ", \
     246        #"+prefix+"flxR4Err=b.APER_FLUX_ERR_4 / " + str(self.expTime) + ", \
     247        #"+prefix+"flxR4Std=b.APER_FLUX_STDEV_4 / " + str(self.expTime) + ", \
     248        #"+prefix+"flxR4Fill=b.APER_FILL_4, \
     249        #"+prefix+"flxR5=b.APER_FLUX_5 / " + str(self.expTime) + ", \
     250        #"+prefix+"flxR5Err=b.APER_FLUX_ERR_5 / " + str(self.expTime) + ", \
     251        #"+prefix+"flxR5Std=b.APER_FLUX_STDEV_5 / " + str(self.expTime) + ", \
     252        #"+prefix+"flxR5Fill=b.APER_FILL_5, \
     253        #"+prefix+"flxR6=b.APER_FLUX_6 / " + str(self.expTime) + ", \
     254        #"+prefix+"flxR6Err=b.APER_FLUX_ERR_6 / " + str(self.expTime) + ", \
     255        #"+prefix+"flxR6Std=b.APER_FLUX_STDEV_6 / " + str(self.expTime) + ", \
     256        #"+prefix+"flxR6Fill=b.APER_FILL_6, \
     257        #"+prefix+"flxR7=b.APER_FLUX_7 / " + str(self.expTime) + ", \
     258        #"+prefix+"flxR7Err=b.APER_FLUX_ERR_7 / " + str(self.expTime) + ", \
     259        #"+prefix+"flxR7Std=b.APER_FLUX_STDEV_7 / " + str(self.expTime) + ", \
     260        #"+prefix+"flxR7Fill=b.APER_FILL_7, \
     261        #"+prefix+"flxR8=b.APER_FLUX_8 / " + str(self.expTime) + ", \
     262        #"+prefix+"flxR8Err=b.APER_FLUX_ERR_8 / " + str(self.expTime) + ", \
     263        #"+prefix+"flxR8Std=b.APER_FLUX_STDEV_8 / " + str(self.expTime) + ", \
     264        #"+prefix+"flxR8Fill=b.APER_FILL_8, \
     265        #"+prefix+"flxR9=b.APER_FLUX_9 / " + str(self.expTime) + ", \
     266        #"+prefix+"flxR9Err=b.APER_FLUX_ERR_9 / " + str(self.expTime) + ", \
     267        #"+prefix+"flxR9Std=b.APER_FLUX_STDEV_9 / " + str(self.expTime) + ", \
     268        #"+prefix+"flxR9Fill=b.APER_FILL_9, \
     269        #"+prefix+"flxR10=b.APER_FLUX_10 / " + str(self.expTime) + ", \
     270        #"+prefix+"flxR10Err=b.APER_FLUX_ERR_10 / " + str(self.expTime) + ", \
     271        #"+prefix+"flxR10Std=b.APER_FLUX_STDEV_10 / " + str(self.expTime) + ", \
     272        #"+prefix+"flxR10Fill=b.APER_FILL_10 \
     273        #WHERE a.ippDetectID=b.IPP_IDET AND b.PSF_FWHM "+psfCondition
     274
     275        #self.scratchDb.execute(sql)
    190276
    191277    '''
Note: See TracChangeset for help on using the changeset viewer.