Changeset 4334 for trunk


Ignore:
Timestamp:
Mar 1, 2020 1:19:50 AM (4 years ago)
Author:
vondreele
Message:

make new f(q) & g(r) files suitable for RMCProfile. The g(r) == PDF.
Fix 2X issue in xray scale factor for .bragg files

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r4333 r4334  
    42674267        'Save S(Q), G(R),... as selected by user'
    42684268        def PDFSave(G2frame,exports,PDFsaves):
    4269             'Save a PDF I(Q), S(Q), F(Q) and G(r)  in column formats'
     4269            'Save a PDF I(Q), S(Q), F(Q), G(r) and g(r)  in column formats'
    42704270            if len(exports) > 1:
    42714271                dirname = G2G.askSaveDirectory(G2frame)
     
    42734273            else:
    42744274                defnam = exports[0].replace(' ','_')[5:]
    4275                 filename = G2G.askSaveFile(G2frame,defnam,'.gr',
    4276                                                'G(r) file, etc.')
     4275                filename = G2G.askSaveFile(G2frame,defnam,'.gr','G(r) file, etc.')
    42774276                if not filename: return
    42784277                dirname,filename = os.path.split(filename)
     
    43004299            od = {'label_1':'Export I(Q)','value_1':False,'label_2':'Export S(Q)','value_2':False,
    43014300                  'label_3':'Export F(Q)','value_3':False,'label_4':'Export G(R)','value_4':True,
    4302                   'label_5':'Make G(R) for pdfGUI','value_5':False}
     4301                  'label_5':'Make G(R) for pdfGUI','value_5':False,
     4302                  'label_6':'Make F(Q) & g(r) for RMCProfile','value_6':False}
    43034303            dlg = G2G.G2MultiChoiceDialog(self,'Select','PDF patterns to export',names,extraOpts=od)
    43044304            if dlg.ShowModal() == wx.ID_OK:
     
    43084308            dlg.Destroy()
    43094309        if exports:
    4310             PDFsaves = [od['value_1'],od['value_2'],od['value_3'],od['value_4'],od['value_5']]
     4310            PDFsaves = [od['value_1'],od['value_2'],od['value_3'],od['value_4'],od['value_5'],od['value_6']]
    43114311            PDFSave(self,exports,PDFsaves)
    43124312       
  • trunk/GSASIIfiles.py

    r4195 r4334  
    905905      PDFsaves[2], if True writes a F(Q) file with a .fq extension
    906906      PDFsaves[3], if True writes a G(r) file with a .gr extension
    907       PDFsaves[4], if True writes G(r) in a pdfGUI input file with 
     907      PDFsaves[4], if True writes G(r) in a pdfGUI input file with
    908908      a .gr extension. Note that if PDFsaves[3] and PDFsaves[4] are
    909909      both True, the pdfGUI overwrites the G(r) file.
     910      PDFsaves[5], if True writes F(Q) & g(R) with .fq & .gr extensions
     911      overwrites these if selected by option 2, 3 or 4
    910912    :param dict PDFControls: The PDF parameters and computed results
    911913    :param dict Inst: Instrument parameters from the PDWR entry used
     
    10291031        grfile.close()
    10301032        G2Print (' G(R) saved to: '+grfilename)
     1033       
     1034    if PDFsaves[5]: #RMCProfile files for F(Q) & g(r) overwrites any above
     1035       
     1036        fqfilename = fileroot+'.fq'
     1037        fqdata = PDFControls['F(Q)'][1]
     1038        fqfxn = scintp.interp1d(fqdata[0],fqdata[1],kind='linear')
     1039        fqfile = open(fqfilename,'w')
     1040        qnew = np.arange(fqdata[0][0],fqdata[0][-1],0.005)
     1041        nq = qnew.shape[0]
     1042        fqfile.write('%20d\n'%nq-1)
     1043        fqfile.write(fqfilename+'\n')
     1044        fqnew = zip(qnew,fqfxn(qnew))
     1045        for q,fq in fqnew[1:]:
     1046            fqfile.write("%15.6g %15.6g\n" % (q,fq))
     1047        fqfile.close()
     1048        G2Print (' F(Q) saved to: '+fqfilename)
     1049       
     1050        grfilename = fileroot+'.gr'
     1051        grdata = PDFControls['g(r)'][1]
     1052        grfxn = scintp.interp1d(grdata[0],grdata[1],kind='linear')
     1053        grfile = open(grfilename,'w')
     1054        rnew = np.arange(grdata[0][0],grdata[0][-1],0.010)
     1055        nr = rnew.shape[0]
     1056        grfile.write('%20d\n'%nr-1)
     1057        grfile.write(grfilename+'\n')
     1058        grnew = zip(rnew,grfxn(rnew))
     1059        for r,gr in grnew[1:]:
     1060            grfile.write("%15.6g %15.6g\n" % (r,gr))
     1061        grfile.close()
     1062        G2Print (' G(R) saved to: '+grfilename)
     1063
  • trunk/GSASIIphsGUI.py

    r4330 r4334  
    53205320            if os.path.isfile(pName+'.his6f'):
    53215321                os.remove(pName+'.his6f')
     5322            if os.path.isfile(pName+'.xray'):
     5323                os.remove(pName+'.xray')
    53225324            if os.path.isfile(pName+'.neigh'):
    53235325                os.remove(pName+'.neigh')
  • trunk/GSASIIplot.py

    r4328 r4334  
    44384438    if not plotType:
    44394439        plotType = G2frame.G2plotNB.plotList[G2frame.G2plotNB.nb.GetSelection()]
    4440     if plotType not in ['I(Q)','S(Q)','F(Q)','G(R)','delt-G(R)']:
     4440    if plotType not in ['I(Q)','S(Q)','F(Q)','G(R)','g(r)','delt-G(R)']:
    44414441        return
    44424442   
     
    46754675                PlotList.append(Pattern[plotType])
    46764676        name = plotType
    4677     if plotType == 'G(R)':
     4677    if plotType in ['G(R)','g(r)']:
    46784678        Plot.set_xlabel(r'r,$\AA$',fontsize=14)
    4679         Plot.set_ylabel(r'G(r), $\AA^{-2}$',fontsize=14)
     4679        Plot.set_ylabel(r'%s, $\AA^{-2}$'%plotType,fontsize=14)
    46804680        if lim is not None:
    46814681            lim[0] = list([lim[0][0],data['Rmax']])
     
    47864786            wx.EndBusyCursor()
    47874787            if plotType == 'G(R)' and numbDen:
    4788                 Xb = [0.,2.5]
    4789                 Yb = [0.,-10.*np.pi*numbDen]
     4788                Xb = [0.,5.]
     4789                Yb = [0.,-20.*np.pi*numbDen]
    47904790                Plot.plot(Xb,Yb,color='k',dashes=(5,5))
    47914791                Plot.set_xlim([0.,PDFdata['Rmax']])
    47924792            elif plotType == 'F(Q)':
     4793                Xb = [0.,5.0]
     4794                Yb = [0.,-20.*np.pi*numbDen]
     4795                Plot.plot(Xb,Yb,color='k',dashes=(5,5))
    47934796                Plot.axhline(0.,color='k')
    47944797            elif plotType == 'S(Q)':
  • trunk/GSASIIpwd.py

    r4333 r4334  
    403403        xydata['FofQ'][1][1] *= LorchWeight(Q)   
    404404    xydata['GofR'] = copy.deepcopy(xydata['FofQ'])
     405    xydata['gofr'] = copy.deepcopy(xydata['FofQ'])
    405406    nR = len(xydata['GofR'][1][1])
    406407    Rmax = GSASIIpath.GetConfigValue('PDF_Rmax',100.)
     
    409410    R = 2.*np.pi*np.linspace(0,nR,nR,endpoint=True)/(mul*qLimits[1])
    410411    xydata['GofR'][1][0] = R
     412    xydata['gofr'][1][0] = R
    411413    GR = -dq*np.imag(fft.fft(xydata['FofQ'][1][1],mul*nR)[:nR])
    412414    xydata['GofR'][1][1] = GR
    413 #    gr = GR/(4.*np.pi*R)
    414 #    auxPlot.append([R,gr,'g(r)'])
     415    gr = GR/(np.pi*R)
     416    xydata['gofr'][1][1] = gr
     417    numbDen = 0.
     418    if 'ElList' in data:
     419        numbDen = GetNumDensity(data['ElList'],data['Form Vol'])
    415420    if data.get('noRing',True):
    416         xydata['GofR'][1][1] = np.where(xydata['GofR'][1][0]<0.5,0.,xydata['GofR'][1][1])
     421        Rmin = data['Rmin']
     422        xydata['gofr'][1][1] = np.where(R<Rmin,-4.*numbDen,xydata['gofr'][1][1])
     423        xydata['GofR'][1][1] = np.where(R<Rmin,-4.*R*np.pi*numbDen,xydata['GofR'][1][1])
    417424    return auxPlot
    418425   
     
    22792286    Sample = PWDdata['Sample Parameters']
    22802287    Scale = Sample['Scale'][0]
    2281     if 'X' in Inst['Type'][0]:
    2282         Scale *= 2.
    22832288    Limits = PWDdata['Limits'][1]
    22842289    Ibeg = np.searchsorted(Data[0],Limits[0])
  • trunk/GSASIIpwdGUI.py

    r4324 r4334  
    67656765    data['F(Q)'] = xydata['FofQ']
    67666766    data['G(R)'] = xydata['GofR']
     6767    data['g(r)'] = xydata['gofr']
    67676768    return auxPlot
    67686769
     
    73147315            G2plt.PlotISFG(G2frame,data,newPlot=True,plotType='F(Q)')
    73157316            G2plt.PlotISFG(G2frame,data,newPlot=True,plotType='G(R)')
     7317            G2plt.PlotISFG(G2frame,data,newPlot=True,plotType='g(r)')
    73167318        else:
    73177319            G2plt.PlotISFG(G2frame,data,newPlot=True)
     
    73847386        G2plt.PlotISFG(G2frame,data,newPlot=True,plotType='F(Q)')
    73857387        G2plt.PlotISFG(G2frame,data,newPlot=True,plotType='G(R)')
     7388        G2plt.PlotISFG(G2frame,data,newPlot=True,plotType='g(r)')
    73867389
    73877390    # Routine UpdatePDFGrid starts here
  • trunk/GSASIIscriptable.py

    r4327 r4334  
    25792579        self.names.append([PDFname]+['PDF Controls', 'PDF Peaks'])
    25802580        self.data[PDFname] = PDFdict
    2581         for i in 'I(Q)','S(Q)','F(Q)','G(R)':
     2581        for i in 'I(Q)','S(Q)','F(Q)','G(R)','g(r)':
    25822582            self.data[PDFname]['PDF Controls'][i] = []
    25832583        G2fil.G2Print('Adding "{}" to project'.format(PDFname))
     
    26082608            'DetType':'Area detector','ObliqCoeff':0.2,'Ruland':0.025,'QScaleLim':[20,25],
    26092609            'Lorch':False,'BackRatio':0.0,'Rmax':100.,'noRing':False,'IofQmin':1.0,'Rmin':1.0,
    2610             'I(Q)':[],'S(Q)':[],'F(Q)':[],'G(R)':[]}
     2610            'I(Q)':[],'S(Q)':[],'F(Q)':[],'G(R)':[],'g(r)':[]}
    26112611
    26122612        fo = open(prmfile,'r')
     
    52765276        data['F(Q)'] = xydata['FofQ']
    52775277        data['G(R)'] = xydata['GofR']
     5278        data['g(r)'] = xydata['gofr']
    52785279
    52795280    def optimize(self,showFit=True,maxCycles=5,
Note: See TracChangeset for help on using the changeset viewer.