mannau / h5

Interface to the HDF5 Library
Other
70 stars 22 forks source link

Add support for H5T_REFERENCE #42

Open RyanHope opened 7 years ago

RyanHope commented 7 years ago

Matlab file format version 7.3 is actually HDF5 but not all of the fields can be read/accessed with your h5 package.

> d.r['EEG/chanlocs/labels']
Error in GetDataSetType(dsetptr) : Datatype unknown.
> d.r['EEG/chanlocs'][]
Error in d.r["EEG/chanlocs"][] : object of type 'S4' is not subsettable

This is what it looks like in matlab:

>> EEG.chanlocs

ans = 

  1×128 struct array with fields:

    labels
    type
    theta
    radius
    X
    Y
    Z
    sph_theta
    sph_phi
    sph_radius
    urchan
    ref

What can I do to help you get this supported? If I provided a test file would that help?

mannau commented 7 years ago

yes - a test file and detailed problem description would definitely help. best, m

On 2017-02-24 16:57, Ryan Hope wrote:

Matlab file format version 7.3 is actually HDF5 but not all of the fields can be read/accessed with your h5 package. What can I do to help you get this supported. If I provided a test file would that help?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mannau/h5/issues/42, or mute the thread https://github.com/notifications/unsubscribe-auth/ABNFaM9L_Q_zZ88O_GlRovzy_un2aBy4ks5rfv31gaJpZM4MLXRP.

RyanHope commented 7 years ago

Here is a link to a test file: https://cmu.box.com/shared/static/gwi0m0uls4rgbf1f5t5zeaq3k2ea2293.set What other information do you need from me about the problem? It seems like I can't access any "struct arrays" in matlab terms. In the output below I can't access the data in any of the fields that start with a +. Supposedly this python package supports matlab files (https://github.com/frejanordsiek/hdf5storage) but for some reason it also has an issue loading my test file. However, it at least claims to support matlabs struct arrays and might be a good reference.

> require(h5)
> d = h5file('debug.set', 'r')
> d['EEG']
H5Group '/EEG'
+ chaninfo
+ chanlocs
+ etc
+ event
+ reject
+ stats
+ urevent
D comments
D condition
D data
D datfile
D dipfit
D epoch
D epochdescription
D eventdescription
D filename
D filepath
D group
D history
D icaact
D icachansind
D icasphere
D icasplinefile
D icaweights
D icawinv
D nbchan
D pnts
D ref
D saved
D session
D setname
D specdata
D specicaact
D splinefile
D srate
D subject
D times
D trials
D urchanlocs
D xmax
D xmin
A MATLAB_class
A MATLAB_fields 

Here is what some of those fields look like in Matlab:

>> EEG.etc

ans = 

  struct with fields:

                      T0: [2016 12 7 9 59 1]
              eeglabvers: '14.0.0'
      clean_channel_mask: [1×143 logical]
       clean_sample_mask: [1×2045440 logical]
                ICAnotes: [1×1 struct]
    icaweights_beforerms: [89×85 double]
     icasphere_beforerms: [85×85 double]
>> EEG.event

ans = 

  1×11 struct array with fields:

    latency
    game
    type
    init_index
    init_time
    urevent
    duration
>> EEG.stats

ans = 

  struct with fields:

              jp: []
             jpE: []
           icajp: []
          icajpE: []
            kurt: []
           kurtE: []
         icakurt: []
        icakurtE: []
        compenta: []
        compentr: []
       compkurta: []
       compkurtr: []
    compkurtdist: []
mannau commented 7 years ago

According to h5dump labels is an object reference (H5T_REFERENCE):

$ h5dump --header -d EEG/chanlocs/labels debug.set

HDF5 "debug.set" {
DATASET "EEG/chanlocs/labels" {
   DATATYPE  H5T_REFERENCE { H5T_STD_REF_OBJECT }
   DATASPACE  SIMPLE { ( 128, 1 ) / ( 128, 1 ) }
}
}

This is currently not supported by h5.

agilebean commented 6 years ago

May I ask about the release planning for this feature? Is the support for H5T_REFERENCE object reference within the scope of the next 1-2 months? Would be great!