-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
WIP/ENH: wavefront class #68
base: master
Are you sure you want to change the base?
Conversation
These need some way to set:
These setters are needed for smart propagation (when you resize the grid as the beam grows) |
We also need a method to write the Genesis4 field data from Wavefront (and corresponding test) |
return self.metadata.mesh.grid_spacing | ||
|
||
@property | ||
def ranges(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChristopherMayes noted below
These need some way to set: Wavefront.ranges Wavefront._pad.pad
These setters are needed for smart propagation (when you resize the grid as the beam grows)
ranges
is not settable as it is calculated based on the grid spacing and the shape of rmesh
.
With the latest code I pushed, you can provide a new rmesh by way of:
new_wf = wf.with_rmesh(rmesh=expanded_version)
and the previous metadata will be retained. Padding can optionally be manually specified (or automatically adjusted based on scipy's suggested size)
pmd_beamphysics/wavefront.py
Outdated
# _z_min, z_max = self.ranges[sum_axis] | ||
# dz = self.grid_spacing[sum_axis] | ||
# dat = np.sum(dat, axis=sum_axis) * dz / (2.0 * z_max) | ||
img = ax.imshow(np.mean(dat, axis=sum_axis), cmap=cmap, extent=extent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sum_axis
implies a sum, but here np.mean
is called.
For power, it should probably be a sum. Others are questionable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a Wavefront class
Entirely based on code from @balticfish and many discussions with @ChristopherMayes
Remaining work
property
for.rspace
and.kspace
as their calculation can take a long time, and IPython auto-completion can automatically evaluate these when you don't want it to (double-check where this was coming from in Jedi; is it still an issue in 2024?)fs
->s
xyz
is desirable. Is there any benefit toz,x,y
? Benchmark some operations to verify?t
->m
(z=c*t
)propagate
todrift
plot("x", "z")
plot_spectrum()
(this is from G.S.; Chris will supply it)Ex
with openpmd, for example)