pypret.pulse module¶
Provides a class to simulate an ultrashort optical pulse using its envelope description.
The temporal envelope is denoted as field and the spectral envelope as spectrum in the code and the function signatures.

class
pypret.pulse.
Pulse
(ft, wl0, unit='wl')[source]¶ Bases:
pypret.io.io.IO
A class for modelling femtosecond pulses by their envelope.

__init__
(ft, wl0, unit='wl')[source]¶ Initializes an optical pulse described by its envelope.
Parameters:  ft (FourierTransform) – A
FourierTransform
instance that specifies a temporal and spectral grid.  wl0 (float) – The center frequency of the pulse.
 unit (str) – The unit in which the center frequency is specified. Can be either
of
wl
,om
,f
, ork
. Seefrequencies
for more information. Default iswl
.
 ft (FourierTransform) – A

amplitude
¶ The temporal amplitude profile of the pulse in vacuum.
Only read access.

copy
()[source]¶ Returns a copy of the pulse object.
Note that they still reference the same FourierTransform instance, which is assumed to be immutable.

field
¶ The complexvalued temporal envelope of the pulse.
On read access returns a copy of the internal array. On write access the spectral envelope is automatically updated.

fwhm
(dt=None)[source]¶ Calculates the full width at half maximum (FWHM) of the temporal intensity profile.
Parameters: dt (float or None, optional) – Specifies the required accuracy of the calculation. If None (the default) it is only as good as the spacing of the underlying simulation grid  which can be quite coarse compared to the FWHM. If smaller it is calculated based on trigonometric interpolation.

intensity
¶ The temporal intensity profile of the pulse in vacuum.
Only read access.

phase
¶ The temporal phase of the pulse.
Only read access.

spectral_amplitude
¶ The spectral amplitude profile of the pulse in vacuum.
Only read access.

spectral_intensity
¶ The spectral intensity profile of the pulse in vacuum.
Only read access.

spectral_phase
¶ The spectral phase of the pulse.
Only read access.

spectrum
¶ The complexvalued spectral envelope of the pulse.
On read access returns a copy of the internal array. On write access the temporal envelope is automatically updated.

time_bandwidth_product
¶ Calculates the rms timebandwidth product of the pulse.
In this definition a transformlimited Gaussian pulse has a timebandwidth product of 0.5. So the number returned by this function will always be >= 0.5.


pypret.random_pulse.
random_pulse
(pulse, tbp, edge_value=None, check=True)[source]¶ Creates a random pulse with a specified timebandwidth product.
Parameters:  pulse (Pulse instance) –
 tbp (float) – The specified timebandwidth product.
 edge_value (float, optional) – The maximal value for the pulse amplitude at the edges of the grid. It defaults to the double value epsilon ~2e16.
Returns: bool – is stored in the Pulse instance passed to the function.
Return type: True on success, False if an error occured. The resulting pulse
Notes
The function creates random pulses by iteratively restricting the bandwidth in time and frequency domain. It starts from random complex values in frequency domain, multiplies a Gaussian function, transforms in the time domain and multiplies a Gaussian function again. The filter functions are Gaussians with the specified timebandwidth product. The TBP of the Gaussian filters, however, does not directly correspond to the TBP of the resulting pulse. To use this algorithm to generate a pulse with exactly the specified TBP, it is run in the range 0.5 * TBP to 1.5 * TBP using a scalar root search (brentq). Usually this guarantees convergence within a few tries. The larger the TBP the larger the number of points has to be. So the algorithm may fail to find a solution if pulse.N is too small.