Changeset 2083
- Timestamp:
- Dec 5, 2015 1:49:31 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r2077 r2083 73 73 import GSASIIpwdGUI as G2pdG 74 74 import GSASIIphsGUI as G2phsG 75 import GSASIIimgGUI as G2imG 75 76 import GSASIIspc as G2spc 76 77 import GSASIIstrMain as G2stMn … … 2027 2028 self.Bind(wx.EVT_MENU, obj.Exporter, id=item.GetId()) 2028 2029 self.ExportLookup[item.GetId()] = typ # lookup table for submenu item 2029 2030 #code to debug an Exporter. hard-coded the routine below, to allow a reload before use 2030 item = imagemenu.Append(wx.ID_ANY, 2031 help='Export image controls and masks for multiple images', 2032 kind=wx.ITEM_NORMAL, 2033 text='Multiple image controls and masks') 2034 self.Bind(wx.EVT_MENU, self.OnSaveMultipleImg, id=item.GetId()) 2035 #code to debug an Exporter. hard-code the routine below, to allow a reload before use 2031 2036 # def DebugExport(event): 2032 2037 # print 'start reload' … … 3678 3683 dlg.Destroy() 3679 3684 return result 3680 3685 3686 def OnSaveMultipleImg(self,event): 3687 '''Select and save multiple image parameter and mask files 3688 ''' 3689 G2IO.SaveMultipleImg(self) 3690 3681 3691 class GSASIImain(wx.App): 3682 3692 '''Defines a wxApp for GSAS-II -
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): -
trunk/GSASIIimgGUI.py
r2082 r2083 304 304 filename = os.path.splitext(filename)[0]+'.imctrl' 305 305 File = open(filename,'w') 306 save = {}307 306 keys = ['type','wavelength','calibrant','distance','center', 308 307 'tilt','rotation','azmthOff','fullIntegrate','LRazimuth', … … 1190 1189 filename = os.path.splitext(filename)[0]+'.immask' 1191 1190 File = open(filename,'w') 1192 save = {}1193 1191 keys = ['Points','Rings','Arcs','Polygons','Frames','Thresholds'] 1194 1192 for key in keys:
Note: See TracChangeset
for help on using the changeset viewer.