Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions utilities/plotting/plotRefSLDHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function plotRefSLDHelper(data, noDelay, linearX, q4, showErrorBar, showGrid, sh
% showLegend : logical, default: true
% Indicates if the legend should be shown.
% shiftValue : float, default: 100
% A value between 1 and 100 that controls the spacing between the reflectivity plots for each of the contrasts.
% A value between 0 and 100 that controls the spacing between the reflectivity plots for each of the contrasts.

arguments
data
Expand All @@ -51,8 +51,9 @@ function plotRefSLDHelper(data, noDelay, linearX, q4, showErrorBar, showGrid, sh
showErrorBar {mustBeA(showErrorBar, 'logical')} = true
showGrid {mustBeA(showGrid, 'logical')} = false
showLegend {mustBeA(showLegend, 'logical')} = true
shiftValue {mustBeGreaterThanOrEqual(shiftValue, 1), mustBeLessThanOrEqual(shiftValue, 100)} = 100
end
shiftValue {mustBeGreaterThanOrEqual(shiftValue, 0), mustBeLessThanOrEqual(shiftValue, 100)} = 100
end

defaultState = 'on';
s = warning();
if any(strcmp({s.identifier}, 'MATLAB:Axes:NegativeDataInLogAxis'))
Expand All @@ -72,24 +73,24 @@ function plotRefSLDHelper(data, noDelay, linearX, q4, showErrorBar, showGrid, sh

if showGrid
set(gca,'YGrid','on','XGrid','on');
end
end

hold on
xlabel('$\textrm{Q}_{z} (\AA^{-1})$', 'Interpreter', 'Latex')
ylabel('Reflectivity', 'Interpreter', 'Latex')
lines = cell(numberOfContrasts, 1);
mult = 1;
q4Data = 1;
q4Data = 1.0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As all numbers in MATLAB are double not sure if this makes a difference

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old habits dying hard I think.


for i = 1:numberOfContrasts
thisRef = data.reflectivity{i};
thisData = data.shiftedData{i};
if i > 1 || q4
mult = 10.^((i/100)*shiftValue);
end


if q4 && data.dataPresent(i)
q4Data = thisData(:,1).^4;
end
mult = q4Data/mult;

div = 10.0^(shiftValue*(i-1)/100.0);
mult = q4Data/div;
refY = thisRef(:,2) .* mult;
% If there is data present
% plot it - size of data.shiftedData
Expand All @@ -102,9 +103,9 @@ function plotRefSLDHelper(data, noDelay, linearX, q4, showErrorBar, showGrid, sh
end

% Plot the fit
lines{i} = plot(thisRef(:,1), refY, '-', 'LineWidth', 2);

lines{i} = plot(thisRef(:,1), refY, '-', 'LineWidth', 2);
end

if showLegend
legend([lines{:}], data.contrastNames{:});
end
Expand Down
Loading