Unable to open a dataset in h5py












0















When I try to import a folder with h5py, I am able to open. However, when I try to access its datasets, it says there is an error. Is there a reason why?



The code below is used to import the folder:



hf = h5py.File('filename', 'r')


However, when I use the code below, there is an error:



x = np.array(hf["dataset"]) 









share|improve this question























  • You must be doing something wrong! (if you want more help you need to give more information, like the text of the error). Do you know, for sure, that there's a dataset called dataset? Or is that just a guess or random choice? How much of the h5py "getting started" documentation have you read (and understood)?

    – hpaulj
    Nov 24 '18 at 4:34













  • The error says "Unable to open object (object 'signal' doesn't exist)". I am sure that the dataset is there. I read most of the h5py doucmentation, and the code above works for other data.

    – kdf
    Nov 24 '18 at 5:08











  • Why didn't you include that information initially, rather than leaving me guessing as to how much you knew or had already done! With the little you added I'd suggest first ds = hf["dataset"] to verify that you can access the dataset. Then start displaying some properties - shape, dtype, etc.. And as per the documentation, x = ds[:] is the preferred syntax for loading. But I suspect there's something unusual about this dataset that prevents loading. If you don't know anything about it, you may have to use a dump script to learn more.

    – hpaulj
    Nov 24 '18 at 5:25
















0















When I try to import a folder with h5py, I am able to open. However, when I try to access its datasets, it says there is an error. Is there a reason why?



The code below is used to import the folder:



hf = h5py.File('filename', 'r')


However, when I use the code below, there is an error:



x = np.array(hf["dataset"]) 









share|improve this question























  • You must be doing something wrong! (if you want more help you need to give more information, like the text of the error). Do you know, for sure, that there's a dataset called dataset? Or is that just a guess or random choice? How much of the h5py "getting started" documentation have you read (and understood)?

    – hpaulj
    Nov 24 '18 at 4:34













  • The error says "Unable to open object (object 'signal' doesn't exist)". I am sure that the dataset is there. I read most of the h5py doucmentation, and the code above works for other data.

    – kdf
    Nov 24 '18 at 5:08











  • Why didn't you include that information initially, rather than leaving me guessing as to how much you knew or had already done! With the little you added I'd suggest first ds = hf["dataset"] to verify that you can access the dataset. Then start displaying some properties - shape, dtype, etc.. And as per the documentation, x = ds[:] is the preferred syntax for loading. But I suspect there's something unusual about this dataset that prevents loading. If you don't know anything about it, you may have to use a dump script to learn more.

    – hpaulj
    Nov 24 '18 at 5:25














0












0








0








When I try to import a folder with h5py, I am able to open. However, when I try to access its datasets, it says there is an error. Is there a reason why?



The code below is used to import the folder:



hf = h5py.File('filename', 'r')


However, when I use the code below, there is an error:



x = np.array(hf["dataset"]) 









share|improve this question














When I try to import a folder with h5py, I am able to open. However, when I try to access its datasets, it says there is an error. Is there a reason why?



The code below is used to import the folder:



hf = h5py.File('filename', 'r')


However, when I use the code below, there is an error:



x = np.array(hf["dataset"]) 






h5py hdf






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 '18 at 4:21









kdfkdf

61




61













  • You must be doing something wrong! (if you want more help you need to give more information, like the text of the error). Do you know, for sure, that there's a dataset called dataset? Or is that just a guess or random choice? How much of the h5py "getting started" documentation have you read (and understood)?

    – hpaulj
    Nov 24 '18 at 4:34













  • The error says "Unable to open object (object 'signal' doesn't exist)". I am sure that the dataset is there. I read most of the h5py doucmentation, and the code above works for other data.

    – kdf
    Nov 24 '18 at 5:08











  • Why didn't you include that information initially, rather than leaving me guessing as to how much you knew or had already done! With the little you added I'd suggest first ds = hf["dataset"] to verify that you can access the dataset. Then start displaying some properties - shape, dtype, etc.. And as per the documentation, x = ds[:] is the preferred syntax for loading. But I suspect there's something unusual about this dataset that prevents loading. If you don't know anything about it, you may have to use a dump script to learn more.

    – hpaulj
    Nov 24 '18 at 5:25



















  • You must be doing something wrong! (if you want more help you need to give more information, like the text of the error). Do you know, for sure, that there's a dataset called dataset? Or is that just a guess or random choice? How much of the h5py "getting started" documentation have you read (and understood)?

    – hpaulj
    Nov 24 '18 at 4:34













  • The error says "Unable to open object (object 'signal' doesn't exist)". I am sure that the dataset is there. I read most of the h5py doucmentation, and the code above works for other data.

    – kdf
    Nov 24 '18 at 5:08











  • Why didn't you include that information initially, rather than leaving me guessing as to how much you knew or had already done! With the little you added I'd suggest first ds = hf["dataset"] to verify that you can access the dataset. Then start displaying some properties - shape, dtype, etc.. And as per the documentation, x = ds[:] is the preferred syntax for loading. But I suspect there's something unusual about this dataset that prevents loading. If you don't know anything about it, you may have to use a dump script to learn more.

    – hpaulj
    Nov 24 '18 at 5:25

















You must be doing something wrong! (if you want more help you need to give more information, like the text of the error). Do you know, for sure, that there's a dataset called dataset? Or is that just a guess or random choice? How much of the h5py "getting started" documentation have you read (and understood)?

– hpaulj
Nov 24 '18 at 4:34







You must be doing something wrong! (if you want more help you need to give more information, like the text of the error). Do you know, for sure, that there's a dataset called dataset? Or is that just a guess or random choice? How much of the h5py "getting started" documentation have you read (and understood)?

– hpaulj
Nov 24 '18 at 4:34















The error says "Unable to open object (object 'signal' doesn't exist)". I am sure that the dataset is there. I read most of the h5py doucmentation, and the code above works for other data.

– kdf
Nov 24 '18 at 5:08





The error says "Unable to open object (object 'signal' doesn't exist)". I am sure that the dataset is there. I read most of the h5py doucmentation, and the code above works for other data.

– kdf
Nov 24 '18 at 5:08













Why didn't you include that information initially, rather than leaving me guessing as to how much you knew or had already done! With the little you added I'd suggest first ds = hf["dataset"] to verify that you can access the dataset. Then start displaying some properties - shape, dtype, etc.. And as per the documentation, x = ds[:] is the preferred syntax for loading. But I suspect there's something unusual about this dataset that prevents loading. If you don't know anything about it, you may have to use a dump script to learn more.

– hpaulj
Nov 24 '18 at 5:25





Why didn't you include that information initially, rather than leaving me guessing as to how much you knew or had already done! With the little you added I'd suggest first ds = hf["dataset"] to verify that you can access the dataset. Then start displaying some properties - shape, dtype, etc.. And as per the documentation, x = ds[:] is the preferred syntax for loading. But I suspect there's something unusual about this dataset that prevents loading. If you don't know anything about it, you may have to use a dump script to learn more.

– hpaulj
Nov 24 '18 at 5:25












1 Answer
1






active

oldest

votes


















0














I think you have a small syntax error. Try this (w/out np.array):



x = hf['/dataset']


I don't think you need the leading '/' to define root level, but it's good practice to include (IMHO).



If that doesn't work, it's time to double check your HDF5 contents. As hpaulj asked, are you sure dataset is at the root level? Maybe there's an intermediate group? If so, you need to define the full path to the object:



dset_table = hf['/topgroup/dataset']


I suggest you use HDFView to examine your file, or run the h5dump utility. Both are available at the HDF Group Download site. That eliminates coding questions. You can also check group names with the following:



list(hf.keys())


You should get something like this (if dataset really is at the root level):



['dataset']


Finally, you can use.get() to get the class of the object.



get(name, default=None, getclass=False, getlink=False)


Set getclass=True to get the Object class: Group or Dataset.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455114%2funable-to-open-a-dataset-in-h5py%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I think you have a small syntax error. Try this (w/out np.array):



    x = hf['/dataset']


    I don't think you need the leading '/' to define root level, but it's good practice to include (IMHO).



    If that doesn't work, it's time to double check your HDF5 contents. As hpaulj asked, are you sure dataset is at the root level? Maybe there's an intermediate group? If so, you need to define the full path to the object:



    dset_table = hf['/topgroup/dataset']


    I suggest you use HDFView to examine your file, or run the h5dump utility. Both are available at the HDF Group Download site. That eliminates coding questions. You can also check group names with the following:



    list(hf.keys())


    You should get something like this (if dataset really is at the root level):



    ['dataset']


    Finally, you can use.get() to get the class of the object.



    get(name, default=None, getclass=False, getlink=False)


    Set getclass=True to get the Object class: Group or Dataset.






    share|improve this answer




























      0














      I think you have a small syntax error. Try this (w/out np.array):



      x = hf['/dataset']


      I don't think you need the leading '/' to define root level, but it's good practice to include (IMHO).



      If that doesn't work, it's time to double check your HDF5 contents. As hpaulj asked, are you sure dataset is at the root level? Maybe there's an intermediate group? If so, you need to define the full path to the object:



      dset_table = hf['/topgroup/dataset']


      I suggest you use HDFView to examine your file, or run the h5dump utility. Both are available at the HDF Group Download site. That eliminates coding questions. You can also check group names with the following:



      list(hf.keys())


      You should get something like this (if dataset really is at the root level):



      ['dataset']


      Finally, you can use.get() to get the class of the object.



      get(name, default=None, getclass=False, getlink=False)


      Set getclass=True to get the Object class: Group or Dataset.






      share|improve this answer


























        0












        0








        0







        I think you have a small syntax error. Try this (w/out np.array):



        x = hf['/dataset']


        I don't think you need the leading '/' to define root level, but it's good practice to include (IMHO).



        If that doesn't work, it's time to double check your HDF5 contents. As hpaulj asked, are you sure dataset is at the root level? Maybe there's an intermediate group? If so, you need to define the full path to the object:



        dset_table = hf['/topgroup/dataset']


        I suggest you use HDFView to examine your file, or run the h5dump utility. Both are available at the HDF Group Download site. That eliminates coding questions. You can also check group names with the following:



        list(hf.keys())


        You should get something like this (if dataset really is at the root level):



        ['dataset']


        Finally, you can use.get() to get the class of the object.



        get(name, default=None, getclass=False, getlink=False)


        Set getclass=True to get the Object class: Group or Dataset.






        share|improve this answer













        I think you have a small syntax error. Try this (w/out np.array):



        x = hf['/dataset']


        I don't think you need the leading '/' to define root level, but it's good practice to include (IMHO).



        If that doesn't work, it's time to double check your HDF5 contents. As hpaulj asked, are you sure dataset is at the root level? Maybe there's an intermediate group? If so, you need to define the full path to the object:



        dset_table = hf['/topgroup/dataset']


        I suggest you use HDFView to examine your file, or run the h5dump utility. Both are available at the HDF Group Download site. That eliminates coding questions. You can also check group names with the following:



        list(hf.keys())


        You should get something like this (if dataset really is at the root level):



        ['dataset']


        Finally, you can use.get() to get the class of the object.



        get(name, default=None, getclass=False, getlink=False)


        Set getclass=True to get the Object class: Group or Dataset.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 24 '18 at 15:54









        kcw78kcw78

        345210




        345210
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53455114%2funable-to-open-a-dataset-in-h5py%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            To store a contact into the json file from server.js file using a class in NodeJS

            Redirect URL with Chrome Remote Debugging Android Devices

            Dieringhausen