Component Separation Using Opt.seperate="Componens'

General forum for EasySpin: questions, how to's, etc.
Post Reply
Shamiul41
Newbie
Posts: 5
Joined: Mon Nov 11, 2024 8:02 pm

Component Separation Using Opt.seperate="Componens'

Post by Shamiul41 »

Hi i am trying to seperate two components using the following code. but getting error every time.
Error using esfit

Experimental data and model have unequal total number of points:
experimental: 2048
model: 4096
Sys1.g = [2.0072, 2.0062, 2.0033];
Sys1.A=[6.7 6.7 35];
Sys1.Nucs = '14N';
Sys1.weight =20;
Sys1.lwpp = 0.1; % mT
Sys2.g = [2.0072, 2.0062, 2.0033];
Sys2.A=[6.7 6.7 35];
Sys2.weight = 80;
Sys2.Nucs = '14N';
Sys2.lwpp =0.15; % mT
Sys1.logtcorr =-9.3;
Sys2.logtcorr =-8.0;
Exp.mwFreq = 9.5; % GHz
Exp.Range = [336.6 340.3]; % mT
Exp.nPoints = 2048;
Sys = {Sys1,Sys2};
Vary1.g = [0.009, 0.009, 0.009]; % Check if this g-tensor is correct for your system
Vary1.A = [1 1 1.5]; % Check if hyperfine values are reasonable
Vary2.g = [0.009, 0.009, 0.009];
Vary2.A=[1 1 1.5];
Vary1.weight=20;
Vary2.weight =20;
Vary1.lwpp = 0.09; % Ensure line width is set correctly
Vary2.lwpp = 0.09; % Allow more variation for Sys2
Vary1.logtcorr =1;
Vary2.logtcorr =1;
Vary = {Vary1, Vary2};
% Now includes variability for the third system
% Call the fitting function
FitOpt.maxTime = '30'; % Allow up to 30 minutes for Stage 1
FitOpt.TolEdgeLength = 1e-3; % Relax tolerance
Options.LLMK = [50000, 25000, 1000, 5000];
Options.maxIter = 10000; % Allow for 50,000 iterations as a test
% Coarse iteration limits
FitOpt.Method = 'simplex'; % Use simplex algorithm
FitOpt.AutoScale = 'maxabs'; % Automatically scale data for better optimization
SimOpt.Method = 'Simplified';
SimOpt.separate = 'components';

% Run the fitting process
Result=esfit(spc, @chili, {Sys, Exp, SimOpt}, {Vary}, FitOpt);

tec000
Newbie
Posts: 7
Joined: Fri May 03, 2024 9:38 am

Re: Component Separation Using Opt.seperate="Componens'

Post by tec000 »

If you use Opt.separate = 'components', chili returns two spectra (one for each component, 2048 points each), leading to the unequal number of points error. If you remove that line, it will return the sum spectrum including the contributions for both components and your code should work.

Post Reply