示例#1
0
def get_histogram(monitor):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()

    nx = core.nx
    ny = core.ny
    n = nx * ny
    shape = nx, ny

    #    xmin = core.x_min; xmax = core.x_max
    #    ymin = core.y_min; ymax = core.y_max

    xmin = attr(core, "xmin", "x_min")
    xmax = attr(core, "xmax", "x_max")
    ymin = attr(core, "ymin", "y_min")
    ymax = attr(core, "ymax", "y_max")

    dx = (xmax - xmin) / nx
    dy = (ymax - ymin) / ny

    Iarr = bpptr2npyarr(core.getPSD_p_00(), 'double', n).copy()
    E2arr = bpptr2npyarr(core.getPSD_p2_00(), 'double', n).copy()
    Iarr.shape = E2arr.shape = shape

    from histogram import histogram, axis, arange
    xaxis = axis('x', arange(xmin, xmax, dx))
    yaxis = axis('y', arange(ymin, ymax, dy))

    h = histogram('I(x,y)', [xaxis, yaxis], data=Iarr, errors=E2arr)
    return h
def get_histogram( monitor ):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()

    nx = core.nxchan; ny =core.nychan; nb = core.nbchan
    n = nx * ny * nb
    shape = nx, ny, nb

    xmin = -core.xwidth/2; xmax = core.xwidth/2
    ymin = -core.yheight/2; ymax = core.yheight/2
    dx = (xmax - xmin)/nx
    dy = (ymax - ymin)/ny

    if core.bmax!=0:
        bmax=core.bmax
        bmin=core.bmin
        db=(bmax-bmin)/nb
    else :
        db = core.deltab
        bmin=0;
        bmax=nb*db+bmin

    Iarr = bpptr2npyarr( core.getTOF_p_00( ), 'double', n ).copy()
    E2arr = bpptr2npyarr( core.getTOF_p2_00( ), 'double', n ).copy()
    Iarr.shape = E2arr.shape = shape

    from histogram import histogram, axis, arange
    xaxis = axis( 'x', boundaries=arange( xmin, xmax+dx/10, dx ) )
    yaxis = axis( 'y', boundaries=arange( ymin, ymax+dy/10, dy ) )
    baxis = axis( 'b', boundaries=arange( bmin, bmax+db/10, db ) )

    h = histogram(
        'I(x,y,b)', [xaxis,yaxis,baxis],
        data = Iarr, errors = E2arr )
    return h
示例#3
0
def get_histogram(monitor):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()

    nx = core.nx
    ny = core.ny
    assert nx == int(nx)
    nx = int(nx)
    assert ny == int(ny)
    ny = int(ny)
    n = nx * ny
    shape = nx, ny

    Iarr = bpptr2npyarr(core.getPSD_p_00(), 'double', n).copy()
    E2arr = bpptr2npyarr(core.getPSD_p2_00(), 'double', n).copy()
    Iarr.shape = E2arr.shape = shape

    from histogram import histogram, axis, arange
    dx = 360. / nx
    xaxis = axis('x', arange(0, 360, dx), unit='deg')

    dy = 180. / ny
    yaxis = axis('y', arange(-90, 90, dy), unit='deg')

    h = histogram('I(x,y)', [xaxis, yaxis], data=Iarr, errors=E2arr)
    return h
示例#4
0
def get_histogram( monitor ):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()

    nx = core.nx; ny =core.ny
    n = nx * ny
    shape = nx, ny

#    xmin = core.x_min; xmax = core.x_max
#    ymin = core.y_min; ymax = core.y_max

    xmin = attr(core, "xmin", "x_min");
    xmax = attr(core, "xmax", "x_max");
    ymin = attr(core, "ymin", "y_min");
    ymax = attr(core, "ymax", "y_max");

    dx = (xmax - xmin)/nx
    dy = (ymax - ymin)/ny

    Iarr = bpptr2npyarr( core.getPSD_p_00( ), 'double', n ).copy()
    E2arr = bpptr2npyarr( core.getPSD_p2_00( ), 'double', n ).copy()
    Iarr.shape = E2arr.shape = shape

    from histogram import histogram, axis, arange
    xaxis = axis( 'x', arange( xmin, xmax, dx ) )
    yaxis = axis( 'y', arange( ymin, ymax, dy ) )

    h = histogram( 'I(x,y)', [xaxis,yaxis], data = Iarr, errors = E2arr )
    return h
示例#5
0
def get_histogram(monitor):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()
    n = core.nchan
    Iarr = bpptr2npyarr( core.getL_p( ), 'double', n ).copy()
    E2arr = bpptr2npyarr( core.getL_p2( ), 'double', n ).copy()
    from histogram import histogram, axis, arange
    dL = (core.Lmax-core.Lmin)/core.nchan 
    Laxis = axis( 'wavelength', arange( core.Lmin+dL/2, core.Lmax+dL/2, dL ), unit = 'angstrom' )
    h = histogram( 'I(L)', [Laxis], data = Iarr, errors = E2arr )
    return h
示例#6
0
def get_histogram( monitor ):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()
    n = core.nchan
    Iarr = bpptr2npyarr( core.getTOF_p( ), 'double', n ).copy()
    E2arr = bpptr2npyarr( core.getTOF_p2( ), 'double', n ).copy()
    from histogram import histogram, axis, arange
    dt = (core.tmax-core.tmin)/core.nchan
    taxis = axis( 'tof', arange( core.tmin+dt/2., core.tmax+dt/2-0.1*dt, dt ), unit = 's' )
    h = histogram( 'I(tof)', [taxis], data = Iarr, errors = E2arr )
    return h
示例#7
0
def get_histogram(monitor):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()
    n = core.nchan
    Iarr = bpptr2npyarr( core.getE_p( ), 'double', n ).copy()
    E2arr = bpptr2npyarr( core.getE_p2( ), 'double', n ).copy()
    from histogram import histogram, axis, arange
    dE = (core.Emax-core.Emin)/core.nchan
    Eaxis = axis( 'energy', arange( core.Emin+dE/2, core.Emax, dE ), unit = 'meV' )
    h = histogram( 'I(E)', [Eaxis], data = Iarr, errors = E2arr )
    return h
示例#8
0
def get_histogram(monitor):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()
    n = core.nchan
    Iarr = bpptr2npyarr(core.getE_p(), 'double', n).copy()
    E2arr = bpptr2npyarr(core.getE_p2(), 'double', n).copy()
    from histogram import histogram, axis, arange
    dE = (core.Emax - core.Emin) / core.nchan
    Eaxis = axis('energy',
                 arange(core.Emin + dE / 2, core.Emax, dE),
                 unit='meV')
    h = histogram('I(E)', [Eaxis], data=Iarr, errors=E2arr)
    return h
示例#9
0
def get_histogram(monitor):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()
    n = core.nchan
    Iarr = bpptr2npyarr(core.getL_p(), 'double', n).copy()
    E2arr = bpptr2npyarr(core.getL_p2(), 'double', n).copy()
    from histogram import histogram, axis, arange
    dL = (core.Lmax - core.Lmin) / core.nchan
    Laxis = axis('wavelength',
                 arange(core.Lmin + dL / 2, core.Lmax + dL / 2, dL),
                 unit='angstrom')
    h = histogram('I(L)', [Laxis], data=Iarr, errors=E2arr)
    return h
示例#10
0
def get_histogram(monitor):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()
    n = core.nchan
    Iarr = bpptr2npyarr(core.getTOF_p(), 'double', n).copy()
    E2arr = bpptr2npyarr(core.getTOF_p2(), 'double', n).copy()
    from histogram import histogram, axis, arange
    dt = (core.tmax - core.tmin) / core.nchan
    taxis = axis('tof',
                 arange(core.tmin + dt / 2., core.tmax + dt / 2 - 0.1 * dt,
                        dt),
                 unit='s')
    h = histogram('I(tof)', [taxis], data=Iarr, errors=E2arr)
    return h
示例#11
0
def get_histogram( monitor ):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()

    nQ = core.nQ; nE =core.nE
    n = nQ * nE
    shape = nQ, nE

    Iarr = bpptr2npyarr( core.getIQE_p( ), 'double', n ).copy()
    E2arr = bpptr2npyarr( core.getIQE_p2( ), 'double', n ).copy()
    Iarr.shape = E2arr.shape = shape

    from histogram import histogram, axis, arange
    dE = (core.Emax-core.Emin)/nE
    Eaxis = axis( 'energy', arange( core.Emin, core.Emax, dE ), unit = 'meV' )

    dQ = (core.Qmax-core.Qmin)/nQ
    Qaxis = axis( 'Q', arange( core.Qmin, core.Qmax, dQ ), unit = 'angstrom**-1' )

    h = histogram( 'I(Q,E)', [Qaxis,Eaxis], data = Iarr, errors = E2arr )
    return h
示例#12
0
def get_histogram(monitor):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()

    nQ = core.nQ
    nE = core.nE
    n = nQ * nE
    shape = nQ, nE

    Iarr = bpptr2npyarr(core.getIQE_p(), 'double', n).copy()
    E2arr = bpptr2npyarr(core.getIQE_p2(), 'double', n).copy()
    Iarr.shape = E2arr.shape = shape

    from histogram import histogram, axis, arange
    dE = (core.Emax - core.Emin) / nE
    Eaxis = axis('energy', arange(core.Emin, core.Emax, dE), unit='meV')

    dQ = (core.Qmax - core.Qmin) / nQ
    Qaxis = axis('Q', arange(core.Qmin, core.Qmax, dQ), unit='angstrom**-1')

    h = histogram('I(Q,E)', [Qaxis, Eaxis], data=Iarr, errors=E2arr)
    return h
示例#13
0
def get_histogram( monitor ):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()

    nx = core.nx; ny =core.ny
    assert nx == int(nx); nx = int(nx)
    assert ny == int(ny); ny = int(ny)
    n = nx * ny
    shape = nx, ny

    Iarr = bpptr2npyarr( core.getPSD_p_00( ), 'double', n ).copy()
    E2arr = bpptr2npyarr( core.getPSD_p2_00( ), 'double', n ).copy()
    Iarr.shape = E2arr.shape = shape

    from histogram import histogram, axis, arange
    dx = 360./nx
    xaxis = axis( 'x', arange( 0, 360, dx ), unit = 'deg' )

    dy = 180./ny
    yaxis = axis( 'y', arange( -90, 90, dy ), unit = 'deg' )

    h = histogram( 'I(x,y)', [xaxis,yaxis], data = Iarr, errors = E2arr )
    return h
def get_histogram(monitor):
    from mcstas2.utils.carray import bpptr2npyarr
    core = monitor.core()

    nx = core.nxchan
    ny = core.nychan
    nb = core.nbchan
    n = nx * ny * nb
    shape = nx, ny, nb

    xmin = -core.xwidth / 2
    xmax = core.xwidth / 2
    ymin = -core.yheight / 2
    ymax = core.yheight / 2
    dx = (xmax - xmin) / nx
    dy = (ymax - ymin) / ny

    if core.bmax != 0:
        bmax = core.bmax
        bmin = core.bmin
        db = (bmax - bmin) / nb
    else:
        db = core.deltab
        bmin = 0
        bmax = nb * db + bmin

    Iarr = bpptr2npyarr(core.getTOF_p_00(), 'double', n).copy()
    E2arr = bpptr2npyarr(core.getTOF_p2_00(), 'double', n).copy()
    Iarr.shape = E2arr.shape = shape

    from histogram import histogram, axis, arange
    xaxis = axis('x', boundaries=arange(xmin, xmax + dx / 10, dx))
    yaxis = axis('y', boundaries=arange(ymin, ymax + dy / 10, dy))
    baxis = axis('b', boundaries=arange(bmin, bmax + db / 10, db))

    h = histogram('I(x,y,b)', [xaxis, yaxis, baxis], data=Iarr, errors=E2arr)
    return h