Exemple #1
0
from SOM import SO
from time import localtime, strftime, time

filename_SOM1 = "stuff1.dat"

SOM1 = SOM()
SOM1.attr_list["filename"] = filename_SOM1
SOM1.attr_list["epoch"] = time()
SOM1.attr_list["timestamp"] = DST.make_ISO8601(SOM1.attr_list["epoch"])
SOM1.attr_list["username"] = "******"
SOM1.setAllAxisLabels(["Q", "E"])
SOM1.setAllAxisUnits(["A-1", "meV"])
SOM1.setYLabel("Intensity")
SOM1.setYUnits("Counts/(meV A-1))")

SO1 = SO(2)
SO1.id = 0
SO1.axis[0].val.extend(range(5))
SO1.axis[1].val.extend(range(10))

y_len = (len(SO1.axis[0].val) - 1) * (len(SO1.axis[1].val) - 1)
y = range(y_len)
SO1.y.extend(y)
SO1.var_y.extend(y)

SOM1.append(SO1)

file = open(filename_SOM1, "w")

d2d = DST.Dave2dDST(file)
d2d.writeSOM(SOM1)
Exemple #2
0
SOM1.setYUnits("counts")
SOM1.setDataSetType("histogram")

if options.extraSom:
    SOM2 = SOM()
    SOM2.copyAttributes(SOM1)
    SOM2.setAllAxisLabels(["Wavelength"])
    SOM2.setAllAxisUnits(["Angstroms"])
    SOM2.setYLabel("Counts")
    SOM2.setYUnits("counts")
    SOM2.setDataSetType("histogram")
else:
    SOM2 = None

for i in range(2):
    SO1 = SO(construct=True, withVar=options.withXvar)
    if options.extraSom:
        SO2 = SO(construct=True)
    for j in range(10):
        SO1.id = i
        SO1.axis[0].val.append(j+1)
        if options.withXvar:
            SO1.axis[0].var.append(j+1)
        SO1.y.append(1000+j+(20*j))
        SO1.var_y.append(100+j)
        if options.extraSom:
            SO2.id = i
            SO2.axis[0].val.append((j+1)*1.0579838)
            SO2.y.append(1000+j+(20*j))
            SO2.var_y.append(100+j)
        
Exemple #3
0
#

# $Id$

import DST
from SOM import SOM
from SOM import SO

filename_SOM1 = "stuff1.dat"

SOM1 = SOM()
SOM1.attr_list["filename"] = filename_SOM1
SOM1.setTitle("This is a test")

for i in range(2):
    SO1 = SO()
    for j in range(10):
        SO1.id = i
        SO1.axis[0].val.append(j+1)
        SO1.y.append(1000+j+(20*j))
        SO1.var_y.append(100+j)
    SO1.axis[0].val.append(11)

    SOM1.append(SO1)

file = open(filename_SOM1, "w")

gsas = DST.GsasDST(file)
gsas.writeSOM(SOM1)
gsas.release_resource()
Exemple #4
0
SOM1.setAllAxisLabels(["momentum transfer", "energy transfer"])
SOM1.setAllAxisUnits(["1/A", "meV"])
SOM1.attr_list["data-title"] = "Test S(Q,E)"
SOM1.attr_list["data-run_number"] = "1344"

DSample = Sample()
DSample.name = "Test Sample"
DSample.nature = "CoCo"
SOM1.attr_list.sample = DSample

x = NessiList()
y = NessiList()
z = NessiList()

x.extend(0,1,2,3)
y.extend(0,1,2)
z.extend(1,2,3,4,5,6)

SO1 = SO(2)
SO1.id = ("bank1", (4, 32))
SO1.y = z
SO1.var_y = z
SO1.axis[0].val = x
SO1.axis[1].val = y

SOM1.append(SO1)

rednxs = DST.RedNxsDST("test_red.nxs")
rednxs.writeSOM(SOM1, entry_name="sqe")
rednxs.release_resource()
Exemple #5
0
DSample = Sample()
DSample.name = "Test Sample"
DSample.nature = "K3NO+"
SOM1.attr_list.sample = DSample

DInst = Instrument(instrument="SANS",
                   primary=(15.0, 0.0),
                   det_secondary=(2.0, 0.0),
                   x_pix_offset=[
                       (),
                       (),
                   ])
SOM1.attr_list.instrument = DInst

length = 10
SO1 = SO(construct=True, withXVar=True)
for i in range(length):
    SO1.axis[0].val.append(float(i))
    SO1.y.append(float(100 * i))
    SO1.var_y.append(float(100 * i))

SO1.axis[0].val.append(length)

SOM1.append(SO1)

ifile = open("test_cansas1d.xml", "w")

cs1d = DST.CanSas1dDST(ifile)
cs1d.writeSOM(SOM1)
cs1d.release_resource()
Exemple #6
0
SOM1.setAllAxisLabels(["momentum transfer", "energy transfer"])
SOM1.setAllAxisUnits(["1/A", "meV"])
SOM1.attr_list["data-title"] = "Test S(Q,E)"
SOM1.attr_list["data-run_number"] = "1344"

DSample = Sample()
DSample.name = "Test Sample"
DSample.nature = "CoCo"
SOM1.attr_list.sample = DSample

x = NessiList()
y = NessiList()
z = NessiList()

x.extend(0, 1, 2, 3)
y.extend(0, 1, 2)
z.extend(1, 2, 3, 4, 5, 6)

SO1 = SO(2)
SO1.id = ("bank1", (4, 32))
SO1.y = z
SO1.var_y = z
SO1.axis[0].val = x
SO1.axis[1].val = y

SOM1.append(SO1)

rednxs = DST.RedNxsDST("test_red.nxs")
rednxs.writeSOM(SOM1, entry_name="sqe")
rednxs.release_resource()
Exemple #7
0
#

# $Id$

import DST
from SOM import SOM
from SOM import SO

filename_SOM1 = "stuff1.dat"

SOM1 = SOM()
SOM1.attr_list["filename"] = filename_SOM1
SOM1.setTitle("This is a test")

for i in range(2):
    SO1 = SO()
    for j in range(10):
        SO1.id = i
        SO1.axis[0].val.append(j + 1)
        SO1.y.append(1000 + j + (20 * j))
        SO1.var_y.append(100 + j)
    SO1.axis[0].val.append(11)

    SOM1.append(SO1)

file = open(filename_SOM1, "w")

gsas = DST.GsasDST(file)
gsas.writeSOM(SOM1)
gsas.release_resource()
Exemple #8
0
from SOM import SO
from time import localtime, strftime, time

filename_SOM1 = "stuff1.dat"

SOM1 = SOM()
SOM1.attr_list["filename"] = filename_SOM1
SOM1.attr_list["epoch"] = time()
SOM1.attr_list["timestamp"] = DST.make_ISO8601(SOM1.attr_list["epoch"])
SOM1.attr_list["username"] = "******"
SOM1.setAllAxisLabels(["Q", "E"])
SOM1.setAllAxisUnits(["A-1", "meV"])
SOM1.setYLabel("Intensity")
SOM1.setYUnits("Counts/(meV A-1))")

SO1 = SO(2)
SO1.id = 0
SO1.axis[0].val.extend(range(5))
SO1.axis[1].val.extend(range(10))

y_len = (len(SO1.axis[0].val)-1) * (len(SO1.axis[1].val)-1)
y = range(y_len)
SO1.y.extend(y)
SO1.var_y.extend(y)

SOM1.append(SO1)

file = open(filename_SOM1, "w")

d2d = DST.Dave2dDST(file)
d2d.writeSOM(SOM1)