Changeset 1261 for trunk/exports/G2export_csv.py
- Timestamp:
- Mar 24, 2014 5:22:41 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/exports/G2export_csv.py
r1236 r1261 61 61 # create a dict with refined values and their uncertainties 62 62 self.loadParmDict() 63 if self.ExportSelect( # set export parameters 64 AskFile=True # prompt the user for a file name 65 ): return 66 self.OpenFile(self.filename) 63 if self.ExportSelect(): return # set export parameters; get file name 64 self.OpenFile() 67 65 # if more than one format is selected, put them into a single file 68 66 for phasenam in self.phasenam: … … 108 106 line += "," 109 107 self.Write(line) 110 print('Phase '+str(phasenam)+' written to file '+str(self.f ilename))108 print('Phase '+str(phasenam)+' written to file '+str(self.fullpath)) 111 109 self.CloseFile() 112 110 … … 135 133 self.loadTree() 136 134 if self.ExportSelect( # set export parameters 137 AskFile= False # use the default file name, which is ignored135 AskFile='single' # get a file name/directory to save in 138 136 ): return 139 137 filenamelist = [] 140 138 for hist in self.histnam: 141 fileroot = G2obj.MakeUniqueLabel(self.MakePWDRfilename(hist),filenamelist) 142 self.filename = fileroot + self.extension 139 if len(self.histnam) > 1: 140 # multiple files: create a unique name from the histogram 141 fileroot = G2obj.MakeUniqueLabel(self.MakePWDRfilename(hist),filenamelist) 142 # create an instrument parameter file 143 self.filename = os.path.join(self.dirname,fileroot + self.extension) 143 144 self.OpenFile() 144 145 histblk = self.Histograms[hist] … … 158 159 self.Write(line) 159 160 self.CloseFile() 160 print('Histogram '+str(hist)+' written to file '+str(self.f ilename))161 print('Histogram '+str(hist)+' written to file '+str(self.fullpath)) 161 162 162 163 class ExportPowderReflCSV(G2IO.ExportBaseclass): … … 181 182 # load all of the tree into a set of dicts 182 183 self.loadTree() 183 if self.ExportSelect( # set export parameters 184 AskFile=False # use the default file name 185 ): return 184 if self.ExportSelect(): return # set export parameters, get file name 186 185 self.OpenFile() 187 186 hist = self.histnam[0] # there should only be one histogram, in any case take the 1st … … 201 200 self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,i)) 202 201 self.CloseFile() 203 print(str(hist)+'reflections written to file '+str(self.f ilename))202 print(str(hist)+'reflections written to file '+str(self.fullpath)) 204 203 205 204 class ExportSingleCSV(G2IO.ExportBaseclass): … … 225 224 # load all of the tree into a set of dicts 226 225 self.loadTree() 227 if self.ExportSelect( # set export parameters 228 AskFile=False # use the default file name 229 ): return 226 if self.ExportSelect(): return # set export parameters, get file name 230 227 self.OpenFile() 231 228 hist = self.histnam[0] # there should only be one histogram, in any case take the 1st … … 238 235 self.Write(fmt.format(h,k,l,dsp,Fobs,sigFobs,Fcalc,phase,mult)) 239 236 self.CloseFile() 240 print(str(hist)+' written to file '+str(self.f ilename))237 print(str(hist)+' written to file '+str(self.fullname)) 241 238 242 239 class ExportStrainCSV(G2IO.ExportBaseclass): … … 262 259 # load all of the tree into a set of dicts 263 260 self.loadTree() 264 if self.ExportSelect( # set export parameters 265 AskFile=True # use the default file name 266 ): return 261 if self.ExportSelect(): return # set export parameters, get file name 267 262 self.OpenFile() 268 263 hist = self.histnam[0] # there should only be one histogram, in any case take the 1st … … 283 278 self.Write(fmt2.format(dat[1],dat[0],dat[2])) 284 279 self.CloseFile() 285 print(str(hist)+' written to file '+str(self.filename)) 286 280 print(str(hist)+' written to file '+str(self.fullpath))
Note: See TracChangeset
for help on using the changeset viewer.