Exemplo n.º 1
0
def getdata(handle, dims, use_slabs=False):
    if not use_slabs:
        data = nessi_list.NessiList(type="double")
        return sns_napi.getdata(handle, data)

    data = nessi_list.NessiList(type="double")
    for x in range(dims[0]):
        for y in range(dims[1]):
            slab = nessi_list.NessiList(type="double")
            start = (x, y, 0)
            stop = (1, 1, dims[2])  #x,y,dims[2])
            print start, stop,
            slab = sns_napi.getslab(handle, start, stop)
            print slab
            data.extend(slab)
    print len(data), data
    return data
Exemplo n.º 2
0
def getdata(handle,dims,use_slabs=False):
    if not use_slabs:
        data=nessi_list.NessiList(type="double")
        return sns_napi.getdata(handle,data)

    data=nessi_list.NessiList(type="double")
    for x in range(dims[0]):
        for y in range(dims[1]):
            slab=nessi_list.NessiList(type="double")
            start=(x,y,0)
            stop=(1,1,dims[2])#x,y,dims[2])
            print start,stop,
            slab=sns_napi.getslab(handle,start,stop)
            print slab
            data.extend(slab)
    print len(data),data
    return data
Exemplo n.º 3
0
def getslab(handle,start,size):
    data=sns_napi.getslab(handle,start,size)
    nessi_data=nessi_list.NessiList()
    nessi_data.__array__.__set_from_NessiVector__(nessi_data.__array__,data)
    return nessi_data
Exemplo n.º 4
0
    nessi_data=nessi_list.NessiList()
    nessi_data.__array__.__set_from_NessiVector__(nessi_data.__array__,data)
    return nessi_data

print dir(sns_napi)
#help(sns_napi)
handle=sns_napi.open("/SNS/users/pf9/REF_M_50-zipped.nxs")
print "opengroup(entry,NXentry)",sns_napi.opengroup(handle,"entry","NXentry")
#print "opengroup(data,NXdata)",sns_napi.opengroup(handle,"data","NXdata")
print "opengroup(bank1,NXdata)",sns_napi.opengroup(handle,"bank1","NXdata")
print "getnextentry()",sns_napi.getnextentry(handle)
print "getnextentry()",sns_napi.getnextentry(handle)
print "opendata(x_pixel_offset)",sns_napi.opendata(handle,"x_pixel_offset")
print "getattr(axis)",sns_napi.getattr(handle,"axis")
print "getattr(units)",sns_napi.getattr(handle,"units")
xpo=sns_napi.getdata(handle)
print "getdata()",xpo.__type__,xpo,len(xpo)
print "closedata()",sns_napi.closedata(handle)
print "opendata(data)",sns_napi.opendata(handle,"data")
(dims,type)=sns_napi.getinfo(handle)
print "getinfo()",(dims,type)
print "getnextattr()",sns_napi.getnextattr(handle)
print "getdata benchmark [:sec.milli]"
timing.start()
sns_napi.getdata(handle)
timing.finish()
print_mark("",timing.milli())
print "getslab((0,0,0),(1,1,167))",sns_napi.getslab(handle,(0,0,0),(1,1,167))
print "getslab((1,1,0),(1,1,167))",sns_napi.getslab(handle,(1,0,0),(1,1,167))

Exemplo n.º 5
0
 def getslab(self, start, size, type="f"):
     return sns_napi.getslab(self.__HANDLE__, start, size, type)
Exemplo n.º 6
0
def getslab(handle, start, size):
    data = sns_napi.getslab(handle, start, size)
    nessi_data = nessi_list.NessiList()
    nessi_data.__array__.__set_from_NessiVector__(nessi_data.__array__, data)
    return nessi_data
Exemplo n.º 7
0

print dir(sns_napi)
#help(sns_napi)
handle = sns_napi.open("/SNS/users/pf9/REF_M_50-zipped.nxs")
print "opengroup(entry,NXentry)", sns_napi.opengroup(handle, "entry",
                                                     "NXentry")
#print "opengroup(data,NXdata)",sns_napi.opengroup(handle,"data","NXdata")
print "opengroup(bank1,NXdata)", sns_napi.opengroup(handle, "bank1", "NXdata")
print "getnextentry()", sns_napi.getnextentry(handle)
print "getnextentry()", sns_napi.getnextentry(handle)
print "opendata(x_pixel_offset)", sns_napi.opendata(handle, "x_pixel_offset")
print "getattr(axis)", sns_napi.getattr(handle, "axis")
print "getattr(units)", sns_napi.getattr(handle, "units")
xpo = sns_napi.getdata(handle)
print "getdata()", xpo.__type__, xpo, len(xpo)
print "closedata()", sns_napi.closedata(handle)
print "opendata(data)", sns_napi.opendata(handle, "data")
(dims, type) = sns_napi.getinfo(handle)
print "getinfo()", (dims, type)
print "getnextattr()", sns_napi.getnextattr(handle)
print "getdata benchmark [:sec.milli]"
timing.start()
sns_napi.getdata(handle)
timing.finish()
print_mark("", timing.milli())
print "getslab((0,0,0),(1,1,167))", sns_napi.getslab(handle, (0, 0, 0),
                                                     (1, 1, 167))
print "getslab((1,1,0),(1,1,167))", sns_napi.getslab(handle, (1, 0, 0),
                                                     (1, 1, 167))