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

Added subdirectory to particlesPath as per standard. #971

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

DavidSagan
Copy link
Member

Added subdirectory to particlesPath as per standard.

@ChristopherMayes
Copy link
Contributor

This doesn't seem to make a valid file. In bmad-doc/tao_examples/optics_matching:

Tao> write beam -at end
[INFO] tao_write_cmd:
    Written: beam_1.hdf5

Tao> sp h5dump beam_1.hdf5 
h5dump error: unable to open file "beam_1.hdf5"

@ChristopherMayes
Copy link
Contributor

One line:

tao -init $ACC_ROOT_DIR/bmad-doc/tao_examples/optics_matching/tao.init -noplot -command "beamon;write beam -at end;sp h5dump beam_1.hdf5"

Tao: set global track_type = beam

Tao: write beam -at end
[ERROR | 2024-MAY-28 20:38:55] hdf5_open_file:
    CANNOT CREATE FILE FOR WRITING: beam_1.hdf5
[INFO] tao_write_cmd:
    Written: beam_1.hdf5

Tao: sp h5dump beam_1.hdf5
h5dump error: unable to open file "beam_1.hdf5"

@DavidSagan
Copy link
Member Author

@ChristopherMayes I'm not seeing these problems.

@ChristopherMayes
Copy link
Contributor

Okay, I must have made a mistake. But @DavidSagan could you put in a better description here about what the change is?

@ChristopherMayes
Copy link
Contributor

I tried openpmd-validator on this, and it gives:

openPMD_check_h5 -i beam_1.hdf5
Error: Attribute openPMDextension in `/` is not of type 'uint32' (is 'bytes_')!
Error: Attribute iterationEncoding (required) does NOT exist in `/`!
Error: Attribute iterationFormat (required) does NOT exist in `/`!
Warning: Attribute author (recommended) does NOT exist in `/`!
Error: Attribute date in `/` does not satisfy format ('2024-05-29 09:08:46' should be in format '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} [\+|-][0-9]{4}$')!
Traceback (most recent call last):
  File "/Users/chrisonian/Code/mambaforge/envs/devel/bin/openPMD_check_h5", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/chrisonian/Code/mambaforge/envs/devel/lib/python3.12/site-packages/openpmd_validator/check_h5.py", line 931, in main
    result_array = check_file(file_name, verbose, force_extension_pic)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chrisonian/Code/mambaforge/envs/devel/lib/python3.12/site-packages/openpmd_validator/check_h5.py", line 917, in check_file
    extensionStates = get_extensions(f, verbose)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chrisonian/Code/mambaforge/envs/devel/lib/python3.12/site-packages/openpmd_validator/check_h5.py", line 116, in get_extensions
    if (bitmask & extensionIDs) == bitmask:
        ~~~~~~~~^~~~~~~~~~~~~~
TypeError: ufunc 'bitwise_and' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

@DavidSagan
Copy link
Member Author

DavidSagan commented May 29, 2024

Stuff like iterationEncoding should not be required. @ChristopherMayes See openPMD/openPMD-standard#232

@DavidSagan
Copy link
Member Author

The change is: using axisLabels to determine storage order instead of gridDataOrder.

@DavidSagan
Copy link
Member Author

And I fixed the date problem.

@ChristopherMayes
Copy link
Contributor

Now I see:

openPMD_check_h5 -i beam_1.hdf5
Error: Attribute openPMDextension in `/` is not of type 'uint32' (is 'bytes_')!
Error: Attribute iterationEncoding (required) does NOT exist in `/`!
Error: Attribute iterationFormat (required) does NOT exist in `/`!
Warning: Attribute author (recommended) does NOT exist in `/`!
Traceback (most recent call last):
  File "/Users/chrisonian/Code/mambaforge/envs/devel/bin/openPMD_check_h5", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/chrisonian/Code/mambaforge/envs/devel/lib/python3.12/site-packages/openpmd_validator/check_h5.py", line 931, in main
    result_array = check_file(file_name, verbose, force_extension_pic)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chrisonian/Code/mambaforge/envs/devel/lib/python3.12/site-packages/openpmd_validator/check_h5.py", line 917, in check_file
    extensionStates = get_extensions(f, verbose)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/chrisonian/Code/mambaforge/envs/devel/lib/python3.12/site-packages/openpmd_validator/check_h5.py", line 116, in get_extensions
    if (bitmask & extensionIDs) == bitmask:
        ~~~~~~~~^~~~~~~~~~~~~~
TypeError: ufunc 'bitwise_and' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

@ChristopherMayes
Copy link
Contributor

Example file with this new code:
beam_1.hdf5.zip

@ChristopherMayes
Copy link
Contributor

The change is: using axisLabels to determine storage order instead of gridDataOrder.

Well it looks like you are adding species in the paths as well.

@DavidSagan
Copy link
Member Author

@ChristopherMayes I moved axisLabels one level higher as discussed. Be aware that the "old" field grid files also have an axisLabels attribute in the same spot but the order with the old files does not reflect the storage order. So you need to check to see if gridDataOrder exists and, if so, use that.

@ChristopherMayes
Copy link
Contributor

I have corresponding changes in ChristopherMayes/openPMD-beamphysics#60.

@DavidSagan
Copy link
Member Author

I will merge when you give the OK.

@ChristopherMayes
Copy link
Contributor

I'd like the openPMD-validator [(version: 2.0.0) to pass with these new files. https://github.com/openPMD/openPMD-validator/tree/2.0.X

Currently is gives:

openPMD_check_h5 -i beam_1.hdf5 
Error: Attribute iterationEncoding (required) does NOT exist in `/`!
Error: Attribute iterationFormat (required) does NOT exist in `/`!
Warning: Attribute author (recommended) does NOT exist in `/`!
Error: Attribute date in `/` does not satisfy format ('2023-07-20 15:54:07' should be in format '^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} [\+|-][0-9]{4}$')!
Found 1 iteration(s)
Error: Attribute time (required) does NOT exist in `/data/00001`!
Error: Attribute dt (required) does NOT exist in `/data/00001`!
Warning: Attribute timeUnitSI (recommended) does NOT exist in `/data/00001`!
Result: 5 Errors and 2 Warnings.

This is related to openPMD/openPMD-standard#232.

@ax3l
Copy link

ax3l commented Jul 31, 2024

Hi @DavidSagan @ChristopherMayes, can you attach here in a comment the new file (as zip) so I can check it with the validator as I update it?

@DavidSagan
Copy link
Member Author

@ChristopherMayes You have a file to post on hand. Yes?

@ChristopherMayes
Copy link
Contributor

Here is an example: particles_from_bmad_pr971.h5.zip

@ChristopherMayes
Copy link
Contributor

@ax3l does that work for you?

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.

3 participants