Solution Class
- class lpmodes.Solution(modes, grid_size=100, max_plot_radius=None)
Class used to store a set of lp modes for a fibre and to perform operations that are applied to the whole set of modes.
- Arguments:
- modeslist
list of instances of Mode as generated by find_modes
- Keyword Arguments:
- grid_sizeint, optional
The size of the grid for mode plotting. Defaults to 100.
- max_plot_radiusfloat, optional
The maximum physical radius for plotting. If None, it is set to 1.5 times the core radius. Defaults to None.
- Attributes:
- modeslist
A list of Mode instances, as generated by find_modes
- num_modesint
The number of modes in the ‘modes’ list.
- mode_lnp.array
A 1D array storing the ‘l’ value for each mode.
- mode_mnp.array
A 1D array storing the ‘m’ value for each mode.
- mode_cosnp.array
A 3D array storing a plot of the amplitude of the cosine component of each mode (mode, x, y)
- mode_sinnp.array
A 3D array storing a plot of the amplitude of the sine component of each mode (mode, x, y)
- mode_cos_intensitynp.array
A 3D array storing a plot of the intensity of the cosine component of each mode (mode, x, y)
- mode_sin_intensitynp.array
A 3D array storing a plot of the amplitude of the sine component of each mode (mode, x, y)
- cos_ampnp.array
A 1D array storing the complex amplitude coupled into the cosine version of each mode.
- sin_ampnp.array
A 1D array storing the complex amplitude coupled into the sine version of each mode.
- mode_powernp.array
1 1D array storing the power coupled into each mode (total power in both orientations)
- power_coupledfloat
Total power coupled into fibre
- prop_cos_ampnp.array
A 1D array storing the complex amplitude coupled into the cosine version of each mode after propagation to end of fibre.
- prop_sin_ampnp.array
A 1D array storing the complex amplitude coupled into the sine version of each mode after propagation to end of fibre.
- prop_fieldnp.array
2D complex array containing plot of field after propagation to end of fibre
- prop_intensitynp.array
2D array containing plot of intensity after propagation to end of fibre
- couple_field(field)
Couples an input field into the modes and calculates the resulting mode amplitudes.
- Arguments:
- fieldnp.array
The input field to be coupled into the modes, as a 2D complex numpy array. This must be on a grid that is the same dimensions and with the same pixel size as defined by the grid_size and max_plot_radius argument to __init__.
- get_in_amplitudes()
Returns the input (i.e. before propagation) coupled amplitudes for the cosine and sine components of each mode.
- Returns:
- tuple(np.array, np.array)
A tuple containing the two 1D numpy arrays containng the input cosine amplitudes and sine amplitudes.
- get_in_field()
Calculates the input field (i.e. before propagation) as represented as a superposition of modes with their respective input amplitudes.
- Returns:
np.array : The input field as a 2D complex numpy array.
- get_in_intensity()
Calculates the input power (intensity) distribution (i.e. before propagation) as represented as a superposition of modes with their respective input amplitudes, all squared.
- Returns:
np.array : The input power (intensity map) as a 2D array.
- get_out_amplitudes()
Returns the output amplitudes for the cosine and sine components after propagation.
- Returns:
- tuple(np.array, np.array)
A tuple containing the two 1D numpy arrays containng the input cosine amplitudes and sine amplitudes.
- get_out_field()
Calculates the input power (intensity) distribution (i.e. before propagation) as represented as a superposition of modes with their respective input amplitudes, all squared.
- Returns:
np.array : The output power (intensity map) as a 2D array.
- get_out_intensity()
Calculates the output power (intensity) distribution (i.e. after propagation) as represented as a superposition of modes with their respective output amplitudes, all squared.
- Returns:
np.array : The output power (intensity map) as a 2D array.
- plot_amplitude(l, m)
Returns an amplitude plot of the sine and cosines components of the mode with the specified l and m. Returns None, None if mode is not present.
- Arguments:
- lint
azimuthal mode number
- mint
radial mode number
- Returns:
- np.array2D numpy array containing plot of mode amplitude. Will be
None if mode is not present.
- plot_intensity(l, m)
Returns an intensity plot of the sine and cosines components of the mode with the specified l and m. Returns None, None if mode is not present.
- Arguments:
- lint
azimuthal mode number
- mint
radial mode number
- Returns:
- np.array2D numpy array containing plot of mode intensity. Will be
None if mode is not present.
- plot_mode_coupling()
Returns a plot, as a 2D numpy array, showing the power coupled into each mode, with the modes organised by l and m.
- propagate(distance, rotations=False)
Propagates the modes through a fibre over a given distance, storing the new complex amplitudes.
- Arguments:
- distancefloat
The distance over which the modes are propagated.
- Keyword Arguments:
- rotationsbool, optional
If True, applies random rotations of each mode during propagation. Defaults to False.
- set_amplitudes(cos_amp, sin_amp)
Sets the amplitude coupled into each mode.
- Arguments:
- cos_ampnp.array
1D array of floats, amplitude for cosine version of mode
- sin_ampnp.array
1D array of floats, amplitude for sine (i.e. rotated) version of mode
- set_random_amplitudes()
Sets random amplitudes for the cosine and sine components of each mode.