function [ Bmap1D ] = readfieldmap( filename, nskiplines )
%READFIELDMAP read fieldmap from the file
%   Detailed explanation goes here

if nargin < 2
    nskiplines =   29; % default for the on-axis field scans
end

map = readtable(filename,'HeaderLines',nskiplines,'Delimiter',' ','ReadVariableNames',false);

zs = table2array(map(:,1));
Bxs = -table2array(map(:,11));
Bys = table2array(map(:,13));

medfilt_width = 5;
Bxs = medfilt1(Bxs, medfilt_width);
Bys = medfilt1(Bys, medfilt_width);

Bmap1D = [ zs, Bxs, Bys ];

end

