Development and first results of a magnetic sample environment for polarized neutron imaging of thin metal sheets

. Polarized neutron imaging brings the great advantage of analyzing bulk magnetic properties with good spatial resolution. The technique is based on the interaction of the neutron spin with magnetic samples or free magnetic fields and observing the changes to a spin-polarized neutron beam. The high sensitivity to even small magnetic fields is a benefit in obtaining magnetization information but simultaneously a challenge in instrumentation, since magnetic environments for the polarized neutron beam and for the sample, as well as the fringe field from the magnetic sample itself all a ff ect the measurement and can give rise to unwanted e ff ects. We have used finite element simulations and ray tracing simulations, to design and analyze a magnetic sample environment devised for the measurement of ferromagnetic metal sheets. Here we show an analysis of performance of the experimental setup based on the simulation results and compare them to first experimental results on a grain oriented silicon steel sample.


Introduction
Neutrons provide an excellent tool for the investigation of magnetic properties due to their inherent magnetic moment and therefore direct magnetic interaction.In experiments using unpolarized neutrons, this magnetic interaction can already provide information about the magnetic properties of the sample, however, to access the full potential, polarized neutrons are required.In these experiments, neutrons are filtered by their spin state, either spinup or spin-down, which can be achieved by using equipment such as polarizing mirrors or polarized 3 He.However, these measurements require significantly more time, as spin-filters reduce the neutron flux and several separate exposures are necessary per measurement.
In scattering techniques, the use of polarized neutrons is well established and allow a distinction between magnetic and non-magnetic scattering contributions.For imaging applications, early experiments with polarized neutrons only started about 15 years ago [1,2] but there is an ongoing development and great advances have been achieved in recent years [3,4].Polarized neutron imaging (PNI) has been used, e.g., to measure the magnetic domain structure in large grain silicon steel [5,6], distinguish magnetic phases in steel samples through combination with conventional transmission data [7] or determine the Curietemperature in a sample with spatial resolution [8,9].It is also possible to obtain images of free magnetic fields, such as the stray field of magnetic flux frozen in a superconduct-ing sample [1,10].More complex measurements even allow the reconstruction of a complete magnetic vector field.This, however requires a full tomography with eighteen separate measurements per projection and is therefore a time consuming technique [11,12].
Generally, special attention has to be given to the magnetic field setup of any PNI experiment.Once the beam is polarized, an external magnetic guide field is required to retain the neutron spin state.Hence, for any sample to be investigated as well as for additional sample environment, the interplay with this guide field has to be assessed.Samples with high permeability at low fields may be magnetized by this field.On the other hand, the guide field might be distorted by samples with high magnetic susceptibility or a high remanent magnetization and cause problems with proper neutron spin transport.Therefore, it is important to make sure the sample and the surrounding field have no unintended effects on each other, which could jeopardize the entire experiment.
Here, we report on the development of our own custom sample environment intended for the measurements of ferromagnetic metal sheets.Silicon steel laminations are routinely used as magnetic core for both transformers and electric engines and a deeper understanding of their magnetic properties and behavior can be extremely beneficial to increase their energy efficiency.For such investigations, PNI distinguishes itself from other methods by supplying spatially resolved data of the bulk material.The sample environment devised for this experiment is meant to avoid the problems mentioned above, by providing a small volume around the sample where we have high precision control over the magnetic field.This is achieved with two additional flat coils surrounding the sample; a compensation coil cancels the external guide field and a sample coil magnetizes the sample in the desired direction.The design and optimization of this setup was done using a combination of the finite element magnetic field computation software COMSOL [13] and the neutron ray tracing Monte Carlo software McStas [14,15] to obtain the magnetic field in the experimental setup and analyze its effect on the neutron polarization, respectively.

Larmor Spin Precession
For PNI, a semi-classical approach to spin interactions is taken, where the spin properties of a neutron beam are described by a polarization vector ⃗ P, which reflects the expectation value of the neutron ensemble in density matrix formalism.Magnetic interactions affect the magnitude and direction of ⃗ P and in this work, we are mainly interested in the effects due to Larmor precession.When exposed to a magnetic field ⃗ B sample that is not collinear with ⃗ P, ⃗ P rotates around the field axis.In a static field, the time evolution of ⃗ P can be calculated using the rotation matrix R around where θ = ω t = γ N B sample t is the angle of rotation, which depends on the flux density B sample , the dwelling time t and the gyro-magnetic ratio of the neutron γ N .
In conventional uniaxial polarization analysis, only a projection P y of ⃗ P on the guide field ⃗ B guide is measured experimentally, so that the spin precession described above is not accessible.We use the subscript 'y' since, throughout this work, the projection axis is always the vertical y-axis.P y is calculated from two separate transmission measurements as where I + and I -are intensities measured with the incoming polarization direction parallel and anti-parallel to the guide field ⃗ B guide , respectively.Ideally, our setup provides an abrupt transition from the guide field ⃗ B guide to the field causing spin precessions ⃗ B sample .Abrupt, in this case, means that the neutron polarization can not follow the change from ⃗ B guide to ⃗ B sample adiabatically.As a result, the spin precession is observed as an oscillation of P y with amplitude A, angular frequency ω, phase shift ψ and offset (or mean polarization) O.The parameters depend on the orientations and values of ⃗ P and ⃗ B sample as well as the projection axis defined by ⃗ B guide .Experimentally, only the final state of a spin precession is accessible after the neutrons have passed through any given field.However, since the dwelling time in the field is directly proportional to the neutron wavelength t ∝ λ N , the time dependence can be recovered by scanning the wavelength.The oscillation Figure (1) illustrates how the spin rotation in a constant field results in the measured polarization oscillation.The sketch in panel (a) shows arbitrary orientations of the sample field ( ⃗ B sample , dark green) and the initial polarization vector ( ⃗ P 0 , orange), which follows the orange dashed circle during the rotation.P y (purple) is the polarization projection on the guide field ( ⃗ B sample , light green).Its wavelength dependence, along with two additional cases, is shown in panel (b): case 1 (blue, solid) is ideal for observing the polarization oscillation with ⃗ B sample ⊥ ⃗ P and ⃗ B sample ⊥ ⃗ y.The oscillation has the maximum amplitude of A = 1 and oscillates around zero (O = 0).For case 2 (red, dashed), ⃗ B sample ⊥ ⃗ y but ⃗ P is inclined away from the y-axis.The result is a reduced amplitude while the offset remains zero.Finally in case 3 (purple, dotted), additionally ⃗ B sample is inclined towards the y-axis.This results in a reduced amplitude and in a non-zero offset.The frequency ν is the same in all cases and chosen to reflect the properties of a steel sample, while the phase angle ψ was chosen arbitrarily.
In the more general case of a field varying in space or time, equation 1 has to be integrated with respect to an infinitesimal rotation angle δϕ or infinitesimal time δt.If the changes in the field direction are much slower than the Larmor precession, the spin evolution is adiabatic, meaning that the polarization component initially oriented along the field is retained and follows the orientation of B. If the field direction changes too rapidly, the spin evolution becomes non-adiabatic, which will result in a wavelength dependent reorientation of ⃗ P with respect to ⃗ B sample .A second common effect important for PNI is depolarization.For spin precession, e.g.inside a single magnetic domain, only the direction of ⃗ P changes while its magnitude and its component along the field are retained.In contrast, spin depolarization reduces the magnitude of ⃗ P. Depolarization is generally caused by magnetic disorder.
Examples are ferromagnetic materials with a large number of randomly oriented domains and domain walls between magnetic domains [16,17].Depolarization can also be due to a wavelength spread or geometric divergence, effectively imposing a resolution limitation on the polarization analysis.

Magnetic Environment
Since polarized neutrons are sensitive to to the magnetic environment, PNI requires a well defined experimental setup to avoid spurious effects from field inhomogeneities.Figure (2) (a) illustrates the key magnetic components relevant for our experiments and simulations.Arrays of permanent magnets provide the vertical guide field (B guide ≈ 5.2 mT) along the neutron flight path to maintain high beam polarization.The analyzer, a reflection solid state bender, requires a strong magnetic field (≈ 50 mT) to work properly, which is provided by permanent magnets in its housing.This, however, creates a considerable stray field.The sample is affected by the guide field and the analyzer fringe field due to its high magnetic susceptibility.Without proper counter measures the sample is magnetized, which in turn distorts the surrounding field.Therefore, a custom double-coil-setup is used to generate two additional fields (called "compensation"-and "magnetization" field) at the sample position.The compensation field is oriented anti-parallel to the guide field and is used to cancel the unwanted field at the sample position.Nested into the compensation field is the magnetization field, in perpendicular direction, which is used to magnetize the sample.
A rendering and photo of the double-coil-setup are shown in panel (b) of figure (2) illustrating the nested structure of the coils with the sample on the inside.The coils are designed to accommodate thin sheets-like samples with a maximum size of 100 mm × 100 mm × 2 mm, though the samples used in this work (simulation and experiment) were smaller as shown in figure (2).
To calculate the magnetic field, we used COMSOL for finite element magnetic field calculations.The dimensions of all components were taken from the actual devices, as were the material properties to the best of our knowledge.For the guide field and the analyzer, the remanent fields of the permanent magnets were adjusted to reflect previous measurements with a Hall probe.The sample, which is a large-grain silicon-steel and therefore very inhomogeneous, was simplified as a homogeneous and isotropic material.In this way, the macroscopic effect of the sample can still be reproduced sufficiently well, while deviations due to the crystal or domain structure are interpreted as sample effects to be evaluated from the experimental data.Magnetic fields generated by the coils match reasonably well with measured values for the same driving current.Panel (c) gives an overview of the simulated magnetic flux density in the central vertical cut plane.The far-reaching stray field of the analyzer is clearly visible, which necessitates placing the sample and the double-coil-setup 8 cm upstream.In this simulation, the sample and double-coilsetup were neglected.Their effects are discussed in the following section.
As explained above, the outer coil of our setup generates a vertical field to compensate the guide field and analyzer stray field (see figure (2)).The coil has two layers of wire around a frame with dimensions 120 mm × 110 mm × 6 mm.The inner coil can be used to apply an additional field along the x-axis (perpendicular to the beam and guide field) to magnetize the sample in this direction.It is slightly smaller, fitting into the outer coil, consisting of one layer of wire with inner dimensions 120 mm × 100 mm × 3 mm. 1 mm diameter anodized aluminium wires were used to minimize neutron absorption and material activation, wound on a 3D printed plastic frame.Mounted at the center of the coils is the sample, which is a horizontally mounted stripe of silicon-steel with dimensions 50 mm × 30 mm × 0.4 mm, such that the inner coil field is aligned along the longest direction.
The impact of both coils is illustrated in figure (3), which shows COMSOL calculation results in the vicinity of the sample under four conditions.Panel (a) shows again the external field generated by the guide field and analyzer.(b) With the sample included, there is a strong distortion of the field.In panel (c), the field at the sample position (B ext ≈ 6.7 to 7.1 mT) is compensated by the outer coil (B remaining ≈ 0.5 to 0.8 mT), which completely removes the previous distortion effects.Finally, in panel (d) the inner coil is active as well with a current of I inner = 2 A, providing a horizontal (along the x-axis) field of 3.1 mT.The images illustrate how the coils can be used to provide a good zero field condition and to magnetize the sample without strong field distortions.

Spin Precession Simulations
For a full analysis of the functionality of our setup, we have used the McStas ray tracing Monte Carlo simulation tool to calculate the neutron spin evolution.In McStas, the basic pinhole geometry of an imaging beamline is modeled to include geometric effects, based on the the BOA beamline at PSI, where our experiments were conducted.As a neutron source, a "Source_simple" component was used, with a wavelength spread of 0.03 Å, representing a double crystal monochromator with ∆λ/λ = 1%.The source had a rectangular size of 15 mm × 15 mm, representing the pinhole used at BOA, and the distance between neutron source and detector was 5.27 m.As detector, a 2D position sensitive monitor recording the Cartesian projections of the polarization was used with an area of 50 mm × 50 mm and 100 × 100 pixel.Two additional such monitors were placed at the front and rear surface of the sample in the beam direction.Magnetic field values calculated in COMSOL were included in McStas as "Pol_Bfield"components in the final 20 cm in beam direction of the instrument with a cross section of 5.2 cm × 5.2 cm.Due to technical difficulties the COMSOL results had to be included as several separate components along the beam direction.Simulations were performed with 2 • 10 6 neutron rays each.
The magnetic field region included in McStas covers the distance between the center of the guide field unit up to the center of the analyzer in the COMSOL calculations.At both positions, the field is aligned perfectly vertical (parallel to the incident polarization direction and the analyzer direction) such that no spurious effects due to abrupt boundaries are introduced.Additionally, no impairments were observed due to the additional boundaries (all parallel to the x-y-plane) introduced by splitting the field region.The sample itself, with a volume of 50 mm × 30 mm × 0.4 mm was excluded from the imported field profiles.While the field distortion outside the sample is very relevant for the spin evolution, the internal field of the sample has little direct correspondence to the real sample.Instead, values in the sample volume were replaced with a homogeneous magnetic field, representing a specific domain orientation and internal magnetic flux density.As a result, the simulations show how the chosen kind of domain would affect the measured polarization in any position in the sample.The most relevant choice for this was a field of 1.5 T oriented horizontally in x-axis, which corresponds to the experimentally determined field integral in the sample and the predominant domain orientation.

Results: Field Compensation
First, we focus on the performance of the outer coil and necessity of guide field compensation, by evaluating the polarization in the two cases of no field compensation and full field compensation (c.f.cases (b) & (c) illustrated in figure ( 3)).For this analysis, the Cartesian projections obtained in McStas are not optimal and instead more suitable quantities are used.i) P abs : the absolute value of the polarization vector.ii) P y-z : the magnitude of the y-z-projection of the polarization vector.iii) β y-z : the angle between the y-z-projection of the polarization vector and the y-axis (the initial polarization direction).P abs is a measure of the depolarization of the neutron beam.With the internal field of the sample pointing in along the x-axis, P y-z corresponds to the part of the polarization contributing to the spin precession.β y-z is needed for complete orientation information of the polarization and is optimal to show the spin precession occurring in the sample.
Figure (4) shows images illustrating the beam polarization just before reaching the sample using the quantities just defined.The uncompensated case is shown in the upper row (both coils inactive) and the compensated case in the lower row (active compensation coil).P abs indicates that no depolarization occurs up to the sample, apart from slight artifacts at the sample edges due to the split simulation.In the uncompensated case, a pattern of horizontal stripes is visible in P y-z , with values going down to 0.85.Fitting the sample shape, the field distortion is more pronounced in the vertical direction.β y-z is entirely inhomogeneous, changing smoothly from 90 • to −90 • from top to bottom.In contrast, the compensated case results in completely homogeneous images, retaining the initial polarization up to the sample.The presented results were calculated at a wavelength λ N = 3.2 Å.In the full range used for the simulations between 3.00 to 3.40 Å, the uncompensated case shows a slight wavelength dependence which indicates a non-adiabatic spin evolution.
Inside the sample, the polarization precesses due to the chosen uniform field (B sample = 1.5 T along the x-axis) according to equation (1) without unexpected side effects.In In the uncompensated case a significant reorientation of the polarization orientation occured over the whole sample area, which is avoided by compensating the guide field.In this and the following images, the sample position is marked by dashed lines.
the 400 µm thick sample, the polarization precesses 10 to 11 times in the chosen wavelength range.Due to the wavelength spread of 0.03 Å, the spin precession angle spreads as well which reduces the measured polarization to ≈ 0.9.
In the space between the sample and the analyzer the spin evolves further, partially in a non-adiabatic way comparable to the one observed before the sample though not entirely symmetric due to the analyzer fringe field.In addition, precession around the strong guide field, combined with the wavelength spread, leads to a complete loss of polarization in the horizontal plane, such that only the polarization projection P y is retained.
For evaluating the full impact of the setup we have simulated a wavelength scan in the range of 3.00 to 3.40 Å in 21 steps of size 0.02 Å.These simulations were analyzed analogous to the experimental data, by pixel-wise fitting of the wavelength dependence.
Ideally, we expect P y (λ N ) to perform sinusoidal oscillations, as described by equation ( 4) and illustrated in figure (1).In figure (5), three of the fitting parameters are shown, the oscillation amplitude A, the mean polarization O and instead of the oscillation frequency ν the corresponding internal field B int = 3956 • ν/γ N /t sample with the thickness of the sample t sample = 400 µm and [ν] = 1/Å.The phase shift ψ does not contribute to a better understanding of the data and has been omitted.
Note, that the presented fitting parameters do not reflect the quality of the fit.If the measured oscillation deviated from a a simple sinusoidal function, this may not be reflected in the fitting result.However, since the same evaluation method is used for experimental results, a reasonable comparison can be drawn.
Again, the uncompensated case is in the upper row and the compensated case in the lower one.Starting with the oscillation amplitude, both cases have a similar range of values with A ≈ 0.65 to 0.88 and A ≈ 0.61 to 0.89 for the uncompensated and compensated case, respectively.The pattern, however is very different.In the uncompensated case we observe a pattern of horizontal stripes reminiscent of the one seen in figure (4).In contrast, the compensated case shows a much clearer pattern along the vertical direction, with a maximum in the center and decreasing to the edges at the top and bottom.Outside the sample, the amplitude is effectively zero as no spin precession occurs.
The mean polarization shows a similar pattern to the amplitude in the first case, with mostly positive values in the range of −0.06 to 0.22.In the second case, no pattern is observed and the values are essentially scattered around zero (−0.04 to 0.02), leaning slightly towards the negative.Outside the sample, however, the compensated case shows strongly reduced mean values O <= 0.6 with a vertical gradient, while the uncompensated case remains high (O ≈ 0.95).
The internal field, again, shows the striped pattern in the uncompensated case, with an average value of 1.50 T and a rather rectangular distribution with FWHM of 0.050 T. In the compensated case, the average value is identical (1.50 T) but the distribution is closer to Gaussian with a narrower FWHM of 0.018 T. Outside the sample, no useful data is obtained as there is no oscillation.
In summary, in the uncompensated case we observe a clear fingerprint of the field distortion by the sample.Corresponding to the sample shape, the field inhomogeneity is pronounced primarily in vertical direction, leading to the horizontal stripe pattern.While a clear polarization oscillation is observed across the whole sample with high oscillation amplitude, the non zero mean polarization and the deviations in the internal field are sub-optimal.In the compensated case, a larger scale pattern seems to be present with an increasingly depolarizing effect going from the horizontal center line towards the top and bottom of the images.This can be seen in the sample area from the amplitude and in the open beam regions in the mean polarization.However, in contrast to the first case, the mean value and internal field determined in the sample are essentially homogeneous in the limit of the simulation statistics.Generally, the values obtained in the sample are fluctuating more in the uncompensated case.
While both cases show that the setup is not optimal, these are strongest in the area of the sample for the uncompensated case while they mostly affect the open beam region for the compensated case.It shows that using the active guide field compensation suppresses an unwanted magnetization of the sample and significantly improves the data quality over the uncompensated case.

Results: Magnetizing Field
As described, the additional inner coil can be used to magnetize a sample along the x-axis.The field direction here is important since the magnetic domains in the sample become (or stay) oriented in the same direction, allowing us to still observe spin precession due to the internal field.In contrast, a magnetization by the guide field in y-direction co-aligns the internal field and the initial neutron polarization, suppressing any spin precession.Figure (6) shows data analogous to figures (4 & 5) for a simulation with field compensation (I comp = 2.7 A) and an additional magnetizing field from the inner coil (I mag = 3 A).The field generated by the inner coil is B mag ≈ 4.6 mT.
In the upper row the state of the incoming polarization is shown, just before the sample, which is affected much stronger than the previous two cases.While there are still no depolarization effects, the other two parameters indicate a strong reorientation of ⃗ P. Especially in a crescent shaped region on the right side of the sample, P y-z drops below 0.3.Additionally, the open beam regions are almost entirely affected.Again, the polarization is slightly wavelength dependent indicating non-adiabatic effects.
In the polarization oscillation fitting shown in the bottom row of figure (6), the crescent shape is visible as well, though slightly distorted.On the left side of the sample the spin oscillation is observed clearly, with a high amplitude (≈ 0.85) and close to zero mean polarization.However, the internal field value obtained in this area is not reliably reproducing B sample with a visible gradient and values of 1.45 to 1.63 T.
The problems observed in this example are representative for driving currents of the inner coil I mag = 1 to 4 A, though the pattern and severity of the effects do change.The interpretation is that the polarization is to some degree reoriented towards the sample field before sample but also oriented back towards the guide field behind the sample.Depolarization in the sample, as in domain walls, can therefore still be observed, but the asymmetric spin evolution on either side of the sample and the non-adiabatic nature of this effect are challenging to isolate from the sample effect.

Experimental Results & Comparison
First experiments using the double-coil-setup were conducted at the BOA beamline at PSI [18].The sample was a grain-oriented silicon-steel sheet with dimensions 70 mm × 30 mm × 0.25 mm.As the simulations were based on this experiment, the instrumental details are virtually the same.
A rectangular pinhole (15 mm × 15 mm) was used, followed by a double crystal monochromator with wavelength spread of 1 % and an adiabatic RF spin flipper [19].BOA provides a polarized neutron beam via a reflection multi-channel bender and a compact reflection solid-state bender was used as spin analyzer.As detector, a typical imaging setup was used with a 200 µm LiFl scintillator, a mirror box and an Andor Ikon-L camera.A rectangular pinhole (15 mm × 15 mm) was used, with the detector placed 5.65 m downstream.Close after the pinhole, a double crystal monochromator with wavelength spread of 1 % and an adiabatic RF spin flipper [19] were placed.BOA has a reflection multi-channel bender for polarizing the neutron beam and a compact reflection solid-state bender was used as spin analyzer.With a pinhole to detector distance of 5.65 m and a sample to detector distance of 17 cm, we had an L/D = 370 and a geometric resolution of ≈ 0.5 mm.Wavelength scans were performed in the range between 3.0 to 3.36 Å in 13 steps of 0.03 Å.
Preliminary analysis of some of the data is presented here to compare with the simulation results.Detailed data analysis is ongoing and not in the scope of this article.In figure (7) we present results from two wavelength scans using the same fitting procedure described for the simulated data.Corresponding to the two cases in figure (6), the upper row shows data in a fully compensated field, i.e. of the remanent state of the sample.In the bottom row, the sample was magnetized using the inner coil with a driving current of I inner = 4 A. According to our COMSOL calculations, this corresponds to a field of B inner = 6.2 mT, however, due to comparison with the simulation results we suspect a slightly lower actual field.Measurements of the field were not possible as the available Hall probe did not fit into the narrow coil.Starting with the remanent state, we first note that the open beam regions at the top and bottom of the images are uniform, with zero amplitude and high mean polarization while the internal field shows pure noise.The mean polarization measured in these regions is ≈ 0.84 without a clear wavelength dependence.It appears that the sample environment introduces a general depolarization of the beam, but it cannot be ruled out, that this is due to a slight adiabatic turning of the polarization instead.Inside the sample, a wealth of features are visible in the amplitude.The sharp boundaries indicate that they are not due to the magnetic environment but inherent to the sample.The mean polarization is very close to zero (< 0.07) almost everywhere and the internal field shows a well defined value of B int ≈ 1.7 T except for a large noisy area left of the center.B int is an especially important parameter, as it shows that our sample has a well defined internal field in a large area leading to a sinusoidal polarization oscillation.We can therefore infer that the sample has magnetic domains extending over its full thickness.The low mean polarization indicates, that the magnetic orientation of those domains lies in the horizontal plane.From the amplitude we obtain more details about the domain structure.In the right side of the sample are two large discernable areas, in the upper and lower half, divided by a sharp ragged line.Without definite proof, we interpret this as two crystallographic grains, where the respective lattice orientations induce different domain structures.The lower region shows a very well ordered stripe pattern oriented almost horizontally, where the darker stripes mark the domain walls which locally depolarize the neutron beam.The width of these domains is ≈ 1.0 mm with lengths reaching well above 10 mm.The amplitude inside the domains is ≈ 0.5 to 0.6, though, due to the geometric smearing with the depolarizing domain walls, the true value is probably above 0.6.Still, even considering the additional depolarization due to wavelength spread observed in the simulations (by a factor of 0.9) and the reduced polarization in the open beam regions, the low amplitude in the magnetic domains indicates an additional depolarization effect.In the upper region on the right side, the domain pattern appears much less well-ordered and has an overall lower amplitude of 0.25 to 0.35 in the brighter regions.As stated above, we suspect different crystallographic and therefore magnetic orientations to be the cause of the two different regions.A plausible case would be to have the magnetic domains in the lower region oriented along the x-axis (in the sample plane as well as in the horizontal plane) while the upper region is oriented slightly out of the sample plane.On the left edge of the image, similar regions to the right half are visible, separated by a large area which completely depolarized the beam.At this preliminary stage of the analysis we are unable to speculate about the internal structure of this region but it appears to consist of substantially smaller magnetic domains, especially in the direction of the neutron beam.
In the second measurement, the field of the inner coil is putting the sample in a highly magnetized state and the magnetic structure has changed drastically.The large disordered region has almost disappeared and clear stripe domains are only visible in a small area at the right bottom of the sample.We believe that most of the larger features visible in the amplitude and mean polarization are indicating crystallographic features, most likely grain boundaries.In addition to sample features, a broad roughly crescent shaped region on the left side of the sample has emerged where the amplitude is low, the mean polarization elevated and the internal field deviates strongly from values in the remaining sample up to being pure noise.We identify this region with the similar effect observed in our simulations and can therefore conclude, that this is no sample effect.Especially in the mean polarization, it is clear that some features of the sample properties are still observed such as the grain boundary between the top and bottom part or the diagonal domains at the bottom edge to the left of the sample.It is also noteworthy that the pattern of the mean polarization in the open beam region is very similar in simulation and experiment.remanent state of the sample, using only the outer coil for field compensation.Lower row: magnetized state of the sample, additionally using the inner coil.The upper measurement is free from artifacts caused by the magnetic setup, while the lower measurement shows large scale features in all fitting parameters.These results correspond with the simulated results shown in figure (6).

Summary
Polarized neutron imaging is a technique very sensitive to small magnetic fields, making it an ideal tool to investigate changes is the magnetic structure of a sample, but likewise very susceptible to variations in the magnetic environment.This makes a very detailed planning of the experimental setup crucial in order to obtain usable and credible data.We have shown that the combination of finite element magnetic field calculations and neutron ray tracing Monte Carlo simulations provides a powerful method to investigate the performance of a new magnetic sample environment.A double-coil-setup was designed using field calculations with COMSOL Subsequently, McStas simulations were used as well to analyze the experimental results.With the excellent agreement between simulation and experiment we are currently updating the double-coils to avoid the strong unwanted effect on the polarization in the vicinity of the sample.At the time of writing, the most promising solution appears to be the inclusion of 'window'-like iron yokes between the inner and outer coil, effectively diverting the fringe fields from the direct neutron flight path.We want to emphasize that EPJ Web of Conferences 286, 05003 (2023) https://doi.org/10.1051/epjconf/202328605003ECNS 2023 magnetic field setups similar to the presented double-coils could be adapted easily and individually to a wide range of PNI experiments and samples.The need for a low magnetic background for a sample in a very limited volume and the necessity to apply a variable field are common prerequisites.The possibility to quickly and inexpensively create a custom sample environment by 3D printing may enable a wide range of experiments in the future.

Figure 1 .
Figure 1.Inside the sample, ⃗ P precesses around the field ⃗ B sample .Experimentally, only the projection of ⃗ P along the guide field ⃗ B guide is measured.(a) shows an arbitrary setup of the relevant vectors and indicates the Larmor precession.(b) shows three possible P y -oscillations with the one corresponding to (a) included as magenta dotted line (case 3).

Figure 2 .
Figure 2. (a) Sketch of the magnetically relevant components in the experimental setup.For graphical reasons the double-coil-setup has been omitted, showing only the additional fields created by it.(b) Sketch and photo of the double-coil-setup.The sample, inner coil and outer coil form a nested compact sample environment that can be quickly disassembled for easy access to the sample.(c) Magnetic field distribution as calculated using COMSOL.Note that the coordinate system in panel (a) is valid for all simulations and data presented in this work.

Figure 3 .
Figure 3. Magnetic flux density at the sample position, side view.(a) shows the field generated by the guide field and analyzer.(b)includes the sample which distorts the field.In (c) the vertical field has been compensated by using the outer coil of our setup.For (d) an additional horizontal field is applied with the inner coil, to magnetize the sample.

Figure 4 .
Figure 4. Orientation of the polarization vector ⃗ P just before entering the sample, described by the values P abs , P y-z and β y-z as defined in the text.The upper row shows results for an uncompensated setup and the lower row the compensated case with an active outer coil, corresponding to cases (B) and (C) in figure (3).In the uncompensated case a significant reorientation of the polarization orientation occured over the whole sample area, which is avoided by compensating the guide field.In this and the following images, the sample position is marked by dashed lines.

Figure 5 .
Figure 5. Fitting results of the polarization oscillation observed at the final monitor position for the two cases of an uncompensated (upper row) and compensated (lower row) setup.The uncompensated case shows a horizontal stripe pattern in the sample area, while for the compensated case, a smooth vertiacl variation is observed over the full image area.Generally, the compensated case results show less fluctuations and introduce less artifacts into the measurement.

Figure 6 .
Figure 6.Simulation results with field compensation and applied magnetizing field.The upper row shows the polarization state just before entering the sample.compared to the previous cases the polarization is heavily affected by the fringe field surrounding the sample.The lower row shows pitting results of the polarization oscillation at the final monitor position.In a pattern similar to the upper row, the fitting results deviate from the perfect case.

Figure 7 .
Figure 7. Fitting results of two wavelength scans.Upper row: remanent state of the sample, using only the outer coil for field compensation.Lower row: magnetized state of the sample, additionally using the inner coil.The upper measurement is free from artifacts caused by the magnetic setup, while the lower measurement shows large scale features in all fitting parameters.These results correspond with the simulated results shown in figure(6).