-
Notifications
You must be signed in to change notification settings - Fork 218
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
add method to radiation python module to load distributed amplitudes #4752
add method to radiation python module to load distributed amplitudes #4752
Conversation
Code has been tested. |
for i, direction in enumerate(["x", "y", "z"]): | ||
tmp = h_distAmp[direction][:, :, :] | ||
self.rad_series.flush() | ||
distAmp[:, :, :, i] = tmp |
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.
distAmp[:, :, :, i]
is a non-contiguous memory slice, right? If not, you could load directly into that buffer, but otherwise the current implementation with an intermediate load buffer is fine.
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.
Good point. As a physicist I would prefer keeping the polarization as my last component - but this is simply due to common convention. I agree with you that directly writing into a chunk of continuous memory would be more elegant and also easier to read.
I will change the memory layout according to your suggestion.
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.
I think that it's okay to have a different memory layout than on the disk. I just wanted to confirm that I interpreted this correctly; probably a short comment is all that's needed here.
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.
Okay - then I will just a comment. Thanks for the feeback @franzpoeschel.
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.
You could, of course, use fancy numpy methods to do so, e.g., create your array such that you can load contiguously and afterwards do a np.moveaxis()
or .transpose()
or the like.
4f702f7
to
4d15fc8
Compare
ping @PrometheusPi |
@PrometheusPi please rebase against dev branch because pre commits has changed and check now python code too |
Steering things up... |
@PrometheusPi is this PR still of interest? |
Yes, I will update it now |
4d15fc8
to
07cdac3
Compare
I will not be able to work on this PR until #5105 is merged. |
e26dcc1
to
7dc8d12
Compare
@steindev @psychocoderHPC @ikbuibui ready for review |
# get shape of distributed amplitude | ||
shapeDistAmp = h_distAmp["x"].shape | ||
# add 3 vector components | ||
shapeDistAmp.append(3) |
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.
What's the magic number 3
? Maybe a named constant would be nice.
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.
3 is for the 3 spacial dimensions
Since there is no const uint
in python, I personally favor using literals instead.
What would you prefer here to make clear that is a never changing value?
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.
@chillenzer I used a class variable to make the global scope of that 3 clear. Is this in agreement with what you wanted?
I am fine with the changes. Would you please squash (and rebase, if necessary)? I guess @chillenzer's comment is resolved as well. Then I will merge. |
967ef18
to
d942c0f
Compare
@steindev squashed to 2 commites |
This pull request adds a new method to the radiation plugin python module to load all distributed radiation amplitudes if available.