Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex Types #235

Open
ax3l opened this issue May 17, 2016 · 1 comment
Open

Complex Types #235

ax3l opened this issue May 17, 2016 · 1 comment
Labels
Milestone

Comments

@ax3l
Copy link
Member

ax3l commented May 17, 2016

Check how the Python dtypes numpy.complex64 and numpy.complex128 look in HDF5 and implement as new types.

@ax3l ax3l added the feature label May 17, 2016
@ax3l ax3l added this to the Future milestone May 17, 2016
@ax3l
Copy link
Member Author

ax3l commented May 18, 2016

import h5py as h5
import numpy as np

f = h5.File("complex.h5")
f["data64"] = np.ones((10,20,), dtype=np.complex64)
f["data128"] = np.ones((10,20,), dtype=np.complex128)
f.close()
$ h5ls -v complex.h5                                                     
Opened "complex.h5" with sec2 driver.
data128                  Dataset {10/10, 20/20}
    Location:  1:1400
    Links:     1
    Storage:   3200 logical bytes, 3200 allocated bytes, 100.00% utilization
    Type:      struct {
                   "r"                +0    native double
                   "i"                +8    native double
               } 16 bytes
data64                   Dataset {10/10, 20/20}
    Location:  1:800
    Links:     1
    Storage:   1600 logical bytes, 1600 allocated bytes, 100.00% utilization
    Type:      struct {
                   "r"                +0    native float
                   "i"                +4    native float
               } 8 bytes
$ h5dump complex.h5
HDF5 "complex.h5" {
GROUP "/" {
   DATASET "data128" {
      DATATYPE  H5T_COMPOUND {
         H5T_IEEE_F64LE "r";
         H5T_IEEE_F64LE "i";
      }
      DATASPACE  SIMPLE { ( 10, 20 ) / ( 10, 20 ) }
      DATA { ... }
   }
   DATASET "data64" {
      DATATYPE  H5T_COMPOUND {
         H5T_IEEE_F32LE "r";
         H5T_IEEE_F32LE "i";
      }
      DATASPACE  SIMPLE { ( 10, 20 ) / ( 10, 20 ) }
      DATA { ... }
   }
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant