Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

h5math apparent error #13

Closed
JohnWeiner opened this issue May 15, 2020 · 4 comments
Closed

h5math apparent error #13

JohnWeiner opened this issue May 15, 2020 · 4 comments

Comments

@JohnWeiner
Copy link

I am using pymeep installed with conda from the conda-forge channel less than a month ago, running on MacOS 10.15.4 (Catalina). The pymeep script runs a meep simulation that produces two h5 files, using the built-in field output functions and at_append for time slices. There is one data set (1000 x 1000 x80) in each h5 file. Assume the names of the files are f1.h5, f2.h5. The utility h5ls appears to work correctly for each file, and h5topng works correctly for each file. But I find a problem with h5math. I have libmatheval installed and the command

h5math -ve 'd1 +d1' out.h5 f1.h5 f2.h5

produces a correct out.h5 file (1000 x 1000 x 80) that can be converted to png files with h5topng. BUT the subtracting expression 'd1 - d2' produces an out.h5 (1000 x 1000 x 80) filled with zeros. The datasets in f1.h5 and f2.h5 are not equal. The command that I use is,

h5math -ve 'd1 - d1' out.h5 f1.h5 f2.h5

I would appreciate some helpful comments or hints as to what might be problem.

John Weiner

@stevengj
Copy link
Collaborator

You want h5math -ve 'd1 - d2' out.h5 f1.h5 f2.h5, I think?

@JohnWeiner
Copy link
Author

YES! The irony is that I started with that syntax about 137 attempts ago and convinced myself that it should be d1 in BOTH files because dn refers to the number n of the data set in EACH file. So I was sure that d1 - d2, while superficially plausible, could not possibly be correct! Suppose you had one data set in f1.h5 and two data sets in f2.h5 AND you wanted to take the difference between the data set in f1.h5 and the second data set in f2.h5. Would the expression be 'd1 - d3'?

@JohnWeiner
Copy link
Author

Wouldn't it be better to use dmn where m Is the sequential (left to right) numbering of the h5 file and n is the numbering of the data set within the mth h5 file? If such were the case, then multiple h5 files and multilple data sets within those files could be used in math expressions without confusion.

@stevengj
Copy link
Collaborator

If you have multiple datasets per file, you specify the files as filename.h5:dataset to indicate which dataset you want. (You can list the same file multiple times with different datasets.)

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

No branches or pull requests

2 participants