{'fraction_non_alphanumeric': 0.02429872495446266, 'fraction_numerical': 0.009326047358834244, 'mean_word_length': 4.469416218370193, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 71, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Signal Enhancement for Magnetic Navigation Challenge Problem

Harnessing the magnetic field of the earth for navigation has shown promise as a viable alternative to other navigation systems. A magnetic navigation system collects its own magnetic field data using a magnetometer and uses magnetic anomaly maps to determine the current location. The greatest challenge with magnetic navigation arises when the magnetic field data from the magnetometer on the navigation system encompass the magnetic field from not just the earth, but also from the vehicle on which it is mounted. It is difficult to separate the earth magnetic anomaly field magnitude, which is crucial for navigation, from the total magnetic field magnitude reading from the sensor. The purpose of this challenge problem is to decouple the earth and aircraft magnetic signals in order to derive a clean signal from which to perform magnetic navigation. Baseline testing on the dataset shows that the earth magnetic field can be extracted from the total magnetic field using machine learning (ML). The challenge is to remove the aircraft magnetic field from the total magnetic field using a trained neural network. These challenges offer an opportunity to construct an effective neural network for removing the aircraft magnetic field from the dataset, using an ML algorithm integrated with physics of magnetic navigation.


Introduction
Harnessing the magnetic field of the earth for navigation has shown promise as a viable alternative to other navigation systems. Commercial and government organizations have surveyed the earth to varying degrees of precision by collecting and storing magnetic field data as magnetic anomaly maps. A magnetic navigation system collects its own magnetic field data using a magnetometer and uses magnetic anomaly maps to determine the current location. This technique does not rely on satellites or other external communications, and it is available globally at all times and in all weather.
The greatest challenge with magnetic navigation arises when the magnetic field data from the magnetometer on the navigation system encompass the magnetic field from not just the earth, but also from the vehicle on which it is mounted. The total magnetic field is a linear superposition of the magnetic fields of the vehicle and the earth (with additional contributions from sources arising from diurnal variation and space weather, which can be largely removed using ground-based reference measurements), and the magnetometer reports the scalar magnitude of the net magnetic field vector. It is difficult to separate the earth magnetic anomaly field magnitude, which is crucial for navigation, from the total magnetic field magnitude reading from the sensor.
The purpose of this challenge problem is to decouple the earth and aircraft magnetic signals in order to derive a clean signal from which to perform magnetic navigation. Baseline testing on the dataset shows that the earth magnetic field can be extracted from the total magnetic field using machine learning (ML). The challenge is to remove the aircraft magnetic field from the total magnetic field using a trained neural network. These challenges offer an opportunity to construct an effective neural network for removing the aircraft magnetic field from the dataset, using an ML algorithm integrated with physics of magnetic navigation.

Magnetic Navigation Background
Magnetic navigation is enabled by variations in the crustal magnetic field of the earth, also known as the magnetic anomaly field. The total geomagnetic field is comprised of fields from several sources, the most dominant of which is the core field with values ranging from 25 to 65 microtesla at the surface of the earth, about 100 times weaker than a refrigerator magnet. The magnetic anomaly field typically varies by hundreds of nanotesla, 100 times weaker than the core field. As such, magnetic navigation requires the ability to sense small differences in the crustal magnetic field, which can be mapped and is stable over geologic time spans. The spatial extent of the crustal fields make the fields strong enough for navigation even at tens of kilometers altitude above the earth's surface.
The strength of a static magnetic field arising from a localized source follows the inverse cubic distance scaling law of a magnetic dipole (when the distance to the source is much larger than the spatial extent of the source). This high drop-off rate in magnetic fields means that it is difficult for disturbances to affect magnetic sensors from a distance without exhorting a significant amount of power, making it difficult to interfere with or jam magnetic navigation from ground stations. Thus, the predominant issue with magnetic navigation comes from magnetic interference generated by the aircraft itself. The purpose of this challenge is to effectively remove the magnetic interference of the aircraft from the readings of the on-board magnetometers so that effective magnetic navigation can be performed.
Traditionally the earth and aircraft magnetic fields can be separated using the Tolles-Lawson model [1], as described in Appendix A. This process uses bandpass filtered measurements from an additional magnetometer, as well as crucial assumptions about the static nature of the aircraft magnetic field, such as: 1. The magnetic sources on the aircraft arise from permanent dipole, induced dipole, and eddy current fields.
2. The permanent dipole sources do not change over time.
3. The induced dipoles depend on the orientation of the aircraft with respect to the magnetic field of the earth.
4. The inductance from electrical current paths is zero, so the eddy currents arise from instantaneous changes of the magnetic flux through a surface.
5. The total-field anomaly due to the aircraft field is the projection of the aircraft field onto the earth field.
These assumptions are sufficient when the magnetometer is placed on a 3m boom behind the aircraft (tail stinger), because the magnetic field from the aircraft is weak enough relative to the earth at the sensor. However, this is impractical for operational aircraft. The Tolles-Lawson approximation does not produce data with sufficiently accurate results when the magnetometer is close to the multiple magnetic interference sources of the aircraft, such as in the cockpit.

Challenge Problem
The goal is to take magnetometer readings from within the cockpit and remove the aircraft magnetic field to yield a clean magnetic signal. The key issue is identifying the desired truth signal, of which two options are presented. One such truth signal is the tail stinger which, after professional compensation, is sufficiently accurate for magnetic navigation. It has the fewest differing conditions from the cockpit sensors due to its location far aft of the cockpit, control surfaces, and other sources of aircraft magnetic interference. However, tail stinger data is not available on all operational aircraft, and using this signal alone would likely cause a model to transfer poorly to other aircraft. The other option is to treat the magnetic anomaly map of the collection region as the truth signal. Using the path of the aircraft, the magnetic anomaly signal of the earth's crust over this path can be determined and treated as the truth signal.
The first case wherein the tail stinger is treated as the truth signal has several advantages. The primary advantage is that there is no need to potentially account for for minor position differences. Additionally, most conditions, such as weather, that were present during the collection would be identical meaning that additional compensation due to known conditions would likely be unnecessary.
The second case wherein the magnetic anomaly map is used as the truth signal yields a case wherein a reference map that would be used for navigation is the target signal. This approach has a major advantage wherein the actual desired signal is the target. However, the map has issues which could make the problem more difficult. First, the signal at the altitude of data collection must be interpolated from the raw map, which adds an additional step of processing. Additionally, the map may be under-sampled in which case the truth data may not be available in the raw map and would need to be interpolated in order to yield the truth signal.
The process of using both truth signals is extremely similar. Both cases can be treated as having 2 outputs; however, each has a natural output that is more useful for evaluation. When training to the tail stinger it is more useful to do a signal comparison rather than comparing to the predicted path along a map as the signal comparison is attempting to determine whether or not the algorithm is learning the aircraft magnetic field. Contrasting this when training to the anomaly map it is more useful to do a comparison to the route as it is possible that the ideal algorithm for navigation purposes is not generating the most optimally enhanced magnetic signal but is instead generating the most optimally enhanced positioning signal.

Judging Criteria
For this challenge problem, an evaluation dataset is withheld from participants. The goal is to learn a mechanism for removing the aircraft magnetic field from the build dataset that will generalize to the evaluation dataset. The quality of the submission will be judged according to the root mean squared error (RMSE) compared to the selected truth signal. Detrending may be used to remove any DC offset prior to RMSE calculation. An alternative award for a method that excels in interpretability and verifiability will also be considered. The challenge problem will commence at the JuliaCon 2020 SciML workshop on July 26, 2020 and will run until August 28, 2020. Judging will take place in early September 2020. All submissions should be sent to crackauc@mit.edu in the form of a Git repository with code that can perform predictions on the evaluation dataset without any modifications to the source code required. It is recommended to include an up to 5 page arXiv compatible manuscript that explains the methodology.

Description of the Magnetic Navigation Data
A campaign was conducted to collect magnetic field data. During the data collection, flight patterns were planned such that data could be collected at varying heights above ellipsoid (HAE), where the aircraft is flying at a constant altitude above the earth's assumed perfectly ellipsoidal shape, and over varying drape surfaces, where the aircraft is flying at a constant altitude over actual crustal features, such as mountains and valleys.  To collect the total magnetic field measurements, five optically-pumped, cesium split-beam scalar magnetometers, and four vector fluxgate magnetometers were positioned in the aircraft. One scalar magnetometer was positioned on a tail stinger to collect magnetic measurements with minimal aircraft magnetic field noise. The remaining four scalar magnetometers, as well as the three vector magnetometers, were placed inside the cabin of the aircraft. The locations of the sensors within the cabin can be found in Table 1. In addition to the magnetometers, supplemental sensors collected relevant flight data. A subset of this data, such as GPS location, contain information redundant to the truth data. Using this data could lead to falsely accurate neural networks, and therefore should not be used. The data fields shown below were determined to provide information for training, while not providing direct truth data. For information on all data fields collected during flight, see Appendix B.
The truth data for training is an uncorrupted measurement of the magnetic anomaly field. This is provided in two ways: first, in the form of the data collected from the scalar magnetometer located on the tail stinger after professional compensation. This data was collected concurrently among the build dataset, and will provide a direct measurement of the uncorrupted signal. Second, a magnetic anomaly map is provided to determine an alternative truth signal. Magnetic anomaly map data provides a unique measure of the magnetic anomaly field for a location in space, and as such is similar to the magnetic anomaly field data collected from the tail stinger.
Four flights were flown to collect data. Each flight contained a different set of objectives, and as such the dataset from each flight has individual nuances. The details of Flight Number 1003 will be discussed below. For further information on the remaining flights (Flight Numbers 1002, 1004, and 1005) see Appendices C, D, and E.
The objectives for Flight Number 1003 were to measure the crustal magnetic field at two altitudes (400m HAE and 800m HAE) in both the Eastern and Renfrew flight regions. The flight was conducted on June 29, 2020 and lasted approximately five hours and forty-five minutes. A summary of the Line Numbers, which describe when a specific flight segment began and subsequently ended, is shown in Table 2. Line Number 1003.10 has been withheld for the evaluation dataset, while the remaining Line Numbers are provided in the build dataset. Other numbers that do not begin with the Flight Number refer to flight over a survey line.  [3]. The files and their function descriptions are described below.
• get flight data.jl -function get flight data: Loads flight data from a saved HDF5 data file and assigns the fields to a struct, which is returned. See get flight data.jl file for the full listing of struct fields. To access a field, use dot indexing. Requires the location/name of the file.
-function readcheck: Only used by function get flight data to identify and warn of NaN values in the flight data.
• get map data.jl -function get map data: Loads magnetic anomaly map data from a saved HDF5 data file and assigns the fields to a struct, which is returned. See file for struct fields. To access a field, use dot indexing. Requires the location/name of the file.
• create TL Amat.jl -function create TL Amat: Creates the 18-term Tolles-Lawson "A" matrix discussed in section A.2, which is returned. Requires 3 corresponding magnetic flux measurement vectors.
-function central fdm: Central finite difference method for gradient calculation. Requires a vector of values, and returns a same-size vector of gradients.
• create TL coef.jl -function create TL coef: Determines the 18 Tolles-Lawson coefficient vector, which is returned. Requires 3 corresponding magnetic flux measurement vectors (calls function create TL Amat) and a scalar magnetic measurement vector from a calibration flight. Optionally accepts a dict of bandpass filter coefficients (pass1, pass2, fs).
• delta lat lon.jl -function delta lat: Converts north-south position error (m) to latitude error (rad), which is returned. Requires north-south position error (m) and latitude (rad).
-function delta lon: Converts east-west position error (m) to longitude error (rad), which is returned. Requires position error position error (m) and latitude (rad).
-function delta north: Converts latitude error (rad) to north-south position error (m), which is returned. Requires latitude error (rad) and latitude (rad).
-function delta east: Converts longitude error (rad) to east-west position error (m), which is returned. Requires longitude error (rad) and latitude (rad).
• fft maps.jl -function upward fft: Upward continuation function for shifting a magnetic anomaly map, which is returned. Requires a magnetic anomaly map matrix (nT), map spacing in each direction (m), and vertical distance for shifting the map (map).
-function create K: Only used by function upward fft.
• gen interp map.jl -function gen interp map: Generates a magnetic anomaly map interpolation, which is re-turned. Requires a matrix of magnetic anomaly map values (nT), longitude vector (deg), and latitude vector (deg).
• helpers.jl -function detrend: Linear regression to remove a trend line (mean, slope) from a vector.
-function map grad: Determines the magnetic anomaly map gradient (nT/rad) at a specified position, which is returned (length 2 vector). Requires a magnetic anomaly map interpolation, longitude (deg), and latitude (deg).
A sample run file has also been provided in the MagNav.jl package within the runs folder. Here the usage of each of these functions is shown, and Figure 2 should be plotted as a baseline result. Here, the scalar magnetometers have been compensated using the Tolles-Lawson model, then detrended to remove DC offsets. As shown in Figure 2, the magnetometer 1 (tail stinger) compensation matches the professional compensation done by SGL ("truth" here). Magnetometer 5, despite being located in the cockpit, also performs fairly well, while magnetometers 3 and 4 would not be suitable for magnetic navigation. Magnetometer 2 is not shown due to even worse performance.

Appendix A The Tolles-Lawson Model
The Tolles-Lawson model [1] provides a means of isolating the aircraft magnetic field so that it can be removed from the total magnetic field, ideally yielding only the earth magnetic anomaly field used for navigation. The model is derived from a physical model of permanent, induced, and eddy current aircraft magnetic fields, which is presented here. Determining the coefficients of the model hinges on collecting magnetometer data during a calibration flight involving a set of maneuvers performed at a high altitude over a region with a small magnetic gradient (See Figure  3). A bandpass filter removes (ideally) nearly all of the earth magnetic field from the measurements.

Platform Calibration -Aaron Canciani
• Chicken and egg problem • "All" we need to do to calibrate out the aircraft is isolate the aircraft's magnetic field, then fit a model to it • But wait…if we could isolate the aircraft's magnetic field so easily then w would we be needing to do this whole calibration thing in the first place

Platform Calibration -Aaron Canciani
• Chicken and egg problem • "All" we need to do to calibrate out the aircraft is isolate the aircraft's magnetic field, then fit a model to it • But wait…if we could isolate the aircraft's magnetic field so easily then why would we be needing to do this whole calibration thing in the first place!

A.1 Aircraft Magnetic Fields
Tolles-Lawson uses measurements from a vector magnetometer to remove aircraft magnetic field contributions to the scalar magnetometer measurements, which are used for navigation. It is anticipated that the magnetic dynamics of an operational aircraft will exceed this model, but its assumptions are valid for compensation of the the stinger magnetometer. The Tolles-Lawson procedure considers the projection of the aircraft magnetic field onto the earth magnetic field, whereas a slightly modified version in [4] considers the projection of the aircraft magnetic field onto the total field, which follows here (see Figure 4a).
The total magnetic field vector H t = H e +H a is comprised of the earth H e and aircraft H a fields (Figure 4a). The reference frame is defined with respect to the transverse, longitudinal, and vertical axes of the aircraft, as shown in Figure 4b. The aircraft magnetic field includes contributions from the permanent magnetic moment, induced magnetic moment, and eddy currents of the aircraft. Their contributions to the magnitude of the total field can be written as    where the unit vector

l A E 0 T o f b f d X T / C f C 5 F a 0 = " > A A A B 6 H i c b V D L S g N B E O y N r x h f U Y 9 e B o P g K e x K Q L 0 F v X h M w D w g W c L s p D c Z M z u 7 z M w K M e Q L v H h Q x K u f 5 M 2 / c Z L s Q R M L G o q q b r q 7 g k R w b V z 3 2 8 m t r W 9 s b u W 3 C z u 7 e / s H x c O j p o 5 T x b D B Y h G r d k A 1 C i 6 x Y b g R 2 E 4 U 0 i g Q 2 A p G t z O / 9 Y h K 8 1 j e m 3 G C f k Q H k o e c U W O l + l O v W H L L 7 h x k l X g Z K U G G W q / 4 1 e 3 H L I 1 Q G i a o 1 h 3 P T Y w / o c p w J n B a 6 K Y a E 8 p G d I A d S y W N U P u T + a F T c m a V P g l j Z U s a M l d / T 0 x o p P U 4 C m x n R M 1 Q L 3 s z 8 T + v k 5 r w y p 9 w m a Q G J V s s C l N B T E x m X 5 M + V 8 i M G F t C m e L 2 V s K G V F F m b D Y F G 4 K 3 / P I q a V 6 U v U r 5 u l 4 p V W + y O P J w A q d w D h 5 c Q h X u o
is directly measured by the vector magnetometer, and consists of direction cosines defined by angles X, Y, Z between the total field vector and the respective axes of the reference frame. The coefficient matrices for the permanent moment induced moment A =   a 11 a 12 a 13 a 21 a 22 a 23 a 31 a 32 a 33   and eddy current contributions comprise the unknown coefficients to learn during calibration.
Consider the physics underlying this construction. The permanent dipole moment and resulting magnetic field of the aircraft are static with respect to the coordinate system, with projections onto the total field defined by the direction cosines. From this, it can be seen that P is the magnetic field vector due to the permanent dipole, with components along the reference frame axes. Note that the numerical indices (1, 2, 3) coincide with the corresponding (x, y, z) axes. The induced dipole moment can be thought of as resulting from three bars which can be magnetized along the x, y, and z axes, with moments proportional to the earth magnetic field projection onto that axis, but not necessarily located on any axis. In general, each dipole will create a vector field at the origin. This means A has components a ij , where u i a ij gives the component of the induced field in the j direction due to the moment pointing in the i direction. A similar argument holds for the geometry and projections of the eddy current fields comprising B. The notable difference is that the eddy currents arise from changes in the magnetic flux through surfaces of the aircraft, which make their contribution proportional to the time derivative of the direction cosines (u T t ) . The quadratic form of the second term in Eq. 1 implies that A can be made symmetric, reducing the number of unknown coefficients for the induced dipole field from 9 to 6, resulting in 18 Tolles-Lawson coefficients. Additional constraints, such as the direction cosine identity cos 2 X + cos 2 Y + cos 2 Z = 1 or assumptions about the surfaces of the aircraft, may further reduce the number of terms and coefficients used in the Tolles-Lawson model.

A.2 Learning the Coefficients
Here a linear model is built to determine the unknown Tolles-Lawson coefficients. A row vector of measurements is at a given time step, and a matrix of these is measurements is where each row is one of the N t timesteps and each column is a term cos X, cos Y , etc. The column vector of coefficients is Because the magnitude of the total field H t = H at + H et is the sum of the projections of the aircraft and earth magnetic field onto the total magnetic field, the N t × 1 column vector h t of total field measurements H t from the scalar magnetometer can be expressed as where h et is the column vector of H et at each timestep, which cannot be measured directly.
To decouple the aircraft field from the earth field, it is helpful to identify a band in which the frequency content of the aircraft dominates the signal. The calibration flight pattern, Figure 3b is roughly a square, with roll, pitch and yaw maneuvers performed along each leg. It can be helpful to think of these maneuvers as injecting aircraft magnetic field content into a given band. The square pattern is repeated in opposite directions, and is flown at high altitude with as tight turns as possible. While the frequency band of interest for magnetic navigation is between 1 mHz and 1 Hz, a band of 0.1 -0.9 Hz is typically used for calibration. Applying a bandpass filter both sides of Eq. 9 gives bpf(H) = bpf(∆)θ + bpf(H et ).
If the bandpass-filtered earth magnetic field projection is zero, i.e. bpf(H et ) = 0, where y = bpf(H t ) and D = bpf(∆). Solving for the coefficient vector θ using linear regression, or ridge regression, with ridge parameter λ, which is useful as the moment matrix D T D is often poorly conditioned.
Learning the Tolles-Lawson coefficients θ completes the calibration. Compensation is performed by applying the Tolles-Lawson coefficients to the instantaneous values of the terms derived from vector magnetometer measurements and subtracting this contribution from the magnitude of the total measured field. In symbolic form, the magnitude of the earth's field along the total field is The Tolles-Lawson coefficients represent the average contributions of the aircraft magnetic field over the calibration flight. They are determined using band-pass filtered measurements, but applied to unfiltered measurements. There is no directional dependence with respect to the earth's field. See [4] for additional discussion of additive noise, cases where the filtered earth magnetic field signal cannot be ignored, and errors of the vector magnetometer.

Appendix B Datafields
Along with magnetic flux and scalar data, additional fields from sensors on the aircraft are recorded. These fields reflect some of the changes in the aircraft's virtual dipole, causing error in the magnetic scalar sensors, and therefore provide additional de-noising information. Below is a description of each data field.

Appendix C Flight Number 1002
The first full flight began with an FOM test at the standard flight location over Shawville, Quebec, at the standard altitude (10,000ft MSL). All sensors were recording en route between Ottawa and FOM area. Then the aircraft flew 3 traverse lines and 2 control lines using drape GPS guidance. The purpose of this was to compare the repeat traverse and control lines to the original map data, and look for measurement agreement to 1-3 nT when the expected map data and actual measurements were compared with their means removed. Additionally, this flight was used to determine that because there was a trivial difference in accuracy between traverse lines and tie lines, the map is fully sampled.
Starting near the south end of the Eastern traverse line, the aircraft completed free fly portion. This allowed for analysis regarding the amount that upward continuation of drape surface to constant altitude degrades the measurement quality. The pilots caused different magnetic events that were expected to alter the virtual dipole of the aircraft. The table of events is shown in figure 4. Finally, the aircraft continued the free flight while changing altitudes, conducted a final FOM test, and completed the flight.

Appendix D Flight Number 1004
Flight Number 1004 occurred over the Eastern free flight area at 800m HAE. The line spacing was less than the height above ground level, and the flight covered as much area as possible (∼40x10 km). The purpose of this pattern was to create a high resolution survey area for future flights. For flight events see table 5.

Appendix E Flight Number 1005
The aircraft first flew 3 compensation profiles at progressively higher altitudes while varying the state: one at 400m HAE above Eastern survey, and the other two at the normal compensation area at 18,000 ft MSL and standard altitude. For 1 hour, the aircraft followed boxy figure 8's in a high resolution survey area (800m HAE) created on Flight Number 1004. The remaining time consisted of two large flight paths through the Renfrew and Eastern surveys at 400m HAE. For flight events see table 5.