Changeset 1655


Ignore:
Timestamp:
Feb 13, 2015 1:35:55 PM (7 years ago)
Author:
vondreele
Message:

add a Show/Hide? command in the phase/data menu
add importer for ISIS SXD data

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASII.py

    r1643 r1655  
    20902090        self.IparmName = ''  # to be removed when SelectPowderData & GetInstrumentFile is
    20912091        self.IfPlot = False
     2092        self.DDShowAll = False
    20922093        self.PatternId = 0
    20932094        self.PickId = 0
  • trunk/GSASIIddataGUI.py

    r1559 r1655  
    159159       
    160160    def OnCopyData(event):
    161         #how about HKLF data? This is only for PWDR data
    162161        Obj = event.GetEventObject()
    163162        hist = Indx[Obj.GetId()]
     
    196195            if name in ['Scale','Extinction','HStrain']:
    197196                if name == 'Extinction' and 'HKLF' in sourceDict['Histogram']:
    198                     copyDict[name] = {name:[sourceDict[name][:1]]}
     197                    copyDict[name] = {name:[sourceDict[name][:2]]}
    199198                    for item in ['Eg','Es','Ep']:
    200199                        copyDict[name][item] = sourceDict[name][2][item][1]
     
    228227                            if name in ['Scale','Extinction','HStrain']:
    229228                                if name == 'Extinction' and 'HKLF' in sourceDict['Histogram']:
    230                                     UseList[item][name][:1] = copy.deepcopy(sourceDict[name][:1])
     229                                    UseList[item][name][:2] = copy.deepcopy(sourceDict[name][:2])
    231230                                    for itm in ['Eg','Es','Ep']:
    232231                                        UseList[item][name][2][itm][1] = copy.deepcopy(copyDict[name][itm])
  • trunk/GSASIIgrid.py

    r1631 r1655  
    7171] = [wx.NewId() for item in range(17)]
    7272
    73 [ wxID_PWDRADD, wxID_HKLFADD, wxID_PWDANALYSIS, wxID_PWDCOPY, wxID_DATADELETE,
    74 ] = [wx.NewId() for item in range(5)]
     73[ wxID_PWDRADD, wxID_HKLFADD, wxID_PWDANALYSIS, wxID_PWDCOPY, wxID_DATADELETE, wxID_SHOWALL,
     74] = [wx.NewId() for item in range(6)]
    7575
    7676[ wxID_ATOMSEDITADD, wxID_ATOMSEDITINSERT, wxID_ATOMSEDITDELETE, wxID_ATOMSREFINE,
     
    23912391        self.DataEdit.Append(id=wxID_HKLFADD, kind=wx.ITEM_NORMAL,text='Add single crystal histograms',
    23922392            help='Select new single crystal histograms to be used for this phase')
     2393        self.DataEdit.Append(id=wxID_SHOWALL, kind=wx.ITEM_NORMAL,text='Show/Hide all',
     2394            help='Show/Hide all data entries')           
    23932395        self.DataEdit.Append(id=wxID_DATADELETE, kind=wx.ITEM_NORMAL,text='Remove histograms',
    23942396            help='Remove histograms from use for this phase')
  • trunk/GSASIImath.py

    r1646 r1655  
    151151        deltaChi2 = (chisq0-chisq1)/chisq0
    152152        if Print:
    153             print ' Cycle: %d, Time: %.2fs, Chi**2: %.3g, Lambda: %.3g,  Delta: %.3g'%(
     153            print ' Cycle: %d, Time: %.2fs, Chi**2: %.5g, Lambda: %.3g,  Delta: %.3g'%(
    154154                icycle,time.time()-time0,chisq1,lam,deltaChi2)
    155155        if deltaChi2 < ftol:
  • trunk/GSASIIphsGUI.py

    r1646 r1655  
    38063806            finally:
    38073807                dlg.Destroy()
     3808               
     3809    def OnShowAll(event):
     3810        G2frame.DDShowAll = not G2frame.DDShowAll
     3811        UseList = data['Histograms']
     3812        for hist in UseList:
     3813            UseList[hist]['Show'] = G2frame.DDShowAll
     3814        wx.CallAfter(G2ddG.UpdateDData,G2frame,DData,data)
    38083815       
    38093816    def OnDataDelete(event):
     
    58425849        G2frame.dataFrame.Bind(wx.EVT_MENU, OnPwdrAdd, id=G2gd.wxID_PWDRADD)
    58435850        G2frame.dataFrame.Bind(wx.EVT_MENU, OnHklfAdd, id=G2gd.wxID_HKLFADD)
     5851        G2frame.dataFrame.Bind(wx.EVT_MENU, OnShowAll, id=G2gd.wxID_SHOWALL)
    58445852        G2frame.dataFrame.Bind(wx.EVT_MENU, OnDataDelete, id=G2gd.wxID_DATADELETE)
    58455853        # Atoms
  • trunk/imports/G2sfact.py

    r1599 r1655  
    392392            return False
    393393
     394class ISIS_SXD_INT_ReaderClass(G2IO.ImportStructFactor):
     395    'Routines to import neutron TOF F**2, sig(F**2) reflections from a ISIS int file'
     396    def __init__(self):
     397        super(self.__class__,self).__init__( # fancy way to self-reference
     398            extensionlist=('.int','.INT'),
     399            strictExtension=False,
     400            formatName = u'Neutron SXD TOF HKL F\u00b2',
     401            longFormatName = u'Neutron SXD TOF [hkl, Fo\u00b2, sig(Fo\u00b2),...] Structure factor text file'
     402            )
     403
     404    def ContentsValidator(self, filepointer):
     405        'Make sure file contains the expected columns on numbers & count number of data blocks - "Banks"'
     406        oldNo = -1
     407        for line,S in enumerate(filepointer):
     408            if not S:   #empty line terminates read
     409                break
     410            if S[0] == '#': continue       #ignore comments, if any
     411            if S[0] == '(': continue        #ignore format line
     412            bankNo = S.split()[5]
     413            if bankNo != oldNo:
     414                self.Banks.append({'RefDict':{'RefList':[],}})
     415                oldNo = bankNo
     416        filepointer.seek(0)
     417        return ColumnValidator(self, filepointer,nCol=8)
     418
     419    def Reader(self,filename,filepointer, ParentFrame=None, **unused):
     420        'Read the file'
     421        filepointer.seek(0)
     422        try:
     423            for line,S in enumerate(filepointer):
     424                self.errors = '  Error reading line '+str(line+1)
     425                if S[0] == '#': continue       #ignore comments, if any
     426                if S[0] == '(': continue        #ignore the format line
     427                data = S.split()
     428                h,k,l,Fo,sigFo,bN,wave,x,x,tbar = data[:10]                   
     429                h,k,l = [int(h),int(k),int(l)]
     430                if not any([h,k,l]):
     431                    break
     432                Fo = float(Fo)
     433                sigFo = float(sigFo)
     434                wave = float(wave)
     435                tbar = float(tbar)
     436                if len(self.Banks):
     437                    self.Banks[int(bN)-1]['RefDict']['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0,wave,tbar])
     438                else:
     439                # h,k,l,m,dsp,Fo2,sig,Fc2,Fot2,Fct2,phase,...
     440                    self.RefDict['RefList'].append([h,k,l,0,0,Fo,sigFo,0,Fo,0,0,0,wave,tbar])
     441            if len(self.Banks):
     442                self.UpdateParameters(Type='SNT',Wave=None) # histogram type
     443                for Bank in self.Banks:
     444                    Bank['RefDict']['RefList'] = np.array(Bank['RefDict']['RefList'])
     445                    Bank['RefDict']['Type'] = 'SNT'                   
     446                    Bank['RefDict']['Super'] = 0
     447            else:
     448                self.RefDict['RefList'] = np.array(self.RefDict['RefList'])
     449                self.RefDict['Type'] = 'SNT'
     450                self.RefDict['Super'] = 0
     451                self.errors = 'Error after reading reflections (unexpected!)'
     452                self.UpdateParameters(Type='SNT',Wave=None) # histogram type
     453            return True
     454        except Exception as detail:
     455            self.errors += '\n  '+str(detail)
     456            print '\n\n'+self.formatName+' read error: '+str(detail) # for testing
     457            import traceback
     458            traceback.print_exc(file=sys.stdout)
     459            return False
     460
Note: See TracChangeset for help on using the changeset viewer.