Changeset 1130


Ignore:
Timestamp:
Oct 29, 2013 4:46:45 PM (10 years ago)
Author:
toby
Message:

CIF export: use G2 T & P values, fix profile inclusion to show all hists

Location:
trunk/exports
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2export_CIF.py

    r1127 r1130  
    362362                mustrain = hapData['Mustrain']
    363363                hstrain = hapData['HStrain']
    364                 s = '  Crystallite size model "%s" for %s (microns)\n  '%(size[0],phasenam)
     364                if len(self.powderDict) > 1:
     365                    if s:
     366                        s += '\n'
     367                    else:
     368                        s += '  Crystallite size model "%s" for %s (microns)\n  '%(size[0],phasenam)
     369                    s += '  Parameters for histogram #'+str(hId)+' '+str(histogram)+'\n'
     370                else:
     371                    s += '  Crystallite size model "%s" for %s (microns)\n  '%(size[0],phasenam)
     372               
    365373                names = ['Size;i','Size;mx']
    366374                if 'uniax' in size[0]:
     
    426434                        s += G2mth.ValEsd(mustrain[1][i],sig)+', '
    427435                        i = 2    #skip the aniso value               
    428                 s += '\n  Macrostrain for %s\n'%(phasenam)
    429                 txt = '  parameters: '
     436                s1 = '  \n  Macrostrain parameters: '
    430437                names = G2spc.HStrainNames(SGData)
    431438                for name in names:
    432                     txt += name+', '
    433                 s += txt+'\n    '
     439                    s1 += name+', '
     440                s1 += '\n    '
     441                macrostrain = False
    434442                for i in range(len(names)):
    435443                    name = phfx+name[i]
    436444                    sig = self.sigDict.get(name,-0.009)
    437                     s += G2mth.ValEsd(hstrain[0][i],sig)+', '
     445                    s1 += G2mth.ValEsd(hstrain[0][i],sig)+', '
     446                    if hstrain[0][i]: macrostrain = True
     447                if macrostrain:
     448                    s += s1 + '\n'
     449                    # show revised lattice parameters here someday
     450                else:
     451                    s += '\n'
    438452            return s
    439453       
     
    10201034            #refprx = '_refln.' # mm
    10211035            refprx = '_refln_' # normal
     1036            # data collection parameters for the powder dataset
     1037           
     1038            temperature = histblk['Sample Parameters'].get('Temperature') # G2 uses K
     1039            if not temperature:
     1040                T = '?'
     1041            else:
     1042                T = G2mth.ValEsd(temperature,-0.009,True) # CIF uses K
     1043            WriteCIFitem('_diffrn_ambient_temperature',T)
     1044
     1045            pressure = histblk['Sample Parameters'].get('Pressure') #G2 uses mega-Pascal
     1046            if not pressure:
     1047                P = '?'
     1048            else:
     1049                P = G2mth.ValEsd(pressure*1000,-0.09,True) # CIF uses kilopascal
     1050            WriteCIFitem('_diffrn_ambient_pressure',P)
     1051
    10221052            WriteCIFitem('\n# STRUCTURE FACTOR TABLE')           
    10231053            # compute maximum intensity reflection
     
    16391669                        return
    16401670                    dlg.Destroy()
    1641 
     1671        if not self.quickmode:
     1672            # check if temperature values & pressure are defaulted
     1673            default = 0
     1674            for hist in self.Histograms:
     1675                if hist.startswith("PWDR"):
     1676                    key2 = "Sample Parameters"
     1677                    T = self.Histograms[hist][key2].get('Temperature')
     1678                    if not T:
     1679                        default += 1
     1680                    elif T == 300:
     1681                        default += 1
     1682                    P = self.Histograms[hist][key2].get('Pressure')
     1683                    if not P:
     1684                        default += 1
     1685                    elif P == 1:
     1686                        default += 1
     1687            if default > 0:
     1688                dlg = wx.MessageDialog(
     1689                    self.G2frame,
     1690                    'Temperature/Pressure values appear to be defaulted for some powder histograms (See Sample Parameters for each PWDR tree entry). Do you want to use those values?',
     1691                    'Check T and P values',
     1692                    wx.OK|wx.CANCEL)
     1693                ret = dlg.ShowModal()
     1694                dlg.Destroy()
     1695                if ret != wx.ID_OK: return
    16421696        if oneblock and not self.quickmode:
    16431697            # select a dataset to use (there should only be one set in one block,
  • trunk/exports/template_powder.cif

    r1067 r1130  
    2727;
    2828
    29 _diffrn_ambient_temperature       ?       
    3029_diffrn_source                    ?       
    3130_diffrn_source_target             ?
Note: See TracChangeset for help on using the changeset viewer.