Changeset 3756


Ignore:
Timestamp:
Dec 6, 2018 3:05:22 PM (4 years ago)
Author:
vondreele
Message:

add an importer for edited NIST hb3a diffractometer (defunct?)
fixes to allow single crystal refinements with CW neutron data

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrIO.py

    r3754 r3756  
    30993099            if 'X' in Inst['Type'][0]:
    31003100                histDict[pfx+'Lam'] = Inst['Lam'][1]
    3101                 controlDict[pfx+'keV'] = 12.397639/histDict[pfx+'Lam']                   
     3101                controlDict[pfx+'keV'] = 12.397639/histDict[pfx+'Lam']
     3102            elif 'NC' in Inst['Type'][0]:                   
     3103                histDict[pfx+'Lam'] = Inst['Lam'][1]
    31023104    return histVary,histDict,controlDict
    31033105   
  • trunk/imports/G2sfact.py

    r3254 r3756  
    566566        return True
    567567
    568 class ISIS_SXD_INT_ReaderClass(G2obj.ImportStructFactor):
    569     'Routines to import neutron TOF F**2, sig(F**2) reflections from a ISIS int file'
     568class NIST_hb3a_INT_ReaderClass(G2obj.ImportStructFactor):
     569    'Routines to import neutron CW F**2, sig(F**2) reflections from a NIST hb3a int file'
    570570    def __init__(self):
    571571        if 'linux' in sys.platform:  # wx 3.0.0.0 on gtk does not like Unicode in menus
    572             formatName = u'Neutron ISIS SXD TOF HKL F2'
    573             longFormatName = u'Neutron ISIS SXD TOF [hkl, Fo2, sig(Fo2),...] Structure factor text file'
    574         else:
    575             formatName = u'Neutron ISIS SXD TOF HKL F\u00b2'
    576             longFormatName = u'Neutron ISIS SXD TOF [hkl, Fo\u00b2, sig(Fo\u00b2),...] Structure factor text file'
     572            formatName = u'Neutron NIST hb3a  CW HKL F2'
     573            longFormatName = u'Neutron NIST hb3a  CW HKL [hkl, Fo2, sig(Fo2),...] 5 column Structure factor text file'
     574        else:
     575            formatName = u'Neutron NIST hb3a  CW HKL F\u00b2'
     576            longFormatName = u'Neutron NIST hb3a  CW HKL [hkl, Fo\u00b2, sig(Fo\u00b2),...] 5 column Structure factor text file'
    577577        super(self.__class__,self).__init__( # fancy way to self-reference
    578578            extensionlist=('.int','.INT'),
     
    583583    def ContentsValidator(self, filename):
    584584        'Make sure file contains the expected columns on numbers & count number of data blocks - "Banks"'
    585         oldNo = -1
    586585        fp = open(filename,'r')
    587586        for line,S in enumerate(fp):
     
    589588                break
    590589            if S[0] == '#': continue       #ignore comments, if any
    591             if S[0] == '(': continue        #ignore format line
    592             bankNo = S.split()[5]
    593             if bankNo != oldNo:
    594                 self.Banks.append({'RefDict':{'RefList':[],}})
    595                 oldNo = bankNo
    596590        fp.seek(0)
    597         valid = ColumnValidator(self, fp,nCol=8)
     591        valid = ColumnValidator(self, fp,nCol=5)
    598592        fp.close()
    599593        return valid
     
    605599            self.errors = '  Error reading line '+str(line+1)
    606600            if S[0] == '#': continue       #ignore comments, if any
    607             if S[0] == '(': continue        #ignore the format line
    608601            data = S.split()
    609             h,k,l,Fo,sigFo,bN,wave,x,x,tbar = data[:10]                   
     602            h,k,l,Fo,sigFo = data                   
    610603            h,k,l = [int(h),int(k),int(l)]
    611604            if not any([h,k,l]):
     
    613606            Fo = float(Fo)
    614607            sigFo = float(sigFo)
    615             wave = float(wave)
    616             tbar = float(tbar)
    617             if len(self.Banks):
    618                 self.Banks[int(bN)-1]['RefDict']['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,0,wave,tbar])
    619             else:
    620608            # h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
    621                 self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,0,wave,tbar])
    622         fp.close()
    623         if len(self.Banks):
    624             self.UpdateParameters(Type='SNT',Wave=None) # histogram type
    625             for Bank in self.Banks:
    626                 Bank['RefDict']['RefList'] = np.array(Bank['RefDict']['RefList'])
    627                 Bank['RefDict']['Type'] = 'SNT'                   
    628                 Bank['RefDict']['Super'] = 0
    629         else:
    630             self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
    631             self.RefDict['Type'] = 'SNT'
    632             self.RefDict['Super'] = 0
    633             self.errors = 'Error after reading reflections (unexpected!)'
    634             self.UpdateParameters(Type='SNT',Wave=None) # histogram type
    635         return True
    636 
     609            self.RefDict['RefList'].append([h,k,l,1,0,Fo,sigFo,0,Fo,0,0,0])
     610        fp.close()
     611        self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
     612        self.RefDict['Type'] = 'SNC'
     613        self.RefDict['Super'] = 0
     614        self.errors = 'Error after reading reflections (unexpected!)'
     615        self.UpdateParameters(Type='SNC',Wave=None) # histogram type
     616        return True
Note: See TracChangeset for help on using the changeset viewer.