I am trying to fit some data where my data points (intensity vs. field) are not equally spaced along the field axis. Can pepper/esfit coomodate that? As far as I can tell from the documentation, it is only possible to define a number of point (Exp.nPoints) and either a range (Exp.Range) or a centre+width (Exp.CenterSweep).
I found a solution for this: Write a custom function that interpolates a simulated spectrum using a spline and evaluate it at the unevenly spaced field values:
function [B, spc] = splinespc(Sys, Exp, Opt)
Exp.nPoints = 10e4; %some arbitrary number
%Exp.XData contains the field values at which your data was measured
Exp.Range = [min(Exp.XData) max(Exp.XData)];
if exist('Opt','var')
[Btemp,spctemp] = pepper(Sys,Exp,Opt);
else
[Btemp,spctemp] = pepper(Sys,Exp);
end
B = Exp.XData;
spc = spline(Btemp,spctemp,B);
end
However, I think it could still be very convenient if it was possible to give a user-defined range for field values instead of simply using "Exp.Range" or "Exp.CenterRange", which gives linearly spaced points.
Supporting unevenly (but still strictly monotonically increasing) field values could in principle be implemented, but it seems that you found an excellent and not too complicated solution for this!