Hi,
Whoever is running the CCP14 site needs to capture these FAQ type
messages & stick them into the appropriate spot in the web site for
others to find later. This question (& ones like it) does come up
occasionally.
Bob Von Dreele

R.B. Von Dreele
IPNS Division
Argonne National Laboratory
Argonne, IL 60439-4814



-----Original Message-----
From: Jon Wright [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 31, 2006 10:33 AM
To: [email protected]


Bob,

Shelx's (3I4,2F8.2) for h,k,l,FoSq,sig is straightforward to do in 
fortran but needs a custom number format in excel? Some people are able 
to type:

awk "{printf(\"%4d%4d%4d%8.2f%8.2f\n\",$1,$2,$3,$8/100,$9/100)}" < 
test.rfl > test.hkl

...and then delete the first and last line from the hkl file - but such 
beings generally don't need help - hence the script ;-)

Best,

Jon

ps: Sadly my mail program appears to have corrupted the indentation, so 
here another attempt at sharing that python script is below. The awk 
version above should survive transmission but you have to fiddle about 
with the factor of 100 manually.

=============================================================
#!/usr/bin/env python

import sys

data = []
max_intensity = 0.
for line in open(sys.argv[1],"r").readlines()[1:]:
   try:
      [H,K,L,M,sth_lam,TTH100,FWHM,FoSq,sig,
       Fobs,obs,phase] = [float(x) for x in line.split()]
   except:
      break
   data.append([H,K,L,FoSq,sig])
   if FoSq > max_intensity:
      max_intensity = FoSq

scale = 9999.99/max_intensity
outputfile = open(sys.argv[2],"w")
for [H,K,L,FoSq,sig] in data:
   outputfile.write("%4d%4d%4d%8.2f%8.2f\n"%(H,K,L,
                               FoSq*scale,sig*scale))
outputfile.close()


Reply via email to