at.physics.nonlinear#

Non-linear optics

Functions

detuning(ring[, xm, ym, npoints, nturns])

Computes the tunes for a sequence of amplitudes

chromaticity(ring[, method, dpm, npoints, ...])

Computes the non-linear chromaticities

gen_detuning_elem(ring[, orbit])

Generates a detuning element

tunes_vs_amp(ring[, amp, dim, nturns])

Generates a range of tunes for varying x, y, or z amplitudes

chromaticity(ring, method='linopt', dpm=0.02, npoints=11, order=3, dp=0, **kwargs)[source]#

Computes the non-linear chromaticities

This function computes the tunes for the specified momentum offsets. Then it fits this data and returns the chromaticity up to the given order (npoints>order)

Parameters:
  • ring (Lattice) – Lattice description

  • method (str | None) –

    'linopt' (dfault) returns the tunes from the linopt6() function,

    'fft' tracks a single particle and computes the tunes with fft,

    'laskar' tracks a single particle and computes the tunes with NAFF.

  • dpm (float | None) – Maximum momentum deviation

  • npoints (int | None) – Number of momentum deviations

  • order (int | None) – Order of the fit

  • dp (float | None) – Central momentum deviation

Returns:
  • fit (ndarray) – Horizontal Vertical polynomial coefficients from numpy.polyfit of shape (2, order+1)

  • dpa – dp array of shape (npoints,)

  • qz – tune array of shape (npoints, 2)

detuning(ring, xm=3e-05, ym=3e-05, npoints=3, nturns=512, **kwargs)[source]#

Computes the tunes for a sequence of amplitudes

This function uses tunes_vs_amp() to compute the tunes for the specified amplitudes. Then it fits this data and returns the detuning coefficiant dQx/dx, dQy/dx, dQx/dy, dQy/dy and the qx, qy arrays versus x, y arrays

Parameters:
  • ring (Lattice) – Lattice description

  • xm (float | None) – Maximum x amplitude

  • ym (float | None) – Maximum y amplitude

  • npoints (int | None) – Number of points in each plane

  • nturns (int | None) – Number of turns for tracking

  • method'laskar' or 'fft'. Default: 'laskar'

  • num_harmonics – Number of harmonic components to compute (before mask applied)

  • fmin – Lower bound for tune

  • fmax – Upper bound for tune

  • hann – Turn on Hanning window. Default: False

Returns:
  • q0 (ndarray) – qx, qy from horizontal and vertical amplitude scans. Fit results with shape (2, 2)

  • q1 (ndarray) – Amplitude detuning coefficients with shape (2, 2) [[dQx/dx, dQy/dx], [dQx/dy, dQy/dy]]

  • x (ndarray) – x amplitudes (npoints, )

  • q_dx (ndarray) – qx, qy tunes as a function of x amplitude (npoints, 2)

  • y (ndarray) – y amplitudes (npoints, )

  • q_dy (ndarray) – qx, qy tunes as a function of y amplitude (npoints, 2)

gen_detuning_elem(ring, orbit=None)[source]#

Generates a detuning element

Parameters:
  • ring (Lattice) – Lattice description

  • orbit (ndarray | None) – Avoids looking for initial the closed orbit if it is already known ((6,) array).

Returns:

detuneElem – Element reproducing the detuning of the ring with amplitude and momentum

tunes_vs_amp(ring, amp=None, dim=0, nturns=512, **kwargs)[source]#

Generates a range of tunes for varying x, y, or z amplitudes

Parameters:
  • ring (Lattice) – Lattice description

  • amp (Sequence[float] | None) – Oscillation amplitude. If amp is None the tunes are calculated from linopt6() else tracking is used

  • dim (int | None) – Coordinate index of the oscillation

  • nturns (int | None) – Number of turns

  • method'laskar' or 'fft'. Default: 'laskar'

  • num_harmonics – Number of harmonic components to compute (before mask applied)

  • fmin – Lower bound for tune

  • fmax – Upper bound for tune

  • hann – Turn on Hanning window. Default: False

Returns:

tunes (ndarray) – Array of tunes qx, qy with shape (len(amp), 2)