Skip to content

New Extension: BeamPhysics - #183

Merged
ax3l merged 72 commits into
openPMD:upcoming-2.0.0from
DavidSagan:EXT_BeamPhysics
Oct 23, 2020
Merged

ax3l merged 72 commits into
openPMD:upcoming-2.0.0from
DavidSagan:EXT_BeamPhysics

Conversation

@DavidSagan

@DavidSagan DavidSagan commented Feb 20, 2018 •

Copy link
Copy Markdown
Collaborator

This is the new proposed Beam Physics extension for describing particle beams in accelerators, storage rings, etc.

CC @ChristopherMayes

@ax3l ax3l added the EXT: BeamPhysics proposed accelerator phsyics extension label Feb 20, 2018
@ax3l
ax3l requested review from RemiLehe, ax3l and jlvay February 20, 2018 09:25
@ax3l ax3l added this to the openPMD 2.X milestone Feb 20, 2018
@ax3l ax3l added major change non-backwards compatible change minor change backwards-compatible change and removed major change non-backwards compatible change labels Feb 20, 2018
@ax3l ax3l changed the title New BeamPhysics Extension New Extension: BeamPhysics Feb 20, 2018
@ax3l
ax3l requested a review from marcguetg February 20, 2018 16:58
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
@RemiLehe

Copy link
Copy Markdown
Member

@DavidSagan Thanks for your answers!
For the points on which we both agreed: could you update your pull request? To do so, you can simply create more commits on the same branch, and push them to this repository ; the pull request will update automatically.

@DavidSagan

Copy link
Copy Markdown
Collaborator Author

@RemiLehe

For the points on which we both agreed: could you update your pull request? To do so, you can simply create more commits on the same branch, and push them to this repository ; the pull request will update automatically.

Will Do.

@DavidSagan

DavidSagan commented Feb 26, 2018 •

Copy link
Copy Markdown
Collaborator Author

@RemiLehe @ChristopherMayes @ax3l @marcguetg

OK I pushed a new version based upon the discussion. Much thanks for the comments.

@marcguetg marcguetg left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I really like the way it is now. One small comment though:

  • I would make the presence of either charge/totalCharge 'Required' as this would allow processing of most data even if 'SpeciesType' is not implemented.

@DavidSagan

Copy link
Copy Markdown
Collaborator Author

@marcguetg

even if 'SpeciesType' is not implemented

I'm not understanding this. The plan is to have the species type extension become official in the 2.0.0 standard along with the Beam Physics standard.

@marcguetg

Copy link
Copy Markdown

@DavidSagan

I understand, I'm just saying this duplication of information would allow a user to implement a 'light version' which is still according to specs. I agree it would be small use case, as most would use the official bindings, but still something that might be worth considering.

Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
@DavidSagan

Copy link
Copy Markdown
Collaborator Author

New revision with minor typo fixes. One thing that needs to be done is reorganization of the Definitions section in conjunction with implementing Definitions section in the base standard #187.

@DavidSagan DavidSagan closed this Apr 9, 2018
@DavidSagan

Copy link
Copy Markdown
Collaborator Author

Sorry hit the close button by mistake.

@DavidSagan DavidSagan reopened this Apr 9, 2018

@ax3l ax3l left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Added a few more inline notes on consistent style and markdown.

Just for consistency with existing extensions (e.g. ED-PIC please keep spellings similar. Examples:

  • lowercase type:, description:, example: ... in keywords
  • scope: for required/optional

Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
@DavidSagan

Copy link
Copy Markdown
Collaborator Author

Note: There is a conflict with position and positionOffset in the base standard (#182) which must be rectified.

@ax3l

ax3l commented Apr 24, 2018

Copy link
Copy Markdown
Member

@DavidSagan but you only use position and not positionOffset in this extension. Anyway, we can discuss this in an hour in detail :)

Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Outdated

- `fileType`
- Type: Optional *(string)*
- Description: The type of data being stored in the file. If present, must be set to `openPMD`. This attribute is used in systems where different data files can contain different types of data and allows for quick identification of the what type of data is in a given file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe I missed it, but isn't this already possible to be quickly identified with the base standard identifier, attribute openPMD in /?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

But a non-openPMD file will not have the openPMD attribute.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am confused how this is useful for files that use openPMD and the openPMD extension :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is useful for readers that can read a variety of data types including openPMD.

Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md Resolved

@ax3l ax3l left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This already looks very good to me. 🚀 ✨

@DavidSagan please just address the introduction section comments to unify the style with the other extension.
Then, please squash your commits into one:

git fetch --all
git rebase -i origin/upcoming-2.0.0
# change all but the first commit to "squash" instead of "pick"
git push -f

@ChristopherMayes and @RemiLehe can you give this your blessing already? :) Comments, wishes?

Comment thread EXT_BeamPhysics.md Resolved
Comment thread EXT_BeamPhysics.md

The `BeamPhysics` extension to the openPMD standard is meant for describing particles and fields commonly encountered in accelerator physics simulations.

How to Use this Extension

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We potentially do not need this paragraph on technical usage ("how specify the attribute") since the base standard explains this already.

Instead, we can write an introduction here and the requirement to co-use the extension with SpeciesType.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@ax3l I'm not exactly sure what you are thinking about here. Could you write a proposed change?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No problem, can you squash all commits first please?

Comment thread EXT_BeamPhysics.md Outdated

where `Z` is the complex field, `f` is the Oscillation frequency, `t` is the time, and `t0` is a reference time.

Software that writes complex data must use native complex storage for formats that support complex numbers. For formats that do not have native complex support (for example, HDF5), complex numbers are to be stored using subgroups labeled `r` and `i` for real and imaginary respectively.

@ax3l ax3l Dec 17, 2019 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would change this to:

Suggested change
Software that writes complex data must use native complex storage for formats that support complex numbers. For formats that do not have native complex support (for example, HDF5), complex numbers are to be stored using subgroups labeled `r` and `i` for real and imaginary respectively.
Software that writes complex data must use native complex storage for formats that support complex numbers.
For formats that do not have native complex support (for example, HDF5), complex numbers are to be stored using value pairs for real and imaginary component and shall follow the `h5py` convention for annotations.

Example code:

import h5py as h5                                                                                
import numpy as np                                                                               

x = np.array([1.+2j, 3.+4j, 5.+6j], np.cdouble)                                                  
x                                                                                                
# array([1.+2.j, 3.+4.j, 5.+6.j])
x.dtype                                                                                          
# dtype('complex128')
f = h5.File('complex.h5', 'w')                                                                   
f['/mydata'] = x                                                                                 
f.close()

Creates:

$ h5ls -d -r complex.h5 
/                        Group
/mydata                  Dataset {3}
    Data:
        (0) {1, 2}, {3, 4}, {5, 6}

$ h5dump complex.h5
HDF5 "complex.h5" {
GROUP "/" {
   DATASET "mydata" {
      DATATYPE  H5T_COMPOUND {
         H5T_IEEE_F64LE "r";
         H5T_IEEE_F64LE "i";
      }
      DATASPACE  SIMPLE { ( 3 ) / ( 3 ) }
      DATA {
      (0): {
            1,
            2
         },
      (1): {
            3,
            4
         },
      (2): {
            5,
            6
         }
      }
   }
}
}

I think this totally works well and corresponds to what I suggest here: #29 (comment)

@ax3l

ax3l commented Dec 21, 2019

Copy link
Copy Markdown
Member

Before we merge this:
Can you please provide an example file or file series that used this convention already? I would like to run it through the validator, viewer, and reference API implementations to see if the extension is fully compatible with the base standard.

Comment thread EXT_BeamPhysics.md Resolved
@ax3l

ax3l commented Apr 20, 2020

Copy link
Copy Markdown
Member

offline/zoom discussed: we don't need to squash and rebase, I will just squash & merge all PRs from now on :)

@ax3l ax3l left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The extension looks like it is in great shape. Thank you for the work on this and the contribution!

@ChristopherMayes @RemiLehe, if you confirm, I would target a merge today. Otherwise if you have further comments early next week. What do you think?

@ax3l ax3l self-assigned this Oct 16, 2020
@ax3l

ax3l commented Oct 16, 2020

Copy link
Copy Markdown
Member

@marcguetg just as a notification to you: we plan to merge the beam-physics extension

@ax3l
ax3l dismissed RemiLehe’s stale review October 22, 2020 00:32

Looks like all points have been addressed from this review. Please don't hesitate to note if something new slipped in, in which case we can open a follow-up PR.

@ax3l
ax3l merged commit 70d06c8 into openPMD:upcoming-2.0.0 Oct 23, 2020
@ax3l ax3l mentioned this pull request Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

EXT: BeamPhysics proposed accelerator phsyics extension minor change backwards-compatible change

Projects

Status: Implemented

Development

Successfully merging this pull request may close these issues.

5 participants