Changeset 1230 for branches/4.2/bindings/python/nxstest.py
- Timestamp:
- 14/04/09 18:56:40 (3 years ago)
- File:
-
- 1 edited
-
branches/4.2/bindings/python/nxstest.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/4.2/bindings/python/nxstest.py
r1180 r1230 132 132 # .. demonstrate extensible data 133 133 file.makedata('flush_data','int32',[nxs.UNLIMITED]) 134 file.opendata('flush_data') 134 135 for i in range(7): 135 file.opendata('flush_data')136 136 file.putslab(i,[i],[1]) 137 file.flush()138 # Oops... why isn't there a closedata()?137 file.closedata() 138 file.flush() 139 139 file.closegroup() 140 140 … … 142 142 file.makegroup('sample','NXsample') 143 143 file.opengroup('sample','NXsample') 144 file.makedata('ch_data','char',[ 12])144 file.makedata('ch_data','char',[20]) 145 145 file.opendata('ch_data') 146 146 file.putdata('NeXus sample') … … 231 231 fail("%s retrieved %s"%(dtype,get)) 232 232 233 233 234 # Check attribute types 234 235 file.opendata('r8_data') … … 255 256 for i in range(100): comp_array[i,:] *= i 256 257 expected = comp_array 257 file.opengroup('data','NXdata') 258 file.opendata('comp_data') 258 file.opengroup('data','NXdata') #/entry/data 259 file.opendata('comp_data') #/entry/data/comp_data 259 260 get = file.getdata() 260 file.closedata() #/entry/data/comp_data261 file.closegroup() #/entry/data261 file.closedata() #/entry/data/comp_data 262 file.closegroup() #/entry/data 262 263 if not (get == expected).all(): 263 264 fail("compressed data differs") 264 265 print get 266 267 # Check strings 268 file.opengroup('sample','NXsample') #/entry/sample 269 file.opendata('ch_data') #/entry/sample/ch_data 270 rawshape,rawdtype = file.getrawinfo() 271 shape,dtype = file.getinfo() 272 get = file.getdata() 273 file.closedata() #/entry/sample/ch_data 274 file.closegroup() #/entry/sample 275 if not (shape[0]==12 and dtype=='char'): 276 fail("returned string info is incorrect") 277 print shape,dtype 278 if not (rawshape[0]==20 and rawdtype=='char'): 279 fail("returned string storage info is incorrect") 280 print shape,dtype 281 if not (get == "NeXus sample"): 282 fail("returned string is incorrect") 283 print shape,dtype 284 285 265 286 file.closegroup() #/entry 266 287 267 288 # Check read slab (e.g., from extensible) 268 289
Note: See TracChangeset
for help on using the changeset viewer.
