Skip to content

Commit

Permalink
Rename sigma to lambda where not stddev (#552)
Browse files Browse the repository at this point in the history
* Rename sigma to lambda where not stddev

This commit replaces (hopefully) all occurrences of sigma<...> as input to
particle distributions with lambda<...> since the parameter describes the
axis intercepts of the phase space ellipse and is only identical to the RMS
extents when there is no correlation between q (position) and p (momentum).

* Apply changes after rebase

Changed PyTorch 15-stage example needed sigma->lambda
  • Loading branch information
n01r authored Mar 26, 2024
1 parent 9fd9b90 commit 39b6f70
Show file tree
Hide file tree
Showing 100 changed files with 693 additions and 693 deletions.
6 changes: 3 additions & 3 deletions docs/source/theory/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ The first option is to characterize the distribution via the intersections of th
.. math::
\begin{align}
\sigma_q &= \sqrt{\frac{\epsilon}{\gamma}} \\
\sigma_p &= \sqrt{\frac{\epsilon}{\beta}} \\
\lambda_q &= \sqrt{\frac{\epsilon}{\gamma}} \\
\lambda_p &= \sqrt{\frac{\epsilon}{\beta}} \\
\mu_{qp} &= \frac{\alpha}{\sqrt{\beta \gamma}}
\end{align}
The units are :math:`[\sigma_q] = \mathrm{m}`, :math:`[\sigma_p] = \mathrm{rad}`, and :math:`[\mu_{qp}] = 1`.
The units are :math:`[\lambda_q] = \mathrm{m}`, :math:`[\lambda_p] = \mathrm{rad}`, and :math:`[\mu_{qp}] = 1`.
To convert between normalized and unnormalized emittance, use the relation :math:`\epsilon_\mathrm{n} = (\beta\gamma)_\mathrm{ref} \cdot \epsilon` which uses the momentum of the reference particle.
**Attention**: Here, :math:`(\beta\gamma)_\mathrm{ref}` are the Lorentz variables for the reference particle momentum and not the Courant-Snyder parameters.

Expand Down
12 changes: 6 additions & 6 deletions docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ Initial Beam Distributions

* Parameters that describe the phase space ellipse and position-momentum correlations:

* ``beam.sigmaX`` (``float``, in meters) phase space ellipse intersection with X
* ``beam.sigmaY`` (``float``, in meters) phase space ellipse intersection with Y
* ``beam.sigmaT`` (``float``, in meters) phase space ellipse intersection with T, normalized by multiplying with the speed of light *c*
* ``beam.sigmaPx`` (``float``, in radians) phase space ellipse intersection with Px
* ``beam.sigmaPy`` (``float``, in radians) phase space ellipse intersection with Py
* ``beam.sigmaPt`` (``float``, in radians) phase space ellipse intersection with Pt
* ``beam.lambdaX`` (``float``, in meters) phase space ellipse intersection with X
* ``beam.lambdaY`` (``float``, in meters) phase space ellipse intersection with Y
* ``beam.lambdaT`` (``float``, in meters) phase space ellipse intersection with T, normalized by multiplying with the speed of light *c*
* ``beam.lambdaPx`` (``float``, in radians) phase space ellipse intersection with Px
* ``beam.lambdaPy`` (``float``, in radians) phase space ellipse intersection with Py
* ``beam.lambdaPt`` (``float``, in radians) phase space ellipse intersection with Pt
* ``beam.muxpx`` (``float``, dimensionless, default: ``0``) correlation X-Px
* ``beam.muypy`` (``float``, dimensionless, default: ``0``) correlation Y-Py
* ``beam.mutpt`` (``float``, dimensionless, default: ``0``) correlation T-Pt
Expand Down
26 changes: 13 additions & 13 deletions docs/source/usage/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -379,33 +379,33 @@ This module provides particle beam distributions that can be used to initialize
.. py:module:: impactx.distribution
:synopsis: Particle beam distributions in ImpactX

.. py:class:: impactx.distribution.Gaussian(sigx, sigy, sigt, sigpx, sigpy, sigpt, muxpx=0.0, muypy=0.0, mutpt=0.0)
.. py:class:: impactx.distribution.Gaussian(lambdax, lambday, lambdat, lambdapx, lambdapy, lambdapt, muxpx=0.0, muypy=0.0, mutpt=0.0)
A 6D Gaussian distribution.

:param sigx: for zero correlation, these are the related RMS sizes (in meters)
:param sigy: see sigx
:param sigt: see sigx
:param sigpx: RMS momentum
:param sigpy: see sigpx
:param sigpt: see sigpx
:param lambdax: phase space position axis intercept; for zero correlation, these are the related RMS sizes (in meters)
:param lambday: see lambdax
:param lambdat: see lambdax
:param lambdapx: phase space momentum axis intercept; for zero correlation, these are the related normalized RMS momenta (in radians)
:param lambdapy: see lambdapx
:param lambdapt: see lambdapx
:param muxpx: correlation length-momentum
:param muypy: see muxpx
:param mutpt: see muxpx

.. py:class:: impactx.distribution.Kurth4D(sigx, sigy, sigt, sigpx, sigpy, sigpt, muxpx=0.0, muypy=0.0, mutpt=0.0)
.. py:class:: impactx.distribution.Kurth4D(lambdax, lambday, lambdat, lambdapx, lambdapy, lambdapt, muxpx=0.0, muypy=0.0, mutpt=0.0)
A 4D Kurth distribution transversely + a uniform distribution
in t + a Gaussian distribution in pt.

.. py:class:: impactx.distribution.Kurth6D(sigx, sigy, sigt, sigpx, sigpy, sigpt, muxpx=0.0, muypy=0.0, mutpt=0.0)
.. py:class:: impactx.distribution.Kurth6D(lambdax, lambday, lambdat, lambdapx, lambdapy, lambdapt, muxpx=0.0, muypy=0.0, mutpt=0.0)
A 6D Kurth distribution.

R. Kurth, Quarterly of Applied Mathematics vol. 32, pp. 325-329 (1978)
C. Mitchell, K. Hwang and R. D. Ryne, IPAC2021, WEPAB248 (2021)

.. py:class:: impactx.distribution.KVdist(sigx, sigy, sigt, sigpx, sigpy, sigpt, muxpx=0.0, muypy=0.0, mutpt=0.0)
.. py:class:: impactx.distribution.KVdist(lambdax, lambday, lambdat, lambdapx, lambdapy, lambdapt, muxpx=0.0, muypy=0.0, mutpt=0.0)
A K-V distribution transversely + a uniform distribution
in t + a Gaussian distribution in pt.
Expand All @@ -414,18 +414,18 @@ This module provides particle beam distributions that can be used to initialize
This distribution sets all values to zero.

.. py:class:: impactx.distribution.Semigaussian(sigx, sigy, sigt, sigpx, sigpy, sigpt, muxpx=0.0, muypy=0.0, mutpt=0.0)
.. py:class:: impactx.distribution.Semigaussian(lambdax, lambday, lambdat, lambdapx, lambdapy, lambdapt, muxpx=0.0, muypy=0.0, mutpt=0.0)
A 6D Semi-Gaussian distribution (uniform in position, Gaussian in momentum).

.. py:class:: impactx.distribution.Triangle(sigx, sigy, sigt, sigpx, sigpy, sigpt, muxpx=0.0, muypy=0.0, mutpt=0.0)
.. py:class:: impactx.distribution.Triangle(lambdax, lambday, lambdat, lambdapx, lambdapy, lambdapt, muxpx=0.0, muypy=0.0, mutpt=0.0)
A triangle distribution for laser-plasma acceleration related applications.

A ramped, triangular current profile with a Gaussian energy spread (possibly correlated).
The transverse distribution is a 4D waterbag.

.. py:class:: impactx.distribution.Waterbag(sigx, sigy, sigt, sigpx, sigpy, sigpt, muxpx=0.0, muypy=0.0, mutpt=0.0)
.. py:class:: impactx.distribution.Waterbag(lambdax, lambday, lambdat, lambdapx, lambdapy, lambdapt, muxpx=0.0, muypy=0.0, mutpt=0.0)
A 6D Waterbag distribution.

Expand Down
12 changes: 6 additions & 6 deletions examples/alignment/input_alignment.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ beam.kin_energy = 2.0e3
beam.charge = 1.0e-9
beam.particle = proton
beam.distribution = waterbag
beam.sigmaX = 1.16098260008648811e-3
beam.sigmaY = 1.16098260008648811e-3
beam.sigmaT = 1.0e-3
beam.sigmaPx = 0.580491300043e-3
beam.sigmaPy = 0.580491300043e-3
beam.sigmaPt = 2.0e-3
beam.lambdaX = 1.16098260008648811e-3
beam.lambdaY = 1.16098260008648811e-3
beam.lambdaT = 1.0e-3
beam.lambdaPx = 0.580491300043e-3
beam.lambdaPy = 0.580491300043e-3
beam.lambdaPt = 2.0e-3
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0
Expand Down
12 changes: 6 additions & 6 deletions examples/alignment/run_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@

# particle bunch
distr = distribution.Waterbag(
sigmaX=1.16098260008648811e-3,
sigmaY=1.16098260008648811e-3,
sigmaT=1.0e-3,
sigmaPx=0.580491300043e-3,
sigmaPy=0.580491300043e-3,
sigmaPt=2.0e-3,
lambdaX=1.16098260008648811e-3,
lambdaY=1.16098260008648811e-3,
lambdaT=1.0e-3,
lambdaPx=0.580491300043e-3,
lambdaPy=0.580491300043e-3,
lambdaPt=2.0e-3,
muxpx=0.0,
muypy=0.0,
mutpt=0.0,
Expand Down
12 changes: 6 additions & 6 deletions examples/aperture/input_aperture.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ beam.kin_energy = 250.0
beam.charge = 1.0e-9
beam.particle = proton
beam.distribution = waterbag
beam.sigmaX = 1.559531175539e-3
beam.sigmaY = 2.205510139392e-3
beam.sigmaT = 1.0e-3
beam.sigmaPx = 6.41218345413e-4
beam.sigmaPy = 9.06819680526e-4
beam.sigmaPt = 1.0e-3
beam.lambdaX = 1.559531175539e-3
beam.lambdaY = 2.205510139392e-3
beam.lambdaT = 1.0e-3
beam.lambdaPx = 6.41218345413e-4
beam.lambdaPy = 9.06819680526e-4
beam.lambdaPt = 1.0e-3
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0
Expand Down
12 changes: 6 additions & 6 deletions examples/aperture/run_aperture.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@

# particle bunch
distr = distribution.Waterbag(
sigmaX=1.559531175539e-3,
sigmaY=2.205510139392e-3,
sigmaT=1.0e-3,
sigmaPx=6.41218345413e-4,
sigmaPy=9.06819680526e-4,
sigmaPt=1.0e-3,
lambdaX=1.559531175539e-3,
lambdaY=2.205510139392e-3,
lambdaT=1.0e-3,
lambdaPx=6.41218345413e-4,
lambdaPy=9.06819680526e-4,
lambdaPt=1.0e-3,
)
sim.add_particles(bunch_charge_C, distr, npart)

Expand Down
12 changes: 6 additions & 6 deletions examples/apochromatic/input_apochromatic.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ beam.kin_energy = 100.0e3 # 100 GeV nominal energy
beam.charge = 1.0e-9
beam.particle = electron
beam.distribution = gaussian
beam.sigmaX = 1.288697604e-6
beam.sigmaY = 1.288697604e-6
beam.sigmaT = 1.0e-6
beam.sigmaPx = 3.965223396e-6
beam.sigmaPy = 3.965223396e-6
beam.sigmaPt = 0.01 #1% energy spread
beam.lambdaX = 1.288697604e-6
beam.lambdaY = 1.288697604e-6
beam.lambdaT = 1.0e-6
beam.lambdaPx = 3.965223396e-6
beam.lambdaPy = 3.965223396e-6
beam.lambdaPt = 0.01 #1% energy spread
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0
Expand Down
12 changes: 6 additions & 6 deletions examples/apochromatic/input_apochromatic_pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ beam.kin_energy = 100.0e3 # 100 GeV nominal energy
beam.charge = 1.0e-9
beam.particle = electron
beam.distribution = gaussian
beam.sigmaX = 1.288697604e-6
beam.sigmaY = 1.288697604e-6
beam.sigmaT = 1.0e-6
beam.sigmaPx = 3.965223396e-6
beam.sigmaPy = 3.965223396e-6
beam.sigmaPt = 0.01 #1% energy spread
beam.lambdaX = 1.288697604e-6
beam.lambdaY = 1.288697604e-6
beam.lambdaT = 1.0e-6
beam.lambdaPx = 3.965223396e-6
beam.lambdaPy = 3.965223396e-6
beam.lambdaPt = 0.01 #1% energy spread
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0
Expand Down
12 changes: 6 additions & 6 deletions examples/apochromatic/run_apochromatic.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

# particle bunch
distr = distribution.Gaussian(
sigmaX=1.288697604e-6,
sigmaY=1.288697604e-6,
sigmaT=1.0e-6,
sigmaPx=3.965223396e-6,
sigmaPy=3.965223396e-6,
sigmaPt=0.01, # 1% energy spread
lambdaX=1.288697604e-6,
lambdaY=1.288697604e-6,
lambdaT=1.0e-6,
lambdaPx=3.965223396e-6,
lambdaPy=3.965223396e-6,
lambdaPt=0.01, # 1% energy spread
muxpx=0.0,
muypy=0.0,
mutpt=0.0,
Expand Down
12 changes: 6 additions & 6 deletions examples/apochromatic/run_apochromatic_pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

# particle bunch
distr = distribution.Gaussian(
sigmaX=1.288697604e-6,
sigmaY=1.288697604e-6,
sigmaT=1.0e-6,
sigmaPx=3.965223396e-6,
sigmaPy=3.965223396e-6,
sigmaPt=0.01, # 1% energy spread
lambdaX=1.288697604e-6,
lambdaY=1.288697604e-6,
lambdaT=1.0e-6,
lambdaPx=3.965223396e-6,
lambdaPy=3.965223396e-6,
lambdaPt=0.01, # 1% energy spread
muxpx=0.0,
muypy=0.0,
mutpt=0.0,
Expand Down
2 changes: 1 addition & 1 deletion examples/cfbend/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ C. Steier et al, "Status of the Conceptual Design of ALS-U", IPAC2017, WEPAB104,

A 2 GeV electron bunch with normalized transverse rms emittance of 50 pm undergoes a 3.76 deg bend.

In this test, the initial and final values of :math:`\sigma_x`, :math:`\sigma_y`, :math:`\sigma_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree with nominal values.
In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree with nominal values.


Run
Expand Down
12 changes: 6 additions & 6 deletions examples/cfbend/input_cfbend.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ beam.kin_energy = 2.0e3 #2 GeV
beam.charge = 1.0e-9
beam.particle = electron
beam.distribution = waterbag
beam.sigmaX = 5.0e-6 #5 um
beam.sigmaY = 8.0e-6 #8 um
beam.sigmaT = 0.0599584916 #200 ps
beam.sigmaPx = 2.5543422003e-9 #exn = 50 pm-rad
beam.sigmaPy = 1.5964638752e-9 #eyn = 50 pm-rad
beam.sigmaPt = 9.0e-4 #approximately dE/E
beam.lambdaX = 5.0e-6 #5 um
beam.lambdaY = 8.0e-6 #8 um
beam.lambdaT = 0.0599584916 #200 ps
beam.lambdaPx = 2.5543422003e-9 #exn = 50 pm-rad
beam.lambdaPy = 1.5964638752e-9 #eyn = 50 pm-rad
beam.lambdaPt = 9.0e-4 #approximately dE/E
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0
Expand Down
12 changes: 6 additions & 6 deletions examples/cfbend/run_cfbend.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

# particle bunch
distr = distribution.Waterbag(
sigmaX=5.0e-6, # 5 um
sigmaY=8.0e-6, # 8 um
sigmaT=0.0599584916, # 200 ps
sigmaPx=2.5543422003e-9, # exn = 50 pm-rad
sigmaPy=1.5964638752e-9, # eyn = 50 pm-rad
sigmaPt=9.0e-4, # approximately dE/E
lambdaX=5.0e-6, # 5 um
lambdaY=8.0e-6, # 8 um
lambdaT=0.0599584916, # 200 ps
lambdaPx=2.5543422003e-9, # exn = 50 pm-rad
lambdaPy=1.5964638752e-9, # eyn = 50 pm-rad
lambdaPt=9.0e-4, # approximately dE/E
muxpx=0.0,
muypy=0.0,
mutpt=0.0,
Expand Down
12 changes: 6 additions & 6 deletions examples/cfbend/run_cfbend_madx.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@

# particle bunch
distr = distribution.Waterbag(
sigmaX=2.2951017632e-5,
sigmaY=1.3084093142e-5,
sigmaT=5.5555553e-8,
sigmaPx=1.598353425e-6,
sigmaPy=2.803697378e-6,
sigmaPt=2.000000000e-6,
lambdaX=2.2951017632e-5,
lambdaY=1.3084093142e-5,
lambdaT=5.5555553e-8,
lambdaPx=1.598353425e-6,
lambdaPy=2.803697378e-6,
lambdaPt=2.000000000e-6,
muxpx=0.933345606203060,
muypy=0.933345606203060,
mutpt=0.999999961419755,
Expand Down
12 changes: 6 additions & 6 deletions examples/cfchannel/input_cfchannel.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ beam.kin_energy = 2.0e3
beam.charge = 1.0e-9
beam.particle = proton
beam.distribution = waterbag
beam.sigmaX = 1.0e-3
beam.sigmaY = 1.0e-3
beam.sigmaT = 3.369701494258956e-4
beam.sigmaPx = 1.0e-3
beam.sigmaPy = 1.0e-3
beam.sigmaPt = 2.9676219145931020e-3
beam.lambdaX = 1.0e-3
beam.lambdaY = 1.0e-3
beam.lambdaT = 3.369701494258956e-4
beam.lambdaPx = 1.0e-3
beam.lambdaPy = 1.0e-3
beam.lambdaPt = 2.9676219145931020e-3
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0
Expand Down
12 changes: 6 additions & 6 deletions examples/cfchannel/input_cfchannel_10nC.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ beam.kin_energy = 2.0e3
beam.charge = 1.0e-8
beam.particle = proton
beam.distribution = waterbag
beam.sigmaX = 1.2154443728379865788e-3
beam.sigmaY = 1.2154443728379865788e-3
beam.sigmaT = 4.0956844276541331005e-4
beam.sigmaPx = 8.2274435782286157175e-4
beam.sigmaPy = 8.2274435782286157175e-4
beam.sigmaPt = 2.4415943602685364584e-3
beam.lambdaX = 1.2154443728379865788e-3
beam.lambdaY = 1.2154443728379865788e-3
beam.lambdaT = 4.0956844276541331005e-4
beam.lambdaPx = 8.2274435782286157175e-4
beam.lambdaPy = 8.2274435782286157175e-4
beam.lambdaPt = 2.4415943602685364584e-3


###############################################################################
Expand Down
12 changes: 6 additions & 6 deletions examples/cfchannel/run_cfchannel.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

# particle bunch
distr = distribution.Waterbag(
sigmaX=1.0e-3,
sigmaY=1.0e-3,
sigmaT=3.369701494258956e-4,
sigmaPx=1.0e-3,
sigmaPy=1.0e-3,
sigmaPt=2.9676219145931020e-3,
lambdaX=1.0e-3,
lambdaY=1.0e-3,
lambdaT=3.369701494258956e-4,
lambdaPx=1.0e-3,
lambdaPy=1.0e-3,
lambdaPt=2.9676219145931020e-3,
)
sim.add_particles(bunch_charge_C, distr, npart)

Expand Down
12 changes: 6 additions & 6 deletions examples/cfchannel/run_cfchannel_10nC.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@

# particle bunch
distr = distribution.Waterbag(
sigmaX=1.2154443728379865788e-3,
sigmaY=1.2154443728379865788e-3,
sigmaT=4.0956844276541331005e-4,
sigmaPx=8.2274435782286157175e-4,
sigmaPy=8.2274435782286157175e-4,
sigmaPt=2.4415943602685364584e-3,
lambdaX=1.2154443728379865788e-3,
lambdaY=1.2154443728379865788e-3,
lambdaT=4.0956844276541331005e-4,
lambdaPx=8.2274435782286157175e-4,
lambdaPy=8.2274435782286157175e-4,
lambdaPt=2.4415943602685364584e-3,
)
sim.add_particles(bunch_charge_C, distr, npart)

Expand Down
Loading

0 comments on commit 39b6f70

Please sign in to comment.