Changeset 1384


Ignore:
Timestamp:
Jun 16, 2014 10:33:13 AM (9 years ago)
Author:
vondreele
Message:

Add option for additional 1/cos(2theta) correction for SASD.
Add display & possible edit of image pixel dimensions onto main image data window - big warning there. Other controls there??

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIIO.py

    r1376 r1384  
    387387            nframes -= 1
    388388    image = np.reshape(image,(sizexy[1],sizexy[0]))
    389     data = {'pixelSize':(200,200),'wavelength':0.15,'distance':250.0,'center':[204.8,204.8],'size':sizexy} 
     389    data = {'pixelSize':[200,200],'wavelength':0.15,'distance':250.0,'center':[204.8,204.8],'size':sizexy} 
    390390    File.close()   
    391391    if imageOnly:
     
    591591        image = np.flipud(np.array(np.asarray(marFrame.image),dtype=np.int32))
    592592        tifType = marFrame.filetitle
    593         pixy = (marFrame.pixelsizeX/1000.0,marFrame.pixelsizeY/1000.0)
     593        pixy = [marFrame.pixelsizeX/1000.0,marFrame.pixelsizeY/1000.0]
    594594        head = marFrame.outputHead()
    595595# extract resonable wavelength from header
     
    619619            tifType = 'Pilatus'
    620620            dataType = 0
    621             pixy = (172,172)
     621            pixy = [172,172]
    622622            File.seek(4096)
    623623            if not imageOnly:
     
    628628            if IFD[258][2][0] == 16:
    629629                tifType = 'GE'
    630                 pixy = (200,200)
     630                pixy = [200,200]
    631631                File.seek(8)
    632632                if not imageOnly:
     
    635635            elif IFD[258][2][0] == 32:
    636636                tifType = 'CHESS'
    637                 pixy = (200,200)
     637                pixy = [200,200]
    638638                File.seek(8)
    639639                if not imageOnly:
     
    643643    elif 262 in IFD and IFD[262][2][0] > 4:
    644644        tifType = 'DND'
    645         pixy = (158,158)
     645        pixy = [158,158]
    646646        File.seek(512)
    647647        if not imageOnly:
     
    650650    elif sizexy == [1536,1536]:
    651651        tifType = 'APS Gold'
    652         pixy = (150,150)
     652        pixy = [150,150]
    653653        File.seek(64)
    654654        if not imageOnly:
     
    659659            if IFD[258][2][0] == 32:
    660660                tifType = 'PE'
    661                 pixy = (200,200)
     661                pixy = [200,200]
    662662                File.seek(8)
    663663                if not imageOnly:
     
    670670        elif IFD[273][2][0] == 4096:
    671671            if sizexy[0] == 3072:
    672                 pixy =  (73,73)
     672                pixy =  [73,73]
    673673                tifType = 'MAR225'           
    674674            else:
    675                 pixy = (158,158)
     675                pixy = [158,158]
    676676                tifType = 'MAR325'           
    677677            File.seek(4096)
     
    690690            if IFD[258][2][0] == 16:
    691691                tifType = 'scanCCD'
    692                 pixy = (9,9)
     692                pixy = [9,9]
    693693                File.seek(8)
    694694                if not imageOnly:
     
    697697        elif IFD[273][2][0] == 4096:
    698698            tifType = 'Rayonix'
    699             pixy = (73.242,73.242)
     699            pixy = [73.242,73.242]
    700700            File.seek(4096)
    701701            if not imageOnly:
  • trunk/GSASIIgrid.py

    r1381 r1384  
    47654765        elif 'IMG' in G2frame.PatternTree.GetItemText(item):
    47664766            G2frame.Image = item
     4767            G2frame.dataFrame.SetTitle('Image Data')
     4768            data = G2frame.PatternTree.GetItemPyData(GetPatternTreeItemId( \
     4769                G2frame,item,'Image Controls'))
     4770            G2imG.UpdateImageData(G2frame,data)
    47674771            G2plt.PlotImage(G2frame,newPlot=True)
    47684772        elif 'PKS' in G2frame.PatternTree.GetItemText(item):
  • trunk/GSASIIimage.py

    r1375 r1384  
    882882        H1 = LRazm
    883883    H0 /= npcosd(H2[:-1])           #**2? I don't think so, **1 is right for powders
     884    if 'SASD' in data['Type']:
     885        H0 /= npcosd(H2[:-1])           #one more for small angle scattering data?
    884886    if data['Oblique'][1]:
    885887        H0 /= G2pwd.Oblique(data['Oblique'][0],H2[:-1])
  • trunk/GSASIIimgGUI.py

    r1380 r1384  
    3939cosd = lambda x: math.cos(x*math.pi/180.)
    4040asind = lambda x: 180.*math.asin(x)/math.pi
     41   
     42################################################################################
     43##### Image Data
     44################################################################################
     45def UpdateImageData(G2frame,data):
     46   
     47    def OnPixVal(event):
     48        Obj = event.GetEventObject()
     49        id = Indx[Obj.GetId()]
     50        try:
     51            data['pixelSize'][id] = min(500,max(10,float(Obj.GetValue())))
     52        except ValueError:
     53            pass
     54        Obj.SetValue('%.3f'%(data['pixelSize'][id]))
     55        G2plt.PlotExposedImage(G2frame,newPlot=True,event=event)
     56       
     57       
     58       
     59    if G2frame.dataDisplay:
     60        G2frame.dataDisplay.Destroy()
     61    if not G2frame.dataFrame.GetStatusBar():
     62        G2frame.dataFrame.CreateStatusBar()
     63    G2frame.dataDisplay = wx.Panel(G2frame.dataFrame)
     64    mainSizer = wx.BoxSizer(wx.VERTICAL)
     65    mainSizer.Add(wx.StaticText(G2frame.dataDisplay,
     66        label='Do not change anything here unless you are absolutely sure!'),0,WACV)
     67    pixSize = wx.FlexGridSizer(0,4,5,5)
     68    pixLabels = [u'Pixel X-dimension (\xb5m)',u'Pixel Y-dimension (\xb5m)']
     69    Indx = {}
     70    for i,[pixLabel,pix] in enumerate(zip(pixLabels,data['pixelSize'])):
     71        pixSize.Add(wx.StaticText(G2frame.dataDisplay,label=pixLabel),0,WACV)
     72        pixVal = wx.TextCtrl(G2frame.dataDisplay,value='%.3f'%(pix),style=wx.TE_PROCESS_ENTER)
     73        Indx[pixVal.GetId()] = i
     74        pixVal.Bind(wx.EVT_TEXT_ENTER,OnPixVal)
     75        pixVal.Bind(wx.EVT_KILL_FOCUS,OnPixVal)
     76        pixSize.Add(pixVal,0,WACV)
     77    mainSizer.Add(pixSize,0)
     78   
     79    mainSizer.Layout()   
     80    G2frame.dataDisplay.SetSizer(mainSizer)
     81    fitSize = mainSizer.Fit(G2frame.dataFrame)
     82    G2frame.dataFrame.setSizePosLeft(fitSize)
     83    G2frame.dataDisplay.SetSize(fitSize)
    4184
    4285################################################################################
     
    63106            data['binType'] = 'log(q)'
    64107#end patch
    65 
    66108   
    67109# Menu items
Note: See TracChangeset for help on using the changeset viewer.