UCL / TDMS

Time Domain Maxwell Solver
https://github-pages.ucl.ac.uk/TDMS
GNU General Public License v3.0
12 stars 4 forks source link

Read complex values from `.mat` files via HDF5 C++ API #343

Closed willGraham01 closed 1 year ago

willGraham01 commented 1 year ago

Allows us to read complex MATLAB arrays via the HDF5 API.

To do this, we have to define (at runtime) a H5::CompType instance that describes the data-structure that needs to be read in - in this case, that describes the format in which MATLAB saves complex data. Note that there is no HDF5 standard for complex datatypes, so trying to read complex data from something like h5py- created files will require separate, but similar, treatment.

Implementation

The hdf5_compound_types.{h,cpp} file has been created to contain compound types.

Currently there is only one compound type, MATLAB_complex. But the following convention has been set given the remark above about compound datatypes and the lack of standard format for complex-values in particular:

Testing

Additional tests in test_hdf5_compound_types.cpp that check that:

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 63% and project coverage change: -1 :warning:

Comparison is base (e8e9809) 27% compared to head (221a033) 26%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #343 +/- ## =================================== - Coverage 27% 26% -1% =================================== Files 77 83 +6 Lines 3687 3687 =================================== - Hits 978 949 -29 - Misses 2709 2738 +29 ``` | [Impacted Files](https://app.codecov.io/gh/UCL/TDMS/pull/343?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL) | Coverage Δ | | |---|---|---| | [tdms/include/hdf5\_io/hdf5\_compound\_types.h](https://app.codecov.io/gh/UCL/TDMS/pull/343?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL2hkZjVfaW8vaGRmNV9jb21wb3VuZF90eXBlcy5o) | `0% <0%> (ø)` | | | [tdms/include/hdf5\_io/hdf5\_reader.h](https://app.codecov.io/gh/UCL/TDMS/pull/343?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9pbmNsdWRlL2hkZjVfaW8vaGRmNV9yZWFkZXIuaA==) | `0% <0%> (ø)` | | | [tdms/src/hdf5\_io/hdf5\_compound\_types.cpp](https://app.codecov.io/gh/UCL/TDMS/pull/343?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL#diff-dGRtcy9zcmMvaGRmNV9pby9oZGY1X2NvbXBvdW5kX3R5cGVzLmNwcA==) | `86% <86%> (ø)` | | ... and [20 files with indirect coverage changes](https://app.codecov.io/gh/UCL/TDMS/pull/343/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=UCL)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

samcunliffe commented 1 year ago

Nice!