shadow4.sources package
Subpackages
- shadow4.sources.bending_magnet package
- Submodules
- shadow4.sources.bending_magnet.s4_bending_magnet module
S4BendingMagnetS4BendingMagnet.get_energy_box()S4BendingMagnet.get_info()S4BendingMagnet.initialize_from_magnetic_field_divergence_and_electron_energy()S4BendingMagnet.initialize_from_magnetic_radius_divergence_and_electron_energy()S4BendingMagnet.is_monochromatic()S4BendingMagnet.set_energy_box()S4BendingMagnet.set_energy_monochromatic()S4BendingMagnet.to_python_code()
- shadow4.sources.bending_magnet.s4_bending_magnet_light_source module
- Module contents
- shadow4.sources.source_geometrical package
- Submodules
- shadow4.sources.source_geometrical.probability_distributions module
- shadow4.sources.source_geometrical.source_gaussian module
SourceGaussianSourceGaussian.get_beam()SourceGaussian.get_info()SourceGaussian.get_number_of_points()SourceGaussian.get_sigmas_direction_space()SourceGaussian.get_sigmas_real_space()SourceGaussian.initialize_collimated_source()SourceGaussian.initialize_from_keywords()SourceGaussian.initialize_point_source()
- shadow4.sources.source_geometrical.source_geometrical module
SourceGeometricalSourceGeometrical.angular_distribution_list()SourceGeometrical.calculate_beam()SourceGeometrical.calculate_rays()SourceGeometrical.depth_distribution_list()SourceGeometrical.energy_distribution_list()SourceGeometrical.get_beam()SourceGeometrical.get_info()SourceGeometrical.set_angular_distribution_by_name()SourceGeometrical.set_angular_distribution_collimated()SourceGeometrical.set_angular_distribution_cone()SourceGeometrical.set_angular_distribution_flat()SourceGeometrical.set_angular_distribution_gaussian()SourceGeometrical.set_angular_distribution_uniform()SourceGeometrical.set_depth_distribution()SourceGeometrical.set_depth_distribution_by_name()SourceGeometrical.set_depth_distribution_gaussian()SourceGeometrical.set_depth_distribution_off()SourceGeometrical.set_depth_distribution_uniform()SourceGeometrical.set_energy_distribution_by_name()SourceGeometrical.set_energy_distribution_gaussian()SourceGeometrical.set_energy_distribution_relativeintensities()SourceGeometrical.set_energy_distribution_severallines()SourceGeometrical.set_energy_distribution_singleline()SourceGeometrical.set_energy_distribution_uniform()SourceGeometrical.set_energy_distribution_userdefined()SourceGeometrical.set_polarization()SourceGeometrical.set_spatial_type_by_name()SourceGeometrical.set_spatial_type_ellipse()SourceGeometrical.set_spatial_type_gaussian()SourceGeometrical.set_spatial_type_point()SourceGeometrical.set_spatial_type_rectangle()SourceGeometrical.spatial_type_list()SourceGeometrical.to_python_code()
- shadow4.sources.source_geometrical.source_grid_cartesian module
SourceGridCartesianSourceGridCartesian.get_arrays_direction_space()SourceGridCartesian.get_arrays_real_space()SourceGridCartesian.get_beam()SourceGridCartesian.get_info()SourceGridCartesian.get_mesh_divergences()SourceGridCartesian.get_mesh_real_space()SourceGridCartesian.get_number_of_points()SourceGridCartesian.get_volume()SourceGridCartesian.get_volume_divergences()SourceGridCartesian.get_volume_real_space()SourceGridCartesian.initialize_collimated_source()SourceGridCartesian.initialize_point_source()SourceGridCartesian.to_python_code()
- shadow4.sources.source_geometrical.source_grid_polar module
SourceGridPolarSourceGridPolar.get_beam()SourceGridPolar.get_info()SourceGridPolar.get_number_of_points()SourceGridPolar.get_number_of_points_direction_space()SourceGridPolar.get_number_of_points_real_space()SourceGridPolar.initialize_collimated_source()SourceGridPolar.initialize_point_source()SourceGridPolar.to_python_code()
- Module contents
- shadow4.sources.undulator package
- Submodules
- shadow4.sources.undulator.calculate_undulator_emission module
- shadow4.sources.undulator.calculate_undulator_emission_pysru module
- shadow4.sources.undulator.calculate_undulator_emission_srw module
- shadow4.sources.undulator.s4_undulator module
- shadow4.sources.undulator.s4_undulator_gaussian module
S4UndulatorGaussianS4UndulatorGaussian.get_energy_box()S4UndulatorGaussian.get_flag_emittance()S4UndulatorGaussian.get_flag_energy_spread()S4UndulatorGaussian.get_info()S4UndulatorGaussian.get_number_of_energy_points()S4UndulatorGaussian.is_monochromatic()S4UndulatorGaussian.set_energy_box()S4UndulatorGaussian.set_energy_monochromatic()S4UndulatorGaussian.to_python_code()
- shadow4.sources.undulator.s4_undulator_gaussian_light_source module
S4UndulatorGaussianLightSourceS4UndulatorGaussianLightSource.Fn()S4UndulatorGaussianLightSource.Qn()S4UndulatorGaussianLightSource.calculate_spectrum()S4UndulatorGaussianLightSource.get_beam()S4UndulatorGaussianLightSource.get_flux()S4UndulatorGaussianLightSource.get_flux_central_cone()S4UndulatorGaussianLightSource.get_info()S4UndulatorGaussianLightSource.get_size_and_divergence_vs_photon_energy()S4UndulatorGaussianLightSource.get_spectral_power()S4UndulatorGaussianLightSource.get_undulator_photon_beam_sizes()S4UndulatorGaussianLightSource.norm_energ_spr()S4UndulatorGaussianLightSource.q_a()S4UndulatorGaussianLightSource.q_s()S4UndulatorGaussianLightSource.theoretical_flux_integrated_central_cone()S4UndulatorGaussianLightSource.to_python_code()
- shadow4.sources.undulator.s4_undulator_light_source module
- Module contents
- shadow4.sources.wiggler package
Submodules
shadow4.sources.s4_electron_beam module
Defines the shadow4 electron beam.
- class shadow4.sources.s4_electron_beam.S4ElectronBeam(energy_in_GeV=1.0, energy_spread=0.0, current=0.1, number_of_bunches=0, moment_xx=0.0, moment_xxp=0.0, moment_xpxp=0.0, moment_yy=0.0, moment_yyp=0.0, moment_ypyp=0.0, dispersion_x=0.0, dispersion_y=0.0, dispersionp_x=0.0, dispersionp_y=0.0)[source]
Bases:
ElectronBeamDefines an electron beam at a given point of the storage ring.
- Parameters:
energy_in_GeV (float, optional) – The electron energy in GeV.
energy_spread (float, optional) – The electron energy spread (in a fraction of the energy_in_GeV).
current (float, optional) – The electron beam current intensity in A.
moment_xx (float, optional) – The <x^2> moment.
moment_xxp (float, optional) – The <x x’> moment.
moment_xpxp (float, optional) – The <x’^2> moment.
moment_yy (float, optional) – The <y^2> moment.
moment_yyp (float, optional) – The <y y’> moment.
moment_ypyp (float, optional) – The <y’^2> moment.
dispersion_x (float, optional) – The eta_x parameter, spatial dispersion
dispersion_y (float, optional) – The eta_y parameter, spatial dispersion
dispersionp_x (float, optional) – The eta’_x parameter, angular dispersion
dispersionp_y (float, optional) – The eta’_y parameter, angular dispersion
shadow4.sources.s4_light_source module
Defines the shadow4 synchrotron LightSource (the base class of beanding magnet, wiggler and undulator lightsources).
It contains an electron beam and a magnetic structure and some parameters like nrays and seed.
- class shadow4.sources.s4_light_source.S4LightSource(name='Undefined', electron_beam=None, magnetic_structure=None, nrays=5000, seed=12345)[source]
Bases:
LightSourceConstructor
- Parameters:
name (str) – A name.
electron_beam (instance of S4ElectronBeam) – The electron beam.
magnetic_structure (instance of a class derived from SYNED MagneticStructre.) – The magnetic structure (bending magnet, wiggler or undulator).
nrays (int) – The number of rays.
seed (int) – The seed.
- calculate_spectrum(**params)[source]
To be implemented in a derived class.
- Raises:
NotImplementedError() –
- get_nrays()[source]
Returns the stored number of rays.
- Returns:
The number of rays.
- Return type:
int
shadow4.sources.s4_light_source_base module
Defines the a Base LightSource to support non-synchrotron sources.
- class shadow4.sources.s4_light_source_base.S4LightSourceBase(name='Undefined', nrays=5000, seed=1234567)[source]
Bases:
EmptyLightSourceAbstract class to support non-synchrotron light sources (e.g. geometrical source)
- Parameters:
name (str) – A name.
nrays (int) – The number of rays.
seed (int) – The Monte Carlo seed.
- calculate_spectrum(**params)[source]
To be implemented in a derived class.
- Raises:
NotImplementedError() –
- get_nrays()[source]
Returns the stored number of rays.
- Returns:
The number of rays.
- Return type:
int
shadow4.sources.s4_light_source_from_beamlines module
Defines the a LightSource merging several beamlines.
- class shadow4.sources.s4_light_source_from_beamlines.S4LightSourceFromBeamlines(name='Undefined', beamlines=None, ids=None, weights=None)[source]
Bases:
EmptyLightSourceClass to create a light source from a S4Beam in an H5 file.
- Parameters:
name (str, optional) – A name.
beamlines (list, optiona) – A list with the beamlines (instances of S4Beamline).
ids (list, optional) – A list with the ids or names (str).
weights (list, optional) – A list with the weights (float).
- append_beamline(beamline, id='appended beamline', weight=1.0)[source]
Appends a beamline
- Parameters:
beamline (instance of S4Beamline) – the beamline to be appended.
id (str, optional) – the beamline id.
weight (float, optional) – the intensity weigh for the beamline.
- calculate_spectrum(**params)[source]
To be implemented in a derived class.
- Raises:
NotImplementedError() –
- get_beam()[source]
Retirns the S4 beam.
- Parameters:
copy (int) – Returns the beam stored in the class (0) or a copy of it (1).
- Returns:
S4Beam instance
The S4 beam.
shadow4.sources.s4_light_source_from_file module
Defines the a LightSource with a beam defined in a HDF5 file.
- class shadow4.sources.s4_light_source_from_file.S4LightSourceFromFile(name='Undefined', file_name='', simulation_name='run001', beam_name='begin')[source]
Bases:
EmptyLightSourceClass to create a light source from a S4Beam in an H5 file.
- Parameters:
name (str, optional) – A name.
file_name (str, optional) – The name of the H5 file.
simulation_name (str, optional) – A name or key to define the simulation within the H5 file.
beam_name (str, optional) – A name or key to define the name of the beam with the simulation.
- calculate_spectrum(**params)[source]
To be implemented in a derived class.
- Raises:
NotImplementedError() –