Ignore:
Timestamp:
Jan 14, 2018 11:28:10 AM (4 years ago)
Author:
toby
Message:

fix histogram export file naming

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2export_pwdr.py

    r3136 r3223  
    6060        self.Write(('INS  1PRCF12%15.6e%15.6e%15.6e%15.6e   ')%(Inst['X'][1],Inst['Y'][1],Inst['SH/L'][1]/2.,Inst['SH/L'][1]/2.))
    6161        self.CloseFile()
    62         print('Parameters from '+hist+' written to file '+prmname)
     62        print('Parameters from '+hist+' written to '+prmname)
    6363        return prmname
    6464
     
    9898        filenamelist = []
    9999        for hist in self.histnam:
    100             # multiple files: create a unique name from the histogram
    101             fileroot = G2obj.MakeUniqueLabel(self.MakePWDRfilename(hist),filenamelist)
    102             # create an instrument parameter file
     100            if len(self.histnam) == 1:
     101                name = self.filename
     102            else:    # multiple files: create a unique name from the histogram
     103                name = self.MakePWDRfilename(hist)
     104            fileroot = os.path.splitext(G2obj.MakeUniqueLabel(name,filenamelist))[0]
    103105            self.filename = os.path.join(self.dirname,fileroot + self.extension)
    104106            histblk = self.Histograms[hist]
     107            # create an instrument parameter file
    105108            prmname = self.WriteInstFile(hist,histblk['Instrument Parameters'][0])
    106109            self.Writer(hist,prmname=prmname)
    107             print('Histogram '+hist+' written to file '+self.fullpath)
     110            print('Histogram '+hist+' written to '+self.fullpath)
    108111
    109112class ExportPowderXYE(G2IO.ExportBaseclass):
     
    152155        filenamelist = []
    153156        for hist in self.histnam:
    154             # multiple files: create a unique name from the histogram
    155             fileroot = G2obj.MakeUniqueLabel(self.MakePWDRfilename(hist),filenamelist)
    156             # create an instrument parameter file
     157            if len(self.histnam) == 1:
     158                name = self.filename
     159            else:    # multiple files: create a unique name from the histogram
     160                name = self.MakePWDRfilename(hist)
     161            fileroot = os.path.splitext(G2obj.MakeUniqueLabel(name,filenamelist))[0]
    157162            self.filename = os.path.join(self.dirname,fileroot + self.extension)
    158163            self.Writer(hist)
    159             print('Histogram '+hist+' written to file '+self.fullpath)
     164            print('Histogram '+hist+' written to '+self.fullpath)
Note: See TracChangeset for help on using the changeset viewer.