Changeset dd56945 for python


Ignore:
Timestamp:
10/30/18 14:31:57 (6 years ago)
Author:
Hal Finkel <hfinkel@…>
Branches:
master, pympi
Children:
c8c291b
Parents:
22c1c0a
git-author:
Hal Finkel <hfinkel@…> (10/30/18 14:31:57)
git-committer:
Hal Finkel <hfinkel@…> (10/30/18 14:31:57)
Message:

import uint16 fix by Biwer, Christopher Michael <cmbiwer@…>

Location:
python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • python/genericio.py

    rbe75350 rdd56945  
    5757libpygio.get_variable_field_count.argtypes=[ct.c_char_p,ct.c_char_p] 
    5858 
     59libpygio.read_gio_uint16.restype=None 
     60libpygio.read_gio_uint16.argtypes=[ct.c_char_p,ct.c_char_p,ct.POINTER(ct.c_uint16),ct.c_int] 
     61 
    5962libpygio.read_gio_int32.restype=None 
    6063libpygio.read_gio_int32.argtypes=[ct.c_char_p,ct.c_char_p,ct.POINTER(ct.c_int),ct.c_int] 
     
    8386        return 
    8487    elif(var_type==9): 
    85         print("variable type not known (not int32/int64/float/double)") 
     88        print("variable type not known (not uint16/int32/int64/float/double)") 
    8689    elif(var_type==0): 
    8790        #float 
     
    104107        libpygio.read_gio_int64(file_name,var_name,result.ctypes.data_as(ct.POINTER(ct.c_int64)),field_count) 
    105108        return result         
     109    elif(var_type==4): 
     110        #uint16 
     111        result = np.ndarray((var_size,field_count),dtype=np.uint16) 
     112        libpygio.read_gio_uint16(file_name,var_name,result.ctypes.data_as(ct.POINTER(ct.c_uint16)),field_count) 
     113        return result 
    106114 
    107115def gio_has_variable(file_name,var_name): 
  • python/lib/gio.cxx

    r9796d0a rdd56945  
    4949    read_gio<double>(file_name,var_name,data,field_count); 
    5050  } 
     51  void read_gio_uint16(char* file_name, char* var_name, uint16_t* data, int field_count){ 
     52    read_gio<uint16_t>(file_name,var_name,data,field_count); 
     53  } 
    5154  void read_gio_int32(char* file_name, char* var_name, int* data, int field_count){ 
    5255    read_gio<int>(file_name,var_name,data,field_count); 
     
    8184        else if(vinfo.IsFloat && vinfo.ElementSize == 8) 
    8285          return double_type; 
     86        else if(!vinfo.IsFloat && vinfo.ElementSize == 2) 
     87          return uint16_type; 
    8388        else if(!vinfo.IsFloat && vinfo.ElementSize == 4) 
    8489          return int32_type; 
  • python/lib/gio.h

    r9796d0a rdd56945  
    7373extern "C" void read_gio_float (char* file_name, char* var_name, float* data, int field_count); 
    7474extern "C" void read_gio_double(char* file_name, char* var_name, double* data, int field_count); 
     75extern "C" void read_gio_uint16 (char* file_name, char* var_name, uint16_t* data, int field_count);  
    7576extern "C" void read_gio_int32 (char* file_name, char* var_name, int* data, int field_count);  
    7677extern "C" void read_gio_int64 (char* file_name, char* var_name, int64_t* data, int field_count); 
     
    8081  int32_type=2, 
    8182  int64_type=3, 
     83  uint16_type=4, 
    8284  type_not_found=9, 
    8385  var_not_found=10 
Note: See TracChangeset for help on using the changeset viewer.