IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37927


Ignore:
Timestamp:
Feb 23, 2015, 4:08:25 PM (11 years ago)
Author:
heather
Message:

sas37 fo now works!

Location:
trunk/ippToPsps
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/config/ippToPspsDbSchema.sql

    r37917 r37927  
    199199  `region` varchar(50) default NULL,
    200200  KEY `batch_id` (`batch_id`),
    201   CONSTRAINT `diffobject_fk_1` FOREIGN KEY (`batch_id`) REFERENCES `batch` (`batch_id`)
     201  CONSTRAINT `forcedobject_fk_1` FOREIGN KEY (`batch_id`) REFERENCES `batch` (`batch_id`)
    202202) ENGINE=InnoDB DEFAULT CHARSET=latin1;
    203203SET character_set_client = @saved_cs_client;
  • trunk/ippToPsps/config/tables.FO.vot

    r37840 r37927  
    264264        <DESCRIPTION>flags for i forced</DESCRIPTION>
    265265      </FIELD>
    266       <FIELD name="iLensObjSmearX11" arraysize="1" datatype="float" unit="arcsec^-2" default="-999">
    267         <DESCRIPTION>per-object smear polarizability X11 term</DESCRIPTION>
    268       </FIELD>
    269       <FIELD name="iLensObjSmearX12" arraysize="1" datatype="float" unit="arcsec^-2" default="-999">
    270         <DESCRIPTION>per-object smear polarizability X12 term</DESCRIPTION>
    271       </FIELD>
    272       <FIELD name="iLensObjSmearX22" arraysize="1" datatype="float" unit="arcsec^-2" default="-999">
    273         <DESCRIPTION>per-object smear polarizability X22 term</DESCRIPTION>
    274       </FIELD>
    275       <FIELD name="iLensObjSmearE1" arraysize="1" datatype="float" unit="arcsec^-2" default="-999">
    276         <DESCRIPTION>per-object smear polarizability E1 term</DESCRIPTION>
    277       </FIELD>
    278       <FIELD name="iLensObjSmearE2" arraysize="1" datatype="float" unit="arcsec^-2" default="-999">
    279         <DESCRIPTION>per-object smear polarizability E2 term</DESCRIPTION>
    280       </FIELD>
    281266      <FIELD name="iGamma" arraysize="1" datatype="float" unit="arcsec^2" default="-999">
    282267        <DESCRIPTION>second moment (Mxx+Myy)</DESCRIPTION>
     
    460445      </DATA>
    461446    </TABLE>
    462     <TABLE name="ForcedMeanObject">
    463       <DESCRIPTION>VOTable description of PSPS table ForcedMeanObject</DESCRIPTION>
     447    <TABLE name="ForcedMeanLensing">
     448      <DESCRIPTION>VOTable description of PSPS table ForcedMeanLensing</DESCRIPTION>
    464449      <PARAM arraysize="1" datatype="char" ucd="meta.bib.author" name="Author" value="PSPS"></PARAM>
    465450      <FIELD name="objID" arraysize="1" datatype="long" unit="dimensionless" default="NA">
     
    607592        <DESCRIPTION>stack image id (how to carry through IPP+DVO</DESCRIPTION>
    608593      </FIELD>
     594      <FIELD name="iLensObjSmearX11" arraysize="1" datatype="float" unit="arcsec^-2" default="-999">
     595        <DESCRIPTION>per-object smear polarizability X11 term</DESCRIPTION>
     596      </FIELD>
     597      <FIELD name="iLensObjSmearX12" arraysize="1" datatype="float" unit="arcsec^-2" default="-999">
     598        <DESCRIPTION>per-object smear polarizability X12 term</DESCRIPTION>
     599      </FIELD>
     600      <FIELD name="iLensObjSmearX22" arraysize="1" datatype="float" unit="arcsec^-2" default="-999">
     601        <DESCRIPTION>per-object smear polarizability X22 term</DESCRIPTION>
     602      </FIELD>
     603      <FIELD name="iLensObjSmearE1" arraysize="1" datatype="float" unit="arcsec^-2" default="-999">
     604        <DESCRIPTION>per-object smear polarizability E1 term</DESCRIPTION>
     605      </FIELD>
     606      <FIELD name="iLensObjSmearE2" arraysize="1" datatype="float" unit="arcsec^-2" default="-999">
     607        <DESCRIPTION>per-object smear polarizability E2 term</DESCRIPTION>
     608      </FIELD>
    609609      <FIELD name="iLensObjShearX11" arraysize="1" datatype="float" unit="dimensionless" default="-999">
    610610        <DESCRIPTION>per-object shear polarizability X11 term</DESCRIPTION>
     
    778778        <DESCRIPTION>psf model shear polarizability E2 term</DESCRIPTION>
    779779      </FIELD>
     780      <DATA>
     781        <TABLEDATA></TABLEDATA>
     782      </DATA>
    780783    </TABLE>
    781784  </RESOURCE>
  • trunk/ippToPsps/jython/Makefile.am

    r37551 r37927  
    1414  diffobjectbatch.py \
    1515  dvodetections.py \
     16  dvodiffobjects.py \
    1617  dvoforceddetections.py \
    1718  dvoforcedobjects.py \
  • trunk/ippToPsps/jython/diffobjectbatch.py

    r37917 r37927  
    1414from ipptopspsdb import IppToPspsDb
    1515from scratchdb import ScratchDb
    16 from dvoobjects import DvoObjects
     16#from dvoobjects import DvoObjects
     17from dvodiffobjects import DvoDiffObjects
    1718from sqlUtility import sqlUtility
    1819
     
    5354
    5455       try:
    55            self.dvoObjects = DvoObjects(self.logger, self.config, self.skychunk, self.ippToPspsDb, self.scratchDb)
     56           self.dvoDiffObjects = DvoDiffObjects(self.logger, self.config, self.skychunk, self.ippToPspsDb, self.scratchDb)
    5657       except:
    57            self.logger.errorPair("Unable to create instance of", "DvoObjects")
     58           self.logger.errorPair("Unable to create instance of", "DvoDiffObjects")
    5859           raise
    5960
     
    7273        self.region = self.scratchDb.getRegionNameFromThisDvoIndex(self.id)
    7374        self.ippToPspsDb.insertObjectMeta(self.batchID, self.region)
    74         self.dvoObjects.nativeIngestRegion(self.region)
     75        self.dvoDiffObjects.nativeIngestRegion(self.region)
    7576
    7677        cptTableName = self.scratchDb.getDbFriendlyTableName(self.region + ".cpt")
     
    184185            except:
    185186                self.logger.errorPair("failed sql", sql)
     187                raise
    186188                return False
    187189
    188190
    189191        # XXX this does not seem like a good thing to leave in SQL
    190         self.logger.infoPair("Calculating nDetections from", "n[filters]")
    191         for filter in filters:
     192        #self.logger.infoPair("Calculating nDetections from", "n[filters]")
     193        #for filter in filters:
    192194            # now do a sum of n[filters], but do not include the ones with -999
    193             sql  = "UPDATE DiffDetObject "
    194             sql += "SET nDetections = nDetections + " + filter[1] +"nTotal "
    195             sql += " WHERE " + filter[1] + "nTotal != -999"
    196             try:
    197                 self.scratchDb.execute(sql)
    198             except:
    199                 self.logger.errorPair("failed sql", sql)
    200                 return False
     195         #   sql  = "UPDATE DiffDetObject "
     196         #   sql += "SET nDetections = nDetections + n" + filter[1]
     197         #   sql += " WHERE n" + filter[1] + " != -999"
     198         #   try:
     199         #       self.scratchDb.execute(sql)
     200         #   except:
     201         #       self.logger.errorPair("failed sql", sql)
     202         #       raise
     203               
    201204
    202205
     
    223226        except:
    224227            self.logger.errorPair("failed sql", sql)
    225             return False
     228            raise
    226229 
    227230    ## use mean ra and dec (dec < 0)
     
    241244        except:
    242245            self.logger.errorPair("failed sql", sql)
    243             return False
     246            raise
    244247
    245248    '''
     
    261264            except:
    262265                self.logger.errorPair("Couldn't squash out of range stuff", sql)
    263                 return False
     266                raise
    264267
    265268            self.logger.infoPair("setting to null  > 1e-38 and < 1e-38 in", "cps FLUX_KRON")
     
    270273            except:
    271274                self.logger.errorPair("Couldn't squash out of range stuff", sql)
    272                 return False
     275                raise
    273276
    274277       
     
    288291        sqlLine.group("batchID",         "'" + str(self.batchID) + "'")
    289292        sqlLine.group("dvoRegionID",     "CAT_ID")
    290         sqlLine.group("skycellID",       "SKYCELL_ID")
     293#        sqlLine.group("skycellID",       "SKYCELL_ID")
    291294        sqlLine.group("dataRelease",     "'" + str(self.skychunk.dataRelease) + "'")
    292295        sqlLine.group("objInfoFlag",     "FLAGS")
     
    304307        except:
    305308            self.logger.errorPair("Couldn't populate DiffDetObject table", sql)
    306             return False
     309            raise
    307310 
    308311        # add row count columns so we can perform joins to get colors
     
    317320
    318321        self.logger.infoPair("update DiffDetObject from ","cps table")
    319 
     322        #this fills ng/etc
    320323        self.updateDiffObjectFromCps(cpsTableName)
    321 
     324        #this fills qfperfect
     325        self.updateMeanObjectFromCps(cpsTableName)
    322326        # XXX EAM 20140724 : is this necessary??
    323327        #objects can have out of range ra dec in dvo - need to find and kill them at the end
     
    360364        except:
    361365            self.logger.errorPair("Couldn't cull outsiders from DiffDetObject table", sql)
    362             return False
     366            raise
    363367
    364368        self.logger.infoPair("Dropping row column from", "DiffDetObject table")
     
    385389        except:
    386390            self.logger.errorPair('failed sql',sql)
    387             return
     391            raise
    388392
    389393
     
    425429        self.scratchDb.dropColumn("DiffDetObject", "row")
    426430
    427         self.dvoObjects.purgeRegion(self.region)
     431        self.dvoDiffObjects.purgeRegion(self.region)
    428432
    429433        #this is abuse of something but this is how I get the object batches to crash to further investigate them
  • trunk/ippToPsps/jython/dvodiffobjects.py

    r37750 r37927  
    1515A class for ingesting DVO detections into MySQL
    1616'''
    17 class DvoObjects(Dvo):
     17class DvoDiffObjects(Dvo):
    1818
    1919    '''
     
    2222    def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDb):
    2323
    24         super(DvoObjects, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb)
     24        super(DvoDiffObjects, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDb)
    2525
    2626        # declare DVO file types of interest
     
    3939
    4040        # TODO path to DVO prog hardcoded temporarily
    41         cmd = "dvopsps objects"
     41        cmd = "dvopsps diffobj"
    4242        cmd += " -dbhost " + self.scratchDb.dbHost
    4343        cmd += " -dbname " + self.scratchDb.dbName
  • trunk/ippToPsps/jython/forcedobjectbatch.py

    r37918 r37927  
    2525
    2626'''
    27 class ForcedMeanObjectBatch(Batch):
     27class ForcedObjectBatch(Batch):
    2828
    2929    '''
     
    4040                 batchID):
    4141
    42        super(ForcedMeanObjectBatch, self).__init__(
     42       super(ForcedObjectBatch, self).__init__(
    4343               logger,
    4444               config,
     
    7171
    7272        self.region = self.scratchDb.getRegionNameFromThisDvoIndex(self.id)
    73         self.ippToPspsDb.insertForcedMeanObjectMeta(self.batchID, self.region)
     73        self.ippToPspsDb.insertForcedObjectMeta(self.batchID, self.region)
    7474        self.dvoForcedObjects.nativeIngestRegion(self.region)
    7575
     
    8686            return False
    8787
     88        self.logger.infoPair("checking if we have anything in"," cpy/cpt")
     89        rowcountcpt = self.scratchDb.getRowCount(cptTableName);
     90        rowcountcpy = self.scratchDb.getRowCount(cpyTableName);
     91        if (rowcountcpt == 0):
     92            self.logger.infoPair("0 rows for ","cpt table")
     93            return False
     94        if (rowcountcpy == 0):
     95            self.logger.infoPair("o rows for ","cpy table")
     96            return False
    8897        return True
    8998
     
    104113
    105114        return True
     115
     116
     117    '''
     118    Updates table and generates pspsuniqueids
     119    '''
     120   
     121    def updatePspsUniqueIDs(self):
     122        sql = "UPDATE ForcedMeanObject set uniquePspsFOid = (("+str(self.batchID)+"*1000000000 ) + row)"
     123        try: self.scratchDb.execute(sql)
     124        except:
     125            self.logger.errorPair('failed sql',sql)
     126            raise
     127
     128
     129
    106130
    107131    '''
     
    146170                   SET \
    147171                    ForcedMeanObject." + filter[1] + "nTotal         = NWARP \
    148                    ,ForcedMeanObject." + filter[1] + "nIncPSFMag     = NUSED_WRP \
    149                    ,ForcedMeanObject." + filter[1] + "nIncKronMag    = NUSED_KRON_WRP \
    150                    ,ForcedMeanObject." + filter[1] + "nIncApMag      = NUSED_AP_WRP \
    151                    ,ForcedMeanObject." + filter[1] + "PSFMag         = MAG_PSF_WRP \
    152                    ,ForcedMeanObject." + filter[1] + "PSFMagErr      = MAG_PSF_WRP_ERR \
    153                    ,ForcedMeanObject." + filter[1] + "PSFMagStd      = MAG_PSF_WRP_STD \
    154                    ,ForcedMeanObject." + filter[1] + "KronMag        = MAG_KRON_WRP \
    155                    ,ForcedMeanObject." + filter[1] + "KronMagErr     = MAG_KRON_WRP_ERR \
    156                    ,ForcedMeanObject." + filter[1] + "KronMagStd     = MAG_KRON_WRP_STD \
    157                    ,ForcedMeanObject." + filter[1] + "ApMag          = MAG_AP_WRP \
    158                    ,ForcedMeanObject." + filter[1] + "ApMagErr       = MAG_AP_WRP_ERR \
    159                    ,ForcedMeanObject." + filter[1] + "ApMagStd       = MAG_AP_WRP_STD \
     172                   ,ForcedMeanObject." + filter[1] + "nIncPSFFlux     = NUSED_WRP \
     173                   ,ForcedMeanObject." + filter[1] + "nIncKronFlux    = NUSED_KRON_WRP \
     174                   ,ForcedMeanObject." + filter[1] + "nIncApFlux      = NUSED_AP_WRP \
     175                   ,ForcedMeanObject." + filter[1] + "PSFFlux         = FLUX_PSF_WRP \
     176                   ,ForcedMeanObject." + filter[1] + "PSFFluxErr      = FLUX_PSF_WRP_ERR \
     177                   ,ForcedMeanObject." + filter[1] + "PSFFluxStd      = FLUX_PSF_WRP_STDEV \
     178                   ,ForcedMeanObject." + filter[1] + "KronFlux        = FLUX_KRON_WRP \
     179                   ,ForcedMeanObject." + filter[1] + "KronFluxErr     = FLUX_KRON_WRP_ERR \
     180                   ,ForcedMeanObject." + filter[1] + "KronFluxStd     = FLUX_KRON_WRP_STDEV \
     181                   ,ForcedMeanObject." + filter[1] + "ApFlux          = FLUX_AP_WRP \
     182                   ,ForcedMeanObject." + filter[1] + "ApFluxErr       = FLUX_AP_WRP_ERR \
     183                   ,ForcedMeanObject." + filter[1] + "ApFluxStd       = FLUX_AP_WRP_STDEV \
    160184                   ,ForcedMeanObject." + filter[1] + "Flags          = FLAGS "
    161185
     
    163187            try: self.scratchDb.execute(sql)
    164188            except:
    165                 self.logger.errorPair("failed update MeanObject", sql)
     189                self.logger.errorPair("failed update ForcedMeanObject", sql)
    166190                raise
    167191
     
    175199                   SET " + filter[1] + "PSFMagErr = null \
    176200                   WHERE " + filter[1] + "PSFMagErr > " + str(cut)
    177             self.scratchDb.execute(sql)
    178 
     201# taking out the cut since this is for mag, not flux
     202
     203    #       try: self.scratchDb.execute(sql)
     204     #       except:
     205     #           self.logger.errorPair("failed setting null meanmagerr","ForcedMeanObject")
     206     #           raise
    179207        self.logger.infoPair("Calculating nDetections from", "n[filters]")
    180208        for filter in filters:
    181209            # now do a sum of n[filters], but do not include the ones with -999
    182             sql  = "UPDATE ForcedMeanObject"
     210            sql  = "UPDATE ForcedMeanObject "
    183211            sql += "SET nDetections = nDetections + " + filter[1] +"nTotal "
    184             sql += " WHERE n" + filter[1] + " != -999"
    185             self.scratchDb.execute(sql)
     212            sql += " WHERE " + filter[1] + "nTotal != -999"
     213            #self.scratchDb.execute(sql)
    186214            try: self.scratchDb.execute(sql)
    187215            except:
     
    192220    Inserts stuff for all mags from the cpy files
    193221    '''
    194     def updateForcedMeanObjectFromCpy(self, cpyTable):
     222    def updateForcedMeanTablesFromCpy(self, cpyTable):
    195223
    196224        # list of all filters PSPS is interested in
     
    229257                   " + cpyTable + " AS cpy ON (cpy.row = (ForcedMeanObject.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) \
    230258                   SET \
    231                     ForcedMeanObject." + filter[1] + "nIncR5          =  NMEAS \
     259                   ForcedMeanObject." + filter[1] + "nIncR5          =  NMEAS \
    232260                   ,ForcedMeanObject." + filter[1] + "nIncR6          =  NMEAS \
    233261                   ,ForcedMeanObject." + filter[1] + "FmeanflxR5      =  FLUX_AP_R5 \
     
    239267                   ,ForcedMeanObject." + filter[1] + "FmeanflxR6Std   =  FLUX_STD_AP_R6 \
    240268                   ,ForcedMeanObject." + filter[1] + "FmeanflxR6Fill  =  FLUX_FIL_AP_R6 \
    241                    ,ForcedMeanObject." + filter[1] + "LensObjSmearX11 =  X11_SM_OBJ \
    242                    ,ForcedMeanObject." + filter[1] + "LensObjSmearX12 =  X12_SM_OBJ \
    243                    ,ForcedMeanObject." + filter[1] + "LensObjSmearX22 =  X22_SM_OBJ \
    244                    ,ForcedMeanObject." + filter[1] + "LensObjSmearE1  =  E1_SM_OBJ \
    245                    ,ForcedMeanObject." + filter[1] + "LensObjSmearE2  =  E2_SM_OBJ \
    246                    ,ForcedMeanObject." + filter[1] + "LensObjShearX11 =  X11_SH_OBJ \
    247                    ,ForcedMeanObject." + filter[1] + "LensObjShearX12 =  X12_SH_OBJ \
    248                    ,ForcedMeanObject." + filter[1] + "LensObjShearX22 =  X22_SH_OBJ \
    249                    ,ForcedMeanObject." + filter[1] + "LensObjShearE1  =  E1_SH_OBJ \
    250                    ,ForcedMeanObject." + filter[1] + "LensObjShearE2  =  E2_SH_OBJ \
    251                    ,ForcedMeanObject." + filter[1] + "LensPSFSmearX11 =  X11_SM_PSF \
    252                    ,ForcedMeanObject." + filter[1] + "LensPSFSmearX12 =  X12_SM_PSF \
    253                    ,ForcedMeanObject." + filter[1] + "LensPSFSmearX22 =  X22_SM_PSF \
    254                    ,ForcedMeanObject." + filter[1] + "LensPSFSmearE1  =  E1_SM_PSF \
    255                    ,ForcedMeanObject." + filter[1] + "LensPSFSmearE2  =  E2_SM_PSF \
    256                    ,ForcedMeanObject." + filter[1] + "LensPSFShearX11 =  X11_SH_PSF \
    257                    ,ForcedMeanObject." + filter[1] + "LensPSFShearX12 =  X12_SH_PSF \
    258                    ,ForcedMeanObject." + filter[1] + "LensPSFShearX22 =  X22_SH_PSF \
    259                    ,ForcedMeanObject." + filter[1] + "LensPSFShearE1  =  E1_SH_PSF \
    260                    ,ForcedMeanObject." + filter[1] + "LensPSFShearE2  =  E2_SH_PSF \
    261269                   ,ForcedMeanObject." + filter[1] + "Gamma           =  GAMMA \
    262270                   ,ForcedMeanObject." + filter[1] + "E1              =  E1 \
    263271                   ,ForcedMeanObject." + filter[1] + "E2              =  E2 "
    264272
    265 
    266273            try: self.scratchDb.execute(sql)
    267274            except:
    268                 self.logger.errorPair("failed update on ForcedMeanObject using cpy table", sql)
     275                self.logger.errorPair("failed update on ForcedMeanObject using cpy table",sql)
     276                raise
     277
     278            sql = "UPDATE ForcedMeanLensing JOIN \
     279                   " + cpyTable + " AS cpy ON (cpy.row = (ForcedMeanLensing.row* " + str(filterCount) + ")-(" + str(filterCount) + " - " + str(filter[0]) + ")) \
     280                   SET \
     281                   ForcedMeanLensing." + filter[1] + "LensObjSmearX11 =  X11_SM_OBJ \
     282                   ,ForcedMeanLensing." + filter[1] + "LensObjSmearX12 =  X12_SM_OBJ \
     283                   ,ForcedMeanLensing." + filter[1] + "LensObjSmearX22 =  X22_SM_OBJ \
     284                   ,ForcedMeanLensing." + filter[1] + "LensObjSmearE1  =  E1_SM_OBJ \
     285                   ,ForcedMeanLensing." + filter[1] + "LensObjSmearE2  =  E2_SM_OBJ \
     286                   ,ForcedMeanLensing." + filter[1] + "LensObjShearX11 =  X11_SH_OBJ \
     287                   ,ForcedMeanLensing." + filter[1] + "LensObjShearX12 =  X12_SH_OBJ \
     288                   ,ForcedMeanLensing." + filter[1] + "LensObjShearX22 =  X22_SH_OBJ \
     289                   ,ForcedMeanLensing." + filter[1] + "LensObjShearE1  =  E1_SH_OBJ \
     290                   ,ForcedMeanLensing." + filter[1] + "LensObjShearE2  =  E2_SH_OBJ \
     291                   ,ForcedMeanLensing." + filter[1] + "LensPSFSmearX11 =  X11_SM_PSF \
     292                   ,ForcedMeanLensing." + filter[1] + "LensPSFSmearX12 =  X12_SM_PSF \
     293                   ,ForcedMeanLensing." + filter[1] + "LensPSFSmearX22 =  X22_SM_PSF \
     294                   ,ForcedMeanLensing." + filter[1] + "LensPSFSmearE1  =  E1_SM_PSF \
     295                   ,ForcedMeanLensing." + filter[1] + "LensPSFSmearE2  =  E2_SM_PSF \
     296                   ,ForcedMeanLensing." + filter[1] + "LensPSFShearX11 =  X11_SH_PSF \
     297                   ,ForcedMeanLensing." + filter[1] + "LensPSFShearX12 =  X12_SH_PSF \
     298                   ,ForcedMeanLensing." + filter[1] + "LensPSFShearX22 =  X22_SH_PSF \
     299                   ,ForcedMeanLensing." + filter[1] + "LensPSFShearE1  =  E1_SH_PSF \
     300                   ,ForcedMeanLensing." + filter[1] + "LensPSFShearE2  =  E2_SH_PSF "
     301
     302            try: self.scratchDb.execute(sql)
     303            except:
     304                self.logger.errorPair("failed update on ForcedMeanLensing using cpy table", sql)
    269305                raise
    270306
     
    299335        except:
    300336            self.logger.errorPair("Couldn't populate Object table from cpt", sql)
    301             return False
     337            raise
    302338 
    303339        # add row count columns so we can perform joins to get colors
    304         self.logger.infoPair("Adding 'row' columns to", "Object and cps tables")
     340        self.logger.infoPair("Adding 'row' columns to", "Object ,cps, cpy tables")
    305341        self.scratchDb.addRowCountColumn("ForcedMeanObject", "row")
    306342        self.scratchDb.addRowCountColumn(cpsTableName, "row")
     343        self.scratchDb.addRowCountColumn(cpyTableName, "row")
     344
     345        self.logger.infoPair("generating unique ids for ","ForcedMeanObject")
     346        self.updatePspsUniqueIDs()
    307347
    308348
    309349        self.logger.infoPair("update ForcedMeanObject from ","cps table")
    310 
    311350        self.updateForcedMeanObjectFromCps(cpsTableName)
    312351
    313         self.logger.infoPair("update ForcedMeanObject from ","cpy table")
    314 
    315         self.updateForcedMeanObjectFromCpy(cpyTableName)
     352        sqlLine = sqlUtility("INSERT INTO ForcedMeanLensing (")
     353
     354        sqlLine.group("objID",           "objID")
     355        sqlLine.group("uniquePspsFOid","uniquePspsFOid")
     356        sqlLine.group("ippObjID",        "ippObjID")
     357        sqlLine.group("batchID",         "batchID")
     358        sqlLine.group("nDetections",      "nDetections")
     359        sqlLine.group("gStackID",      "gStackID")
     360        sqlLine.group("rStackID",      "rStackID")
     361        sqlLine.group("iStackID",      "iStackID")
     362        sqlLine.group("zStackID",      "zStackID")
     363        sqlLine.group("yStackID",      "yStackID")
     364
     365        sql = sqlLine.makeRaw(") SELECT ", " FROM ForcedMeanObject")
     366
     367        try:
     368            self.scratchDb.execute(sql)
     369        except:
     370            self.logger.errorPair("Couldn't populate ForcedMeanLensing table from ForcedMeanObject", sql)
     371            raise
     372
     373        self.logger.infoPair("adding row to ","ForcedMeanLensing")
     374        self.scratchDb.addRowCountColumn("ForcedMeanLensing", "row")
     375
     376        self.logger.infoPair("updating ForcedMeanObject and ForcedMeanLensing from ","cpy tables")
     377        self.updateForcedMeanTablesFromCpy(cpyTableName)
    316378
    317379
    318380        self.logger.infoPair("Dropping row column from", "ForcedMeanObject table")
    319381        self.scratchDb.dropColumn("ForcedMeanObject", "row")
    320 
     382        self.logger.infoPair("Dropping row column from", "ForcedMeanLensing table")
     383        self.scratchDb.dropColumn("ForcedMeanLensing", "row")
    321384        ##self.logger.infoPair("Purging from scratch Db", self.region + " region")
    322385
    323386        ##Don't do this till after MeanObject
    324387        ##self.dvoForcedObjects.purgeRegion(self.region)
    325 
     388        self.logger.infoPair("setting minmaxobjid for ", "ForcedMeanObject table")
    326389        self.setMinMaxObjID(["ForcedMeanObject"])
    327 
    328         return True
     390        self.logger.infoPair("checking if we have detctions", "FOrcedMeanObject table")
     391        rowcount = self.scratchDb.getRowCount("ForcedMeanObject")
     392        if rowcount == 0:
     393            self.logger.infoPair("skipping this one","ForcedMeanObject ")
     394            self.skipBatch  = False
     395            return True
     396        else:
     397            return True
    329398
    330399 
  • trunk/ippToPsps/jython/loader.py

    r37763 r37927  
    2828
    2929#from forcedwarpbatch import ForcedWarpBatch
    30 #from forcedobjectbatch import ForcedObjectBatch
     30from forcedobjectbatch import ForcedObjectBatch
    3131#
    3232#
     
    168168                    self.logger.infoPair("Box dimensions: ", "ra / dec / size : %.1f / %.1f / %.1f   --   sky bounds : (%.2f - %2.f, %2.f - %2.f)" % (boxDim['RA'], boxDim['DEC'], boxDim['SIDE'], boxDim['minRA'], boxDim['maxRA'], boxDim['minDEC'], boxDim['maxDEC']))
    169169                    self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids))
    170 
    171                     if batchType != "OB":
     170                    #previously said if not OB, but we don't need these for Do or FO
     171                    if (batchType == "P2" or batchType == "ST" or batchType =="DF" or batchType == "FW"):
    172172                        if self.config.resetDvo or not self.ippToPspsDb.isBoxIngested(boxId, self.scratchDb.dbHost):
    173173                            if not self.dvoDetections.nativeIngestDetections(boxId, boxDim):
Note: See TracChangeset for help on using the changeset viewer.