srxraylib.waveoptics package

Submodules

srxraylib.waveoptics.CompactAFReader module

srxraylib.waveoptics.NumpyToSRW module

srxraylib.waveoptics.polarization module

Polarization class (deprecated, use wofry/wofrylib instead).

class srxraylib.waveoptics.polarization.Polarization[source]

Bases: object

PI = 1
SIGMA = 0
TOTAL = 3

srxraylib.waveoptics.propagator module

1D wave-optics propagators.

srxraylib.waveoptics.propagator.propagate_1D_fraunhofer(wavefront, propagation_distance=0.0, shift_half_pixel=0)[source]

1D Fraunhofer propagator using convolution via Fourier transform :param shift_half_pixel: :param shift_half_pixel: :param wavefront: :param propagation_distance: propagation distance. If set to zero, the abscissas

of the returned wavefront are in angle (rad)

Returns:

a new 1D wavefront object with propagated wavefront

srxraylib.waveoptics.propagator.propagate_1D_fresnel(wavefront, propagation_distance)[source]

1D Fresnel propagator using convolution via Fourier transform :param wavefront: :param propagation_distance: propagation distance :return: a new 1D wavefront object with propagated wavefront

srxraylib.waveoptics.propagator.propagate_1D_fresnel_convolution(wavefront, propagation_distance)[source]

1D Fresnel propagator using direct convolution :param wavefront: :param propagation_distance: :return:

srxraylib.waveoptics.propagator.propagate_1D_fresnel_radius(wavefront, propagation_distance, eta)[source]

1D Fresnel propagator using convolution via Fourier transform :param wavefront: :param propagation_distance: propagation distance :return: a new 1D wavefront object with propagated wavefront

srxraylib.waveoptics.propagator.propagate_1D_integral(wavefront, propagation_distance, detector_abscissas=[None], method=0, magnification=1.0, npoints_exit=None)[source]

1D Fresnel-Kirchhoff propagator via integral implemented as sum :param wavefront: :param propagation_distance: propagation distance :param detector_abscissas: a numpy array with the abscissas at the image position. If undefined ([None])

it uses the same abscissas present in input wavefront.

Parameters:
  • method – 0 (default_ makes a loop over detector coordinates, 1: makes matrices (outer products) so it is more memory hungry.

  • magnification – if detector_abscissas is [None], the detector abscissas range is the input wavefront range times this magnification factor. Default =1

  • npoints_exit – if detector_abscissas is [None], the number of points of detector abscissas. Default=None meaning that the same number of points than wavefront are used.

Returns:

a new 1D wavefront object with propagated wavefront

srxraylib.waveoptics.propagator.propagator1d_fourier_rescaling(wavefront, propagation_distance, m=1)[source]

srxraylib.waveoptics.propagator2D module

2D wave-optics propagators: Fraunhofer, Fresnel, etc.

srxraylib.waveoptics.propagator2D.propagate_2D_fraunhofer(wavefront, propagation_distance=1.0, shift_half_pixel=0)[source]

2D Fraunhofer propagator using convolution via Fourier transform :param wavefront: :param propagation_distance: propagation distance. If set to zero, the abscissas

of the returned wavefront are in angle (rad)

Parameters:

shift_half_pixel – set to 1 to shift half pixel (recommended using an even number of pixels) Set as default.

Returns:

a new 2D wavefront object with propagated wavefront

srxraylib.waveoptics.propagator2D.propagate_2D_fresnel(wavefront, propagation_distance, shift_half_pixel=1)[source]

2D Fresnel propagator using convolution via Fourier transform :param wavefront: :param propagation_distance: propagation distance :param shift_half_pixel: set to 1 to shift half pixel (recommended using an even number of pixels) Set as default. :return: a new 2D wavefront object with propagated wavefront

srxraylib.waveoptics.propagator2D.propagate_2D_fresnel_convolution(wavefront, propagation_distance, shift_half_pixel=1)[source]

2D Fresnel propagator using convolution via Fourier transform :param wavefront: :param propagation_distance: propagation distance :param shift_half_pixel: set to 1 to shift half pixel (recommended using an even number of pixels) Set as default. :return: a new 2D wavefront object with propagated wavefront

srxraylib.waveoptics.propagator2D.propagate_2D_fresnel_srw(wavefront, propagation_distance, srw_autosetting=0)[source]

2D Fresnel propagator using convolution via Fourier transform :param wavefront: :param propagation_distance: :param srw_autosetting:set to 1 for automatic SRW redimensionate wavefront :return:

srxraylib.waveoptics.propagator2D.propagate_2D_integral(wavefront, propagation_distance, shuffle_interval=0, calculate_grid_only=1)[source]

2D Fresnel-Kirchhoff propagator via simplified integral

NOTE: this propagator is experimental and much less performant than the ones using Fourier Optics

Therefore, it is not recommended to use.

Parameters:
  • wavefront

  • propagation_distance – propagation distance

  • shuffle_interval

    it is known that this method replicates the central diffraction spot The distace of the replica is proportional to 1/pixelsize To avoid that, it is possible to change a bit (randomly) the coordinates of the wavefront. shuffle_interval controls this shift: 0=No shift. A typical

    value can be 1e5. The result shows a diffraction pattern without replica but with much noise.

  • calculate_grid_only – if set, it calculates only the horizontal and vertical profiles, but returns the full image with the other pixels to zero. This is useful when calculating large arrays, so it is set as the default.

Returns:

a new 2D wavefront object with propagated wavefront

srxraylib.waveoptics.propagator2D.propagator2d_fourier_rescaling(wf, propagation_distance, shift_half_pixel=1, m=1)[source]
srxraylib.waveoptics.propagator2D.propagator2d_fourier_rescaling_xy(wf, propagation_distance, shift_half_pixel=1, m_x=1, m_y=1)[source]

srxraylib.waveoptics.wavefront module

1D wavefront class (deprecated, use wofry/wofrylib instead).

class srxraylib.waveoptics.wavefront.Wavefront1D(wavelength=1e-10, electric_field_array=None)[source]

Bases: object

add_phase_shift(phase_shift)[source]
add_phase_shifts(phase_shifts)[source]
apply_ideal_lens(focal_length)[source]
apply_slit(x_slit_min, x_slit_max)[source]
delta()[source]
duplicate()[source]
electric_field_array = None
get_abscissas()[source]
get_amplitude()[source]
get_complex_amplitude()[source]
get_complex_amplitude_from_abscissas(abscissa_values)[source]
get_intensity()[source]
get_interpolated_amplitude(abscissa_value)[source]
get_interpolated_amplitudes(abscissa_values)[source]
get_interpolated_complex_amplitude(abscissa_value)[source]
get_interpolated_complex_amplitudes(abscissa_values)[source]
get_interpolated_intensities(abscissa_values)[source]
get_interpolated_intensity(abscissa_value)[source]
get_interpolated_phase(abscissa_value)[source]
get_interpolated_phases(abscissa_values)[source]
get_normalized_intensity()[source]
get_phase(from_minimum_intensity=0.0)[source]
get_wavelength()[source]
get_wavenumber()[source]
classmethod initialize_wavefront(wavelength=1e-10, number_of_points=1000)[source]
classmethod initialize_wavefront_from_arrays(x_array, y_array, wavelength=1e-10)[source]
classmethod initialize_wavefront_from_range(x_min=0.0, x_max=0.0, number_of_points=1000, wavelength=1e-10)[source]
classmethod initialize_wavefront_from_steps(x_start=0.0, x_step=0.0, number_of_points=1000, wavelength=1e-10)[source]
offset()[source]
rescale_amplitude(factor)[source]
rescale_amplitudes(factors)[source]
set_complex_amplitude(complex_amplitude)[source]
set_photon_energy(photon_energy)[source]
set_plane_wave_from_amplitude_and_phase(amplitude=1.0, phase=0.0)[source]
set_plane_wave_from_complex_amplitude(complex_amplitude=1 + 0j)[source]
set_spherical_wave(radius=1.0, complex_amplitude=1.0)[source]
set_wavelength(wavelength)[source]
set_wavenumber(wavenumber)[source]
size()[source]
wavelength = 0.0
srxraylib.waveoptics.wavefront.test_plane_wave(do_plot=0)[source]

srxraylib.waveoptics.wavefront2D module

2D wavefront class (deprecated, use wofry/wofrylib instead).

class srxraylib.waveoptics.wavefront2D.Wavefront2D(wavelength=1e-10, electric_field_array=None, electric_field_array_pi=None)[source]

Bases: object

add_phase_shift(phase_shift, polarization=0)[source]
add_phase_shifts(phase_shifts, polarization=0)[source]
apply_ideal_lens(focal_length_x, focal_length_y)[source]
apply_pinhole(radius, x_center=0.0, y_center=0.0, negative=False)[source]
apply_slit(x_slit_min, x_slit_max, y_slit_min, y_slit_max)[source]
delta()[source]
duplicate()[source]
electric_field_array = None
get_amplitude(polarization=0)[source]
get_complex_amplitude(polarization=0)[source]
get_coordinate_x()[source]
get_coordinate_y()[source]
get_intensity(polarization=0)[source]
get_interpolated(x_value, y_value, toreturn='complex_amplitude', polarization=0)[source]
get_interpolated_amplitude(x_value, y_value, polarization=0)[source]
get_interpolated_amplitudes(x_value, y_value, polarization=0)[source]
get_interpolated_complex_amplitude(x_value, y_value, polarization=0)[source]
get_interpolated_complex_amplitudes(x_value, y_value, polarization=0)[source]
get_interpolated_intensities(x_value, y_value, polarization=0)[source]
get_interpolated_intensity(x_value, y_value, polarization=0)[source]
get_interpolated_phase(x_value, y_value, polarization=0)[source]
get_interpolated_phases(x_value, y_value, polarization=0)[source]
get_mask_grid(width_in_pixels=(1, 1), number_of_lines=(1, 1))[source]
Parameters:
  • width_in_pixels – (pixels_for_horizontal_lines,pixels_for_vertical_lines

  • number_of_lines – (number_of_horizontal_lines, number_of_vertical_lines)

Returns:

get_mesh_indices_x()[source]
get_mesh_indices_y()[source]
get_mesh_x()[source]
get_mesh_y()[source]
get_phase(from_minimum_intensity=0.0, polarization=0)[source]
get_photon_energy()[source]
get_wavelength()[source]
get_wavenumber()[source]
classmethod initialize_wavefront(number_of_points=(100, 100), wavelength=1e-10)[source]
classmethod initialize_wavefront_from_arrays(x_array, y_array, z_array, z_pi_array=None, wavelength=1e-10)[source]
classmethod initialize_wavefront_from_range(x_min=0.0, x_max=0.0, y_min=0.0, y_max=0.0, number_of_points=(100, 100), wavelength=1e-10, polarization=0)[source]
classmethod initialize_wavefront_from_steps(x_start=0.0, x_step=0.0, y_start=0.0, y_step=0.0, number_of_points=(100, 100), wavelength=1e-10, polarization=0)[source]
is_polarized()[source]
offset()[source]
rebin(expansion_points_horizontal, expansion_points_vertical, expansion_range_horizontal, expansion_range_vertical, keep_the_same_intensity=0, set_extrapolation_to_zero=0)[source]
rescale_amplitude(factor, polarization=0)[source]
rescale_amplitudes(factors, polarization=0)[source]
set_complex_amplitude(complex_amplitude, polarization=0)[source]
set_photon_energy(photon_energy)[source]
set_plane_wave_from_amplitude_and_phase(amplitude=1.0, phase=0.0)[source]
set_plane_wave_from_complex_amplitude(complex_amplitude=1 + 0j)[source]
set_spherical_wave(radius=1.0, complex_amplitude=1.0)[source]
Parameters:
  • complex_amplitude

  • radius – Positive radius is divergent wavefront, negative radius is convergent

Returns:

set_wavelength(wavelength)[source]
set_wavenumber(wavenumber)[source]
size()[source]
wavelength = 0.0
srxraylib.waveoptics.wavefront2D.test_initializers(do_plot=0)[source]
srxraylib.waveoptics.wavefront2D.test_interpolator(do_plot=0)[source]
srxraylib.waveoptics.wavefront2D.test_plane_wave(do_plot=0)[source]
srxraylib.waveoptics.wavefront2D.test_polarization(do_plot=0)[source]
srxraylib.waveoptics.wavefront2D.test_polarization_interpolation()[source]

Module contents