Changeset 38999 for trunk/ippToPsps/jython/forcedwarpbatch.py
- Timestamp:
- Oct 29, 2015, 10:50:19 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/forcedwarpbatch.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/forcedwarpbatch.py
r38990 r38999 747 747 748 748 return True 749 750 749 750 ''' 751 Imports IPP tables from FITS file 752 753 Accepts a regular expression filter so not all tables need to be imported 754 ''' 755 def importIppTables(self, columns="*", filter=""): 756 if self.config.useOhanaMYSQLtoFITS: 757 if not self.importIppTablesOhana(): 758 self.logger.errorPair("problem running", "importIppTablesOhana") 759 return False 760 else: 761 if not self.importIppTablesStilts(columns, filter): 762 self.logger.errorPair("problem running", "importIppTablesStilts") 763 return False 764 765 return True 766 767 ''' 768 Imports IPP tables from FITS file 769 ''' 770 def importIppTablesOhana(self): 771 772 self.logger.infoPair("Importing DF tables", "using fits_to_mysql") 773 774 count = 0 775 self.tablesLoaded = [] 776 self.haveApNpix = {} 777 778 for num in self.number: 779 forcedWarpID = self.number[num] 780 fileName = self.fits[num].getPath() 781 782 self.logger.infoPair("loading for FW id", forcedWarpID) 783 784 self.logger.infoPair("using filename:",fileName) 785 786 ## output table names need to have "_num" appended. 787 fitsOptions = "-tablesuffix _" + str(forcedWarpID) 788 789 # this option is equivalent to the stilts "addcol table_index $0" call 790 fitsOptions += " -sequence-column table_index" 791 fitsOptions += " -sequence-column-start 1" 792 793 ## *** actually write the FITS data to mysql 794 self.scratchDb.loadFITStoMYSQL(fileName, fitsOptions) 795 796 ## use stilts to get a list of the tables from the header 797 try: 798 tables = stilts.treads(fileName) 799 except: 800 self.logger.errorPair("STILTS could not import from", fileName) 801 return False 802 803 # this is an optional field, check for it in the table below 804 self.haveApNpix[num] = 0 805 806 for table in tables: 807 myTable = table.name + "_" + str(forcedWarpID) 808 count = count + 1 809 810 self.tablesLoaded.append(myTable) 811 812 self.indexIppTables(forcedWarpID) 813 814 # after all tables are read for this forcedWarpID, then index the set 815 self.logger.infoPair("Done. Imported", "%d tables" % count) 816 return True 751 817 752 818 ''' 753 819 This function reads the cmf/smf file and loads it into the database as its own table 754 820 ''' 755 def importIppTables (self, columns="*", tableRE=""):821 def importIppTablesStilts(self, columns="*", tableRE=""): 756 822 757 823 self.tablesLoaded = [] … … 760 826 for num in self.number: 761 827 forcedWarpID = self.number[num] 762 if self.config.retry: return True 828 fileName = self.fits[num].getPath() 829 763 830 self.logger.infoPair("loading for add id", forcedWarpID) 764 831 self.logger.infoPair("Importing FW tables with table match expression: ", tableRE) 765 fileName = self.fits[num].getPath()766 832 767 833 self.logger.infoPair("using filename:",fileName)
Note:
See TracChangeset
for help on using the changeset viewer.
