[Ifeffit] how to import this kind of XAFS data

2017-12-11 Thread woschangqi...@126.com
Dear Bruce Ravel, Matt Newville and Carlo Segre, I am sorry to reply late. 
Thanks very much for your time and detailed explanations.  


Qiang CHANG
Unversity of Chinese Academy of Sciences
___
Ifeffit mailing list
Ifeffit@millenia.cars.aps.anl.gov
http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit


Re: [Ifeffit] how to import this kind of XAFS data

2017-12-08 Thread Carlo Segre


Hi Chang:

If it is the right form, I have a Python program which will convert them 
along with a description of the file format.  I have attached the 
description below and the python program to the email.  If it does not get 
through the mailing list filter, just email me directly and I will send 
it.


Carlo



The first column is in motor steps (!), and the angle is a linear function
of motor steps, and the rest is just Bragg's law.  Things are referenced
physically to the copper edge.

Key parameters used in the data acquisition program are in the header: 
dspace is obvious, stepdeg is steps per degree in the mono, cuedge is 
the position of the Cu edge as measured in motor step units.


I think the channel offsets (dark currents) are already subtracted from the
other columns; the offsets are just listed for documentation.

In addition, there are two different file types, the ones which have a
header beginning with NPTS and containing DSPACE and the older files which
begin with CUEDGE and do not contain d-spacing information.

For the latter, we make the following assumptions:
dSpacing = 1.92017
stepDegree = 2000 * int(edgeCu / 42000)

The guts of the calculation are as follows:

theta = ((steps - edgeCu) / stepDegree) * (pi / 180.) + thetaCu
energy = hc / (2 * d * numpy.sin(theta))

where   steps - the current step value in the original file
edgeCu - the position of the Cu edge in steps
stepDegree - the steps per degree theta
thetaCu - the angle of the Cu edge (from d-spacing information)


On Fri, 8 Dec 2017, woschangqi...@126.com wrote:


Hello, dear everyone.
I downloaded a XAFS data about mettalic Ru from the website of ixs.iit.edu. 
There are 4 groups of information in the data, and each ranges between ~67800 
with ~63000 in energy. So how to import the data to Athena, and how this kind 
of data was produced? Does anyone  come across this situation? Thanks for your 
time and help in advance.

Q. CHANG
Unversity of Chinese  of Academy of Sciences



--
Carlo U. Segre -- Duchossois Leadership Professor of Physics
Interim Chair, Department of Chemistry
Director, Center for Synchrotron Radiation Research and Instrumentation
Illinois Institute of Technology
Voice: 312.567.3498Fax: 312.567.3494
se...@iit.edu   http://phys.iit.edu/~segre   se...@debian.org#!/usr/bin/env python
# Name:		lytle_convert
# Purpose:	Convert Farrel Lytle data files from steps to energy
#   and output in SFF format.  This program supports
#			conversion of two different file types.  Those which 
#			have a header beginning with NPTS and containing DSPACE and 
#			the older files with begin with CUEDGE and do not contain
#			d-spacing information. 
# Author:	Carlo U. Segre 
#
# Copyright 2009 Illinois Institute of Technology
#
# Version:
#	1.0		2009/02/03	Carlo Segre
#			* Initial release
#	1.1		2009/02/11	Carlo Segre
#			* Replace Numeric with numpy
#			* Open output file after checking for supported input 
#			  file format
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
# 
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL ILLINOIS INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# 
# Except as contained in this notice, the name of Illinois Institute
# of Technology shall not be used in advertising or otherwise to promote
# the sale, use or other dealings in this Software without prior written
# authorization from Illinois Institute of Technology.
#

__version__ = '1.1'
__rcsid__ = '$Id$'
__source__ = '$Source$'

import os
import sys
import getopt
from string import *
from struct import *
import commands
import time
import numpy

def usage(error=1):
	usage = """\
	
Usage: %s [OPTION]... INFILE0 [INFILE1 ... INFILEn]
Converts Farrel Lytle data files from steps to energy.

Options:
   -h, --helpPrint this message
   
""" % os.path.basename(sys.argv[0])

	if error:
		sys.stderr.write(usage)
		sys.exit(1)
	else:
		sys.stdout.write(usage)
		sys.exit()


def main(rawFile, convFile):

inFile = open(ra

Re: [Ifeffit] how to import this kind of XAFS data

2017-12-08 Thread Matt Newville
On Fri, Dec 8, 2017 at 3:00 AM, woschangqi...@126.com  wrote:

> Hello, dear everyone.
> I downloaded a XAFS data about mettalic Ru from the website of *ixs.iit.edu
> *. There are 4 groups of information in the data, and
> each ranges between ~67800 with ~63000 in energy. So how to import the
> data to Athena, and how this kind of data was produced? Does anyone  come
> across this situation? Thanks for your time and help in advance.
>


This data file is a particularly nasty form of data from the Lytle
database.   Each line of data contains consecutive pairs of  AngleSteps Mu

To convert the angle steps to energy, you need to know how many steps there
are in a degree and the lattice constant of the mono crystal used.  Neither
of these are in the file.  I happen to have a good guess that these numbers
should be  8000 steps per degree, and 1.92017 Angstroms.

Still the data are a pain to deal with.  They can be read with Ifeffit too,
but with Larch it goes like this:


ru = read_ascii('ru.001.txt')
# flatten array data to [step, mu, step, mu,...]
dat = ru.data.transpose().flatten()

# take every 2nd value as angle or xmu
asteps = dat[0::2]
xmu= dat[1::2]
step2rad = (pi/180)/ 8000  # radians per step
hc = 12398.417   # eV Ang
dspace = 1.92017 # Ang

energy = hc/(2*dspace)/sin(asteps * step2rad)
label  = 'energy   xmu   angle_steps'
header = ['data converted from Lytle database file: %s'  % ru.filename,
  'using  dspace=1.92017, steps-per-degree=8000']

write_ascii('ru.001.xmu', energy, xmu, asteps, header=header,
label=label)

Resulting converted file attached.

--Matt


ru.001.xmu
Description: Binary data
___
Ifeffit mailing list
Ifeffit@millenia.cars.aps.anl.gov
http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit


[Ifeffit] how to import this kind of XAFS data

2017-12-08 Thread woschangqi...@126.com
Hello, dear everyone. 
I downloaded a XAFS data about mettalic Ru from the website of ixs.iit.edu. 
There are 4 groups of information in the data, and each ranges between ~67800 
with ~63000 in energy. So how to import the data to Athena, and how this kind 
of data was produced? Does anyone  come across this situation? Thanks for your 
time and help in advance. 

Q. CHANG
Unversity of Chinese  of Academy of Sciences


ru.001.txt
Description: Binary data
___
Ifeffit mailing list
Ifeffit@millenia.cars.aps.anl.gov
http://millenia.cars.aps.anl.gov/mailman/listinfo/ifeffit
Unsubscribe: http://millenia.cars.aps.anl.gov/mailman/options/ifeffit