- Timestamp:
- 01/11/19 20:01:29 (6 years ago)
- Branches:
- master, pympi
- Children:
- 33686f4
- Parents:
- dd56945
- git-author:
- Thomas Uram <turam@…> (01/11/19 20:01:29)
- git-committer:
- Thomas Uram <turam@…> (01/11/19 20:01:29)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/genericio.py
rdd56945 rc8c291b 75 75 libpygio.inspect_gio.argtypes=[ct.c_char_p] 76 76 77 def gio_read (file_name,var_name):77 def gio_read_(file_name,var_name): 78 78 if sys.version_info[0] == 3: 79 79 file_name = bytes(file_name,'ascii') … … 89 89 elif(var_type==0): 90 90 #float 91 result = np.ndarray((var_size ,field_count),dtype=np.float32)91 result = np.ndarray((var_size),dtype=np.float32) 92 92 libpygio.read_gio_float(file_name,var_name,result.ctypes.data_as(ct.POINTER(ct.c_float)),field_count) 93 93 return result 94 94 elif(var_type==1): 95 95 #double 96 result = np.ndarray((var_size ,field_count),dtype=np.float64)96 result = np.ndarray((var_size),dtype=np.float64) 97 97 libpygio.read_gio_double(file_name,var_name,result.ctypes.data_as(ct.POINTER(ct.c_double)),field_count) 98 98 return result 99 99 elif(var_type==2): 100 100 #int32 101 result = np.ndarray((var_size ,field_count),dtype=np.int32)101 result = np.ndarray((var_size),dtype=np.int32) 102 102 libpygio.read_gio_int32(file_name,var_name,result.ctypes.data_as(ct.POINTER(ct.c_int32)),field_count) 103 103 return result 104 104 elif(var_type==3): 105 105 #int64 106 result = np.ndarray((var_size ,field_count),dtype=np.int64)106 result = np.ndarray((var_size),dtype=np.int64) 107 107 libpygio.read_gio_int64(file_name,var_name,result.ctypes.data_as(ct.POINTER(ct.c_int64)),field_count) 108 108 return result … … 112 112 libpygio.read_gio_uint16(file_name,var_name,result.ctypes.data_as(ct.POINTER(ct.c_uint16)),field_count) 113 113 return result 114 115 def gio_read(file_name,var_names): 116 ret = [] 117 if not isinstance(var_names,list): 118 var_names = [ var_names ] 119 for var_name in var_names: 120 ret.append( gio_read_(file_name,var_name) ) 121 return np.array( ret ) 114 122 115 123 def gio_has_variable(file_name,var_name):
Note: See TracChangeset
for help on using the changeset viewer.