Changeset 2083 for trunk/GSASIIIO.py
- Timestamp:
- Dec 5, 2015 1:49:31 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIIO.py
r2071 r2083 36 36 import GSASIIlattice as G2lat 37 37 import GSASIIpwdGUI as G2pdG 38 import GSASIIimgGUI as G2imG 38 39 import GSASIIimage as G2img 39 40 import GSASIIElem as G2el … … 506 507 return [] 507 508 #raise Exception('No image read') 509 510 def SaveMultipleImg(G2frame): 511 if not G2frame.PatternTree.GetCount(): 512 print 'no images!' 513 return 514 choices = G2gd.GetPatternTreeDataNames(G2frame,['IMG ',]) 515 if len(choices) == 1: 516 names = choices 517 else: 518 dlg = G2G.G2MultiChoiceDialog(G2frame,'Stress/Strain fitting','Select images to fit:',choices) 519 dlg.SetSelections([]) 520 names = [] 521 if dlg.ShowModal() == wx.ID_OK: 522 names = [choices[sel] for sel in dlg.GetSelections()] 523 dlg.Destroy() 524 if not names: return 525 for name in names: 526 Id = G2gd.GetPatternTreeItemId(G2frame, G2frame.root, name) 527 Npix,imagefile,imagetag = G2frame.PatternTree.GetImageLoc(Id) 528 imroot = os.path.splitext(imagefile)[0] 529 if imagetag: 530 imroot += '_' + str(imagetag) 531 Data = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id, 'Image Controls')) 532 print('Writing '+imroot+'.imctrl') 533 File = open(imroot+'.imctrl','w') 534 keys = ['type','wavelength','calibrant','distance','center', 535 'tilt','rotation','azmthOff','fullIntegrate','LRazimuth', 536 'IOtth','outChannels','outAzimuths','invert_x','invert_y','DetDepth', 537 'calibskip','pixLimit','cutoff','calibdmin','chisq','Flat Bkg', 538 'binType','SampleShape','PolaVal','SampleAbs','dark image','background image'] 539 for key in keys: 540 if key not in Data: continue #uncalibrated! 541 File.write(key+':'+str(Data[key])+'\n') 542 File.close() 543 mask = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id, 'Masks')) 544 G2imG.CleanupMasks(mask) 545 print('Writing '+imroot+'.immask') 546 File = open(imroot+'.immask','w') 547 for key in ['Points','Rings','Arcs','Polygons','Frames','Thresholds']: 548 File.write(key+':'+str(mask[key])+'\n') 549 File.close() 508 550 509 551 def PutG2Image(filename,Comments,Data,Npix,image):
Note: See TracChangeset
for help on using the changeset viewer.