NEW: Option to give upper and lower limit for linear background and Shirley offset
This commit is contained in:
1 parent
2f942c554c
commit
caec12ce3d
1 file changed
+120
-540
+120
-540
@@ -119,456 +119,7 @@ function DataTable = nappFitGaussXps(DataTable,varargin)
|
||||
% based customization and generic flexibility—can leverage the same underlying
|
||||
% infrastructure (Gaussian, Pseudo-Voigt, linear, and Shirley background models).
|
||||
%
|
||||
% =========================================================================% =========================================================================
|
||||
% PARAMETER VECTOR LAYOUTS FOR ALL MODE / BACKGROUND / PEAK-TYPE COMBINATIONS
|
||||
% =========================================================================
|
||||
%
|
||||
% NOTE:
|
||||
% - All layouts below use FWHM as the width parameter (not Gaussian sigma).
|
||||
% - "pos1_abs" means the absolute position of peak 1 (fit parameter).
|
||||
% - "pos2_rel", "pos4_rel", etc. are offsets relative to a reference peak.
|
||||
% - "width_shared" / "FWHM_shared" means a single FWHM shared across peaks.
|
||||
% - "K_i" are Shirley K parameters per peak, "C0" is the Shirley intercept.
|
||||
% - "slope" and "intercept" are linear background parameters: BG(E) = slope*E + intercept.
|
||||
% - nPeaks is determined from numel(FitParameter.peakArea).
|
||||
% - All generic modes (unconstrained, position, width, widthPosition) support any nPeaks >= 1.
|
||||
% - Custom modes (unconstrainedAndWidthPosition, gasAndTwoAcidBasePairs, etc.) are hard-coded for specific peak counts.
|
||||
%
|
||||
% =========================================================================
|
||||
% GENERIC MODES (support arbitrary number of peaks)
|
||||
% =========================================================================
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% UNCONSTRAINED MODE
|
||||
% - All peaks: independent FWHM, independent position.
|
||||
% - All FWHM values are free parameters.
|
||||
% - All peak positions are free parameters.
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + LINEAR (UNCONSTRAINED, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, pos1, area2, FWHM2, pos2, ..., areaN, FWHMN, posN, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + LINEAR (UNCONSTRAINED, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, pos1, eta1, ...
|
||||
% area2, FWHM2, pos2, eta2, ...
|
||||
% ...
|
||||
% areaN, FWHMN, posN, etaN, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== GAUSSIAN + SHIRLEY (UNCONSTRAINED, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, pos1, ...
|
||||
% area2, FWHM2, pos2, ...
|
||||
% ...
|
||||
% areaN, FWHMN, posN, ...
|
||||
% K1, K2, ..., KN, ...
|
||||
% C0]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (UNCONSTRAINED, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, pos1, eta1, ...
|
||||
% area2, FWHM2, pos2, eta2, ...
|
||||
% ...
|
||||
% areaN, FWHMN, posN, etaN, ...
|
||||
% K1, K2, ..., KN, ...
|
||||
% C0]
|
||||
%
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% POSITION MODE
|
||||
% - Peak 1: absolute position (fit parameter), independent FWHM.
|
||||
% - Peaks 2..N: positions relative to peak 1 via FitParameter.peakPos(1,i),
|
||||
% independent FWHM.
|
||||
% - All FWHM values are independent (no sharing).
|
||||
% - Shirley mode: K1, K2, ..., KN per-peak (NOT shared).
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + LINEAR (POSITION MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, area2, FWHM2, ..., areaN, FWHMN, ...
|
||||
% pos1_abs, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + LINEAR (POSITION MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, eta1, ...
|
||||
% area2, FWHM2, eta2, ...
|
||||
% ...
|
||||
% areaN, FWHMN, etaN, ...
|
||||
% pos1_abs, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== GAUSSIAN + SHIRLEY (POSITION MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, area2, FWHM2, ..., areaN, FWHMN, ...
|
||||
% pos1_abs, ...
|
||||
% K1, K2, ..., KN, ...
|
||||
% C0]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (POSITION MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, eta1, ...
|
||||
% area2, FWHM2, eta2, ...
|
||||
% ...
|
||||
% areaN, FWHMN, etaN, ...
|
||||
% pos1_abs, ...
|
||||
% K1, K2, ..., KN, ...
|
||||
% C0]
|
||||
%
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% POSITION-SHIRLEY MODE
|
||||
% - Peak 1: absolute position (fit parameter).
|
||||
% - Peaks 2..N: positions relative to peak 1.
|
||||
% - All peaks: independent FWHM.
|
||||
% - Shirley background ONLY (no linear option).
|
||||
% - K value is SHARED (single K for all peaks, NOT per-peak).
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + SHIRLEY (POSITION-SHIRLEY MODE, Shirley shared) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, area2, FWHM2, ..., areaN, FWHMN, ...
|
||||
% pos1_abs, ...
|
||||
% K, ...
|
||||
% C0]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (POSITION-SHIRLEY MODE, Shirley shared) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, eta1, ...
|
||||
% area2, FWHM2, eta2, ...
|
||||
% ...
|
||||
% areaN, FWHMN, etaN, ...
|
||||
% pos1_abs, ...
|
||||
% K, ...
|
||||
% C0]
|
||||
%
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% WIDTH-POSITION MODE
|
||||
% - All peaks: shared FWHM (single FWHM_shared for all).
|
||||
% - Peak 1: absolute position (fit parameter).
|
||||
% - Peaks 2..N: positions relative to peak 1 via FitParameter.peakPos(1,i).
|
||||
% - Shirley mode: K1, K2, ..., KN per-peak (NOT shared).
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + LINEAR (WIDTH-POSITION MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, area2, ..., areaN, ...
|
||||
% FWHM_shared, ...
|
||||
% pos1_abs, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + LINEAR (WIDTH-POSITION MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, eta1, ...
|
||||
% area2, eta2, ...
|
||||
% ...
|
||||
% areaN, etaN, ...
|
||||
% FWHM_shared, ...
|
||||
% pos1_abs, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== GAUSSIAN + SHIRLEY (WIDTH-POSITION MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, area2, ..., areaN, ...
|
||||
% FWHM_shared, ...
|
||||
% pos1_abs, ...
|
||||
% K1, K2, ..., KN, ...
|
||||
% C0]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (WIDTH-POSITION MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, eta1, ...
|
||||
% area2, eta2, ...
|
||||
% ...
|
||||
% areaN, etaN, ...
|
||||
% FWHM_shared, ...
|
||||
% pos1_abs, ...
|
||||
% K1, K2, ..., KN, ...
|
||||
% C0]
|
||||
%
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% WIDTH-POSITION-SHIRLEY MODE
|
||||
% - All peaks: shared FWHM (single FWHM_shared for all).
|
||||
% - Peak 1: absolute position (fit parameter).
|
||||
% - Peaks 2..N: positions relative to peak 1.
|
||||
% - Shirley background ONLY (no linear option).
|
||||
% - K value is SHARED (single K for all peaks, NOT per-peak).
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + SHIRLEY (WIDTH-POSITION-SHIRLEY MODE, Shirley shared) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, area2, ..., areaN, ...
|
||||
% FWHM_shared, ...
|
||||
% pos1_abs, ...
|
||||
% K, ...
|
||||
% C0]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (WIDTH-POSITION-SHIRLEY MODE, Shirley shared) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, eta1, ...
|
||||
% area2, eta2, ...
|
||||
% ...
|
||||
% areaN, etaN, ...
|
||||
% FWHM_shared, ...
|
||||
% pos1_abs, ...
|
||||
% K, ...
|
||||
% C0]
|
||||
%
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% WIDTH MODE
|
||||
% - All peaks: shared FWHM (single FWHM_shared for all).
|
||||
% - All peaks: independent absolute positions.
|
||||
% - Shirley mode: K1, K2, ..., KN per-peak (NOT shared).
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + LINEAR (WIDTH MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, pos1_abs, ...
|
||||
% area2, pos2_abs, ...
|
||||
% ...
|
||||
% areaN, posN_abs, ...
|
||||
% FWHM_shared, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + LINEAR (WIDTH MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, pos1_abs, eta1, ...
|
||||
% area2, pos2_abs, eta2, ...
|
||||
% ...
|
||||
% areaN, posN_abs, etaN, ...
|
||||
% FWHM_shared, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== GAUSSIAN + SHIRLEY (WIDTH MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, pos1_abs, ...
|
||||
% area2, pos2_abs, ...
|
||||
% ...
|
||||
% areaN, posN_abs, ...
|
||||
% FWHM_shared, ...
|
||||
% K1, K2, ..., KN, ...
|
||||
% C0]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (WIDTH MODE, FWHM as parameter) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, pos1_abs, eta1, ...
|
||||
% area2, pos2_abs, eta2, ...
|
||||
% ...
|
||||
% areaN, posN_abs, etaN, ...
|
||||
% FWHM_shared, ...
|
||||
% K1, K2, ..., KN, ...
|
||||
% C0]
|
||||
%
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% WIDTH-SHIRLEY MODE
|
||||
% - All peaks: shared FWHM (single FWHM_shared for all).
|
||||
% - All peaks: independent absolute positions.
|
||||
% - Shirley background ONLY (no linear option).
|
||||
% - K value is SHARED (single K for all peaks, NOT per-peak).
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + SHIRLEY (WIDTH-SHIRLEY MODE, Shirley shared) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, pos1_abs, ...
|
||||
% area2, pos2_abs, ...
|
||||
% ...
|
||||
% areaN, posN_abs, ...
|
||||
% FWHM_shared, ...
|
||||
% K, ...
|
||||
% C0]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (WIDTH-SHIRLEY MODE, Shirley shared) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, pos1_abs, eta1, ...
|
||||
% area2, pos2_abs, eta2, ...
|
||||
% ...
|
||||
% areaN, posN_abs, etaN, ...
|
||||
% FWHM_shared, ...
|
||||
% K, ...
|
||||
% C0]
|
||||
%
|
||||
%
|
||||
% =========================================================================
|
||||
% CUSTOM MODES (hard-coded constraint patterns)
|
||||
% =========================================================================
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% CUSTOM MODE: unconstrainedAndWidthPosition
|
||||
% - 5-peak hard-coded constraint pattern.
|
||||
% - Peak 1 and 2: share width (FWHM1), positions coupled by shift parameter.
|
||||
% - Peak 3: independent width (FWHM3), independent position.
|
||||
% - Peaks 4 and 5: share width with peak 1, independent relative positions.
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + LINEAR (UNCONSTRAINED+WIDTH-POSITION HYBRID, 5 PEAKS) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, pos2_rel, ...
|
||||
% area2, ...
|
||||
% area3, FWHM3, pos3_abs, ...
|
||||
% area4, pos4_rel, ...
|
||||
% area5, pos5_rel, ...
|
||||
% slope, intercept, ...
|
||||
% pos1_abs_shift]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + LINEAR (UNCONSTRAINED+WIDTH-POSITION HYBRID, 5 PEAKS) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, pos2_rel, eta1, ...
|
||||
% area2, eta2, ...
|
||||
% area3, FWHM3, pos3_abs, eta3, ...
|
||||
% area4, pos4_rel, eta4, ...
|
||||
% area5, pos5_rel, eta5, ...
|
||||
% slope, intercept, ...
|
||||
% pos1_abs_shift]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (UNCONSTRAINED+WIDTH-POSITION HYBRID, 5 PEAKS) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, pos2_rel, eta1, K1, ...
|
||||
% area2, eta2, K2, ...
|
||||
% area3, FWHM3, pos3_abs, eta3, K3, ...
|
||||
% area4, pos4_rel, eta4, K4, ...
|
||||
% area5, pos5_rel, eta5, K5, ...
|
||||
% C0, ...
|
||||
% pos1_abs_shift]
|
||||
%
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% CUSTOM MODE: gasAndTwoAcidBasePairs
|
||||
% - 5-peak hard-coded pattern: one gas peak + two acid-base pairs.
|
||||
% - Peak 1: gas peak, independent width, positions of peaks 2/4 coupled to it via shift.
|
||||
% - Peak 2: first acid (bound to peak 1).
|
||||
% - Peak 3: base pair, independent width and position.
|
||||
% - Peaks 4 and 5: second acid-base pair (relative positions).
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + LINEAR (GAS + TWO ACID-BASE PAIRS, 5 PEAKS) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, pos2_rel, ...
|
||||
% area2, ...
|
||||
% area3, FWHM3, pos3_abs, ...
|
||||
% area4, pos4_rel, ...
|
||||
% area5, pos5_rel, ...
|
||||
% slope, intercept, ...
|
||||
% pos1_abs_shift]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + LINEAR (GAS + TWO ACID-BASE PAIRS, 5 PEAKS) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, pos2_rel, eta1, ...
|
||||
% area2, eta2, ...
|
||||
% area3, FWHM3, pos3_abs, eta3, ...
|
||||
% area4, pos4_rel, eta4, ...
|
||||
% area5, pos5_rel, eta5, ...
|
||||
% slope, intercept, ...
|
||||
% pos1_abs_shift]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (GAS + TWO ACID-BASE PAIRS, 5 PEAKS) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM1, pos2_rel, eta1, K1, ...
|
||||
% area2, eta2, K2, ...
|
||||
% area3, FWHM3, pos3_abs, eta3, K3, ...
|
||||
% area4, pos4_rel, eta4, K4, ...
|
||||
% area5, pos5_rel, eta5, K5, ...
|
||||
% C0, ...
|
||||
% pos1_abs_shift]
|
||||
%
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% CUSTOM MODE: TwoSpinOrbitDoublet
|
||||
% - 4-peak model: two spin-orbit doublets (each doublet has a fixed area ratio
|
||||
% and energy separation, representing J=1/2 and J=3/2 spin-orbit splitting).
|
||||
% - Peak 1: first doublet, intensity I (area1).
|
||||
% - Peak 2: first doublet satellite, intensity I*R (fixed ratio), energy shift fixed.
|
||||
% - Peak 3: second doublet, intensity I3 (area3).
|
||||
% - Peak 4: second doublet satellite, intensity I3*R (fixed ratio), energy shift fixed.
|
||||
% - All peaks share the same FWHM.
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + LINEAR (TWO SPIN-ORBIT DOUBLET, 4 PEAKS) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM_shared, pos1_abs, ...
|
||||
% area3, pos3_abs, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (TWO SPIN-ORBIT DOUBLET, 4 PEAKS) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM_shared, pos1_abs, eta_shared, ...
|
||||
% area3, pos3_abs, ...
|
||||
% K_shared, ...
|
||||
% C0]
|
||||
%
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% CUSTOM MODE: widthPositionAreaRatio
|
||||
% - 2-peak model: second peak area and position are constrained by fixed ratios.
|
||||
% - Peak 1: free area, free position, shared width.
|
||||
% - Peak 2: area = area1 * FitParameter.peakArea(1,2) (fixed ratio),
|
||||
% position = pos1 + FitParameter.peakPos(1,2) (fixed offset).
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + LINEAR (2 PEAKS, AREA RATIO, SHARED WIDTH) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM_shared, pos1_abs, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + LINEAR (2 PEAKS, AREA RATIO, SHARED WIDTH) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM_shared, eta_shared, ...
|
||||
% pos1_abs, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (2 PEAKS, AREA RATIO, SHARED WIDTH) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM_shared, eta_shared, K_shared, ...
|
||||
% pos1_abs, ...
|
||||
% C0]
|
||||
%
|
||||
%
|
||||
% -------------------------------------------------------------------------
|
||||
% CUSTOM MODE: widthPositionAmineAreaRatio
|
||||
% - 5-peak model: specialized for amine deconvolution with constrained areas.
|
||||
% - Peak 1: primary amine (free area, free position), shared width.
|
||||
% - Peak 2: secondary amine (area constrained), relative position.
|
||||
% - Peak 3: secondary amine satellite (area constrained), relative position.
|
||||
% - Peaks 4 and 5: tertiary amines, shared width.
|
||||
% -------------------------------------------------------------------------
|
||||
%
|
||||
% ===== GAUSSIAN + LINEAR (AMINE AREA RATIO, 5 PEAKS) =====
|
||||
% PARAMETER VECTOR:
|
||||
% [area1, FWHM_shared, pos1_abs, ...
|
||||
% area2, ...
|
||||
% area2*ratio, ...
|
||||
% area4, ...
|
||||
% slope, intercept]
|
||||
%
|
||||
%
|
||||
% =========================================================================
|
||||
% SYMBOLS AND SHORT-HANDS
|
||||
% =========================================================================
|
||||
%
|
||||
% area_i : area (intensity integral) of peak i
|
||||
% FWHM_i : full width at half maximum of peak i
|
||||
% FWHM_shared : single shared FWHM used by all (or multiple) peaks
|
||||
% pos_i : center energy of peak i
|
||||
% pos1_abs : absolute fitted position of peak 1 (fit parameter)
|
||||
% pos*_rel : relative energy offset from a reference peak
|
||||
% (calculated from FitParameter.peakPos, NOT fit parameter)
|
||||
% pos1_abs_shift : additional shift applied to peak 1 position in custom modes
|
||||
% eta_i : Pseudo-Voigt mixing parameter of peak i (0 = pure Gaussian,
|
||||
% 1 = pure Lorentzian)
|
||||
% eta_shared : single shared eta for all peaks
|
||||
% K_i : Shirley background K parameter for peak i
|
||||
% K : shared Shirley K parameter (used in shared modes)
|
||||
% C0 : Shirley background intercept constant
|
||||
% slope : linear background slope (coefficient of energy)
|
||||
% intercept : linear background y-intercept
|
||||
%
|
||||
% =========================================================================
|
||||
|
||||
|
||||
|
||||
%% Define function input
|
||||
@@ -617,6 +168,34 @@ if matches(p.Results.peakWidthMode,'gauss')
|
||||
% input is in gauss-width, this function requires FWHM:
|
||||
FitParameter.peakWidth = FitParameter.peakWidth .* sqrt(log(4));
|
||||
end
|
||||
|
||||
% Define defaults for linear background slope and intercept (historic
|
||||
% reasons)
|
||||
bkgrd_init = [0, 0];
|
||||
bkgrd_lb = [-Inf, -Inf];
|
||||
bkgrd_ub = [ Inf, Inf];
|
||||
% June 2026: User can give constraints to linear background.
|
||||
if isfield(FitParameter, 'bkgrd')
|
||||
bkgrd_init = FitParameter.bkgrd(1:2);
|
||||
end
|
||||
if isfield(FitParameter, 'bkgrdLowerBound')
|
||||
bkgrd_lb = FitParameter.bkgrdLowerBound(1:2);
|
||||
end
|
||||
if isfield(FitParameter, 'bkgrdUpperBound')
|
||||
bkgrd_ub = FitParameter.bkgrdUpperBound(1:2);
|
||||
end
|
||||
|
||||
% Define defaults for Shirley background slope and intercept (historic
|
||||
% reasons)
|
||||
shirleyC0_lb = 0;
|
||||
shirleyC0_ub = Inf;
|
||||
% June 2026: User can give constraints to Shirley background.
|
||||
if isfield(FitParameter, 'peakShirleyOffsetLowerBound')
|
||||
shirleyC0_lb = FitParameter.peakShirleyOffsetLowerBound;
|
||||
end
|
||||
if isfield(FitParameter, 'peakShirleyOffsetUpperBound')
|
||||
shirleyC0_ub = FitParameter.peakShirleyOffsetUpperBound;
|
||||
end
|
||||
% =========================================================================
|
||||
%% VALIDATION
|
||||
% =========================================================================
|
||||
@@ -865,9 +444,9 @@ for iuz = 1
|
||||
FitParameter.peakPosUpperBound(1,iPeak)];
|
||||
end
|
||||
% Append linear background (slope, intercept)
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
|
||||
elseif matches(p.Results.backgroundMode, 'linear') && peakEta_exists
|
||||
% ===== PSEUDO-VOIGT + LINEAR (UNCONSTRAINED) =====
|
||||
@@ -895,9 +474,9 @@ for iuz = 1
|
||||
FitParameter.peakEtaUpperBound(1,iPeak)];
|
||||
end
|
||||
% Append linear background (slope, intercept)
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
|
||||
elseif contains(p.Results.backgroundMode, 'shirley') && ~peakEta_exists
|
||||
% ===== GAUSSIAN + SHIRLEY (UNCONSTRAINED) =====
|
||||
@@ -931,9 +510,9 @@ for iuz = 1
|
||||
end
|
||||
|
||||
% Append C0
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
elseif matches(p.Results.backgroundMode, 'shirley') && peakEta_exists
|
||||
% ===== PSEUDO-VOIGT + SHIRLEY (UNCONSTRAINED) =====
|
||||
@@ -966,9 +545,9 @@ for iuz = 1
|
||||
end
|
||||
|
||||
% Append C0
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
else
|
||||
error('Unconstrained mode: invalid combination of backgroundMode and peakEta.');
|
||||
@@ -1003,9 +582,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakPosUpperBound(1, 1)];
|
||||
|
||||
% Linear background: slope, intercept
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
|
||||
elseif peakEtaexists
|
||||
modelDefinitionFunction = @(currentParameterVector,energyValues) ...
|
||||
@@ -1032,9 +611,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakPosUpperBound(1, 1)];
|
||||
|
||||
% Linear background
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
end
|
||||
|
||||
elseif matches(p.Results.backgroundMode, 'shirley')
|
||||
@@ -1067,9 +646,9 @@ for iuz = 1
|
||||
end
|
||||
|
||||
% Append C0
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
elseif peakEtaexists
|
||||
modelDefinitionFunction = @(currentParameterVector,energyValues) ...
|
||||
@@ -1102,9 +681,9 @@ for iuz = 1
|
||||
end
|
||||
|
||||
% Append C0
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
else
|
||||
error('Position mode: invalid combination of backgroundMode and peakEta.');
|
||||
@@ -1147,9 +726,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakShirleyKUpperBound(1,1)];
|
||||
|
||||
% Append C0
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
elseif peakEtaexists
|
||||
modelDefinitionFunction = @(currentParameterVector,energyValues) ...
|
||||
@@ -1181,9 +760,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakShirleyKUpperBound(1,1)];
|
||||
|
||||
% Append C0
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1219,9 +798,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakPosUpperBound(1, 1)];
|
||||
|
||||
% Linear background: slope, intercept
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
|
||||
elseif peakEtaexists
|
||||
modelDefinitionFunction = @(currentParameterVector,energyValues) ...
|
||||
@@ -1250,9 +829,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakPosUpperBound(1, 1)];
|
||||
|
||||
% Linear background: slope, intercept
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
end
|
||||
|
||||
elseif matches(p.Results.backgroundMode, 'shirley')
|
||||
@@ -1288,9 +867,9 @@ for iuz = 1
|
||||
end
|
||||
|
||||
% C0 (Shirley offset)
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
elseif peakEtaexists
|
||||
|
||||
@@ -1327,9 +906,9 @@ for iuz = 1
|
||||
end
|
||||
|
||||
% C0 (Shirley offset)
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
else
|
||||
error('widthPosition mode: invalid combination of backgroundMode and peakEta.');
|
||||
@@ -1376,9 +955,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakShirleyKUpperBound(1, 1)];
|
||||
|
||||
% C0 (Shirley offset)
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
elseif peakEtaexists
|
||||
|
||||
@@ -1413,9 +992,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakShirleyKUpperBound(1, 1)];
|
||||
|
||||
% C0 (Shirley offset)
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
end
|
||||
end
|
||||
@@ -1457,9 +1036,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakShirleyKUpperBound(1, 1)];
|
||||
|
||||
% C0 (Shirley offset)
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
else
|
||||
error('widthPositionShirleyEta mode requires backgroundMode ''shirley''.');
|
||||
end
|
||||
@@ -1494,9 +1073,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakWidthUpperBound(1, 1)];
|
||||
|
||||
% Linear background: slope, intercept
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
|
||||
elseif peakEtaexists
|
||||
modelDefinitionFunction = @(currentParameterVector,energyValues) ...
|
||||
@@ -1523,9 +1102,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakWidthUpperBound(1, 1)];
|
||||
|
||||
% Linear background: slope, intercept
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
end
|
||||
|
||||
elseif matches(p.Results.backgroundMode, 'shirley')
|
||||
@@ -1560,9 +1139,9 @@ for iuz = 1
|
||||
end
|
||||
|
||||
% C0 (Shirley offset)
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
elseif peakEtaexists
|
||||
|
||||
@@ -1597,9 +1176,9 @@ for iuz = 1
|
||||
end
|
||||
|
||||
% C0 (Shirley offset)
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
else
|
||||
error('width mode: invalid combination of backgroundMode and peakEta.');
|
||||
@@ -1644,9 +1223,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakShirleyKUpperBound(1, 1)];
|
||||
|
||||
% C0 (Shirley offset)
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
elseif peakEtaexists
|
||||
|
||||
@@ -1679,9 +1258,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakShirleyKUpperBound(1, 1)];
|
||||
|
||||
% C0 (Shirley offset)
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
else
|
||||
error('width mode: invalid combination of backgroundMode and peakEta.');
|
||||
@@ -1756,9 +1335,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakAreaUpperBound(1, 5), FitParameter.peakPosUpperBound(1, 5)];
|
||||
|
||||
% #13,14 Background: slope, intercept
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
|
||||
|
||||
% #14: Pos 1 (shift)
|
||||
@@ -1873,9 +1452,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakPosUpperBound(1, 3)];
|
||||
|
||||
% #6 & #7 Background: slope, intercept
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
elseif matches(p.Results.mode,'GasAndSurfaceSpinOrbitDoublet')
|
||||
%% GasAndSurfaceSpinOrbitDoublet
|
||||
|
||||
@@ -1921,9 +1500,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, FitParameter.peakPosUpperBound(1, 3)];
|
||||
|
||||
% #7 & #8 Background: slope, intercept
|
||||
initialParameterVector = [initialParameterVector, 0, 0];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, -Inf, -Inf];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, Inf, Inf];
|
||||
initialParameterVector = [initialParameterVector, bkgrd_init];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, bkgrd_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, bkgrd_ub];
|
||||
|
||||
elseif matches(p.Results.mode,'TwoSpinOrbitDoubletPseudoVoigtShirley')
|
||||
%% TwoSpinOrbitDoubletPseudoVoigtShirley
|
||||
@@ -1975,9 +1554,9 @@ for iuz = 1
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector,FitParameter.peakShirleyKUpperBound(1, 1)];
|
||||
|
||||
% #7 C0
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset(1, 1)];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, 0];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector,Inf];
|
||||
initialParameterVector = [initialParameterVector, FitParameter.peakShirleyOffset];
|
||||
lowerBoundsParameterVector = [lowerBoundsParameterVector, shirleyC0_lb];
|
||||
upperBoundsParameterVector = [upperBoundsParameterVector, shirleyC0_ub];
|
||||
|
||||
elseif matches(p.Results.mode,'gasAndTwoAcidBasePairs')
|
||||
%% gasAndTwoAcidBasePairs
|
||||
@@ -1997,7 +1576,7 @@ for iuz = 1
|
||||
FitParameter.peakArea(1,3) FitParameter.peakWidth(1,2) FitParameter.peakPos(1,3)... % Gauss peak 3
|
||||
FitParameter.peakArea(1,4) FitParameter.peakPos(1,4)... % Gauss peak 4
|
||||
FitParameter.peakArea(1,5) FitParameter.peakPos(1,5)... % Gauss peak 5
|
||||
1 0 ... % linear background
|
||||
FitParameter.bkgrd(1) FitParameter.bkgrd(2) ... % linear background
|
||||
FitParameter.peakPos(1,1)];
|
||||
% lower bounds
|
||||
lowerBoundsParameterVector = [FitParameter.peakAreaLowerBound(1,1) FitParameter.peakWidthLowerBound(1,1) FitParameter.peakPosLowerBound(1,2) ... % Gauss peak 1
|
||||
@@ -2005,7 +1584,7 @@ for iuz = 1
|
||||
FitParameter.peakAreaLowerBound(1,3) FitParameter.peakWidthLowerBound(1,2) FitParameter.peakPosLowerBound(1,3) ... % Gauss peak 3
|
||||
FitParameter.peakAreaLowerBound(1,4) FitParameter.peakPosLowerBound(1,4) ...
|
||||
FitParameter.peakAreaLowerBound(1,5) FitParameter.peakPosLowerBound(1,5) ...% Gauss peak 4
|
||||
-Inf -Inf ... % linear background
|
||||
FitParameter.bkgrdLowerBound(1) FitParameter.bkgrdLowerBound(2) ... % linear background
|
||||
FitParameter.peakPosLowerBound(1,1)];
|
||||
|
||||
% upper bound
|
||||
@@ -2014,7 +1593,7 @@ for iuz = 1
|
||||
FitParameter.peakAreaUpperBound(1,3) FitParameter.peakWidthUpperBound(1,2) FitParameter.peakPosUpperBound(1,3) ... % Gauss peak 3
|
||||
FitParameter.peakAreaUpperBound(1,4) FitParameter.peakPosUpperBound(1,4) ...
|
||||
FitParameter.peakAreaUpperBound(1,5) FitParameter.peakPosUpperBound(1,5) ... % Gauss peak 4
|
||||
Inf Inf ... % linear background
|
||||
FitParameter.bkgrdUpperBound(1) FitParameter.bkgrdUpperBound(2)... % linear background
|
||||
FitParameter.peakPosUpperBound(1,1)]; % shift upper bound
|
||||
|
||||
elseif matches(p.Results.mode,'widthPositionAreaRatio')
|
||||
@@ -2029,13 +1608,13 @@ for iuz = 1
|
||||
|
||||
% initial value
|
||||
initialParameterVector= [FitParameter.peakArea(1,1) FitParameter.peakWidth(1,1) FitParameter.peakPos(1,1)... % Gauss peak 1
|
||||
1 0]; % linear background
|
||||
bkgrd_init]; % linear background
|
||||
% lower bounds
|
||||
lowerBoundsParameterVector = [FitParameter.peakAreaLowerBound(1,1) FitParameter.peakWidthLowerBound(1,1) FitParameter.peakPosLowerBound(1,1) ... % Gauss peak 1
|
||||
-Inf -Inf]; % linear background
|
||||
bkgrd_lb]; % linear background
|
||||
% upper bound
|
||||
upperBoundsParameterVector = [FitParameter.peakAreaUpperBound(1,1) FitParameter.peakWidthUpperBound(1,1) FitParameter.peakPosUpperBound(1,1) ... % Gauss peak 1
|
||||
Inf Inf]; % linear background
|
||||
bkgrd_ub]; % linear background
|
||||
|
||||
|
||||
elseif matches(p.Results.mode,'widthPositionAmineAreaRatio')
|
||||
@@ -2054,19 +1633,20 @@ for iuz = 1
|
||||
FitParameter.peakArea(1,2) ... % Gauss peak 3
|
||||
FitParameter.peakArea(1,4)...
|
||||
FitParameter.peakArea(1,5)...% Gauss peak 5
|
||||
1 0]; % linear background
|
||||
bkgrd_init]; % linear background
|
||||
% lower bounds
|
||||
lowerBoundsParameterVector = [FitParameter.peakAreaLowerBound(1,1) FitParameter.peakWidthLowerBound(1,1) FitParameter.peakPosLowerBound(1,1) ... % Gauss peak 1
|
||||
FitParameter.peakAreaLowerBound(1,2) ... % Gauss peak 3
|
||||
FitParameter.peakAreaLowerBound(1,4) ...
|
||||
FitParameter.peakAreaLowerBound(1,5) ... % Gauss peak 5
|
||||
-Inf -Inf]; % linear background
|
||||
bkgrd_lb]; % linear background
|
||||
% upper bound
|
||||
upperBoundsParameterVector = [FitParameter.peakAreaUpperBound(1,1) FitParameter.peakWidthUpperBound(1,1) FitParameter.peakPosUpperBound(1,1) ... % Gauss peak 1
|
||||
FitParameter.peakAreaUpperBound(1,2) ... % Gauss peak 3
|
||||
FitParameter.peakAreaUpperBound(1,4) ...
|
||||
FitParameter.peakAreaUpperBound(1,5) ...% Gauss peak 5
|
||||
Inf Inf]; % linear background
|
||||
bkgrd_ub]; % linear background
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user