Changeset 4830 for trunk/GSASIIimgGUI.py


Ignore:
Timestamp:
Feb 26, 2021 4:49:53 PM (9 months ago)
Author:
vondreele
Message:

show more places in Absorb output
improve image absorption calcs for cylinders now seems to work OK
reorganize Image controls GUI & add option for vertical samples
hide printing of LS cycles if Rrint=False in HessianLSQ
implement (& not use) Klein-Nishina PDF correction
Fix bug in if importer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimgGUI.py

    r4820 r4830  
    157157       
    158158    def OnMakeGainMap(event):
     159        import scipy.ndimage.filters as sdif
    159160        sumImg = GetImageZ(G2frame,data)
    160161        masks = copy.deepcopy(G2frame.GPXtree.GetItemPyData(
     
    166167        Data['LRazimuth'] = [0.,360.]
    167168        Data['outChannels'] = 5000
    168         Data['SampleAbs'] = [0.0,False]
    169169        Data['binType'] = '2-theta'
    170170        Data['color'] = 'gray'
     
    182182            Data['formatName'] = 'GSAS-II image'
    183183            Data['range'] = [(500,2000),[800,1200]]
    184             GainMap = np.where(GainMap > 1200,1200,GainMap)
    185             GainMap = np.where(GainMap < 800,800,GainMap)
     184            GainMap = np.where(GainMap > 2000,2000,GainMap)
     185            GainMap = np.where(GainMap < 500,500,GainMap)
     186            masks['Thresholds'] = [(500.,2000.),[800.,1200.]]
    186187            G2IO.PutG2Image(newimagefile,[],data,Npix,GainMap)
    187188            GMname = 'IMG '+os.path.split(newimagefile)[1]
     
    284285    if 'det2theta' not in data:
    285286        data['det2theta'] = 0.0
     287    if 'orientation' not in data:
     288        data['orientation'] = 'horizontal'
    286289#end patch
    287290
     
    646649                    'tilt','rotation','azmthOff','fullIntegrate','LRazimuth','setdist',
    647650                    'IOtth','outChannels','outAzimuths','invert_x','invert_y','DetDepth',
    648                     'calibskip','pixLimit','cutoff','calibdmin','Flat Bkg','varyList',
     651                    'calibskip','pixLimit','cutoff','calibdmin','Flat Bkg','varyList','orientation',
    649652                    'binType','SampleShape','PolaVal','SampleAbs','dark image','background image']
    650653        keyList.sort(key=lambda s: s.lower())
     
    11861189        def OnSamAbs(event):
    11871190            data['SampleAbs'][1] = not data['SampleAbs'][1]
     1191            wx.CallLater(100,UpdateImageControls,G2frame,data,masks)
    11881192                           
    11891193        def OnShowLines(event):
     
    12191223        def OnIfPink(event):
    12201224            data['IfPink'] = not data['IfPink']
     1225           
     1226        def OnOchoice(event):
     1227            data['orientation'] = ochoice.GetValue()
    12211228               
    12221229        dataSizer = wx.FlexGridSizer(0,2,5,3)
     
    12701277        outAzim = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data,'outAzimuths',nDig=(10,4),xmin=1,typeHint=int,OnLeave=OnNumOutAzms)
    12711278        littleSizer.Add(outAzim,0,WACV)
    1272         dataSizer.Add(littleSizer,0,)
    1273         samplechoice = ['Cylinder','Fixed flat plate',]
    1274         dataSizer.Add(wx.StaticText(G2frame.dataWindow,label='Select sample shape'),0,WACV)
    1275         samShape = wx.ComboBox(G2frame.dataWindow,value=data['SampleShape'],choices=samplechoice,
    1276             style=wx.CB_READONLY|wx.CB_DROPDOWN)
    1277         samShape.Bind(wx.EVT_COMBOBOX,OnSampleShape)
    1278         dataSizer.Add(samShape,0,WACV)
     1279        dataSizer.Add(littleSizer)
     1280        showLines = wx.CheckBox(parent=G2frame.dataWindow,label='Show integration limits?')
     1281        dataSizer.Add(showLines,0,WACV)
     1282        showLines.Bind(wx.EVT_CHECKBOX, OnShowLines)
     1283        showLines.SetValue(data['showLines'])
     1284        fullIntegrate = wx.CheckBox(parent=G2frame.dataWindow,label='Do full integration?')
     1285        dataSizer.Add(fullIntegrate,0,WACV)
     1286        fullIntegrate.Bind(wx.EVT_CHECKBOX, OnFullIntegrate)
     1287        fullIntegrate.SetValue(data['fullIntegrate'])
     1288        setDefault = wx.CheckBox(parent=G2frame.dataWindow,label='Use for all new images?')
     1289        dataSizer.Add(setDefault,0,WACV)
     1290        setDefault.Bind(wx.EVT_CHECKBOX, OnSetDefault)
     1291        setDefault.SetValue(data['setDefault'])
     1292        centerAzm = wx.CheckBox(parent=G2frame.dataWindow,label='Azimuth at bin center?')
     1293        dataSizer.Add(centerAzm,0,WACV)
     1294        centerAzm.Bind(wx.EVT_CHECKBOX, OnCenterAzm)
     1295        centerAzm.SetValue(data['centerAzm'])
    12791296        #SampleShape - cylinder or flat plate choice?
    12801297        littleSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    12841301        samabs.SetValue(data['SampleAbs'][1])
    12851302        minmax = [0.,2.]
    1286         if 'Cylind' in data['SampleShape']: #cylinder mu*R; flat plate transmission
    1287             littleSizer.Add(wx.StaticText(G2frame.dataWindow,label='mu*R (0.00-2.0) '),0,WACV)
    1288         elif 'Fixed' in data['SampleShape']:
    1289             littleSizer.Add(wx.StaticText(G2frame.dataWindow,label='transmission '),0,WACV) #for flat plate
    1290             minmax = [.05,1.0]
    1291         samabsVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['SampleAbs'],0,nDig=(10,3),
    1292             typeHint=float,xmin=minmax[0],xmax=minmax[1])
    1293         littleSizer.Add(samabsVal,0,WACV)
    1294         dataSizer.Add(littleSizer,0,)       
     1303        if data['SampleAbs'][1]:
     1304            samplechoice = ['Cylinder','Fixed flat plate',]
     1305            littleSizer.Add(wx.StaticText(G2frame.dataWindow,label='Select shape '),0,WACV)
     1306            samShape = wx.ComboBox(G2frame.dataWindow,value=data['SampleShape'],choices=samplechoice,
     1307                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     1308            samShape.Bind(wx.EVT_COMBOBOX,OnSampleShape)
     1309            littleSizer.Add(samShape,0,WACV)
     1310        dataSizer.Add(littleSizer)
     1311        if data['SampleAbs'][1]:
     1312            littleSizer = wx.BoxSizer(wx.HORIZONTAL)
     1313            if 'Cylind' in data['SampleShape']: #cylinder mu*R; flat plate transmission
     1314                littleSizer.Add(wx.StaticText(G2frame.dataWindow,label='mu*R (0.00-2.0) '),0,WACV)
     1315            elif 'Fixed' in data['SampleShape']:
     1316                littleSizer.Add(wx.StaticText(G2frame.dataWindow,label='transmission '),0,WACV) #for flat plate
     1317                minmax = [.05,1.0]
     1318            samabsVal = G2G.ValidatedTxtCtrl(G2frame.dataWindow,data['SampleAbs'],0,nDig=(10,3),
     1319                typeHint=float,xmin=minmax[0],xmax=minmax[1])
     1320            littleSizer.Add(samabsVal,0,WACV)
     1321            dataSizer.Add(littleSizer,0,WACV)
     1322        if 'Cylind' in data['SampleShape'] and data['SampleAbs'][1]:
     1323            littleSizer = wx.BoxSizer(wx.HORIZONTAL)
     1324            littleSizer.Add(wx.StaticText(G2frame.dataWindow,label='Select orientation '),0,WACV)
     1325            choice = ['horizontal','vertical']
     1326            ochoice = wx.ComboBox(G2frame.dataWindow,value=data['orientation'],choices=choice,
     1327                style=wx.CB_READONLY|wx.CB_DROPDOWN)
     1328            ochoice.Bind(wx.EVT_COMBOBOX,OnOchoice)
     1329            littleSizer.Add(ochoice,0,WACV)
     1330            dataSizer.Add(littleSizer)
     1331        if 'flat' in data['SampleShape'] and data['SampleAbs'][1]:
     1332            dataSizer.Add((5,5),0)
    12951333        if 'PWDR' in data['type']:
    12961334            littleSizer = wx.BoxSizer(wx.HORIZONTAL)
     
    13141352            dataSizer.Add(littleSizer,0,)
    13151353       
    1316         showLines = wx.CheckBox(parent=G2frame.dataWindow,label='Show integration limits?')
    1317         dataSizer.Add(showLines,0,WACV)
    1318         showLines.Bind(wx.EVT_CHECKBOX, OnShowLines)
    1319         showLines.SetValue(data['showLines'])
    1320         fullIntegrate = wx.CheckBox(parent=G2frame.dataWindow,label='Do full integration?')
    1321         dataSizer.Add(fullIntegrate,0,WACV)
    1322         fullIntegrate.Bind(wx.EVT_CHECKBOX, OnFullIntegrate)
    1323         fullIntegrate.SetValue(data['fullIntegrate'])
    1324         setDefault = wx.CheckBox(parent=G2frame.dataWindow,label='Use for all new images?')
    1325         dataSizer.Add(setDefault,0,WACV)
    1326         setDefault.Bind(wx.EVT_CHECKBOX, OnSetDefault)
    1327         setDefault.SetValue(data['setDefault'])
    1328         centerAzm = wx.CheckBox(parent=G2frame.dataWindow,label='Azimuth at bin center?')
    1329         dataSizer.Add(centerAzm,0,WACV)
    1330         centerAzm.Bind(wx.EVT_CHECKBOX, OnCenterAzm)
    1331         centerAzm.SetValue(data['centerAzm'])
    13321354        return dataSizer
    13331355       
     
    16301652    mainSizer.Add((5,5),0)           
    16311653    mainSizer.Add(BackSizer(),0)
    1632     mainSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Calibration controls:'),0,WACV)
     1654    mainSizer.Add(wx.StaticText(parent=G2frame.dataWindow,label=' Calibration controls:'),0)
    16331655    mainSizer.Add((5,5),0)
    1634     mainSizer.Add(CalibSizer(),0,WACV)
     1656    mainSizer.Add(CalibSizer(),0)
    16351657    mainSizer.Add((5,5),0)
    1636     mainSizer.Add(GonioSizer(),0,WACV)   
     1658    mainSizer.Add(GonioSizer(),0)   
    16371659    G2frame.dataWindow.SetDataSize()
    16381660   
     
    21042126    delbtn.Bind(wx.EVT_BUTTON,OnDelBtn)
    21052127    spotSizer.Add(delbtn,0,WACV)
    2106     mainSizer.Add(spotSizer,0,WACV)
     2128    mainSizer.Add(spotSizer,0)
    21072129    if len(Spots):
    21082130        lbl = wx.StaticText(parent=G2frame.dataWindow,label=' Spot masks(on plot LB drag to move, shift-LB drag to resize, RB to delete)')
Note: See TracChangeset for help on using the changeset viewer.