initial_beam_parameters module
Gather beam parameters at the entrance of a ListOfElements.
For a list of the units associated with every parameter, see Units and conventions.
- class InitialBeamParameters(z_abs, gamma_kin, beta_kin)[source]
Bases:
objectHold all emittances, envelopes, etc in various planes at a single position.
- Parameters:
z_abs (
float) – Absolute position in the linac in \(\mathrm{m}\).gamma_kin (
float) – Lorentz gamma factor.beta_kin (
float) – Lorentz beta factor.zdelta – Beam parameters respectively in the \([z-z\delta]\), \([z-z']\), \([\phi-W]\), \([x-x']\), \([y-y']\) and \([t-t']\) planes.
z – Beam parameters respectively in the \([z-z\delta]\), \([z-z']\), \([\phi-W]\), \([x-x']\), \([y-y']\) and \([t-t']\) planes.
phiw – Beam parameters respectively in the \([z-z\delta]\), \([z-z']\), \([\phi-W]\), \([x-x']\), \([y-y']\) and \([t-t']\) planes.
x – Beam parameters respectively in the \([z-z\delta]\), \([z-z']\), \([\phi-W]\), \([x-x']\), \([y-y']\) and \([t-t']\) planes.
y – Beam parameters respectively in the \([z-z\delta]\), \([z-z']\), \([\phi-W]\), \([x-x']\), \([y-y']\) and \([t-t']\) planes.
t – Beam parameters respectively in the \([z-z\delta]\), \([z-z']\), \([\phi-W]\), \([x-x']\), \([y-y']\) and \([t-t']\) planes.
phiw99 – 99% beam parameters respectively in the \([\phi-W]\), \([x-x']\) and \([y-y']\) planes. Only used with multiparticle simulations.
x99 – 99% beam parameters respectively in the \([\phi-W]\), \([x-x']\) and \([y-y']\) planes. Only used with multiparticle simulations.
y99 – 99% beam parameters respectively in the \([\phi-W]\), \([x-x']\) and \([y-y']\) planes. Only used with multiparticle simulations.
- has(key)[source]
Tell if the required attribute is in this class.
Notes
key = 'property_phasespace'will return True if'property'exists inphasespace. Hence, the following two commands will have the same return values:self.has('twiss_zdelta') self.zdelta.has('twiss')
See also
- get(*keys, to_numpy=True, none_to_nan=False, phase_space_name=None, **kwargs)[source]
Get attributes from this class or its attributes.
Notes
What is particular in this getter is that all
InitialPhaseSpaceBeamParametersobjects have attributes with the same name:twiss,alpha,beta,gamma,eps, etc.Hence, you must provide either a
phase_space_nameargument which shall be inPHASE_SPACES, either or you must append the name of the phase space to the name of the desired variable with an underscore.Examples
>>> initial_beam_parameters: InitialBeamParameters >>> initial_beam_parameters.get("beta", phase_space_name="zdelta") >>> initial_beam_parameters.get("beta_zdelta") # Alternative >>> initial_beam_parameters.get("beta") # Incorrect
See also
- Parameters:
*keys (
Literal['alpha_phiw','beta_phiw','envelope_energy_phiw','envelope_pos_phiw','eps_phiw','eps_no_normalization_phiw','eps_normalized_phiw','gamma_phiw','sigma_phiw','twiss_phiw','alpha_phiw99','beta_phiw99','envelope_energy_phiw99','envelope_pos_phiw99','eps_phiw99','eps_no_normalization_phiw99','eps_normalized_phiw99','gamma_phiw99','sigma_phiw99','twiss_phiw99','alpha_t','beta_t','envelope_energy_t','envelope_pos_t','eps_t','eps_no_normalization_t','eps_normalized_t','gamma_t','sigma_t','twiss_t','alpha_x','beta_x','envelope_energy_x','envelope_pos_x','eps_x','eps_no_normalization_x','eps_normalized_x','gamma_x','sigma_x','twiss_x','alpha_x99','beta_x99','envelope_energy_x99','envelope_pos_x99','eps_x99','eps_no_normalization_x99','eps_normalized_x99','gamma_x99','sigma_x99','twiss_x99','alpha_y','beta_y','envelope_energy_y','envelope_pos_y','eps_y','eps_no_normalization_y','eps_normalized_y','gamma_y','sigma_y','twiss_y','alpha_y99','beta_y99','envelope_energy_y99','envelope_pos_y99','eps_y99','eps_no_normalization_y99','eps_normalized_y99','gamma_y99','sigma_y99','twiss_y99','alpha_z','beta_z','envelope_energy_z','envelope_pos_z','eps_z','eps_no_normalization_z','eps_normalized_z','gamma_z','sigma_z','twiss_z','alpha_zdelta','beta_zdelta','envelope_energy_zdelta','envelope_pos_zdelta','eps_zdelta','eps_no_normalization_zdelta','eps_normalized_zdelta','gamma_zdelta','sigma_zdelta','twiss_zdelta'] |Literal['alpha','beta','beta_kin','envelope_energy','envelope_pos','eps','eps_no_normalization','eps_normalized','gamma','gamma_kin','sigma','twiss','z_abs'] |Literal['phiw','phiw99','t','x','x99','y','y99','z','zdelta']) – Name of the desired attributes.to_numpy (
bool, default:True) – If you want the list output to be converted to a np.ndarray. The default is True.none_to_nan (
bool, default:False) – To convertNonetonp.nan. The default is True.phase_space_name (
Literal['phiw','phiw99','t','x','x99','y','y99','z','zdelta'] |None, default:None) – Phase space in which you want the key. The default is None. In this case, the quantities from thezdeltaphase space are taken. Otherwise, it must be inPHASE_SPACES.**kwargs (Any) – Other arguments passed to recursive getter.
- Returns:
out – Attribute(s) value(s).
- Return type:
Any