Changeset 1219


Ignore:
Timestamp:
Feb 13, 2014 12:35:01 AM (8 years ago)
Author:
vondreele
Message:

further SASD progress, absorption, transmission, contract calcs & GUI display

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1215 r1219  
    15591559                [Iparm1,Iparm2])
    15601560            self.PatternTree.SetItemPyData(
     1561                self.PatternTree.AppendItem(Id,text='Substances'),G2pdG.SetDefaultSubstances())
     1562            self.PatternTree.SetItemPyData(
    15611563                self.PatternTree.AppendItem(Id,text='Sample Parameters'),
    15621564                rd.Sample)
    1563             self.PatternTree.SetItemPyData(
    1564                 self.PatternTree.AppendItem(Id,text='Substances'),G2pdG.SetDefaultSubstances())
    15651565            self.PatternTree.SetItemPyData(
    15661566                self.PatternTree.AppendItem(Id,text='Models'),G2pdG.SetDefaultSASDModel())
  • trunk/GSASIIIO.py

    r1217 r1219  
    981981        if 'PWDR' in name:
    982982            parms = ['PXC',data['wavelength'],0.0,0.99,1.0,-0.10,0.4,0.30,1.0,0.0001,Azms[i]]    #set polarization for synchrotron radiation!
    983         elif 'SASD' in name:   
     983        elif 'SASD' in name:
     984            Sample['Trans'] = data['SampleAbs'][0]
    984985            parms = ['LXC',data['wavelength'],0.0,Azms[i]]
    985986        Y = G2frame.Integrate[0][i]
     
    10141015                inst[0][item] = list(inst[0][item])
    10151016            G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Instrument Parameters'),inst)
    1016             G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Sample Parameters'),Sample)
    10171017            if 'PWDR' in name:
     1018                G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Sample Parameters'),Sample)
    10181019                G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Peak List'),[])
    10191020                G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Index Peak List'),[])
     
    10221023            elif 'SASD' in name:             
    10231024                G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Substances'),G2pdG.SetDefaultSubstances())
     1025                G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Sample Parameters'),Sample)
    10241026                G2frame.PatternTree.SetItemPyData(G2frame.PatternTree.AppendItem(Id,text='Models'),G2pdG.SetDefaultSASDModel())
    10251027            valuesdict = {
  • trunk/GSASIIimage.py

    r1204 r1219  
    838838                tay = 4.*np.pi*npsind(tay/2.)/data['wavelength']
    839839            if any([tax.shape[0],tay.shape[0],taz.shape[0]]):
    840                 NST,H0 = h2d.histogram2d(len(tax),tax,tay,taz*tad*tabs,numAzms,numChans,LRazm,lutth,Dazm,dtth,NST,H0)
     840                NST,H0 = h2d.histogram2d(len(tax),tax,tay,taz*tad/tabs,
     841                    numAzms,numChans,LRazm,lutth,Dazm,dtth,NST,H0)
    841842            Nup += 1
    842843            if dlg:
  • trunk/GSASIIpwdGUI.py

    r1217 r1219  
    7575#SASD items
    7676        'Materials':[{'Name':'vacuum','VolFrac':1.0,},{'Name':'vacuum','VolFrac':0.0,}],
    77         'Thick':1.0,
     77        'Thick':1.0,'Contrast':[0.0,0.0],       #contrast & anomalous contrast
     78        'Trans':1.0,                            #measured transmission
    7879        }
    7980       
     
    9091def SetDefaultSubstances():
    9192    'Fills in default items for the SASD Substances dictionary'
    92     return {'Substances':{'vacuum':{'Elements':{},'Volume':1.0,'Density':0.0,'Scatt density':0.0}},
    93                     'Contrast':0.0}
     93    return {'Substances':{'vacuum':{'Elements':{},'Volume':1.0,'Density':0.0,'Scatt density':0.0}}}
    9494                         
    9595################################################################################
     
    12951295        if invalid:
    12961296            return
    1297         if tc.key == 0 and 'SASD' in histName:          #a kluge!
     1297        if tc.key == 0 and 'SASD' in histName:          #a kluge for Scale!
    12981298            G2plt.PlotPatterns(G2frame,plotType='SASD',newPlot=True)
     1299        elif tc.key == 'Thick':
     1300            wx.CallAfter(UpdateSampleGrid,G2frame,data)           
    12991301           
    13001302    def OnMaterial(event):
     
    13551357        data['SurfRoughA'] = [0.,False]
    13561358        data['SurfRoughB'] = [0.,False]
     1359    if 'Trans' not in data and 'SASD' in histName:
     1360        data['Trans'] = 1.0
    13571361#patch end
    13581362   
     
    13711375                ['SurfRoughB','Surface roughness B: ',[10,4]]]
    13721376    elif 'SASD' in histName:
    1373         parms.append(['Thick','Sample thickness (cm)',[10,3]])
     1377        parms.append(['Thick','Sample thickness (mm)',[10,3]])
     1378        parms.append(['Trans','Transmission (meas)',[10,3]])
    13741379    parms.append(['Omega','Goniometer omega:',[10,3]])
    13751380    parms.append(['Chi','Goniometer chi:',[10,3]])
     
    14171422            parmSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' '+lbl),
    14181423                0,wx.ALIGN_CENTER_VERTICAL|wx.EXPAND)
    1419             parmVal = G2gd.ValidatedTxtCtrl(G2frame.dataDisplay,data,key,typeHint=float)
     1424            parmVal = G2gd.ValidatedTxtCtrl(G2frame.dataDisplay,data,key,
     1425                typeHint=float,OnLeave=AfterChange)
    14201426        parmSizer.Add(parmVal,1,wx.EXPAND)
    14211427    Info = {}
    1422     if 'SASD' in histName:
    1423         Substances = G2frame.PatternTree.GetItemPyData(
    1424             G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Substances'))
    1425         for id,item in enumerate(data['Materials']):
    1426             subst = wx.BoxSizer(wx.HORIZONTAL)
    1427             subst.Add(wx.StaticText(G2frame.dataDisplay,label=' Material: '),0,wx.ALIGN_CENTER_VERTICAL)
    1428             matsel = wx.ComboBox(G2frame.dataDisplay,value=item['Name'],choices=Substances['Substances'].keys(),
    1429                 style=wx.CB_READONLY|wx.CB_DROPDOWN)
    1430             Info[matsel.GetId()] = [id,'Name']
    1431             matsel.Bind(wx.EVT_COMBOBOX,OnMaterial)       
    1432             subst.Add(matsel,0,wx.ALIGN_CENTER_VERTICAL)
    1433             subst.Add(wx.StaticText(G2frame.dataDisplay,label=' Volume fraction: '),0,wx.ALIGN_CENTER_VERTICAL)
    1434             volfrac = wx.TextCtrl(G2frame.dataDisplay,value=str('%.3f'%(item['VolFrac'])),style=wx.TE_PROCESS_ENTER)
    1435             Info[volfrac.GetId()] = [id,'VolFrac']
    1436             volfrac.Bind(wx.EVT_TEXT_ENTER,OnMaterial)
    1437             volfrac.Bind(wx.EVT_KILL_FOCUS,OnMaterial)
    1438             subst.Add(volfrac,0,wx.ALIGN_CENTER_VERTICAL)
    1439             parmSizer.Add(subst,0)
    1440            
    14411428
    14421429       
     
    14491436    mainSizer.Add(parmSizer,1,wx.EXPAND)
    14501437    mainSizer.Add((0,5),0)   
     1438    if 'SASD' in histName:
     1439        rho = [0.,0.]
     1440        anomrho = [0.,0.]
     1441        mu = 0.
     1442        subSizer = wx.FlexGridSizer(1,4,5,5)
     1443        Substances = G2frame.PatternTree.GetItemPyData(
     1444            G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Substances'))
     1445        for id,item in enumerate(data['Materials']):
     1446            subSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Material: '),0,wx.ALIGN_CENTER_VERTICAL)
     1447            matsel = wx.ComboBox(G2frame.dataDisplay,value=item['Name'],choices=Substances['Substances'].keys(),
     1448                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     1449            Info[matsel.GetId()] = [id,'Name']
     1450            matsel.Bind(wx.EVT_COMBOBOX,OnMaterial)       
     1451            subSizer.Add(matsel,0,wx.ALIGN_CENTER_VERTICAL)
     1452            subSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Volume fraction: '),0,wx.ALIGN_CENTER_VERTICAL)
     1453            volfrac = wx.TextCtrl(G2frame.dataDisplay,value=str('%.3f'%(item['VolFrac'])),style=wx.TE_PROCESS_ENTER)
     1454            Info[volfrac.GetId()] = [id,'VolFrac']
     1455            volfrac.Bind(wx.EVT_TEXT_ENTER,OnMaterial)
     1456            volfrac.Bind(wx.EVT_KILL_FOCUS,OnMaterial)
     1457            subSizer.Add(volfrac,0,wx.ALIGN_CENTER_VERTICAL)
     1458            material = Substances['Substances'][item['Name']]
     1459            mu += item['VolFrac']*material.get('XAbsorption',0.)
     1460            rho[id] = material['Scatt density']
     1461            anomrho[id] = material.get('XAnom density',0.)
     1462        data['Contrast'] = [(rho[1]-rho[0])**2,(anomrho[1]-anomrho[0])**2]
     1463        mainSizer.Add(subSizer,0)
     1464        conSizer = wx.BoxSizer(wx.HORIZONTAL)
     1465        conSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Contrast: %10.2f '%(data['Contrast'][0])),0,wx.ALIGN_CENTER_VERTICAL)
     1466        conSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Anom. Contrast: %10.2f '%(data['Contrast'][1])),0,wx.ALIGN_CENTER_VERTICAL)
     1467        mut =  mu*data['Thick']
     1468        conSizer.Add(wx.StaticText(G2frame.dataDisplay,label=' Transmission (calc): %10.3f  '%(np.exp(-mut))),0,wx.ALIGN_CENTER_VERTICAL)
     1469        mainSizer.Add(conSizer,0)
    14511470   
    14521471    mainSizer.Layout()   
Note: See TracChangeset for help on using the changeset viewer.