IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2015, 4:00:17 PM (11 years ago)
Author:
eugene
Message:

add options to import FITS tables using Ohana fits_to_mysql

File:
1 edited

Legend:

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

    r38973 r38981  
    446446        self.logger.warn("alterPspsTables not implemented")
    447447
     448
     449    '''
     450    Imports IPP tables from FITS file
     451
     452    Accepts a regular expression filter so not all tables need to be imported
     453    '''
     454    def importIppTablesOhana(self):
     455       
     456        self.logger.infoPair("Importing IPP tables", "using fits_to_mysql")
     457
     458        ## use stilts to get a list of the tables from the header
     459        try:
     460            tables = stilts.treads(self.fits.getPath())
     461        except:
     462            self.logger.errorPair("STILTS could not import from", self.fits.getPath())
     463            return False
     464
     465        loadFITStoMYSQL(self.fits.getPath(), "none")
     466
     467        ## may need to do this with direct sql:
     468        # table = stilts.tpipe(table, cmd='addcol table_index $0')
     469
     470        self.tablesLoaded = []
     471
     472        count = 0
     473        for table in tables:
     474
     475            # example of listing all columns in a table:
     476            ## print "-----table: " + table.name
     477            ## columns = table.columns()
     478            ## for column in columns:
     479            ##     print column
     480            ##
     481            ## print "-----"
     482
     483            self.logger.debugPair("Read IPP table", table.name)
     484
     485            self.tablesLoaded.append(table.name)
     486            count ++
     487
     488        self.logger.infoPair("Done. Imported", "%d tables" % count)
     489        self.indexIppTables()
     490
     491        return True
     492
    448493    '''
    449494    Imports IPP tables from FITS file
Note: See TracChangeset for help on using the changeset viewer.