Skip to content

Add per-bunch output files#8

Open
mattachu wants to merge 12 commits intoimpact-lbl:masterfrom
mattachu:feature/bunch-output
Open

Add per-bunch output files#8
mattachu wants to merge 12 commits intoimpact-lbl:masterfrom
mattachu:feature/bunch-output

Conversation

@mattachu
Copy link
Copy Markdown
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
Copy Markdown
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.

!> 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
Copy Markdown
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.

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
Copy Markdown
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

else:
return [zcol, 'z direction (m)']

class PlotFrame(PlotBaseFrame):
Copy link
Copy Markdown
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