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

TOPIC:

Hyperslabs 9 years 1 month ago #29

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

I'd say you're jumping in the deep end of the pool with hyperslabs. With great power comes great... complication.

A few more words, perhaps. Dataspaces encompass two concepts: extent and selection. The extent is the dimensionality of the dataset and whether or not it can be extended and in which dimensions. The selection is the elements of the dataspace selected for an operation, typically a transfer from memory to disk or vice versa. A dataspace's extent is always hyperrectangular. That is, its extent can be expressed as (N) or (N x M) or (N x M x P), etc. The selection of the dataspace may be much more complicated, either via point selections or hyperslabs. Two dataspaces are always necessary for any HDF5 read or write, the file dataspace, representing the extent and selection of the dataset on the disk, and the memory dataspace, representing the extent and selection of the in-memory array that holds the data. The extent of your dataspaces must always match either the extent of your dataset on disk (for file dataspaces) or the extent of the memory block which you are reading into/writing from (memory dataspaces). You may transfer between dataspaces that have different extents--as you are trying to do in both of the examples you discuss--so long as the number of selected elements in the source and target dataspaces match.

Of course, many of the high-level functions hide the dataspaces from you because they make assumptions about what you are doing and can create appropriate dataspaces automagically.

Anyway, good luck.

Jason

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

Hyperslabs 9 years 1 month ago #28

  • dave2000x
  • dave2000x's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thank you received: 0
Thanks Jason,

Looks like using HDF5 files is going to be a lot more involved than I was anticipating. I will just have to persevere.

Kind regards,

Dave

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

Hyperslabs 9 years 1 month ago #27

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

Attached please find my example saved for LabVIEW 2011.

The problem with your VI is that your File Dataspace in your second read doesn't match the actual dataspace of the dataset. You are confusing the dataset dimensionality with the selection size. The dataspace should be a 1M element 1D dataspace with only the requisite elements selected. You could (and in this case probably should) use the H5Dget_space function to get the dataspace of the dataset on disk, and then use hyperslab functions (or others) on that dataspace to select the elements of interest.

Jason


File Attachment:

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

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

Hyperslabs 9 years 1 month ago #26

  • dave2000x
  • dave2000x's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thank you received: 0
Hi again,

Sadly I was wrong. It still doesn't work but now for a different reason. If one selects a simple data-space which does not start at an offset of zero and a length very close to the length of the complete dataset, it returns scrambled data or it crashes LabVIEW when you try to call the H5Dread.vi.

Is this perhaps because I am using 64bit LabVIEW?

Do you have a working example of the use of the simple dataset vi's for reading part of a dataset? (Can you save it for LabVIEW 2013?)

I will try to add a link to an example I have made which demonstrates the behavior I cannot understand. If you can help me work out why this doesn't work it will be very helpful to me. As you will see in the vi, the offset term does not have the behavior I expected.

Thank you for your time and help, it is very appreciated,

Dave

Drive link to example file

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

Hyperslabs 9 years 1 month ago #25

  • dave2000x
  • dave2000x's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thank you received: 0
Aha - got it! It is too simple to use a hyperslab for. I need to use a simple dataspace instead.

Well that seems to be working now.

Phew,

Dave

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

Hyperslabs 9 years 1 month ago #23

  • dave2000x
  • dave2000x's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 5
  • Thank you received: 0
Thanks for that,

I will check it out on Monday - I haven't actually upgraded from 2013 to 2014 yet and the disks for that are back in my office.

I've tried reading the manual links you sent (I'd been there before posting on here), but they are written for someone much more intelligent than me. They seem to eschew simple examples to go for very complex ones and they give the examples in C or Fortran neither of which I can understand well enough to follow, sadly. I suspect that the most common things people will want to do is cut out a single index or contiguous section from a 1D array, or access a single cell, column, row or rectangular section from a 2D array. For some reason, examples of these simple calls are not well discussed in the HDF5 files.

I have tried the suggestions from your previous post - setting the dataspace, specifying the array size and disconnecting the memory space connector but to no avail. Can you look at the attached and see if I am making some glaring error? I must be doing something stupid.

Kind regards and thanks for your help,

Dave





image link

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

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