Wake-T icon indicating copy to clipboard operation
Wake-T copied to clipboard

Naming convention of bunch generation vs analysis, saving of bunch parameters

Open TheresaBruemmer opened this issue 3 years ago • 1 comments

I have 2 issues that arise for my use case:

When initialising a ParticleBunch instance from parameters, (eg get_gaussian_bunch_from_twiss), the naming of the input parameters do not match the naming of the output obtained from analyze_bunch. Consequently, one cannot simply run

bunch_params = analyze_bunch(ExistingBunch) NewBunch = get_gaussian_bunch_from_twiss(**bunch_params)

I wrote a function which rewrites the names to match the required input to fix the issue or me, but I guess it could just be renamed in wake-t..?

In analyze_bunch, basically all data (eg energy spread) has to be calculated (even when the bunch was initialised from parameters, not a file) because that initial info is not stored... Saving input parameters in ParticleBunch and/or adding routines to calc them would also resolve my first issue.

TheresaBruemmer avatar Sep 09 '22 09:09 TheresaBruemmer

Hi Theresa, Thanks for your feedback! I'm not sure I understand the use case here. The method analyze_bunch calculates a wide range of bunch parameters, many more than the parameters needed by get_gaussian_bunch_from_twiss, for example. Therefore, it will not be possible to do what you suggest unless the number of output parameters from analyze_bunch exactly match those of the generator function. Since we have many generator functions, each of them with different input parameters, we cannot do this in a way that works for all of them as you describe.

In what case do you need this functionality? Are you trying to make a copy of a bunch? In that case, using the copy module would be much easier.

AngelFP avatar Sep 09 '22 15:09 AngelFP