Skip to content

Data type reading in .npy files#14

Merged
Algiane merged 3 commits intoMmgTools:developfrom
corentin-prigent:feature/readDataType
Feb 29, 2024
Merged

Data type reading in .npy files#14
Algiane merged 3 commits intoMmgTools:developfrom
corentin-prigent:feature/readDataType

Conversation

@corentin-prigent
Copy link
Copy Markdown

This update allows hex2tet to read the data size contained in the file, in order to read data properly.

Copy link
Copy Markdown
Member

@Algiane Algiane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix.

  • I think that we need to improve the readibility before merging this : I propose to define macros at file begining to allow the user to easily understand the meaning of the hex code and to add at least comments on what is readed in the header.

  • Is it possible to add 2 minimal .npy files with different data sizes to illustrate this PR (so we can easily see that the develop branch fails to read a file with a wrong data size).

Comment thread src/inout.c Outdated
Comment thread src/inout.c Outdated
Comment thread src/inout.c Outdated
Comment thread src/inout.c Outdated
…odified reading method for data type in header
@corentin-prigent
Copy link
Copy Markdown
Author

corentin-prigent commented Feb 27, 2024

  • Several macros have been defined and some comments have been added in order to increase the readability of the reading process for .npy files.
  • Reading process for data size has been modified in order to make it more portable and more general. We now look for the ket "descr" in header dictionnary to locate data size specifications.
  • Several files are linked with this message: they illustrate the need for proper data specification. example-i2.npy and example-u4.npy are two .npy files containing a 4x4x4 array of numbers ranging from 1 to 64, one encoded in 2-byte signed integers and the other in 4-byte unsigned integers. example-i2-devel.mesh and example-u4-devel.mesh are the outputs with the current develop branch. In example-i2-devel.mesh, it can be seen that reference values are wrong, while they are correct in example-u4-devel.mesh. example-i2-fix.mesh and example-u4-fix.mesh are the output files with the proposed fix. The two files are identical and correct.
    example.tar.gz

@Algiane
Copy link
Copy Markdown
Member

Algiane commented Feb 29, 2024

Perfect, thanks!

@Algiane Algiane merged commit c4e63cb into MmgTools:develop Feb 29, 2024
@corentin-prigent corentin-prigent deleted the feature/readDataType branch March 5, 2024 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants