# Thread: Bivariate gaussians for ion beam optics

1. Hello,

here is something that's been bothering me for a while:
say I have a charged particle beam that can be described by one bivariate Gaussian in X dimension and another bivariate Gaussian in Y dimension. The parameters of the bivariate gaussian are the position (X) of an individual particle and the projection of the tangent of the angle onto the X axis (Xnu). The angle and position can be correlated, hence the covariance between X and Xnu may be not zero. The same for the Y axis: Y and Ynu. Each distribution is characterized by its own variance, so there are var(X), var(Xnu), var(Y), and var(Ynu) as well as cov(x,Xnu), cov(Y,Ynu). Covariance between X and Y is not accounted for but also not important in this problem.

Now, I would like to experimentally measure the beam spot size and I have two available techniques:
(1) a 2D scintillation screen that gives me X,Y map of beam intensities in the plane perpendicular to XY
(2) a pinhole detector that moves along X or Y to collect the beam profile. Neither of the two detectors gives the particle direction information.

In (1) I get the map of the intensities and fit 2D gaussian in X and Y to give me var(X) and var(Y) (actually I'm after beam spot sizes, so sqrt(var(X)) and sqrt(var(Y))).
In (2) I get a profile that typically runs across the center of the spot along X and Y directions, so for Y=0 and X=0, respectively. These are the 'conditional' profiles and they should also give me the same values for var(X) and var(Y).

Should or should not?

I looked into a statistics textbook and found the proof that the variance of a projected bivariate gaussian (which is what I measure by fitting the 2D gaussian in (1)) and the conditional gaussian (which is what I get from my experiment in (2)) should be equal.
I also found that in the beam optics physics literature there is a distinction between the 'conditional' (aka plane) and the 'projected' (aka space) beam spot standard deviations. The article that I've found says that the conditional beam spot size is sqrt(2) times bigger than the projected beam spot size (variance(conditional) = 2* variance (projected)).

I'm confused. Are the variances equal or are they not? Your input is appreciated.

LinguisticM  2. Originally Posted by LinguisticM Hello,

here is something that's been bothering me for a while:
say I have a charged particle beam that can be described by one bivariate Gaussian in X dimension and another bivariate Gaussian in Y dimension. The parameters of the bivariate gaussian are the position (X) of an individual particle and the projection of the tangent of the angle onto the X axis (Xnu).
I have no idea what the "projection of the tangent of the angle on the X axis" is supposed to mean. One cannot generally project the tangent of "the angle". If, as I suspect the angle in question is the angle between the vector connecting your point to the origin and the x-axis then the desired projection is simply the length of the vector (the radial distance from the origin) time the cosine of the angle.

What might make sense is to project the position onto the X axis, or in other words take the x-coordinate of the point in question. Is this what you mean ? If so it would make sense to simply let X be the random variable that is the x-coordinate.

Moreover, a random variable is, by definition, a scalar-valued function defined on a probability space, whereas using your literal words X is a vector-valued function. This is important since to have a bivariate Gaussian random variable you start out with a vector valued function and then require that for any fixed vector a the random variable that is the inner product <a,x> be normally distributed as a univariate random variable. In other words every linear combination of X and Y is to be normally distributed. For this to happen, X and Y are assumed to be jointly normally distributed, theyneed to be independent. I see no reason why they should not be.

Ditto for Y (using the sine rather than the cosine), which as you describe it is also position, and hence the same thing as X, though one might suppose that your intent is for Y to give you the Y coordinate.

Thus, if I interpret what you are trying to do correctly, you really have two random variables X, the x-coordinate and Y, the y-coordinate that together give you the random vector (X,Y) that you intend to have a bivariate normal distribution. Originally Posted by LinguisticM The angle and position can be correlated, hence the covariance between X and Xnu may be not zero. The same for the Y axis: Y and Ynu. Each distribution is characterized by its own variance, so there are var(X), var(Xnu), var(Y), and var(Ynu) as well as cov(x,Xnu), cov(Y,Ynu). Covariance between X and Y is not accounted for but also not important in this problem.
Not only can the angle and position be correlated, one would expect that to be the case. In fact, if your spot is radially symmetric one would expect the distribution to be dependent on the radial distance from the center, i.e. a function of [tex[x^2+y^2[/tex] alone. Note that in this case that the two variances would be equal (i.e. ). Originally Posted by LinguisticM Now, I would like to experimentally measure the beam spot size and I have two available techniques:
(1) a 2D scintillation screen that gives me X,Y map of beam intensities in the plane perpendicular to XY
(2) a pinhole detector that moves along X or Y to collect the beam profile. Neither of the two detectors gives the particle direction information.

In (1) I get the map of the intensities and fit 2D gaussian in X and Y to give me var(X) and var(Y) (actually I'm after beam spot sizes, so sqrt(var(X)) and sqrt(var(Y))).
In (2) I get a profile that typically runs across the center of the spot along X and Y directions, so for Y=0 and X=0, respectively. These are the 'conditional' profiles and they should also give me the same values for var(X) and var(Y).
Ok since as noted earlier we are assuming that X and Y are independent experiment 2 gives you the distribution of X and Y separately and from that one gets their joint distribution. In essence what this gives you is their variance since you know that the mean is 0 (by fiat due to the selection of what you call the center of the spot). The joint distribution calculated from this data will be Experiment 1 appears to be more meaningful, since it takes data from samples over the entire plane of the detector screen. But in fact, if the assumption of independence of X and Y holds it really gives no more information than does experiment 2. What it does do is give some additional empirical data with which to test the assumption that X and Y are independent (i.e. to find hot spots or cold spots in the beam profile). If X any are independent you should a density that looks like which is the same as above. Now, in an actual experiment you may find some small deviations between experiment 1 and 2 in the calculated variances, but that is due to the experiment and the fact that you are using sample variances rather than true population variances.

Note that if your distribution is radially symmetric then and you will have the distribution  Originally Posted by LinguisticM Should or should not?

I looked into a statistics textbook and found the proof that the variance of a projected bivariate gaussian (which is what I measure by fitting the 2D gaussian in (1)) and the conditional gaussian (which is what I get from my experiment in (2)) should be equal.
I also found that in the beam optics physics literature there is a distinction between the 'conditional' (aka plane) and the 'projected' (aka space) beam spot standard deviations. The article that I've found says that the conditional beam spot size is sqrt(2) times bigger than the projected beam spot size (variance(conditional) = 2* variance (projected)).

I'm confused. Are the variances equal or are they not? Your input is appreciated.

LinguisticM
Should or should not what ?

Note that we are talking about 2 variances in each case, not just one.

I am having trouble understanding what the difference ought to be between the projected beam spot size and the "conditionial beam spot size. If you had a radially symmetric beam centered on the origin, then just on physical grounds it seems to me that the spot size, by any reasonable definition would be the same -- and it would simply be the number of standard deviations that you define the size to be taken along any radial line through the origin, including either of the coordinate axes.

It might be useful, if this does not settle the problem, for you to ask it again, but with mathematics and sketches to indicate precisely what you are talking about.  3. Originally Posted by DrRocket I have no idea what the "projection of the tangent of the angle on the X axis" is supposed to mean.

Thus, if I interpret what you are trying to do correctly, you really have two random variables X, the x-coordinate and Y, the y-coordinate that together give you the random vector (X,Y) that you intend to have a bivariate normal distribution.
My sentence was indeed not precise.
X is the position of the particle and thetaX comes from the direction of motion of the particle. This is the angle between the projection of the momentum vector onto the Y=0 plane and the Z direction. If theta and phi are the polar and azimutal angles in the spherical coordinate system, respectively, then the thetaX is:

thetaX = tan(theta)cos(phi)

Including Y and thetaY, there are altogether four random variables in this problem.

Since the correlation between X and Y is not the main focus here, one can treat X and Y as uncorrelated and use only two bivariate distributions to describe the beam profile i.e. one distribution with X,Xtheta and the other with Y,Ytheta. Originally Posted by DrRocket Not only can the angle and position be correlated, one would expect that to be the case. In fact, if your spot is radially symmetric one would expect the distribution to be dependent on the radial distance from the center, i.e. a function of [tex[x^2+y^2[/tex] alone. Note that in this case that the two variances would be equal (i.e. ).
Position and angle may or may not be correlated depending on e.g. if beamline focusing quadrupoles are active upstream of the measurement plane, the amount of material that the beam has traversed thereby losing the angle-position dependence as a result of multiple Coulomb scattering process. X and Y position parameters may also be correlated, which results in a rotated elliptical shape of the beam spot, and this is usually not desired. In this case I can see how the 'projected' and 'conditional' variances would be different, but this is dependent of the covariance and contrary to what I can find in the literature (see below). Originally Posted by DrRocket I am having trouble understanding what the difference ought to be between the projected beam spot size and the "conditionial beam spot size. If you had a radially symmetric beam centered on the origin, then just on physical grounds it seems to me that the spot size, by any reasonable definition would be the same -- and it would simply be the number of standard deviations that you define the size to be taken along any radial line through the origin, including either of the coordinate axes.

It might be useful, if this does not settle the problem, for you to ask it again, but with mathematics and sketches to indicate precisely what you are talking about.

Let me try explaining with words. If this won't work then I'll make some sketches.
This is an excerpt that discusses the difference between the conditional and projected quantities:

<quote start>
1/(2*Pi*sqrt(d))*exp(-1/2*((a*thetaX^2-2*b*X*thetaX+c*X^2)/d)
Random variables x and thetaX are projected, or 'plane' variables. For example, x is the x coordinate of the random variable r. The variance of x, denoted a, is however different from what would be measured in a typical beam pro file measurement. In a such a measurement, assuming measurement in x direction along the y = 0 line, one obtains a conditional probability distribution of x coordinate with the condition y = 0. This is not the same as the probability distribution for the x coordinate; they are both Gaussians, but the variance of the conditional is larger by a factor of 2. Sometimes such conditional variables are called 'space' variables
<quote end>

"d" above is the determinant of the covariance matrix.

<quote start>
At any x we can also calculate a scattering power
T= d<theta^2>/dx
the rate of increase with x of the mean squared projected multiple Coulomb scattering MCS angle. In the early literature, T is the rate of increase in the mean squared space angle, which is greater by a factor 2. In transport calculations projected quantities are usually more convenient.
<quote end>

The above is another example. This time it refers to the angle thetaX.

Does this shed some light?  4. Originally Posted by LinguisticM My sentence was indeed not precise.
X is the position of the particle and thetaX comes from the direction of motion of the particle. This is the angle between the projection of the momentum vector onto the Y=0 plane and the Z direction. If theta and phi are the polar and azimutal angles in the spherical coordinate system, respectively, then the thetaX is:

thetaX = tan(theta)cos(phi)

Including Y and thetaY, there are altogether four random variables in this problem.

Since the correlation between X and Y is not the main focus here, one can treat X and Y as uncorrelated and use only two bivariate distributions to describe the beam profile i.e. one distribution with X,Xtheta and the other with Y,Ytheta.

Position and angle may or may not be correlated depending on e.g. if beamline focusing quadrupoles are active upstream of the measurement plane, the amount of material that the beam has traversed thereby losing the angle-position dependence as a result of multiple Coulomb scattering process. X and Y position parameters may also be correlated, which results in a rotated elliptical shape of the beam spot, and this is usually not desired. In this case I can see how the 'projected' and 'conditional' variances would be different, but this is dependent of the covariance and contrary to what I can find in the literature (see below).

Let me try explaining with words. If this won't work then I'll make some sketches.
This is an excerpt that discusses the difference between the conditional and projected quantities:

<quote start>
1/(2*Pi*sqrt(d))*exp(-1/2*((a*thetaX^2-2*b*X*thetaX+c*X^2)/d)
Random variables x and thetaX are projected, or 'plane' variables. For example, x is the x coordinate of the random variable r. The variance of x, denoted a, is however different from what would be measured in a typical beam profile measurement. In a such a measurement, assuming measurement in x direction along the y = 0 line, one obtains a conditional probability distribution of x coordinate with the condition y = 0. This is not the same as the probability distribution for the x coordinate; they are both Gaussians, but the variance of the conditional is larger by a factor of 2. Sometimes such conditional variables are called 'space' variables
<quote end>

"d" above is the determinant of the covariance matrix.

<quote start>
At any x we can also calculate a scattering power
T= d<theta^2>/dx
the rate of increase with x of the mean squared projected multiple Coulomb scattering MCS angle. In the early literature, T is the rate of increase in the mean squared space angle, which is greater by a factor 2. In transport calculations projected quantities are usually more convenient.
<quote end>

The above is another example. This time it refers to the angle thetaX.

Does this shed some light?
It might a help a bit if you went the trouble of using the LaTex function to make your mathematics a bit more clear, but I doubt that would be enough. I am not a specialist in particle beam design, and find it difficult to follow your explanation. For instance, I have no idea how you are tracking particle direction at your screen or why you care if your objective is to measure spot size.

I am afraid that this is the sort of problem that would be more easily solved with some knowledgeable group of people able to work at a chalk board, and discuss the problem in detail. It is strikes me as rather difficult to communicate adequately in this venue, at least not without a lot more work and offline sketching and calculation that I am willing to do at the moment.

You might benefit from working through the details of multivariate distributions in detail, using a good, rigorous, statistics text. Such texts can be difficult to find. One that I usually like is Mathematical Statistics by B.L. van der Waerden.  Posting Permissions
 You may not post new threads You may not post replies You may not post attachments You may not edit your posts   BB code is On Smilies are On [IMG] code is On [VIDEO] code is On HTML code is Off Trackbacks are Off Pingbacks are Off Refbacks are On Forum Rules