## Support #1589

Support #1588: Field Mapping Analysis

### FC1 Magnetic Axis

100%

**Description**

Finding the magnetic axis of FC1

**Files**

**Related issues**

#### Updated by Blackmore, Victoria almost 9 years ago

**File**FC1_run5_cartesianField.gif FC1_run5_cartesianField.gif added**File**FC1_run5_radialField.gif FC1_run5_radialField.gif added

Field components plotted as you travel through FC1 in polar and Cartesian co-ordinates. Each hall probe is represented by a different colour point.

Top row: Plots update at a specific slice of z

Bottom row: Plots accumulate information with increasing z

Purpose: in Cartesian co-ordinates, (x, Bx) and (y, By) follow a straight line which we can fit to find the axis. There is some deviation from this line at large (x, y) -- i.e. high radius Hall probes -- that needs accounting for (see later entries).

Uses: FC1, Run 5, 150A, Flip mode

#### Updated by Blackmore, Victoria almost 9 years ago

**File**axis_residuals.gif axis_residuals.gif added**File**figure_1.pdf figure_1.pdf added

Now fit a line through (x, Bx) and (y, By) at each slice of z.

Assume that each Hall probe is perfectly perpendicular to its measured co-ordinate (i.e. Bx is purely Bx and contains no mixed amount of other components). This is *not true* but will do as a first attempt.

- axis_residuals.gif
- At each slice through z, plot (x, Bx), (y, By) and (z, Bz) along the top row. The bottom right plot is (z, Bz) accumulating with increasing z.
- Top left, top middle: vertical red dotted line is the fitted position of the axis in x or y.
- Top left, top middle: red solid line is the best fit line through the data
- Bottom left, bottom right: The residual of B(x, y)_fitted - B(x, y) measured at each x (or y).

- figure_1.pdf
- The x and y axis co-ordinates vs. z, with 1-sigma error bars.
- Discontinuities are where the fitted line becomes (practically) horizontal, at the points where Bz is maximum (and turning over).

#### Updated by Blackmore, Victoria almost 9 years ago

Attached plot is from FC1, Run 6 -- also at 150A, but with only 7 measurements along z and a full rotation of the mapper at each point. There are some interesting correlations in the residuals. Either from tilts of the mapper carriage (and hence other components mixing in) or the probes themselves not being exactly perpendicular to the axis.

(NB: Only 6 z-coordinates in the plots -- known issue with iterating through data that's easily fixed later)

#### Updated by Blackmore, Victoria almost 9 years ago

**File**figure_3.pdf figure_3.pdf added

... and the axis results that correspond to #3.

(NB: Still in mapper co-ordinates, not FC co-ordinates)

#### Updated by Blackmore, Victoria almost 9 years ago

**File**test_magnet_pure.gif test_magnet_pure.gif added**File**test_magnet_mixed.gif test_magnet_mixed.gif added

Attempting to reproduce the "tan"-esque behaviour of the axis plots.

- Produce a FC-like test magnet, operating at 100A, centred on a similar region of z as the field maps of FC1 show (for a comparable z-axis).
- Find the axis of this pure, unadulterated test magnet field.
- Confirm that no "tan"-esque behaviour is observed.

- From the pure field, create a new
**mixed component**test magnetic map- For each probe, and (x, y, z) component of a probe, define the proportions of field that are mixed together as:
- alpha = major field component
- beta = minor field component to mix in
- gamma = minor field component to mix in

- Then:
- Bx_mixed = alpha*pure_Bx + beta*pure_By + gamma*pure_Bz
- By_mixed = beta*pure_Bx + alpha*pure_By + gamma*pure_Bz
- Bz_mixed = beta*pure_Bx + gamma*pure_By + alpha*pure_Bz

- Choose:
- alpha = 1.0 - beta - gamma
- beta = 1.0e-6
- gamma = 1.0e-6

- For each probe, and (x, y, z) component of a probe, define the proportions of field that are mixed together as:

Files: test_magnet_pure.gif shows field components as in item1 for the pure test field map, test_magnet_mixed.gif shows the mixed component test field map. NB: Both of them show some "bend" in the (x, Bx) and (y, By) plots as you get to the peaks in Bz.

#### Updated by Blackmore, Victoria almost 9 years ago

**File**figure_6.pdf figure_6.pdf added**File**figure_6b.pdf figure_6b.pdf added**File**test_mixing_x.pdf test_mixing_x.pdf added**File**test_mixing_y.pdf test_mixing_y.pdf added

- figure_6
- Top row: axis fit to pure test field map
- Bottom row: axis fit to mixed test field map
- Left: x axis
- Right: y axis
- Mixing: beta = 1e-6, gamma = 1e-6
- This and previous plots showing the axis fits assumed a Hall probe error of 20mT, which is a higher than reality (1--5mT depending on Hall probe).

- figure_6b
- Same as figure 6, but with Hall probe error of 5mT

- test_mixing_x
- Vary beta from 0--1e-4, and gamma from 0==1e-4, and explore how it affects the axis fit.
- Each figure has its value of beta & gamma in its title
- All plots are x-axis fits
- Hall probe error is 5mT
- (A2 sized plot.. so careful if printing)
- Note opposite direction of 'tan'-esque behaviour to that observed in real data (curious!)

- test_mixing_y
- Same as test_mixing_x, but for the y-axis.

#### Updated by Blackmore, Victoria almost 9 years ago

**File**test_neg_mixing_x_5mT.pdf test_neg_mixing_x_5mT.pdf added**File**test_neg_mixing_y_5mT.pdf test_neg_mixing_y_5mT.pdf added

Changing the sign of beta & gamma -- axis fit results now match the direction of data.

5mT Hall probe error assumed.

beta: 0--> - 1e-4

gamma: 0--> - 1e-6

alpha = 1 - beta - gamma, alpha >=1 in this case.

#### Updated by Blackmore, Victoria almost 9 years ago

**File**test_cross-product_mixing_x.pdf test_cross-product_mixing_x.pdf added**File**test_cross-product_mixing_y.pdf test_cross-product_mixing_y.pdf added

The more likely scenario is going to be a Hall probe (for example) pointing along x, and picking up components according to the cross-product of By & Bz (which will point along x).

So, sticking to the Bx example:

Bx_measured = alpha*pure_Bx - (gamma*pure_Bz + beta*pure_By)

--> Attached plots are for beta: 0-->1e-4, gamma: 0-->-1e-4

#### Updated by Rogers, Chris almost 9 years ago

Had a chat with Victoria to get the status

- Working on FC1
- Fancy gifs
- Plotting e.g. x vs Bx calculated in lab frame
- Checked that the Bx, By vs x, y is straight as a function of z - qualitative looks more-or-less okay
- Considered looking at Bphi doing "NAFF" like a Fourier Transform, did not get much out (Bphi vs r plot)
- Looked at error on fit, of order 40 mT looks systematic probe by probe, is it an error on the calibration or geometrical? Or something else?
- Basically the error on the fit is the main issue at present - there appears to be a geometrical issue.
- Could be the mapper plane is tilted - prime suspect
- Could be the probe is misaligned
- Could be the axes are not perpendicular
- Could be absolute calibration issue

- Running toy simulation to simulate errors - looks like errors come from a mapper plane tilt
- Error bars looks wrong

#### Updated by Blackmore, Victoria almost 9 years ago

**File**axis_fit.gif axis_fit.gif added**File**test_magnet_with_mixing_axis.pdf test_magnet_with_mixing_axis.pdf added**File**test_magnet_with_mixing_axis_zoom1.pdf test_magnet_with_mixing_axis_zoom1.pdf added**File**test_magnet_with_mixing_axis_zoom2.pdf test_magnet_with_mixing_axis_zoom2.pdf added

Correcting for field component mixing:

- Use same test magnet field as in entries #5, #6, #7

- Mix in gamma of 1.0e-4*Bz in both Bx and By

- No By mixed into Bx or vice versa (not dominant effect according to plots in #5, #6, #7 ---> Have tried, but don't see much of a difference in the outcome).

- Calculate (x0, y0, z0) axis as done previously, by looking at (x, Bx) etc.
- Assume that the magnetic axis is a straight line
- Different amounts of, or wearing down of, insulation might make this not
**exactly**true, but such effects are likely to be negligible - Coils are wound on same bobbin, so don't expect to see huge 'kinks' in the axis of one magnet

- Different amounts of, or wearing down of, insulation might make this not
- Can find best fit to the lines:
- x1 = m*z + c, where m = dx/dz etc
- y1 = n*z + d, where n = dy/dz etc
- Minimise (x - x0)^2, (y - y0)^2

- At each z, calculate the amount of measured Bz that we need to mix in to the x- and y-field components so that the axis might match the lines found from (3).
- x2 = -(c_x0 + gamma_x*Bz)/m_x0, where m_x0 = dBx/dx found from (1) etc.
- y2 = -(c_y0 + gamma_y*Bz)/m_y0, where m_y0 = dBy/dx found from (1) etc.
- Minimise (x2 - x1)^2, (y2 - y1)^2

- Using gamma_x and gamma_y, recalculate (x0, y0, z0) in the usual manner by looking at (x, Bx) and (y, By), except this time we have an additional component:
- Bx = m_x*x + c_x - alpha_x*Bz
- By = m_y*y + c_y - alpha_y*Bz
- Minimise (Bx - Bx_measured)^2, (By - By_measured)^2
- Fit gives m_x, m_y and c_x, c_y
- Rearrange for x3, y3
- Repeat from (2) until satisfied.

**axis_fit.gif** Shows what happens if we repeat until consecutive changes in the fitted gradient m (dx/dz) and n (dy/dz) from (3) hit 10^-12 (i.e. from one iteration to the next, the gradient of the (x, z) and (y, z) lines has changed only marginally). The left-hand plot shows the evolution of the x-axis fits, and the right-hand plot shows the evolution of the y-axis fits. Note that the scale on the vertical changes as we progress through iterations.

All of the iterations are shown together in test_magnet_with_mixing_axis.pdf, with test_magnet_with_mixing_axis_zoom1.pdf and test_magnet_with_mixing_axis_zoom2.pdf increasing the vertical scale.

The red, solid, line on all of the above plots is the final fit through the magnetic axis. For the test magnet, the real axis lies along x=y=0. This method retrieves x=y=0.

Next: Show that it still works on a **tilted** test magnet.

#### Updated by Blackmore, Victoria almost 9 years ago

**File**test_magnet_8_result.pdf test_magnet_8_result.pdf added**File**test_magnet_9_result.pdf test_magnet_9_result.pdf added**File**test_magnet_10_result.pdf test_magnet_10_result.pdf added**File**test_magnet_3_result.pdf test_magnet_3_result.pdf added**File**test_magnet_4_result.pdf test_magnet_4_result.pdf added**File**test_magnet_5_result.pdf test_magnet_5_result.pdf added**File**test_magnet_6_result.pdf test_magnet_6_result.pdf added**File**test_magnet_7_result.pdf test_magnet_7_result.pdf added

Fit method tested against a FC-like test magnet with random tilts about the x and y axes. The left-hand plots show the magnetic x-axis and the right-hand plots show the magnetic y-axis.

- Black points are what you find from a "first guess" at the axes, assuming that there are no magnet tilts and field mixing
- Red points are what you find if you go through the fit routine and find the best tilts and offsets
- The blue line is the
**actual**magnetic axis

[Still no error bars for now]

#### Updated by Blackmore, Victoria almost 9 years ago

**File**FC1_result_noErrors.pdf FC1_result_noErrors.pdf added**File**FC2_result_noErrors.pdf FC2_result_noErrors.pdf added

The fit routine carried out on FC1 and FC2 at different currents. Both fits are still in the CERN mappers co-ordinate system -- so x=y=0 is the line the mapper nominally follows. As before, the x-axis is plotted on the left, and the y-axis on the right.

Points are:- Black, 50A flip mode
- Red, 100A flip mode
- Blue, 150A flip mode
- Green, 114A solenoid mode (on FC1 plot only)

In solenoid mode, there's barely any place where Bz-->0, and the mixing dominates the fits. Flip mode appears to be the better means of finding the axis.

There's also some discrepancy between the axis found at different currents: as the current increases, Bz increases, and the divergent regions (where we end up dividing by zero) get worse. It's odd that this argument doesn't appear to hold for FC2 in y.

Next:- Try 3 different currents with same tilted test magnet and compare the fitted axes -- do we reproduce the effect seen in data?
- Try a solenoid mode tilted test magnet -- do we reproduce the effect seen in data?

--> See item 18 for an update on the FC2 plots shown here.

#### Updated by Blackmore, Victoria almost 9 years ago

**File**test_magnet_3_result_line.pdf test_magnet_3_result_line.pdf added**File**axis_fit_iteration_06.png axis_fit_iteration_06.png added**File**test_magnet_8_result_line.pdf test_magnet_8_result_line.pdf added**File**test_magnet_10_result_line.pdf test_magnet_10_result_line.pdf added**File**FC1_result_noErrors_line.pdf FC1_result_noErrors_line.pdf added

A selection of the plots from items 11 and 12, with the best-fit line to the magnetic axis drawn instead of points.

The best-fit line is also drawn for FC1 at 50, 100, and 150A. Concerned that the 150A x-axis line (left plot) is so different...

#### Updated by Blackmore, Victoria almost 9 years ago

**File**11Dec_testMagnet_f.pdf 11Dec_testMagnet_f.pdf added**File**11Dec_testMagnet_g.pdf 11Dec_testMagnet_g.pdf added**File**11Dec_testMagnet_differences.pdf 11Dec_testMagnet_differences.pdf added**File**11Dec_testMagnet_a.pdf 11Dec_testMagnet_a.pdf added**File**11Dec_testMagnet_b.pdf 11Dec_testMagnet_b.pdf added**File**11Dec_testMagnet_c.pdf 11Dec_testMagnet_c.pdf added**File**11Dec_testMagnet_d.pdf 11Dec_testMagnet_d.pdf added**File**11Dec_testMagnet_e.pdf 11Dec_testMagnet_e.pdf added

Test magnet axis fits:

- Each magnet has a random tilt and offset
- Left-hand plot shows x-axis fit, right-hand plot shows y-axis fit
- Black points on left plot are all estimated x-axis points given best estimate of alpha*Bz contribution, red points are similar on the right-hand plot for the best estimate of y.
- To improve the fits, points near discontinuities are ignored before the final straight-line fit through these points. Points in cyan, on both left and right plots, indicate
**included**points in the final straight-line fit - Green line is the best fit line to the cyan points
- Blue line is the
**true**axis of the magnet. - Fitted axis is always very close to true axis, but not exact.

- Top row: x axis differences
- Bottom row: y axis differences
- Left: Difference between fitted values at the upstream side of the coils
- Right: Difference between fitted values at the downstream side of the coils
- Too few test magnets to really say anything definite (they take a long time to compute), but in all cases fitted axis agrees with true axis to 0.000010m = 0.010mm

#### Updated by Blackmore, Victoria almost 9 years ago

**File**test_magnet_e.gif test_magnet_e.gif added**File**test_magnet_f.gif test_magnet_f.gif added**File**test_magnet_g.gif test_magnet_g.gif added**File**FC1_run5_vectors.gif FC1_run5_vectors.gif added**File**test_magnet_pure_vectors.gif test_magnet_pure_vectors.gif added**File**test_magnet_a.gif test_magnet_a.gif added**File**test_magnet_b.gif test_magnet_b.gif added**File**test_magnet_c.gif test_magnet_c.gif added**File**test_magnet_d.gif test_magnet_d.gif added

Updating with some plots of Bx & By vectors, since J. Cobb identified this as a possible systematic error in field mapping data.

All plots:*Left-hand plot is a transverse slice at a particular z.

- Arrow base is at the Hall probe (x, y) position.
- Arrow points along the vector (Bx, By)
- Red lines extrapolate along the vector
- All lines should cross at x = y = 0 if the magnet is on-axis, or cross at another (x, y) if off-axis. Lines that do not cross may be a systematic error.

*Right-hand plot is (z, Bz) to indicate where along the magnet we are.

- test_magnet_pure_vectors: This is an
**untilted**perfect FC model. Radial vectors either point towards the axis or directly away from the axis. - test_magnet_a--g: These correspond to test magnets a--g above, vectors do not cross at 0, but do all converge to a common point.
- FC1_run5_vectors: Run 5 of FC1 field maps (150A). Vectors do not point to a common location. Possible explanation: Hall probes are not
**exactly**oriented along the axes we think they are (i.e. strictly along x-axis in mapper system, but are very slightly tilted themselves).

#### Updated by Blackmore, Victoria almost 9 years ago

**File**11_Dec_FC1_run2.pdf 11_Dec_FC1_run2.pdf added**File**11_Dec_FC1_run3.pdf 11_Dec_FC1_run3.pdf added**File**11_Dec_FC1_run5.pdf 11_Dec_FC1_run5.pdf added**File**11_Dec_FC1_run2-3-5.pdf 11_Dec_FC1_run2-3-5.pdf added

Current best estimate of FC1 axis in mapper co-ordinate system.

11_Dec_FC1_run2: 50A field map- Left-hand plot: x-axis fit
- Right-hand plot: y-axis fit
- Black (left) and red (right) points are
**all**estimated axis points - Cyan points are those accepted for the final straight line fit
- Green line is the fitted axis

- Plots as for run 2 above

- Plots as for run 2 above

- Top row: All axis points calculated from the data, before selecting for points to feed into the final line fit.
- Black = 50A, red = 100A, blue = 150A
- Left-hand plot = x-axis fits, right-hand plot = y-axis fits
- Mostly in agreement except for where you get close to the discontinuities

- Bottom row: Final straight line fit (the green line from the previous three pdfs)
- Left-hand plot = x-axis, right-hand plot = y-axis.
- Seems consistent at different currents (difference to item #13 is excluding discontinuous region from final line fit)

#### Updated by Blackmore, Victoria almost 9 years ago

**File**VectorPlots.zip VectorPlots.zip added

Prettier versions of the vector plots attached to previous issues. Now, red lines point forwards along the Bx, By vector, and blue lines point backwards (so you can see what's happening whilst the field is pointing outward!)

#### Updated by Blackmore, Victoria almost 9 years ago

**File**12Dec14_FC2_run5.pdf 12Dec14_FC2_run5.pdf added**File**12Dec14_FC2_fits.pdf 12Dec14_FC2_fits.pdf added**File**FC2_run2_vectors.gif FC2_run2_vectors.gif added**File**FC2_run3_vectors.gif FC2_run3_vectors.gif added**File**FC2_run5_vectors.gif FC2_run5_vectors.gif added**File**12Dec14_FC2_run2.pdf 12Dec14_FC2_run2.pdf added**File**12Dec14_FC2_run3.pdf 12Dec14_FC2_run3.pdf added

And now for FC2 (FC2 fits in item 12 used buggily interpreted data files, data used here should be being read correctly).

Plots labelled 'vectors' are the same as in item 15, but for FC2 instead.

Plots labelled '_runX' are the same as in item 16, but for FC2

12Dec14_FC2_fits shows a comparison between 50, 100 and 150A field map axis results for FC2.

#### Updated by Blackmore, Victoria almost 9 years ago

**File**m2_Bz_probe1.pdf m2_Bz_probe1.pdf added**File**USS_first_pass_m1m2.pdf USS_first_pass_m1m2.pdf added

.. clicked submit too soon. These go with item #19.

These plots are a first pass at the Upstream SS's axis (as requested by C. Rogers). The SS's are a bit more complicated than the FCs, as there're more regions of constant solenoid field (for which there is no axis). We have some low-current measurements of the M1 and M2 coils powered individually.

m1_Bz_probe1: The Bz component of the field measured by the 30mm probe through M1 at 30A

m2_Bz_probe2: The Bz component of the field measured by the 30mm probe through M2 at 30A

Need to proceed more cautiously with these field maps, since 30A is quite low and the measurements are more likely to be noisy. Nevertheless, **USS_first_pass_m1m2** shows the result of the method on the M1 and M2 coils without the final straight line fit.

To do:

- Combine the results from M1 and M2, then do a straight line fit

- Compare with 'full field' SS, picking out sections where there is a field gradient (dBz/dz != 0). (This will take a bit of time to select the 'right' regions).

#### Updated by Rogers, Chris almost 9 years ago

Could you please explain roughly what the coordinate system is (e.g. where is the 4 T region?)

#### Updated by Blackmore, Victoria almost 9 years ago

**File**tilted_USS_1.png tilted_USS_1.png added

The 4T region is to the far right, at about 3-4m (so not on the axis plot).

Attached is a calculation of an SS operating at "100% Solenoid Mode" currents, which were used during mapping. The calculation is not co-axial with the mapper (so like the tilted FC test maps from earlier issues). I should probably also mark on these which points contribute to the fitted line -- expect that with the next few test cases I'm generating. The green line shows the best fit line, the red line is the true axis of the magnet.

(Note-for-later: the mapper enters the magnet in the downstream --> upstream direction, so the z-axis is reversed compared to my calculations. This would be fixed by applying the survey.)

#### Updated by Blackmore, Victoria over 8 years ago

**File**FC2_vector_sum.gif FC2_vector_sum.gif added**File**testmagnet3_vector_sum.gif testmagnet3_vector_sum.gif added**File**perfect_magnet.pdf perfect_magnet.pdf added**File**testmagnet3.pdf testmagnet3.pdf added**File**fc2.pdf fc2.pdf added**File**testmagnet3_all_residual_vectors.pdf testmagnet3_all_residual_vectors.pdf added**File**fc2_all_residual_vectors.pdf fc2_all_residual_vectors.pdf added

**Back to FC field maps** (to try and understand the systematics, e.g. item #17)

Idea: See if anything obvious shows up when we sum up the transverse field vector components for one probe as we travel along the magnet in z.

- A perfectly aligned, perfect FC, measured with a perfect mapper will have all radial (transverse) vectors pointing at the axis. Summing up its vectors around a loop should bring us back to zero.
**[see perfect_magnet.pdf]** - A mis-aligned, but otherwise perfect FC, measured with a perfect mapper will have all its radial vectors pointing at the true axis. This axis may no longer coincide with the mapper axis. The mapper may 'measure' the field at different true radii, so the magnitude of the field vectors may differ from the perfectly aligned case. Though the vectors point towards the axis, the sum of those vectors does not necessarily bring us back around to zero.
**[see testmagnet3.pdf]** - A mis-aligned, real FC, measured with a real mapper
**should**sill measure radial vectors pointing toward the true axis. We may misinterpret the positions and orientations of the Hall probes, which may mean our vectors miss each other. It's unlikely that the sum of these vectors will be zero, but we may learn something interesting by looking at it and comparing to the tilted calculation**[see fc2.pdf]**

perfect_magnet.pdf, testmagnet3.pdf and fc2.pdf try to test the above at z~1m for a probe that is 30mm away from the mapper's axis.

- Left plot: This shows the sum of "measured" vectors. Red points indicate the start of a vector, black points indicate the end. For plotting, one vector is plotted on top of the next, so only one black point is visible -- this is the final end of the summed vector.
- Middle plot: This is the residual vector, the vector between (0, 0), the tail of our first vector in the sum, and the end of the summed vector.
- Right plot: A plot of (z, Bz) for a rough visualisation of where in the magnet we are.

(Left plots) The aligned and tilted calculations have a similar-looking vector sum pattern. The FC field map is a lot more scattered and random.

(Middle plots) The aligned calculation has no residual vector (the scales are 1e-17 in x and y, which is zero within rounding errors). The tilted calculation has some small residual vector. The FC field map has a larger residual vector.

(Right plots) Nothing of significance, except to say that we're trying to compare similar z-positions in these plots.

- We can look at these plots as we go along z, through the magnet.
**See testmagnet3_vector_sum.gif and FC2_vector_sum.gif**- These are animated versions of the left/right/middle plots described previously. The right-hand plot shows you how z is changing.
- testmagnet3[...] is from the tilted calculation. The residual vector goes back and forth along a straight line.
- fc2[...] is from the FC2 (run 7, 150A) field map. The residual vector goes around in a rough circle.

To see if the residual vectors do follow a line/circle, we can plot them for all z. In other words, at each z, calculate the sum of the measured (Bx, By) vectors and the residual vector. Plot the residual vector -- **See testmagnet3_all_residual_vectors.pdf and fc2_all_residual_vectors.pdf** The residual vector for the FC2 measurements is not exactly circular, but the precession of the vector must be some indication of the systematic we don't yet understand (e.g. an additional tilt of the Hall probe? Non-circular movement due to transverse physical offset of the mapper, bumping along its carriage?)

#### Updated by Rogers, Chris over 7 years ago

**Status**changed from*Open*to*Closed***% Done**changed from*0*to*100*

I think this is closed?