예제 #1
0
파일: test6b.py 프로젝트: yxqd/nslice
def process(path):
    basename, ext = os.path.splitext(os.path.basename(path))
    
    from nslice.Run import Run
    run = Run(path)
    print "file=%s, instrument=%s, Ei=%s, psi=%s" % (
        path, run.instrument, run.Ei, run.psi)

    from nslice.XtalOrientation import XtalOrientation
    a = b = 8.87;  c = 5.2
    from math import pi
    twopi = 2*pi
    ra,rb,rc = [twopi/a, 0,0], [0,twopi/b,0], [0,0,twopi/c]
    u,v = [1,0,0], [0,1,0]
    xtal_ori = XtalOrientation(ra,rb,rc, u,v, run.psi)

    h,k,l,E = run.compute_hklE(xtal_ori)
    I, error = run.read_data()
    h.shape = k.shape = l.shape = E.shape = I.shape = error.shape = -1
    hklEIE = np.vstack((h,k,l,E,I,error))
    
    from nslice.slice import slice
    H, edges = slice(
        hklEIE, 
        x = '110', y = '1,-1,0', u='l', v='E',
        E=[-1,1], l=[-1,1], 
        xaxis=(-5, 5, 0.02), yaxis=(-5, 5, 0.02),
        )
    return H, edges
예제 #2
0
def process(path):
    basename = os.path.basename(path)
    
    from nslice.Run import Run
    run = Run(path)
    print "instrument=%s, Ei=%s, psi=%s" % (
        run.instrument, run.Ei, run.psi)

    from nslice.XtalOrientation import XtalOrientation
    a = b = 8.87;  c = 5.2
    from math import pi
    twopi = 2*pi
    ra,rb,rc = [twopi/a, 0,0], [0,twopi/b,0], [0,0,twopi/c]
    u,v = [1,0,0], [0,1,0]
    xtal_ori = XtalOrientation(ra,rb,rc, u,v, run.psi)

    h,k,l,E = run.compute_hklE(xtal_ori)
    I, error = run.read_data()
    h.shape = k.shape = l.shape = E.shape = I.shape = error.shape = -1
    hklEIE = np.vstack((h,k,l,E,I,error))
    
    from nslice.slice import slice_hE
    H, edges = slice_hE(
        hklEIE, 
        k=[0.95,1.05], l=[-1,1], 
        h=(-1, 6, 0.02), E=(-5, 10, 0.1),
        )
    import histogram, histogram.hdf as hh
    axes = [
        histogram.axis('h', boundaries=edges[0]),
        histogram.axis('E', unit='meV', boundaries=edges[1]),
        ]
    h = histogram.histogram('I(h,E)', axes=axes, data=H)
    hh.dump(h, 'I_hE.h5')
    return
예제 #3
0
def process(path):
    basename, ext = os.path.splitext(os.path.basename(path))

    from nslice.Run import Run
    run = Run(path)
    print "file=%s, instrument=%s, Ei=%s, psi=%s" % (path, run.instrument,
                                                     run.Ei, run.psi)

    from nslice.XtalOrientation import XtalOrientation
    a = b = 8.87
    c = 5.2
    from math import pi
    twopi = 2 * pi
    ra, rb, rc = [twopi / a, 0, 0], [0, twopi / b, 0], [0, 0, twopi / c]
    u, v = [1, 0, 0], [0, 1, 0]
    xtal_ori = XtalOrientation(ra, rb, rc, u, v, run.psi)

    h, k, l, E = run.compute_hklE(xtal_ori)
    I, error = run.read_data()
    h.shape = k.shape = l.shape = E.shape = I.shape = error.shape = -1
    hklEIE = np.vstack((h, k, l, E, I, error))

    from nslice.slice import slice
    H, edges = slice(
        hklEIE,
        x='k',
        y='E',
        u='h',
        v='l',
        k=(-1, 4, .03),
        E=(0, 6, 0.1),
        h=(0.95, 1.05),
        l=(-1, 1),
    )

    solidangle_I = np.ones(h.shape, dtype='double')
    solidangle_error = np.zeros(h.shape, dtype='double')
    hklEIE = np.vstack((h, k, l, E, solidangle_I, solidangle_error))
    sa, edges = slice(
        hklEIE,
        x='k',
        y='E',
        u='h',
        v='l',
        k=(-1, 4, .03),
        E=(0, 6, 0.1),
        h=(0.95, 1.05),
        l=(-1, 1),
    )
    return edges, H, sa
예제 #4
0
def process(path):
    basename = os.path.basename(path)

    from nslice.Run import Run
    run = Run(path)
    print "instrument=%s, Ei=%s, psi=%s" % (run.instrument, run.Ei, run.psi)

    from nslice.XtalOrientation import XtalOrientation
    a = b = c = 3
    from math import pi
    twopi = 2 * pi
    ra, rb, rc = [twopi / a, 0, 0], [0, twopi / b, 0], [0, 0, twopi / c]
    u, v = [1, 0, 0], [0, 1, 0]
    xtal_ori = XtalOrientation(ra, rb, rc, u, v, run.psi)

    hklE = run.compute_hklE(xtal_ori)
    return
예제 #5
0
def process(path):
    basename, ext = os.path.splitext(os.path.basename(path))

    from nslice.Run import Run
    run = Run(path)
    print "instrument=%s, Ei=%s, psi=%s" % (run.instrument, run.Ei, run.psi)

    from nslice.XtalOrientation import XtalOrientation
    a = b = 8.87
    c = 5.2
    from math import pi
    twopi = 2 * pi
    ra, rb, rc = [twopi / a, 0, 0], [0, twopi / b, 0], [0, 0, twopi / c]
    u, v = [1, 0, 0], [0, 1, 0]
    xtal_ori = XtalOrientation(ra, rb, rc, u, v, run.psi)

    h, k, l, E = run.compute_hklE(xtal_ori)
    I, error = run.read_data()
    h.shape = k.shape = l.shape = E.shape = I.shape = error.shape = -1
    hklEIE = np.vstack((h, k, l, E, I, error))

    from nslice.slice import slice
    H, edges = slice(
        hklEIE,
        x='h',
        y='k',
        u='l',
        v='E',
        E=[-2, 2],
        l=[-5, 5],
        h=(-5, 5, 0.02),
        k=(-5, 5, 0.02),
    )
    import histogram, histogram.hdf as hh
    axes = [
        histogram.axis('h', boundaries=edges[0]),
        histogram.axis('k', boundaries=edges[1]),
    ]
    h = histogram.histogram('I(h,k)', axes=axes, data=H)
    hh.dump(h, '%s-I_hk.h5' % basename)
    return
예제 #6
0
import os, numpy as np

dir = os.path.expanduser("~/simulations/HYSPEC/kvo/exp/spe")
filename_template = "HYS_%d_4pixel.nxspe"
run_numbers = range(28880, 29084)
from nslice.Scan import Scan
scan = Scan(dir, filename_template, run_numbers)

from nslice.XtalOrientation import XtalOrientation
a = b = 8.87
c = 5.2
from math import pi
twopi = 2 * pi
ra, rb, rc = [twopi / a, 0, 0], [0, twopi / b, 0], [0, 0, twopi / c]
u, v = [1, 0, 0], [0, 1, 0]
xtal_ori = XtalOrientation(ra, rb, rc, u, v, 0)

print "computing projections..."
scan.computeProjections(xtal_ori)
print "computing slice..."
h = scan.computeVolume(
    x='h',
    y='k',
    z='E',
    u='l',
    k=(-4, 4, 0.05),
    l=[-2, 2],
    h=(-3, 6, 0.05),
    E=(-5, 10, 0.2),
)
import histogram, histogram.hdf as hh
예제 #7
0
#!/usr/bin/env python

import os

dir = os.path.expanduser("~/simulations/HYSPEC/kvo/exp/spe")
path = os.path.join(dir, "HYS_28880_4pixel.nxspe")

from nslice.Run import Run
run = Run(path)
print "instrument=%s, Ei=%s, psi=%s" % (
    run.instrument, run.Ei, run.psi)

from nslice.XtalOrientation import XtalOrientation
a = b = c = 3
from math import pi
twopi = 2*pi
ra,rb,rc = [twopi/a, 0,0], [0,twopi/b,0], [0,0,twopi/c]
u,v = [1,0,0], [0,1,0]
xtal_ori = XtalOrientation(ra,rb,rc, u,v, run.psi)

hklE = run.compute_hklE(xtal_ori)