Changeset 1222


Ignore:
Timestamp:
Feb 16, 2014 5:52:50 AM (10 years ago)
Author:
vondreele
Message:

Image calibrants changed to include (optionally) the space group for each phase so that space group reflections can be skipped.n G2imagGUI & G2image changed to reflect this.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIimage.py

    r1219 r1222  
    2929import GSASIIlattice as G2lat
    3030import GSASIIpwd as G2pwd
     31import GSASIIspc as G2spc
    3132import fellipse as fel
    3233
     
    489490    skip = data['calibskip']
    490491    dmin = data['calibdmin']
    491     Bravais,Cells = calFile.Calibrants[data['calibrant']][:2]
     492    Bravais,SGs,Cells = calFile.Calibrants[data['calibrant']][:3]
    492493    HKL = []
    493     for bravais,cell in zip(Bravais,Cells):
     494    for bravais,sg,cell in zip(Bravais,SGs,Cells):
    494495        A = G2lat.cell2A(cell)
    495         hkl = G2lat.GenHBravais(dmin,bravais,A)
    496         HKL += hkl
     496        if sg:
     497            SGData = G2spc.SpcGroup(sg)[1]
     498            hkl = G2pwd.getHKLpeak(dmin,SGData,A)
     499            for h in hkl: print h
     500            HKL += hkl
     501        else:
     502            hkl = G2lat.GenHBravais(dmin,bravais,A)
     503            for h in hkl: print h
     504            HKL += hkl
    497505    HKL = G2lat.sortHKLd(HKL,True,False)
    498506    varyList = ['dist','det-X','det-Y','tilt','phi']
     
    593601    dmin = data['calibdmin']
    594602#generate reflection set
    595     Bravais,Cells = calFile.Calibrants[data['calibrant']][:2]
     603    Bravais,SGs,Cells = calFile.Calibrants[data['calibrant']][:3]
    596604    HKL = []
    597     for bravais,cell in zip(Bravais,Cells):
     605    for bravais,sg,cell in zip(Bravais,SGs,Cells):
    598606        A = G2lat.cell2A(cell)
    599         hkl = G2lat.GenHBravais(dmin,bravais,A)[skip:]
    600         HKL += hkl
    601     HKL = G2lat.sortHKLd(HKL,True,False)
     607        if sg:
     608            SGData = G2spc.SpcGroup(sg)[1]
     609            hkl = G2pwd.getHKLpeak(dmin,SGData,A)
     610            for h in hkl: print h
     611            HKL += hkl
     612        else:
     613            hkl = G2lat.GenHBravais(dmin,bravais,A)
     614            for h in hkl: print h
     615            HKL += hkl
     616    HKL = G2lat.sortHKLd(HKL,True,False)[skip:]
    602617    wave = data['wavelength']
    603618#set up 1st ring
    604619    elcent,phi,radii = ellipse              #from fit of 1st ring
    605620    dsp = HKL[0][3]
     621    print '1st ring: try %.4f'%(dsp)
    606622    tth = 2.0*asind(wave/(2.*dsp))
    607623    Ring0 = makeRing(dsp,ellipse,3,cutoff,scalex,scaley,self.ImageZ)
     
    626642#check get same ellipse parms either way
    627643#now do next ring; estimate either way & do a FitDetector each way; best fit is correct one
    628     dsp = HKL[1][3]
    629     tth = 2.0*asind(wave/(2.*dsp))
    630     ellipsep = GetEllipse2(tth,0.,dist,centp,tilt,phi)
    631     print fmt%('plus ellipse :',ellipsep[0][0],ellipsep[0][1],ellipsep[1],ellipsep[2][0],ellipsep[2][1])
    632     Ringp = makeRing(dsp,ellipsep,3,cutoff,scalex,scaley,self.ImageZ)
    633     parmDict = {'dist':dist,'det-X':centp[0],'det-Y':centp[1],
    634         'tilt':tilt,'phi':phi,'wave':wave,'dep':0.0}
    635     varyList = ['dist','det-X','det-Y','tilt','phi']
    636     if len(Ringp) > 10:
    637         chip = FitDetector(np.array(Ring0+Ringp),varyList,parmDict,True)
    638         tiltp = parmDict['tilt']
    639         phip = parmDict['phi']
    640         centp = [parmDict['det-X'],parmDict['det-Y']]
    641     else:
    642         chip = 1e6
    643     ellipsem = GetEllipse2(tth,0.,dist,centm,-tilt,phi)
    644     print fmt%('minus ellipse:',ellipsem[0][0],ellipsem[0][1],ellipsem[1],ellipsem[2][0],ellipsem[2][1])
    645     Ringm = makeRing(dsp,ellipsem,3,cutoff,scalex,scaley,self.ImageZ)
    646     if len(Ringm) > 10:
    647         parmDict['tilt'] *= -1
    648         chim = FitDetector(np.array(Ring0+Ringm),varyList,parmDict,True)
    649         tiltm = parmDict['tilt']
    650         phim = parmDict['phi']
    651         centm = [parmDict['det-X'],parmDict['det-Y']]
    652     else:
    653         chim = 1e6
     644    fail = True
     645    i2 = 1
     646    while fail:
     647        dsp = HKL[i2][3]
     648        print '2nd ring: try %.4f'%(dsp)
     649        tth = 2.0*asind(wave/(2.*dsp))
     650        ellipsep = GetEllipse2(tth,0.,dist,centp,tilt,phi)
     651        print fmt%('plus ellipse :',ellipsep[0][0],ellipsep[0][1],ellipsep[1],ellipsep[2][0],ellipsep[2][1])
     652        Ringp = makeRing(dsp,ellipsep,3,cutoff,scalex,scaley,self.ImageZ)
     653        parmDict = {'dist':dist,'det-X':centp[0],'det-Y':centp[1],
     654            'tilt':tilt,'phi':phi,'wave':wave,'dep':0.0}
     655        varyList = ['dist','det-X','det-Y','tilt','phi']
     656        if len(Ringp) > 10:
     657            chip = FitDetector(np.array(Ring0+Ringp),varyList,parmDict,True)
     658            tiltp = parmDict['tilt']
     659            phip = parmDict['phi']
     660            centp = [parmDict['det-X'],parmDict['det-Y']]
     661            fail = False
     662        else:
     663            chip = 1e6
     664        ellipsem = GetEllipse2(tth,0.,dist,centm,-tilt,phi)
     665        print fmt%('minus ellipse:',ellipsem[0][0],ellipsem[0][1],ellipsem[1],ellipsem[2][0],ellipsem[2][1])
     666        Ringm = makeRing(dsp,ellipsem,3,cutoff,scalex,scaley,self.ImageZ)
     667        if len(Ringm) > 10:
     668            parmDict['tilt'] *= -1
     669            chim = FitDetector(np.array(Ring0+Ringm),varyList,parmDict,True)
     670            tiltm = parmDict['tilt']
     671            phim = parmDict['phi']
     672            centm = [parmDict['det-X'],parmDict['det-Y']]
     673            fail = False
     674        else:
     675            chim = 1e6
     676        if fail:
     677            i2 += 1
    654678    if chip < chim:
    655679        data['tilt'] = tiltp
     
    670694    if data['DetDepthRef']:
    671695        varyList.append('dep')
    672     data['rings'] = []
    673     data['ellipses'] = []
     696#    data['rings'] = []
     697#    data['ellipses'] = []
    674698    for i,H in enumerate(HKL):
    675699        dsp = H[3]
  • trunk/GSASIIimgGUI.py

    r1204 r1222  
    790790        def OnNewCalibrant(event):
    791791            data['calibrant'] = calSel.GetValue()
    792             data['calibskip'] = calFile.Calibrants[data['calibrant']][2]
    793             limits = calFile.Calibrants[data['calibrant']][3]
     792            data['calibskip'] = calFile.Calibrants[data['calibrant']][3]
     793            limits = calFile.Calibrants[data['calibrant']][4]
    794794            data['calibdmin'],data['pixLimit'],data['cutoff'] = limits
    795795            pixLimit.SetValue(str(limits[1]))
  • trunk/ImageCalibrants.py

    r1140 r1222  
    88Each entry in ``ImageCalibrants`` consists of::
    99
    10   'key':([Bravais num,],[(a,b,c,alpha,beta,gamma),],no. lines skipped,(dmin,pixLimit,cutOff))
     10  'key':([Bravais num,],[space group,],[(a,b,c,alpha,beta,gamma),],no. lines skipped,(dmin,pixLimit,cutOff))
     11  (The space group may be an empty string)
    1112
    1213as an example::
    1314
    14   'LaB6  SRM660a':([2,],[(4.1569162,4.1569162,4.1569162,90,90,90),],0,(1.0,10,10)),
     15  'LaB6  SRM660a':([2,],['',][(4.1569162,4.1569162,4.1569162,90,90,90),],0,(1.0,10,10)),
    1516
    1617or where "Bravais num" and "(a,b,...)" are repeated in the case of mixtures::
    1718
    18   'LaB6 & CeO2':([2,0], [(4.1569,4.1569,4.1569,90,90,90),(5.4117,5.4117,5.4117,90,90,90)], 0, (1.0,2,1)),
     19  'LaB6 & CeO2':([2,0],['',''] [(4.1569,4.1569,4.1569,90,90,90),(5.4117,5.4117,5.4117,90,90,90)], 0, (1.0,2,1)),
    1920
    2021To expand this list with locally needed additions, do not modify this file,
     
    2425
    2526  Calibrants={
    26     'LaB6 skip 2 lines':([2,],[(4.1569162,4.1569162,4.1569162,90,90,90),],2,(1.0,10,10)),
     27    'LaB6 skip 2 lines':([2,],['',],[(4.1569162,4.1569162,4.1569162,90,90,90),],2,(1.0,10,10)),
    2728  }
    2829
     
    3435"""
    3536Calibrants={
    36 '':([0,],[(0,0,0,0,0,0),],0,(1.0,10,10)),
    37 'LaB6  SRM660a':([2,],[(4.1569162,4.1569162,4.1569162,90,90,90),],0,(1.0,10,10)),
    38 'LaB6  SRM660a skip 1':([2,],[(4.1569162,4.1569162,4.1569162,90,90,90),],1,(1.0,10,10)),
    39 'LaB6  SRM660': ([2,],[(4.15695,4.15695,4.15695,90,90,90),],0,(1.0,10,10)),
    40 'Si    SRM640c':([0,],[(5.4311946,5.4311946,5.4311946,90,90,90),],0,(1.,10,10)),
    41 'CeO2  SRM674b':([0,],[(5.411651,5.411651,5.411651,90,90,90),],0,(1.0,2,1)),
    42 'Al2O3 SRM676a':([3,],[(4.759091,4.759091,12.991779,90,90,120),],0,(1.0,5,5)),
    43 'Ni   @ 298K':([0,],[(3.52475,3.52475,3.52475,90,90,90),],0,(1.0,10,10)),
    44 'NaCl @ 298K':([0,],[(5.6402,5.6402,5.6402,90,90,90),],0,(1.0,10,10)),
    45 'NaCl even hkl only':([2,],[(2.8201,2.8201,2.8201,90,90,90),],0,(1.0,10,10)),
    46 'Ag behenate':([6,],[(1.0,1.0,58.380,90,90,90),],0,(7.0,5,1)),
    47 'Spun Si 3600 line/mm grating':([6,],[(1.0,1.0,2777.78,90,90,90),],2,(200.,5,1)),
    48 'Spun Si 7200 line/mm grating':([6,],[(1.0,1.0,1388.89,90,90,90),],1,(200.,5,1)),
    49 'Pt   @ 298K':([0,],[(3.9231,3.9231,3.9231,90,90,90),],0,(1.0,5,1)),
    50 'LaB6 & CeO2':([2,0],[(4.1569162,4.1569162,4.1569162,90,90,90),(5.411651,5.411651,5.411651,90,90,90)],0,(1.0,2,1)),
     37'':([0,],['',],[(0,0,0,0,0,0),],0,(1.0,10,10)),
     38'LaB6  SRM660a':([2,],[''],[(4.1569162,4.1569162,4.1569162,90,90,90),],0,(1.0,10,10)),
     39'LaB6  SRM660a skip 1':([2,],[''],[(4.1569162,4.1569162,4.1569162,90,90,90),],1,(1.0,10,10)),
     40'LaB6  SRM660': ([2,],[''],[(4.15695,4.15695,4.15695,90,90,90),],0,(1.0,10,10)),
     41'Si    SRM640c':([0,],[''],[(5.4311946,5.4311946,5.4311946,90,90,90),],0,(1.,10,10)),
     42'CeO2  SRM674b':([0,],[''],[(5.411651,5.411651,5.411651,90,90,90),],0,(1.0,2,1)),
     43'Al2O3 SRM676a':([3,],[''],[(4.759091,4.759091,12.991779,90,90,120),],0,(1.0,5,5)),
     44'Ni   @ 298K':([0,],[''],[(3.52475,3.52475,3.52475,90,90,90),],0,(1.0,10,10)),
     45'NaCl @ 298K':([0,],[''],[(5.6402,5.6402,5.6402,90,90,90),],0,(1.0,10,10)),
     46'NaCl even hkl only':([2,],[''],[(2.8201,2.8201,2.8201,90,90,90),],0,(1.0,10,10)),
     47'Ag behenate':([6,],[''],[(1.0,1.0,58.380,90,90,90),],0,(7.0,5,1)),
     48'Spun Si 3600 line/mm grating':([6,],[''],[(1.0,1.0,2777.78,90,90,90),],2,(200.,5,1)),
     49'Spun Si 7200 line/mm grating':([6,],[''],[(1.0,1.0,1388.89,90,90,90),],1,(200.,5,1)),
     50'Pt   @ 298K':([0,],[''],[(3.9231,3.9231,3.9231,90,90,90),],0,(1.0,5,1)),
     51'LaB6 & CeO2':([2,0],['','',],[(4.1569162,4.1569162,4.1569162,90,90,90),(5.411651,5.411651,5.411651,90,90,90)],0,(1.0,2,1)),
    5152}
    5253   
Note: See TracChangeset for help on using the changeset viewer.