Changeset 38999 for trunk/ippToPsps/jython/diffbatch.py
- Timestamp:
- Oct 29, 2015, 10:50:19 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/diffbatch.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/diffbatch.py
r38960 r38999 564 564 ''' 565 565 Imports IPP tables from FITS file 566 567 Accepts a regular expression filter so not all tables need to be imported 568 ''' 569 def importIppTables(self, columns="*", filter=""): 570 if self.config.useOhanaMYSQLtoFITS: 571 if not self.importIppTablesOhana(): 572 self.logger.errorPair("problem running", "importIppTablesOhana") 573 return False 574 else: 575 if not self.importIppTablesStilts(columns, filter): 576 self.logger.errorPair("problem running", "importIppTablesStilts") 577 return False 578 579 return True 580 581 ''' 582 Imports IPP tables from FITS file 583 ''' 584 def importIppTablesOhana(self): 585 586 self.logger.infoPair("Importing DF tables", "using fits_to_mysql") 587 588 count = 0 589 self.tablesLoaded = [] 590 self.haveApNpix = {} 591 592 for num in self.number: 593 diffSkyFileID = self.number[num] 594 fileName = self.fits[num].getPath() 595 596 self.logger.infoPair("using filename:",fileName) 597 598 ## output table names need to have "_num" appended. 599 fitsOptions = "-tablesuffix _" + str(num) 600 601 # this option is equivalent to the stilts "addcol table_index $0" call 602 fitsOptions += " -sequence-column table_index" 603 fitsOptions += " -sequence-column-start 1" 604 605 ## *** actually write the FITS data to mysql 606 self.scratchDb.loadFITStoMYSQL(fileName, fitsOptions) 607 608 ## use stilts to get a list of the tables from the header 609 try: 610 tables = stilts.treads(fileName) 611 except: 612 self.logger.errorPair("STILTS could not import from", fileName) 613 return False 614 615 # this is an optional field, check for it in the table below 616 self.haveApNpix[num] = 0 617 618 for table in tables: 619 # check for AP_NPIX columns: missing for SAS39 620 if table.name == "SkyChip_psf": 621 columns = table.columns() 622 if 'AP_NPIX' in columns: 623 self.haveApNpix[num] = 1 624 625 myTable = table.name + "_" + str(num) 626 count = count + 1 627 628 self.tablesLoaded.append(myTable) 629 630 # after all tables are read for this 'num', then index the set 631 self.indexIppTables(num) 632 633 self.logger.infoPair("Done. Imported", "%d tables" % count) 634 return True 635 636 ''' 637 Imports IPP tables from FITS file 566 638 Accepts a regular expression to match the tables so not all tables need to be imported 567 639 (This regex feature is not currently used...) 568 640 ''' 569 def importIppTables (self, columns="*", tableRE=""):641 def importIppTablesStilts(self, columns="*", tableRE=""): 570 642 571 643 if self.config.retry: return True … … 632 704 return True 633 705 634 635 636 637 638 639 706 ''' 640 707 Overriding this method. Use regex to trim off, eg _XY33 extension
Note:
See TracChangeset
for help on using the changeset viewer.
