Ignore:
Timestamp:
Oct 10, 2015 11:58:12 AM (6 years ago)
Author:
toby
Message:

Add API for direct image read (G2IO.ExportPowderList?) and powder exports w/o GUI (G2IO.ExportPowderList?); redo export to add new method (Writer)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2export_examples.py

    r1902 r1997  
    132132        self.multiple = False # only allow one histogram to be selected
    133133
    134     def Exporter(self,event=None):
    135         '''Export a set of powder data as a text file
    136         '''
    137         # the export process starts here
    138         self.InitExport(event)
    139         # load all of the tree into a set of dicts
    140         self.loadTree()
    141         if self.ExportSelect( # set export parameters
    142             AskFile='default' # base name on the GPX file name
    143             ): return
    144         self.OpenFile()
    145         hist = self.histnam[0] # there should only be one histogram, in any case take the 1st
    146         histblk = self.Histograms[hist]
     134    def Writer(self,TreeName,filename=None):
     135        self.OpenFile(filename)
     136        histblk = self.Histograms[TreeName]
    147137        hfmt = 5*"{:12s} "
    148138        digitList = 2*((13,3),) + ((13,5),) + 2*((13,3),)
     
    161151            self.Write(strg)
    162152        self.CloseFile()
     153       
     154    def Exporter(self,event=None):
     155        '''Export a set of powder data as a text file
     156        '''
     157        # the export process starts here
     158        self.InitExport(event)
     159        # load all of the tree into a set of dicts
     160        self.loadTree()
     161        if self.ExportSelect( # set export parameters
     162            AskFile='default' # base name on the GPX file name
     163            ): return
     164        hist = self.histnam[0] # there should only be one histogram, in any case take the 1st
     165        self.Writer(hist)
    163166        print(str(hist)+' written to file '+str(self.fullpath))
    164167       
Note: See TracChangeset for help on using the changeset viewer.