I downloaded an astronomical data file called sources.h5
from this webpage. I am trying to access it to no avail. What I achieved doing is:
source_cat = h5py.File('sources.h5', 'r')
print(source_cat.keys())
>>> <KeysViewHDF5 ['_types', 'sources']>
print(source_cat['sources']
>>> <HDF5 dataset "sources": shape (), type "|V136">
data = source_cat['sources'][()]
print(data)
>>> (<HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, <HDF5 object reference>, 230355498, 51400878)
But if I do
print(source_cat['sources'][:10])
I get the error message ValueError: Illegal slicing argument for scalar dataspace
Do you have any ideas how I can get to the data inside the file? And not only for the sources
, but also _types
key? Further, if you can share a program/code that would show me the three of the h5 file – this would be also very helpful! Tnx