ladisk / pyuff

This module defines an UFF class to manipulate with the UFF (Universal File Format) files.
Other
58 stars 40 forks source link

Added support for function 9 in dataset 58 #72

Closed BruckmosHM closed 1 year ago

BruckmosHM commented 1 year ago

Heyho,

I had some time today and created a little fix to support function 9 in dataset 58.

My "fix" is really raw, as you can see. I only added function 9 in the array of supported functions. As I need to work with a 3rd party software, I also had to change the formatting of the data. I don't know if thats defined in a standard somewhere, or if the 3rd party app is just not that good.

There are still some open issues:

And it's related to this issue. At the moment, this is all I need in order to complete my task and therefore I won't be doing any more changes. Thanks for the great module!

Cheers, Jakob

jankoslavic commented 1 year ago

Dear @BruckmosHM I needed some time to get back to you. I have checked the details. Adding function_type 9 here: https://github.com/ladisk/pyuff/pull/72/commits/0b565bb7f652195601ecaf15f6828a25aa28e6fd#diff-91c69484961f2b902369f9cc92cf1d8b8d76a06111eb1e27b1535b6cd3552b2fR12

should be enough. pyUFF always writes data in double precision. The reason for this is that single precision is really bad accuracy and programs should not be using it. Therefore if you read a uff with pyUff and it is ord_data_type==5 (single) it will be written back as ord_data_type==6 (double).

Do you have a problem with this? Does your program properly handle double precision?

Units are a separate problem (original format only supports ASCII, but the square is unicode character; I will handle this after we clear the ord_data_type issue)

ttys, Janko

BruckmosHM commented 1 year ago

Dear @jankoslavic ,

thanks for the feedback. I'm not 100% sure, if the program can handle double precision. I just noticed, that I had to change the formatting in order for the program to be able to read the data. Therefore I assume, that the program unfortunately can't handle double precision..

cheers, Jakob

jankoslavic commented 1 year ago

Single precision in 2023 is really bad! How important is it to read back the data for you? A possible solution could be to force it via an argument to write it back to single. However, I would never use single precision.

BruckmosHM commented 1 year ago

Quite important, as the program has a lot of features for data analysis, which I would have to write myself.. I get your point that double precision shouldn't be used, but I don't really have the option to use double precision..

jankoslavic commented 1 year ago

Dear @BruckmosHM Please checkout the branch https://github.com/ladisk/pyuff/tree/force_double if you use .write_sets(a, 'add', force_double=False) it will save data in single if the dataset is defined as single

How does this sound to you?

BruckmosHM commented 1 year ago

Dear @jankoslavic , Oh yes, this works! Nice. Next would be the units..If this can't be easily handled in your repository, I can change it afterwards quite easily. Thanks so much for your help.

jankoslavic commented 1 year ago

Ok, thank you for the feedback. With this I will close this PR and make a PR on the above branch. Units are tricky... I already tried... but not a simple and clear solution for now. Thank you.