Ignore:
Timestamp:
Aug 28, 2019 11:11:22 PM (2 years ago)
Author:
toby
Message:

add reflection output in scripting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2export_csv.py

    r3825 r4119  
    167167        super(self.__class__,self).__init__( # fancy way to say <parentclass>.__init__
    168168            G2frame=G2frame,
    169             formatName = 'CSV file',
     169            formatName = 'histogram CSV file',
    170170            extension='.csv',
    171171            longFormatName = 'Export powder data as comma-separated (csv) file'
     
    293293        self.multiple = False # only allow one histogram to be selected
    294294
     295    def Writer(self,TreeName,filename=None):
     296        print(filename)
     297        self.OpenFile(filename)
     298        histblk = self.Histograms[TreeName]
     299        self.write(TreeName,histblk)
     300        self.CloseFile()
     301        print(TreeName+' reflections written to file '+self.fullpath)
     302       
    295303    def Exporter(self,event=None):
    296304        '''Export a set of powder reflections as a csv file
     
    300308        self.loadTree()
    301309        if self.ExportSelect(): return  # set export parameters, get file name
    302         self.OpenFile()
    303310        hist = list(self.histnam)[0] # there should only be one histogram, in any case take the 1st
    304311        histblk = self.Histograms[hist]
     312        self.OpenFile()
     313        self.write(hist,histblk)
     314        self.CloseFile()
     315        print(hist+' reflections written to file '+self.fullpath)
     316       
     317    def write(self,hist,histblk):
    305318        self.Write('"Histogram"')
    306319        self.Write('"'+hist+'"')
     
    351364                        FWHM = G2pwd.getgamFW(g,s)
    352365                        self.Write(fmt.format(h,k,l,dsp,pos,Fobs,Fcalc,phase,mult,s,g,FWHM,Prfo,i))
    353         self.CloseFile()
    354         print(hist+' reflections written to file '+self.fullpath)
    355 
     366       
    356367class ExportSASDCSV(G2IO.ExportBaseclass):
    357368    '''Used to create a csv file for a small angle data set
Note: See TracChangeset for help on using the changeset viewer.