Copyrighrt (c) 2014-2020 UPVI, LLC
Welcome, Guest
Username: Password: Remember me
LVHDF5 Toolkit Forum
  • Page:
  • 1
  • 2

TOPIC:

Hyperslabs 5 years 11 months ago #22

  • jdsommer
  • jdsommer's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 23
  • Thank you received: 1
Hi Dave,

Glad you're finding the toolkit useful.

First of all, a complete discussion of hyperslabs and dataspaces in general is beyond the scope of what I want to tackle, and I'll refer you to the HDF5 documentation, particularly here and here .

That said, you are making the right selection with your start, count, block and stride to do what you want. If I had to guess, your problem lies one of two places: the selection operation, or the memory dataspace.

1) Selection Operation
The default operation in HDF5 Dataspaces.vi is H5S_SELECT_OR. This is probably unfortunate, because the dataspace is initially set to select all of the elements. Thus, ORing a new hyperslab accomplishes nothing. Use H5S_SELECT_SET for the first (or only) hyperslab that you select in your dataspace.

2) File vs. memory dataspace:
The HDF5 Dataspaces example uses the same dataspace for both file and memory. This may not be what you want. This has the meaning that the function will expect the array in the dataset to be the same dimension as the array in memory into which the data is read. If you had the dataset [0,1 ... 9] and you wanted to your selection ( Hslab(2, 5, 1, 1)  ) into an array just long enough to hold these data, you would need to use different dataspaces for file and memory. The dataset for file would be the hyperslab selection, but the dataset for memory would select all the elements in a dataspace of dimension [5].

One way to accomplish this is to initialize the array feed into the H5Dread node to the appropriate size and leave the HDF5 Memory Dataspace input unwired. It defaults to selecting a memory space that matches the input array, if it is present. You can use the Get Select Count (H5Sget_select_npoints) function to figure out how many points are selected out of the file dataspace.

I've attached a modifed version of HDF5 Dataspaces to this post that demostrates this.

As to your question about how to select a 10x10 out of 100x100 (or, any size dataspace>=10x10, really)

Start: N,M
Count: 10,10
Block: 1,1
Stride: 1,1

For extra credit, can anyone give me another hyperslab selection that will accomplish the same thing?

Jason

File Attachment:

File Name: HDF5Datasp...ead1D.vi
File Size:52 KB
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by jdsommer.

Hyperslabs 5 years 11 months ago #21

  • dave2000x
  • dave2000x's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thank you received: 0
Hi, really pleased to see this functionality available for LabVIEW as HDF5 is a format that 2 different sets of collaborators like. So, thank you for developing it.



I am having difficulty understanding how to use the definitions of the hyperslab function though. If you could provide a couple of examples showing this in operation would be very helpful. For example, how would I read a subset of data from a 1D dataset (say read from index 2 to 6 from the 1D dataset [0,1,2,3,4,5,6,7,8,9]) - what values should be put in Count, Start, Block and Stride. I naively thought Count=[5], Start=[2], Block=[1], Stride=[1] would do it, but I can't get this to work. Similarly, how would one cut out a 10x10 section from a 100x100 dataset? I can see from the <HDF Dataspaces.vi> example how to wire up the sub-vi's, just not what to put in the controls.
Thank you for your help.

Dave

Please Log in or Create an account to join the conversation.

Last edit: by dave2000x.
  • Page:
  • 1
  • 2
Time to create page: 0.153 seconds