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, or k. See frequencies for more information. Default is wl.
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 complex-valued temporal envelope of the pulse.

On read access returns a copy of the internal array. On write access the spectral envelope is automatically updated.

field_at(t)[source]

The complex-valued temporal envelope of the pulse at the times t.

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 complex-valued spectral envelope of the pulse.

On read access returns a copy of the internal array. On write access the temporal envelope is automatically updated.

spectrum_at(w)[source]

The complex-valued spectral envelope of the pulse at the frequencies w.

time_bandwidth_product

Calculates the rms time-bandwidth product of the pulse.

In this definition a transform-limited Gaussian pulse has a time-bandwidth product of 0.5. So the number returned by this function will always be >= 0.5.

update_field()[source]

Manually updates the field from the (modified) spectrum.

update_spectrum()[source]

Manually updates the spectrum from the (modified) field.

pypret.random_pulse.random_pulse(pulse, tbp, edge_value=None, check=True)[source]

Creates a random pulse with a specified time-bandwidth product.

Parameters:
  • pulse (Pulse instance) –
  • tbp (float) – The specified time-bandwidth 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 ~2e-16.
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 time-bandwidth 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.

pypret.random_pulse.random_gaussian(pulse, fwhm, phase_max=0.3141592653589793)[source]

Generates a Gaussian pulse with random phase.

Its pulse of duration is given by fwhm.