pulsesuite.libpulsesuite.pulsegenerator

Pulse envelope generator — Python port of pulsegenerator.F90.

Generates temporal pulse envelopes (Gaussian, Sech², Square, file-based) on arbitrary grids. All public names preserve the Fortran API so that existing users can grep for pulsegen, GaussPulse, etc.

Dependencies

  • helpers.gauss_dp, helpers.sech, helpers.sech_dp

  • spliner.rescale_1D

Functions

GaussPulse(→ numpy.ndarray)

Gaussian envelope normalised to unit peak with given FWHM.

Sech2Pulse(→ numpy.ndarray)

Sech² envelope normalised to unit peak with given FWHM.

SquarePulse(→ numpy.ndarray)

Rectangular (top-hat) pulse of width FWHM.

FilePulse(→ numpy.ndarray)

Load a pulse profile from a text file and interpolate onto X.

pulsegen(→ numpy.ndarray)

Generate a pulse envelope.

multipulsegen(→ numpy.ndarray)

Generate a train of 2 or 3 identical pulses.

Module Contents

pulsesuite.libpulsesuite.pulsegenerator.GaussPulse(x: numpy.ndarray, FWHM: float) numpy.ndarray

Gaussian envelope normalised to unit peak with given FWHM.

Parameters:
  • x (ndarray) – Coordinate array.

  • FWHM (float) – Full width at half maximum.

pulsesuite.libpulsesuite.pulsegenerator.Sech2Pulse(x: numpy.ndarray, FWHM: float) numpy.ndarray

Sech² envelope normalised to unit peak with given FWHM.

Parameters:
  • x (ndarray) – Coordinate array.

  • FWHM (float) – Full width at half maximum.

pulsesuite.libpulsesuite.pulsegenerator.SquarePulse(x: numpy.ndarray, FWHM: float) numpy.ndarray

Rectangular (top-hat) pulse of width FWHM.

Parameters:
  • x (ndarray) – Coordinate array.

  • FWHM (float) – Full width.

pulsesuite.libpulsesuite.pulsegenerator.FilePulse(fn: str, X: numpy.ndarray) numpy.ndarray

Load a pulse profile from a text file and interpolate onto X.

The file must be a whitespace-delimited matrix where: - column 0 = coordinate - column 1 = real part (or amplitude) - column 2 = imaginary part (optional)

Uses np.loadtxt (replaces Fortran readmatrix from fileio).

Parameters:
  • fn (str) – Path to the data file.

  • X (ndarray) – Target coordinate grid.

pulsesuite.libpulsesuite.pulsegenerator.pulsegen(shp: str, FWHM: float, X: numpy.ndarray | None = None, N: int | None = None, dx: float | None = None) numpy.ndarray

Generate a pulse envelope.

Mirrors the Fortran pulsegen interface (pulsegen1 / pulsegen2).

  • If X is given, evaluates the envelope at those coordinates.

  • If N and dx are given, builds a centred grid first.

Parameters:
  • shp (str) – Shape identifier: "gauss", "sech2", "square", or "file:<path>" to read from a data file.

  • FWHM (float) – Full width at half maximum.

  • X (ndarray, optional) – Coordinate array (pulsegen2 path).

  • N (int, optional) – Number of grid points (pulsegen1 path).

  • dx (float, optional) – Grid spacing (pulsegen1 path).

Returns:

Y – Pulse envelope on the grid.

Return type:

ndarray of complex128

pulsesuite.libpulsesuite.pulsegenerator.multipulsegen(shp: str, t0: float, t: numpy.ndarray, sep: float, num: int) numpy.ndarray

Generate a train of 2 or 3 identical pulses.

Parameters:
  • shp (str) – "gauss" for Gaussian envelopes, "sech" for sech envelopes, "uneven2a" / "uneven2b" for asymmetric two-pulse trains.

  • t0 (float) – Pulse duration parameter (1/e half-width for Gaussian, t0 for sech).

  • t (ndarray) – Time grid.

  • sep (float) – Centre-to-centre separation between adjacent pulses.

  • num (int) – Number of pulses (2 or 3).

Returns:

Y – Envelope on the time grid.

Return type:

ndarray of complex128