Changeset 1658 for trunk/bindings/python
- Timestamp:
- 21/10/11 19:55:03 (7 months ago)
- File:
-
- 1 edited
-
trunk/bindings/python/nxs/napi.py (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bindings/python/nxs/napi.py
r1572 r1658 738 738 739 739 # ==== Data ==== 740 nxlib.nxigetrawinfo _.restype = c_int741 nxlib.nxigetrawinfo _.argtypes = [c_void_p, c_int_p, c_void_p, c_int_p]740 nxlib.nxigetrawinfo64_.restype = c_int 741 nxlib.nxigetrawinfo64_.argtypes = [c_void_p, c_int_p, c_void_p, c_int_p] 742 742 def getrawinfo(self): 743 743 """ … … 760 760 """ 761 761 rank = c_int(0) 762 shape = numpy.zeros(MAXRANK, 'i ')762 shape = numpy.zeros(MAXRANK, 'int64') 763 763 storage = c_int(0) 764 status = nxlib.nxigetrawinfo _(self.handle, _ref(rank), shape.ctypes.data,765 _ref(storage))764 status = nxlib.nxigetrawinfo64_(self.handle, _ref(rank), 765 shape.ctypes.data, _ref(storage)) 766 766 if status == ERROR: 767 767 raise NeXusError, "Could not get data info: %s"%(self._loc()) … … 771 771 return shape,dtype 772 772 773 nxlib.nxigetinfo _.restype = c_int774 nxlib.nxigetinfo _.argtypes = [c_void_p, c_int_p, c_void_p, c_int_p]773 nxlib.nxigetinfo64_.restype = c_int 774 nxlib.nxigetinfo64_.argtypes = [c_void_p, c_int_p, c_void_p, c_int_p] 775 775 def getinfo(self): 776 776 """ … … 796 796 """ 797 797 rank = c_int(0) 798 shape = numpy.zeros(MAXRANK, 'i ')798 shape = numpy.zeros(MAXRANK, 'int64') 799 799 storage = c_int(0) 800 status = nxlib.nxigetinfo_(self.handle, _ref(rank), shape.ctypes.data, 800 status = nxlib.nxigetinfo64_(self.handle, _ref(rank), 801 shape.ctypes.data, 801 802 _ref(storage)) 802 803 if status == ERROR: … … 846 847 self._indata = False 847 848 848 nxlib.nximakedata _.restype = c_int849 nxlib.nximakedata _.argtypes = [c_void_p, c_char_p, c_int, c_int, c_int_p]849 nxlib.nximakedata64_.restype = c_int 850 nxlib.nximakedata64_.argtypes = [c_void_p, c_char_p, c_int, c_int, c_int64_p] 850 851 def makedata(self, name, dtype=None, shape=None): 851 852 """ … … 866 867 #print "makedata",self._loc(),name,shape,dtype 867 868 storage = _nxtype_code[str(dtype)] 868 shape = numpy.a rray(shape,'i')869 status = nxlib.nximakedata _(self.handle,name,storage,len(shape),870 shape.ctypes.data_as(c_int_p))869 shape = numpy.asarray(shape,'int64') 870 status = nxlib.nximakedata64_(self.handle,name,storage,len(shape), 871 shape.ctypes.data_as(c_int64_p)) 871 872 if status == ERROR: 872 873 raise ValueError, "Could not create data %s: %s"%(name,self._loc()) 873 874 874 nxlib.nxicompmakedata _.restype = c_int875 nxlib.nxicompmakedata _.argtypes = [c_void_p, c_char_p, c_int, c_int, c_int_p,876 c_int, c_int_p]875 nxlib.nxicompmakedata64_.restype = c_int 876 nxlib.nxicompmakedata64_.argtypes = [c_void_p, c_char_p, c_int, c_int, c_int64_p, 877 c_int, c_int64_p] 877 878 def compmakedata(self, name, dtype=None, shape=None, mode='lzw', 878 879 chunks=None): … … 894 895 # Make sure shape/chunk_shape are integers; hope that 32/64 bit issues 895 896 # with the c int type sort themselves out. 896 dims = numpy.a rray(shape,'i')897 dims = numpy.asarray(shape,'int64') 897 898 if chunks == None: 898 chunks = numpy.ones(dims.shape,'i ')899 chunks = numpy.ones(dims.shape,'int64') 899 900 chunks[-1] = shape[-1] 900 901 else: 901 chunks = numpy.array(chunks,'i ')902 status = nxlib.nxicompmakedata _(self.handle,name,storage,len(dims),903 dims.ctypes.data_as(c_int_p),904 _compression_code[mode],905 chunks.ctypes.data_as(c_int_p))902 chunks = numpy.array(chunks,'int64') 903 status = nxlib.nxicompmakedata64_(self.handle,name,storage,len(dims), 904 dims.ctypes.data_as(c_int64_p), 905 _compression_code[mode], 906 chunks.ctypes.data_as(c_int64_p)) 906 907 if status == ERROR: 907 908 raise ValueError, \ … … 932 933 return datafn() 933 934 934 nxlib.nxigetslab _.restype = c_int935 nxlib.nxigetslab _.argtypes = [c_void_p, c_void_p, c_int_p, c_int_p]935 nxlib.nxigetslab64_.restype = c_int 936 nxlib.nxigetslab64_.argtypes = [c_void_p, c_void_p, c_int64_p, c_int64_p] 936 937 def getslab(self, slab_offset, slab_shape): 937 938 """ … … 948 949 dummy_shape,dtype = self.getrawinfo() 949 950 dummy_data,pdata,dummy_size,datafn = self._poutput(dtype,slab_shape) 950 slab_offset = numpy.a rray(slab_offset,'i')951 slab_shape = numpy.a rray(slab_shape,'i')952 status = nxlib.nxigetslab _(self.handle,pdata,953 slab_offset.ctypes.data_as(c_int_p),954 slab_shape.ctypes.data_as(c_int_p))951 slab_offset = numpy.asarray(slab_offset,'int64') 952 slab_shape = numpy.asarray(slab_shape,'int64') 953 status = nxlib.nxigetslab64_(self.handle,pdata, 954 slab_offset.ctypes.data_as(c_int64_p), 955 slab_shape.ctypes.data_as(c_int64_p)) 955 956 #print "slab",offset,size,data 956 957 if status == ERROR: … … 975 976 raise ValueError, "Could not write data: %s"%(self._loc()) 976 977 977 nxlib.nxiputslab _.restype = c_int978 nxlib.nxiputslab _.argtypes = [c_void_p, c_void_p, c_int_p, c_int_p]978 nxlib.nxiputslab64_.restype = c_int 979 nxlib.nxiputslab64_.argtypes = [c_void_p, c_void_p, c_int64_p, c_int64_p] 979 980 def putslab(self, data, slab_offset, slab_shape): 980 981 """ … … 990 991 dummy_shape,dtype = self.getrawinfo() 991 992 data,pdata = self._pinput(data,dtype,slab_shape) 992 slab_offset = numpy.a rray(slab_offset,'i')993 slab_shape = numpy.a rray(slab_shape,'i')993 slab_offset = numpy.asarray(slab_offset,'int64') 994 slab_shape = numpy.asarray(slab_shape,'int64') 994 995 #print "slab",offset,size,data 995 996 status = nxlib.nxiputslab_(self.handle,pdata, 996 slab_offset.ctypes.data_as(c_int _p),997 slab_shape.ctypes.data_as(c_int _p))997 slab_offset.ctypes.data_as(c_int64_p), 998 slab_shape.ctypes.data_as(c_int64_p)) 998 999 if status == ERROR: 999 1000 raise ValueError, "Could not write slab: %s"%(self._loc())
Note: See TracChangeset
for help on using the changeset viewer.
