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

Feature/sc linedensity interpolation #50

Merged

Conversation

aoeftiger
Copy link

@aoeftiger aoeftiger commented Jun 12, 2020

Adding a new space charge class with bunch profile interpolation (e.g. for double harmonics and anything else).

Up for discussion 😄

On another note, this patch introduces the new naming and refactoring of space charge classes discussed with @hannes-bartosik and @martinschwinzerl (cf. email 6.5.2020):

  • SpaceChargeCoasting attributes are adapted to SpaceChargeBunched with line_density replaced by number_of_particles and an additional circumference attribute; the track method has been adjusted correspondingly
  • SpaceChargeBunched becomes SpaceChargeQGaussianProfile and sports two new attributes (q and b factor for q-Gaussian which by default are 1.0 for the standard Gaussian) --> this class has yet to be extended to support q,b != 1

due to the renaming, the automated tests will have to be adapted, otherwise they throw:

==================================== ERRORS ====================================
_____________________ ERROR collecting tests/test_track.py _____________________
tests/test_track.py:23: in <module>
    pysixtrack.elements.SpaceChargeBunched,
E   AttributeError: module 'pysixtrack.elements' has no attribute 'SpaceChargeBunched'
=========================== short test summary info ============================
ERROR tests/test_track.py - AttributeError: module 'pysixtrack.elements' has ...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!

@aoeftiger
Copy link
Author

Here's a test for the new interpolating class:

test.zip

image

Testing_SC_interpolated.pdf

@aoeftiger
Copy link
Author

Just as a remark, I've added np.interp and np.linspace to pysixtrack.mathlibs.MathlibDefault for the moment -- suggestions for improvement are of course welcome.

It'd probably be nicer (for compute time) to avoid recomputing the bins for the interpolation at each track call, but I avoided touching the instantiation part (for precomputing and storing at __init__).

@aoeftiger aoeftiger force-pushed the feature/sc-linedensity-interpolation branch from e492a14 to 1e4875d Compare June 12, 2020 12:00
... SpaceChargeCoasting to new interface with number_of_particles
and circumference.
@aoeftiger
Copy link
Author

The latest commit should solve any test errors and also bring the examples in line.

Now that SpaceChargeCoasting and SpaceChargeQGaussianProfile (former SpaceChargeBunched) have more or less the same argument signature, I'd even opt for removing the double set-up with all functions in bttools existing for both classes (such as setup_spacecharge_bunched_in_line and setup_spacecharge_coasting_in_line)...

@aoeftiger
Copy link
Author

Updated with aoeftiger#2 .

Still needs to be adapted to the final layout and naming conventions (along with the still missing implementation of the q-Gaussian algorithm as in STL by @martinschwinzerl ) following the SixTrackLib counterpart SixTrack/sixtracklib#132 .

martinschwinzerl and others added 10 commits October 14, 2020 15:16
…lation' into feature/sc-linedensity-interpolation
Updating typo in y coordinate unit with shifted parenthesis
... which are passed on to the created Particles instance,
such that closed orbits w.r.t. to different mass and charge
can be found.
--> adding Roman's and Kosta's new features
... w.r.t. longitudinal parameter in functions
for setting up SC classes
... such that mass and charge can be changed to other
than proton default.
@aoeftiger aoeftiger mentioned this pull request Nov 4, 2020
Copy link

@martinschwinzerl martinschwinzerl left a comment

Choose a reason for hiding this comment

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

Reviewed and approved

@rdemaria rdemaria merged commit 37e87fa into SixTrack:master Nov 5, 2020
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