def get_srw_source(self, electron_beam): self.magnetic_radius = BendingMagnet.calculate_magnetic_radius( self.magnetic_field, electron_beam.electron_energy_in_GeV ) if self.magnetic_radius == 0.0 else self.magnetic_radius self.magnetic_field = BendingMagnet.calculate_magnetic_field( self.magnetic_radius, electron_beam.electron_energy_in_GeV ) if self.magnetic_field == 0.0 else self.magnetic_field return SRWBendingMagnetLightSource( electron_beam=electron_beam, bending_magnet_magnetic_structure=SRWBendingMagnet( self.magnetic_radius, self.magnetic_field, self.length))
def __init__(self, name="Undefined", electron_beam=ElectronBeam(), bending_magnet_magnetic_structure=BendingMagnet(0, 0, 0), bending_magnet_parameters=Shadow3BendingMagnetParameters()): super().__init__(name, electron_beam=electron_beam, magnetic_structure=bending_magnet_magnetic_structure, additional_parameters=bending_magnet_parameters)
def __init__( self, radius=0.0, magnetic_field=1.72, center_of_straight_section=12.405 / 2, length=1.05 / 2, transition_steepness=60, z_start=-8.0, z_end=8.0, n_points=16001, ): BendingMagnet.__init__(self, radius, magnetic_field, length) self.center_of_straight_section = center_of_straight_section self.transition_steepness = transition_steepness self.z_start = z_start self.z_end = z_end self.n_points = n_points
def get_srw_source(self, electron_beam): self.magnetic_radius = BendingMagnet.calculate_magnetic_radius( self.magnetic_field, electron_beam.electron_energy_in_GeV ) if self.magnetic_radius == 0.0 else self.magnetic_radius self.magnetic_field = BendingMagnet.calculate_magnetic_field( self.magnetic_radius, electron_beam.electron_energy_in_GeV ) if self.magnetic_field == 0.0 else self.magnetic_field return SRWIRBendingMagnetLightSource( electron_beam=electron_beam, bending_magnet_magnetic_structure=SRWIRBendingMagnet( radius=self.magnetic_radius, magnetic_field=self.magnetic_field, length=self.length, center_of_straight_section=self.center_of_straight_section, transition_steepness=self.transition_steepness, z_start=self.z_start, z_end=self.z_end, n_points=self.wf_number_of_points_for_trajectory_calculation))
def __init__(self, radius = 0.0, magnetic_field = 0.0, length = 0.0): BendingMagnet.__init__(self, radius, magnetic_field, length)
########################################## electron_beam = ElectronBeam(energy_in_GeV=2.0, energy_spread=0.80e-03, current=0.32) electron_beam.set_sigmas_all(sigma_x=0.2529e-3, sigma_xp=0.02881e-3, sigma_y=0.01844e-3, sigma_yp=5.235e-6) bm = Shadow3BendingMagnetLightSource( electron_beam=electron_beam, bending_magnet_magnetic_structure=BendingMagnet(radius=0.0, magnetic_field=1.2, length=0.0), bending_magnet_parameters=Shadow3BendingMagnetParameters(NPOINT=50000)) slit = Shadow3Slit(name="first slit", boundary_shape=Rectangle(x_left=-0.0001, x_right=0.0001, y_bottom=-0.0005, y_top=0.0005), slit_parameters=Shadow3SlitParameters()) slit_coordinates = ElementCoordinates(p=10.0, q=0.0) elements = RaytracingElements() elements.add_beamline_element( BeamlineElement(optical_element=slit, coordinates=slit_coordinates))
def calculateMagneticRadius(self): if self.magnetic_field > 0: self.magnetic_radius = BendingMagnet.calculate_magnetic_radius( self.magnetic_field, self.electron_energy_in_GeV)
def calculateMagneticField(self): if self.magnetic_radius > 0: self.magnetic_field = BendingMagnet.calculate_magnetic_field( self.magnetic_radius, self.electron_energy_in_GeV)
("input_source_bm", "Specific BM", ""), ] ) if __name__ == "__main__": from srxraylib.plot.gol import plot_scatter syned_electron_beam = ElectronBeam(energy_in_GeV=6.04,current=0.2, moment_xx=(0.0078e-2)**2, moment_xpxp=(3.8e-07/0.0078)**2, moment_yy=(0.0036*1e-2)**2, moment_ypyp=(3.8e-09/0.0036)**2, ) syned_bending_magnet = BendingMagnet(radius=25.1772,magnetic_field=0.8,length=25.1772*0.001) emin = 5000.0 # Photon energy scan from energy (in eV) emax = 100000.0 # Photon energy scan to energy (in eV) ng_e = 51 # Photon energy scan number of points ng_j = 20 # Number of points in electron trajectory (per period) for internal calculation only flag_emittance = 1 # when sampling rays: Use emittance (0=No, 1=Yes) bm_input = InputSourceBM( emin=emin, # Photon energy scan from energy (in eV) emax=emax, # Photon energy scan to energy (in eV) ng_e=ng_e, # Photon energy scan number of points ng_j=ng_j, # Number of points in electron trajectory (per period) for internal calculation only flag_emittance=flag_emittance, # when sampling rays: Use emittance (0=No, 1=Yes)