Aeromagnetic Compensation
The following are key functions related to aeromagnetic compensation.
Tolles-Lawson
MagNav.create_TL_A — Functioncreate_TL_A(Bx, By, Bz;
Bt = sqrt.(Bx.^2+By.^2+Bz.^2),
terms = [:permanent,:induced,:eddy],
Bt_scale = 50000,
return_B = false)Create Tolles-Lawson A matrix using vector magnetometer measurements. Optionally returns the magnitude & derivatives of total field.
Arguments:
Bx,By,Bz: vector magnetometer measurements [nT]Bt: (optional) magnitude of vector magnetometer measurements or scalar magnetometer measurements for modified Tolles-Lawson [nT]terms: (optional) Tolles-Lawson terms to use {:permanent,:induced,:eddy,:bias}Bt_scale: (optional) scaling factor for induced & eddy current terms [nT]return_B: (optional) if true, also returnBt&B_dot
Returns:
A: Tolles-LawsonAmatrixBt: ifreturn_B = true, magnitude of total field measurements [nT]B_dot: ifreturn_B = true, finite differences of total field vector [nT]
create_TL_A(flux::MagV, ind = trues(length(flux.x));
Bt = sqrt.(flux.x.^2+flux.y.^2+flux.z.^2)[ind],
terms = [:permanent,:induced,:eddy],
Bt_scale = 50000,
return_B = false)Create Tolles-Lawson A matrix using vector magnetometer measurements. Optionally returns the magnitude & derivatives of total field.
Arguments:
flux:MagVvector magnetometer measurement structind: (optional) selected data indicesBt: (optional) magnitude of vector magnetometer measurements or scalar magnetometer measurements for modified Tolles-Lawson [nT]terms: (optional) Tolles-Lawson terms to use {:permanent,:induced,:eddy,:bias}Bt_scale: (optional) scaling factor for induced & eddy current terms [nT]return_B: (optional) if true, also returnBt&B_dot
Returns:
A: Tolles-LawsonAmatrixBt: ifreturn_B = true, magnitude of total field measurements [nT]B_dot: ifreturn_B = true, finite differences of total field vector [nT]
MagNav.create_TL_coef — Functioncreate_TL_coef(Bx, By, Bz, B;
Bt = sqrt.(Bx.^2+By.^2+Bz.^2),
λ = 0,
terms = [:permanent,:induced,:eddy],
pass1 = 0.1,
pass2 = 0.9,
fs = 10.0,
pole::Int = 4,
trim::Int = 20,
Bt_scale = 50000,
return_var = false)Create Tolles-Lawson coefficients using vector & scalar magnetometer measurements with a bandpass, low-pass, or high-pass filter.
Arguments:
Bx,By,Bz: vector magnetometer measurements [nT]B: scalar magnetometer measurements [nT]Bt: (optional) magnitude of vector magnetometer measurements or scalar magnetometer measurements for modified Tolles-Lawson [nT]λ: (optional) ridge parameterterms: (optional) Tolles-Lawson terms to use {:permanent,:induced,:eddy,:bias}pass1: (optional) first passband frequency [Hz]pass2: (optional) second passband frequency [Hz]fs: (optional) sampling frequency [Hz]pole: (optional) number of poles for Butterworth filtertrim: (optional) number of elements to trim after filteringBt_scale: (optional) scaling factor for induced & eddy current terms [nT]return_var: (optional) if true, also returnB_var
Returns:
coef: Tolles-Lawson coefficientsB_var: ifreturn_var = true, fit error variance
create_TL_coef(flux::MagV, B, ind = trues(length(flux.x));
Bt = sqrt.(flux.x.^2+flux.y.^2+flux.z.^2)[ind],
λ = 0,
terms = [:permanent,:induced,:eddy],
pass1 = 0.1,
pass2 = 0.9,
fs = 10.0,
pole::Int = 4,
trim::Int = 20,
Bt_scale = 50000,
return_var = false)Create Tolles-Lawson coefficients using vector & scalar magnetometer measurements with a bandpass, low-pass, or high-pass filter.
Arguments:
flux:MagVvector magnetometer measurement structB: scalar magnetometer measurements [nT]ind: (optional) selected data indicesBt: (optional) magnitude of vector magnetometer measurements or scalar magnetometer measurements for modified Tolles-Lawson [nT]λ: (optional) ridge parameterterms: (optional) Tolles-Lawson terms to use {:permanent,:induced,:eddy,:bias}pass1: (optional) first passband frequency [Hz]pass2: (optional) second passband frequency [Hz]fs: (optional) sampling frequency [Hz]pole: (optional) number of poles for Butterworth filtertrim: (optional) number of elements to trim after filteringBt_scale: (optional) scaling factor for induced & eddy current terms [nT]return_var: (optional) if true, also returnB_var
Returns:
coef: Tolles-Lawson coefficientsB_var: ifreturn_var = true, fit error variance
Model Training/Fitting
MagNav.comp_train — Functioncomp_train(comp_params::CompParams, xyz::XYZ, ind,
mapS::Union{MapS,MapSd,MapS3D} = mapS_null;
temp_params::TempParams = TempParams(),
xyz_test::XYZ = xyz,
ind_test = BitVector(),
silent::Bool = false)Train an aeromagnetic compensation model.
Arguments:
comp_params:CompParamsaeromagnetic compensation parameters struct, either:NNCompParams: neural network-based aeromagnetic compensation parameters structLinCompParams: linear aeromagnetic compensation parameters struct
xyz:XYZflight data structind: selected data indicesmapS: (optional)MapS,MapSd, orMapS3Dscalar magnetic anomaly map struct, only used fory_type = :b, :ctemp_params: (optional)TempParamstemporary temporal parameters structxyz_test: (optional)XYZheld-out test data structind_test: (optional) indices for test data structsilent: (optional) if true, no print outs
Returns:
comp_params:CompParamsaeromagnetic compensation parameters structy: length-Ntarget vectory_hat: length-Nprediction vectorerr: length-Ncompensation errorfeatures: length-Nffeature vector (including components of TLA, etc.)
comp_train(comp_params::CompParams, xyz_vec::Vector, ind_vec::Vector,
mapS::Union{MapS,MapSd,MapS3D} = mapS_null;
temp_params::TempParams = TempParams(),
xyz_test::XYZ = xyz_vec[1],
ind_test = BitVector(),
silent::Bool = false)Train an aeromagnetic compensation model.
Arguments:
comp_params:CompParamsaeromagnetic compensation parameters struct, either:NNCompParams: neural network-based aeromagnetic compensation parameters structLinCompParams: linear aeromagnetic compensation parameters struct
xyz_vec: vector ofXYZflight data structsind_vec: vector of selected data indicesmapS: (optional)MapS,MapSd, orMapS3Dscalar magnetic anomaly map struct, only used fory_type = :b, :ctemp_params: (optional)TempParamstemporary temporal parameters structxyz_test: (optional)XYZheld-out test data structind_test: (optional) indices for test data structsilent: (optional) if true, no print outs
Returns:
comp_params:CompParamsaeromagnetic compensation parameters structy: length-Ntarget vectory_hat: length-Nprediction vectorerr: length-Ncompensation errorfeatures: length-Nffeature vector (including components of TLA, etc.)
comp_train(comp_params::CompParams, lines,
df_line::DataFrame, df_flight::DataFrame, df_map::DataFrame;
temp_params::TempParams = TempParams(),
silent::Bool = false)Train an aeromagnetic compensation model.
Arguments:
comp_params:CompParamsaeromagnetic compensation parameters struct, either:NNCompParams: neural network-based aeromagnetic compensation parameters structLinCompParams: linear aeromagnetic compensation parameters struct
lines: selected line number(s)df_line: lookup table (DataFrame) oflines
| Field | Type | Description |
|---|---|---|
flight | Symbol | flight name (e.g., :Flt1001) |
line | Real | line number, i.e., segments within flight |
t_start | Real | start time of line to use [s] |
t_end | Real | end time of line to use [s] |
map_name | Symbol | (optional) name of magnetic anomaly map relevant to line |
df_flight: lookup table (DataFrame) of flight data files
| Field | Type | Description |
|---|---|---|
flight | Symbol | flight name (e.g., :Flt1001) |
xyz_type | Symbol | subtype of XYZ to use for flight data {:XYZ0,:XYZ1,:XYZ20,:XYZ21} |
xyz_set | Real | flight dataset number (used to prevent improper mixing of datasets, such as different magnetometer locations) |
xyz_file | String | path/name of flight data CSV, HDF5, or MAT file (.csv, .h5, or .mat extension required) |
df_map: lookup table (DataFrame) of map data files
| Field | Type | Description |
|---|---|---|
map_name | Symbol | name of magnetic anomaly map |
map_file | String | path/name of map data HDF5 or MAT file (.h5 or .mat extension required) |
temp_params: (optional)TempParamstemporary temporal parameters structsilent: (optional) if true, no print outs
Returns:
comp_params:CompParamsaeromagnetic compensation parameters structy: length-Ntarget vectory_hat: length-Nprediction vectorerr: length-Nmean-corrected (per line) compensation errorfeatures: length-Nffeature vector (including components of TLA, etc.)
Model Testing
MagNav.comp_test — Functioncomp_test(comp_params::CompParams, xyz::XYZ, ind,
mapS::Union{MapS,MapSd,MapS3D} = mapS_null;
temp_params::TempParams = TempParams(),
silent::Bool = false)Evaluate performance of an aeromagnetic compensation model.
Arguments:
comp_params:CompParamsaeromagnetic compensation parameters struct, either:NNCompParams: neural network-based aeromagnetic compensation parameters structLinCompParams: linear aeromagnetic compensation parameters struct
xyz:XYZflight data structind: selected data indicesmapS: (optional)MapS,MapSd, orMapS3Dscalar magnetic anomaly map struct, only used fory_type = :b, :ctemp_params: (optional)TempParamstemporary temporal parameters structsilent: (optional) if true, no print outs
Returns:
y: length-Ntarget vectory_hat: length-Nprediction vectorerr: length-Ncompensation errorfeatures: length-Nffeature vector (including components of TLA, etc.)
comp_test(comp_params::CompParams, lines,
df_line::DataFrame, df_flight::DataFrame, df_map::DataFrame;
temp_params::TempParams = TempParams(),
silent::Bool = false)Evaluate performance of an aeromagnetic compensation model.
Arguments:
comp_params:CompParamsaeromagnetic compensation parameters struct, either:NNCompParams: neural network-based aeromagnetic compensation parameters structLinCompParams: linear aeromagnetic compensation parameters struct
lines: selected line number(s)df_line: lookup table (DataFrame) oflines
| Field | Type | Description |
|---|---|---|
flight | Symbol | flight name (e.g., :Flt1001) |
line | Real | line number, i.e., segments within flight |
t_start | Real | start time of line to use [s] |
t_end | Real | end time of line to use [s] |
map_name | Symbol | (optional) name of magnetic anomaly map relevant to line |
df_flight: lookup table (DataFrame) of flight data files
| Field | Type | Description |
|---|---|---|
flight | Symbol | flight name (e.g., :Flt1001) |
xyz_type | Symbol | subtype of XYZ to use for flight data {:XYZ0,:XYZ1,:XYZ20,:XYZ21} |
xyz_set | Real | flight dataset number (used to prevent improper mixing of datasets, such as different magnetometer locations) |
xyz_file | String | path/name of flight data CSV, HDF5, or MAT file (.csv, .h5, or .mat extension required) |
df_map: lookup table (DataFrame) of map data files
| Field | Type | Description |
|---|---|---|
map_name | Symbol | name of magnetic anomaly map |
map_file | String | path/name of map data HDF5 or MAT file (.h5 or .mat extension required) |
temp_params: (optional)TempParamstemporary temporal parameters structsilent: (optional) if true, no print outs
Returns:
y: length-Ntarget vectory_hat: length-Nprediction vectorerr: length-Nmean-corrected (per line) compensation errorfeatures: length-Nffeature vector (including components of TLA, etc.)