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

Add per-bunch output files #8

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

mattachu
Copy link
Contributor

As well as the standard output files, also produce separate output files for each bunch, to enable more detailed analysis of bunch behaviour.

Includes changes to the output routine, a couple of calls in the main accelerator routine, and lots of changes in the GUI to be able to plot all the extra statistical data.

* Add new parameter `file_offset` to keep the files separate
* Adjust output statements to use the new file numbers
* Adjust output statements to include z-location and correctly scale `xpx` values (as in `diagnostic1avg_Output`)
* Call with a different file offset each time to avoid file clash
* Call once at the start and then every 15 time steps
* Use a single plot for both single and multiple bunch plots
* Use a drop-down to select bunch rather than a message window
* Set the bunch selector based on number of bunches in simulation
* Use methods instead of attributes to pass data
@mattachu
Copy link
Contributor Author

Note that I have only tested the GUI changes with Python 3, we'd need to check whether or not I've broken anything in Python 2.x.

@@ -20,11 +20,12 @@ module Outputclass
contains
!> calculate <x^2>,<xp>,<px^2>,x emittance, <y^2>,<ypy>,
!> <py^2> and y emittance, <z^2>,<zp>,<pz^2>,z emittance.
subroutine diagnostic1_Output(z,this)
subroutine diagnostic1_Output(z,this,file_offset)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I can tell, this older routine diagnostic1_Output is no longer used, so modifying it here shouldn't cause any problems. It is just what is needed for per-bunch output.

@@ -201,7 +207,7 @@ def liveParticlePlot(self):
plotWindow = tk.Toplevel(self)
plotWindow.title(sys._getframe().f_back.f_code.co_name)

l=PlotFrame(plotWindow,'fort.28',1,4,'Live particle number')
l=PlotFrame(plotWindow, 'fort.28', 4, 'Live particle number')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

x-axis columns now selected in the plot classes themselves


class PlotFrame(PlotBaseFrame):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Other plot frames now inherit from PlotBaseFrame to access the new features and reduce duplication.

Adjusted calculation of `localmax(5)` and `localmax(6)` to match the calculation in the average diagnostic output subroutines.

Previously would output maximum size in the z direction without first subtracting the beam centroid.
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.

1 participant