TeapotTuneAnalysisNode#

class orbit.diagnostics.TeapotTuneAnalysisNode(name='TeapotTuneAnalysis no name')[source]#

Bases: orbit.teapot.teapot.DriftTEAPOT

Estimates tunes from coordinates on neighboring turns.

This node computes the tunes and actions of each particle in the bunch. We use the Average Phase Advance (APA) method to estimate the tunes [1]. We use only a single turn rather than the average of multiple turns.

[1] https://cds.cern.ch/record/292773/files/p147.pdf [2] https://arxiv.org/pdf/1207.5526 [3] S. Y. Lee, Accelerator Physics

Methods Summary

activate()

rtype

None

deactivate()

rtype

None

getActions(bunch, index)

Return actions (J_1, J_2).

getData(bunch[, index])

Return tune and action data.

getNormMatrix()

rtype

ndarray

getTunes(bunch[, index])

Return fractional tunes (nu_1, nu_2).

setNormMatrix(norm_matrix)

rtype

None

setNormMatrixFromBunch(bunch[, dim])

Set normalization matrix from bunch covariance matrix.

setNormMatrixFromCovMatrix(cov_matrix)

Set normalization matrix from covariance matrix.

setNormMatrixFromTransferMatrix(transfer_matrix)

Set normalization matrix from transfer matrix.

setNormMatrixFromTwiss(betax, alphax, etax, ...)

Set normalization matrix from Twiss parameters (x, y) and dispersion.

setPosition(position)

rtype

None

track(params_dict)

The drift class implementation of the AccNodeBunchTracker class track(probe) method.

Methods Documentation

Parameters

name (str) –

Return type

None

activate()[source]#
Return type

None

deactivate()[source]#
Return type

None

getActions(bunch, index)[source]#

Return actions (J_1, J_2).

Parameters
  • bunch (Bunch) – Bunch object.

  • index (int) – Particle index (not ID).

Returns

Action (mode 1). J_2: Action (mode 2).

Return type

J_1

getData(bunch, index=None)[source]#

Return tune and action data.

Parameters
  • bunch (Bunch) – A Bunch object.

  • index (int) – Particle index. If None, return data for all particles.

Returns

Dictionary with the following keys:
  • ”phase_1”

  • ”phase_2”

  • ”tune_1”

  • ”tune_2”

  • ”action_1”

  • ”action_2”

  • ”action_3”

If index is provided, each value is a float. Otherwise each value is a list of floats. If the lattice is uncoupled, 1->x and 2->y.

Return type

data

getNormMatrix()[source]#
Return type

ndarray

getTunes(bunch, index=None)[source]#

Return fractional tunes (nu_1, nu_2).

Parameters
  • bunch (Bunch) – A Bunch object.

  • index (int) – Particle index (not ID).

Returns

Fractional tune (mode 1). tune_2: Fractional tune (mode 2).

Return type

tune_1

setNormMatrix(norm_matrix)[source]#
Return type

None

Parameters

norm_matrix (numpy.ndarray) –

setNormMatrixFromBunch(bunch, dim=4)[source]#

Set normalization matrix from bunch covariance matrix.

The bunch covariance matrix is calculated from the macroparticles.

Parameters
  • bunch (Bunch) – Bunch object with at least one macroparticle.

  • dim (int) –

Return type

None

setNormMatrixFromCovMatrix(cov_matrix)[source]#

Set normalization matrix from covariance matrix.

Assume that S = M S M^T, where S is the covariance matrix and M is the transfer matrix. Then M and SU (U is the Poisson matrix) have different eigenvalues but the same eigenvectors So we can compute the normalization matrix directly from SU, without knowing M.

I’m not sure how to order the eigenvectors of SU as there is no guaranteed ordering from np.linalg.eig. By default, we sort the eigenvectors of SU by their eigenvalues (eigenemittances), so the smallest eigenemittance is mode 1, the next is mode 2, and so on. So if you compare this method to setNormMatrixFromTransferMatrix, you may get {nu1, nu2} -> {nu2, nu1}.

This is only a problem in coupled lattices with 4D normalization. With 2D normalization there is no ambiguity. This function will check if there are off-block-diagonal terms in the covariance matrix to determine whether to use 2D or 4D normalization. norm_matrix = build_norm_matrix_from_cov(cov_matrix) self.setNormMatrix(norm_matrix)

Parameters

cov_matrix (ndarray) – 4x4 or 6x6 covariance matrix.

Return type

None

setNormMatrixFromTransferMatrix(transfer_matrix)[source]#

Set normalization matrix from transfer matrix.

Assumes transfer matrix is periodic and stable.

Parameters

transfer_matrix (ndarray) – 4x4 or 6x6 transfer matrix.

Return type

None

setNormMatrixFromTwiss(betax, alphax, etax, etapx, betay, alphay)[source]#

Set normalization matrix from Twiss parameters (x, y) and dispersion.

betax{y}: Beta parameter in x{y} plane. alphax{y}: Alpha parameter in x{y} plane. etax: Dispersion in x plane. etapx: Disperion prime in x plane.

Return type

None

Parameters
  • betax (float) –

  • alphax (float) –

  • etax (float) –

  • etapx (float) –

  • betay (float) –

  • alphay (float) –

setPosition(position)[source]#
Return type

None

Parameters

position (float) –

track(params_dict)[source]#

The drift class implementation of the AccNodeBunchTracker class track(probe) method.

Return type

None

Parameters

params_dict (dict) –