Changeset 1030 for trunk/exports


Ignore:
Timestamp:
Aug 13, 2013 2:25:42 PM (8 years ago)
Author:
vondreele
Message:

mods to CIF export
add residuals to histogram GUI
save histogram residual info in data[0] dictionary

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/exports/G2cif.py

    r1029 r1030  
    147147                WriteCIFitem('\n# OVERALL POWDER R-FACTOR')
    148148                try:
    149                     R = str(self.OverallParms['Covariance']['Rvals']['Rwp'])
     149                    R = '%.3f'%(self.OverallParms['Covariance']['Rvals']['Rwp'])
    150150                except:
    151151                    R = '?'
     
    819819            out = out.rstrip('0')  # strip zeros to right of decimal
    820820            return out.rstrip('.')  # and decimal place when not needed
     821           
     822        def WriteReflStat(refcount,hklmin,hklmax,dmin,dmax,nRefSets=1):
     823            WriteCIFitem('_reflns_number_total', str(refcount))
     824            if hklmin is not None and nRefSets == 1: # hkl range has no meaning with multiple phases
     825                WriteCIFitem('_reflns_limit_h_min', str(int(hklmin[0])))
     826                WriteCIFitem('_reflns_limit_h_max', str(int(hklmax[0])))
     827                WriteCIFitem('_reflns_limit_k_min', str(int(hklmin[1])))
     828                WriteCIFitem('_reflns_limit_k_max', str(int(hklmax[1])))
     829                WriteCIFitem('_reflns_limit_l_min', str(int(hklmin[2])))
     830                WriteCIFitem('_reflns_limit_l_max', str(int(hklmax[2])))
     831            if hklmin is not None:
     832                WriteCIFitem('_reflns_d_resolution_low', G2mth.ValEsd(dmax,-0.0009))
     833                WriteCIFitem('_reflns_d_resolution_high', G2mth.ValEsd(dmin,-0.009))
    821834
    822835        def WritePowderData(histlbl):
     
    9941007                    WriteCIFitem("  "+s)
    9951008
    996             WriteCIFitem('_reflns_number_total', str(refcount))
    997             if hklmin is not None and len(histblk['Reflection Lists']) == 1: # hkl range has no meaning with multiple phases
    998                 WriteCIFitem('_reflns_limit_h_min', str(int(hklmin[0])))
    999                 WriteCIFitem('_reflns_limit_h_max', str(int(hklmax[0])))
    1000                 WriteCIFitem('_reflns_limit_k_min', str(int(hklmin[1])))
    1001                 WriteCIFitem('_reflns_limit_k_max', str(int(hklmax[1])))
    1002                 WriteCIFitem('_reflns_limit_l_min', str(int(hklmin[2])))
    1003                 WriteCIFitem('_reflns_limit_l_max', str(int(hklmax[2])))
    1004             if hklmin is not None:
    1005                 WriteCIFitem('_reflns_d_resolution_high', G2mth.ValEsd(dmin,-0.009))
    1006                 WriteCIFitem('_reflns_d_resolution_low', G2mth.ValEsd(dmax,-0.0009))
    1007 
     1009            WriteReflStat(refcount,hklmin,hklmax,dmin,dmax,len(histblk['Reflection Lists']))
    10081010            WriteCIFitem('\n# POWDER DATA TABLE')
    10091011            # is data fixed step? If the step varies by <0.01% treat as fixed step
     
    10911093                         '\n\t' + refprx + 'F_squared_sigma' +
    10921094                         '\n\t' + refprx + 'F_squared_calc' +
    1093                          '\n\t' + refprx + 'phase_calc' +
    1094                          '\n\t_pd_refln_d_spacing'
     1095                         '\n\t' + refprx + 'phase_calc'
    10951096                         )
    10961097
     
    11171118                dmax = max(dmax,ref[4])
    11181119                dmin = min(dmin,ref[4])
    1119                 s += PutInCol(G2mth.ValEsd(ref[4],-0.009),8)
    11201120                WriteCIFitem(s)
    1121             WriteCIFitem('_reflns_number_total', str(refcount))
    1122             if hklmin is not None:
    1123                 WriteCIFitem('_reflns_limit_h_min', str(int(hklmin[0])))
    1124                 WriteCIFitem('_reflns_limit_h_max', str(int(hklmax[0])))
    1125                 WriteCIFitem('_reflns_limit_k_min', str(int(hklmin[1])))
    1126                 WriteCIFitem('_reflns_limit_k_max', str(int(hklmax[1])))
    1127                 WriteCIFitem('_reflns_limit_l_min', str(int(hklmin[2])))
    1128                 WriteCIFitem('_reflns_limit_l_max', str(int(hklmax[2])))
    1129                 WriteCIFitem('_reflns_d_resolution_high', G2mth.ValEsd(dmin,-0.009))
    1130                 WriteCIFitem('_reflns_d_resolution_low', G2mth.ValEsd(dmax,-0.0009))
     1121            WriteReflStat(refcount,hklmin,hklmax,dmin,dmax)
    11311122
    11321123        #============================================================
Note: See TracChangeset for help on using the changeset viewer.