Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced non-polarised calculation with normal calculation #281

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions API/createProject.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
% absorption terms are included in the refractive index.
% All of the arguments are optional.
%
% project = createProject(name='New experiment', calc='non polarised');
% project = createProject(name='New experiment', calc='normal');
arguments
options.name {mustBeTextScalar} = ''
options.calcType = calculationTypes.NonPolarised
options.calcType = calculationTypes.Normal
options.model = modelTypes.StandardLayers
options.geometry = geometryOptions.AirSubstrate
options.absorption {mustBeA(options.absorption,'logical')} = false
Expand Down
2 changes: 1 addition & 1 deletion API/enums/calculationTypes.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
end

enumeration
NonPolarised ('non polarised')
Normal ('normal')
Domains ('domains')
OilWater ('oil water')
Magnetic ('magnetic')
Expand Down
2 changes: 1 addition & 1 deletion API/makeEmptyResultStruct.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%
% nParams = number of fitted parameters
% nContrasts = number of contrasts
% nDomains = number of domains - 1 for non-polarised, 2 for domains
% nDomains = number of domains - 1 for normal, 2 for domains
%
% result =
%
Expand Down
2 changes: 1 addition & 1 deletion API/projectClass/customFileClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function displayTable(obj)
% Convert the custom files class to a struct
%
% customFiles.toStruct()
fileStruct.files = {};
fileStruct.files = cell(1, 0);
fileStruct.fileIdentifiers = {};
numberOfFiles = obj.rowCount;
if numberOfFiles > 0
Expand Down
10 changes: 5 additions & 5 deletions API/projectClass/domainsClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
% Alias of the converter routine from domainsClass to
% projectClass.
% This routine takes the currently defined project and
% converts it to a nonPolarised calculation, preserving all
% converts it to a normal calculation, preserving all
% currently defined properties.
%
% nonPolarisedProject = project.toProjectClass();
% normalProject = project.toProjectClass();
projectObj = obj.projectClass();
end

Expand Down Expand Up @@ -245,11 +245,11 @@
function projectObj = projectClass(obj)
% Converter routine from domainsClass to projectClass.
% This routine takes the currently defined project and
% converts it to a nonPolarised calculation, preserving all
% converts it to a normal calculation, preserving all
% currently defined properties.
%
% nonPolarisedProject = project.projectClass();
projectObj = projectClass(obj.experimentName, calculationTypes.NonPolarised, obj.modelType, obj.geometry, obj.absorption);
% normalProject = project.projectClass();
projectObj = projectClass(obj.experimentName, calculationTypes.Normal, obj.modelType, obj.geometry, obj.absorption);
projectObj = copyProperties(obj, projectObj);

% Need to treat contrasts separately due to changes in the
Expand Down
2 changes: 1 addition & 1 deletion API/projectClass/projectClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
% project = projectClass('New experiment');
arguments
experimentName {mustBeTextScalar} = ''
calculationType = calculationTypes.NonPolarised
calculationType = calculationTypes.Normal
modelType = modelTypes.StandardLayers
geometry = geometryOptions.AirSubstrate
absorption {mustBeA(absorption,'logical')} = false
Expand Down
2 changes: 1 addition & 1 deletion compile/fullCompile/makeCompileArgsFull.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
ARG = coder.typeof(0,[1 10],[1 1]);
ARGS_1_1.layersDetails = coder.typeof({ARG}, [maxArraySize 1],[1 1]);
ARG = coder.typeof('X',[1 maxArraySize],[0 1]);
ARGS_1_1.customFiles = coder.typeof({ARG}, [1 maxArraySize], [1 1]);
ARGS_1_1.customFiles = coder.typeof({ARG}, [1 maxArraySize], [0 1]);
ARGS_1_1.modelType = coder.typeof('X',[1 maxArraySize],[0 1]);
ARGS_1_1.contrastCustomFiles = coder.typeof(0,[1 maxArraySize],[0 1]);
ARGS_1_1.contrastDomainRatios = coder.typeof(0,[1 maxArraySize],[0 1]);
Expand Down
2 changes: 1 addition & 1 deletion compile/reflectivityCalculation/makeCompileArgs.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
ARG = coder.typeof(0,[1 10],[1 1]);
ARGS_1_1.layersDetails = coder.typeof({ARG}, [maxArraySize 1],[1 1]);
ARG = coder.typeof('X',[1 maxArraySize],[0 1]);
ARGS_1_1.customFiles = coder.typeof({ARG}, [1 maxArraySize], [1 1]);
ARGS_1_1.customFiles = coder.typeof({ARG}, [1 maxArraySize], [0 1]);
ARGS_1_1.modelType = coder.typeof('X',[1 maxArraySize],[0 1]);
ARGS_1_1.contrastCustomFiles = coder.typeof(0,[1 maxArraySize],[0 1]);
ARGS_1_1.contrastDomainRatios = coder.typeof(0,[1 maxArraySize],[0 1]);
Expand Down
2 changes: 1 addition & 1 deletion examples/domains/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This folder contains examples of how to use RAT to analyse what are referred
to as 'Domains TF' samples, which are those where an incoherent sum is required
in order to calculate the reflectivity. As is the case for normal reflectivity i.e. non-polarised TF,
in order to calculate the reflectivity. As is the case for normal reflectivity i.e. normal TF,
it is possible to use either 'Standard Layers', 'Custom Layers' or 'Custom XY' models.

The basic principle for all three is that there is an additional fittable
Expand Down
2 changes: 1 addition & 1 deletion examples/miscellaneous/absorption/absorptionDPPC50.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


% Set up the initial project....
problem = createProject(name = 'DPPC_50_3pcBins', calcType = 'non polarised',...
problem = createProject(name = 'DPPC_50_3pcBins', calcType = 'normal',...
model = 'custom layers', geometry = 'substrate/liquid', absorption = true);

% Add the required parameters (substrate reference as already there by default)....
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% Standard Layers fit of a DSPC floating bilayer

% Make the project
problem = createProject(name='original_dspc_bilayer', calcType='non polarised', model='standard layers', geometry='substrate/liquid', absorption=false);
problem = createProject(name='original_dspc_bilayer', calcType='normal', model='standard layers', geometry='substrate/liquid', absorption=false);

% Make priors visible
problem.showPriors(true);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% Standard Layers fit of a DSPC floating bilayer

% Make the project
problem = createProject(name='original_dspc_bilayer', calcType='non polarised', model='standard layers', geometry='substrate/liquid', absorption=false);
problem = createProject(name='original_dspc_bilayer', calcType='normal', model='standard layers', geometry='substrate/liquid', absorption=false);

% Make priors visible
problem.showPriors(true);
Expand Down
4 changes: 2 additions & 2 deletions examples/normalReflectivity/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## 'Non-polarised Target Functions' Examples
## 'Normal Target Functions' Examples

This folder contains examples of how to use RAT to analyse what are referred
to as 'Non-polarised TF' samples. This refers to reflectivity data that does not use
to as 'Normal TF' samples. This refers to reflectivity data that does not use
absorption (i.e. an imaginary SLD), and is not analysed as magnetic, polarised or
oil-water data.

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
% Standard Layers fit of a DSPC floating bilayer

% Make the project
problem = createProject(name='original_dspc_bilayer', calcType='non polarised', model='standard layers', geometry='substrate/liquid', absorption=false);
problem = createProject(name='original_dspc_bilayer', calcType='normal', model='standard layers', geometry='substrate/liquid', absorption=false);

% Make priors visible..
problem.showPriors = true;
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions targetFunctions/+domainsTF/customLayers.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@

% Call the core layers calculation - need to do this once for each
% domain
[sldProfile1,reflect1,simul1,~,layerSld1,resampledLayer1,~] = nonPolarisedTF.coreLayersCalculation(calcAllLayers1,roughness,...
[sldProfile1,reflect1,simul1,~,layerSld1,resampledLayer1,~] = normalTF.coreLayersCalculation(calcAllLayers1,roughness,...
geometry,bulkInValue,bulkOutValue,resample,calcSld,shiftedData,simLimits,repeatLayers,...
resolutionParamValue,background,backgroundAction,nParams,parallel,resampleMinAngle,resampleNPoints,useImaginary);

[sldProfile2,reflect2,simul2,shiftedData,layerSld2,resampledLayer2,~] = nonPolarisedTF.coreLayersCalculation(calcAllLayers2,roughness,...
[sldProfile2,reflect2,simul2,shiftedData,layerSld2,resampledLayer2,~] = normalTF.coreLayersCalculation(calcAllLayers2,roughness,...
geometry,bulkInValue,bulkOutValue,resample,calcSld,shiftedData,simLimits,repeatLayers,...
resolutionParamValue,background,backgroundAction,nParams,parallel,resampleMinAngle,resampleNPoints,useImaginary);

Expand Down
4 changes: 2 additions & 2 deletions targetFunctions/+domainsTF/standardLayers.m
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@

% Call the core layers calculation - need to do this once for each
% domain
[sldProfile1,reflect1,simul1,~,layerSld1,resampledLayer1,~] = nonPolarisedTF.coreLayersCalculation(thisContrastLayers1,roughness,...
[sldProfile1,reflect1,simul1,~,layerSld1,resampledLayer1,~] = normalTF.coreLayersCalculation(thisContrastLayers1,roughness,...
geometry,bulkInValue,bulkOutValue,resample,calcSld,shiftedData,simLimits,repeatLayers,...
resolutionParamValue,background,backgroundAction,nParams,parallel,resampleMinAngle,resampleNPoints,useImaginary);

[sldProfile2,reflect2,simul2,shiftedData,layerSld2,resampledLayer2,~] = nonPolarisedTF.coreLayersCalculation(thisContrastLayers2,roughness,...
[sldProfile2,reflect2,simul2,shiftedData,layerSld2,resampledLayer2,~] = normalTF.coreLayersCalculation(thisContrastLayers2,roughness,...
geometry,bulkInValue,bulkOutValue,resample,calcSld,shiftedData,simLimits,repeatLayers,...
resolutionParamValue,background,backgroundAction,nParams,parallel,resampleMinAngle,resampleNPoints,useImaginary);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function [qzshifts,scalefactors,bulkIns,bulkOuts,...
resolutionParams,chis,reflectivity,simulation,shiftedData,backgrounds,layerSlds,...
sldProfiles,resampledLayers,subRoughs] = customLayers(problemStruct,controls)
% The custom layers, nonPolarisedTF reflectivity calculation.
% The custom layers, normalTF reflectivity calculation.
% The function extracts the relevant parameters from the input arrays,
% allocates these on a pre-contrast basis, then calls the
% 'coreLayersCalculation' (the core layers nonPolarisedTF calc is
% 'coreLayersCalculation' (the core layers normalTF calc is
% shared between multiple calculation types).

% Extract parameters from problemStruct
Expand Down Expand Up @@ -37,7 +37,7 @@
sldProfiles = cell(numberOfContrasts,1);

% Process the custom models
[resampledLayers,subRoughs] = nonPolarisedTF.customLayers.processCustomFunction(contrastBulkInIndices,contrastBulkOutIndices,...
[resampledLayers,subRoughs] = normalTF.customLayers.processCustomFunction(contrastBulkInIndices,contrastBulkOutIndices,...
bulkInArray,bulkOutArray,cCustFiles,numberOfContrasts,customFiles,params,useImaginary);

if strcmpi(parallel, coderEnums.parallelOptions.Contrasts)
Expand Down Expand Up @@ -113,7 +113,7 @@

% Call the core layers calculation
[sldProfile,reflectivity,simulation,shiftedData,layerSld,resampledLayer,...
chi] = nonPolarisedTF.coreLayersCalculation(layer,roughness,...
chi] = normalTF.coreLayersCalculation(layer,roughness,...
geometry,bulkInValue,bulkOutValue,resample,calcSld,shiftedData,simLimits,repeatLayers,...
resolutionParamValue,background,backgroundAction,nParams,parallel,resampleMinAngle,resampleNPoints,useImaginary);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
resampledLayers = cell(numberOfContrasts,1);

% Process the custom models
[sldProfiles,subRoughs] = nonPolarisedTF.customXY.processCustomFunction(contrastBulkInIndices,contrastBulkOutIndices,...
[sldProfiles,subRoughs] = normalTF.customXY.processCustomFunction(contrastBulkInIndices,contrastBulkOutIndices,...
bulkInArray,bulkOutArray,cCustFiles,numberOfContrasts,customFiles,params);

if strcmpi(parallel, coderEnums.parallelOptions.Contrasts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@

% Call the core layers calculation
[sldProfile,reflectivity,simulation,shiftedData,layerSld,resampledLayer,...
chi] = nonPolarisedTF.coreLayersCalculation(thisContrastLayers,roughness,...
chi] = normalTF.coreLayersCalculation(thisContrastLayers,roughness,...
geometry,bulkInValue,bulkOutValue,resample,calcSld,shiftedData,simLimits,repeatLayers,...
resolutionParamValue,background,backgroundAction,nParams,parallel,resampleMinAngle,resampleNPoints,useImaginary);

Expand Down
10 changes: 5 additions & 5 deletions targetFunctions/reflectivityCalculation.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
% (i.e. 'Target function' is required, and call the relevant routines.
% The types of available target functions are:*
%
% * non polarised - The main basic target function type, for non polarised neutrons (or x-rays) with non-absorbing samples. Different model types are specified in sub functions from here.
% * normal - The main basic target function type, for non polarised neutrons (or x-rays) with non-absorbing samples. Different model types are specified in sub functions from here.
%
% * oil water - Target function for oil-water samples
%
Expand All @@ -21,7 +21,7 @@
modelType = problemStruct.modelType;

switch targetFunction
case coderEnums.calculationTypes.NonPolarised
case coderEnums.calculationTypes.Normal

switch lower(modelType)

Expand All @@ -30,21 +30,21 @@
[qzshifts,scalefactors,bulkIns,bulkOuts,...
resolutionParams,chis,reflectivity,simulation,shiftedData,...
backgrounds,layerSlds,sldProfiles,resampledLayers,...
subRoughs] = nonPolarisedTF.standardLayers(problemStruct,controls);
subRoughs] = normalTF.standardLayers(problemStruct,controls);

case coderEnums.modelTypes.CustomLayers

[qzshifts,scalefactors,bulkIns,bulkOuts,...
resolutionParams,chis,reflectivity,simulation,shiftedData,...
backgrounds,layerSlds,sldProfiles,resampledLayers,...
subRoughs] = nonPolarisedTF.customLayers(problemStruct,controls);
subRoughs] = normalTF.customLayers(problemStruct,controls);

case coderEnums.modelTypes.CustomXY

[qzshifts,scalefactors,bulkIns,bulkOuts,...
resolutionParams,chis,reflectivity,simulation,shiftedData,...
backgrounds,layerSlds,sldProfiles,resampledLayers,...
subRoughs] = nonPolarisedTF.customXY(problemStruct,controls);
subRoughs] = normalTF.customXY(problemStruct,controls);

otherwise
error('The model type "%s" is not supported', modelType);
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

%%
% Now add the custom file to the project..
project.addCustomFile('DPPC Model','DPPCCustomXY.m','matlab','tests/nonPolarisedTFReflectivityCalculation/');
project.addCustomFile('DPPC Model','DPPCCustomXY.m','matlab','tests/normalTFReflectivityCalculation/');


%%
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
inputs.controlsInput = controlsInput;
inputs.controls = controls;

save([root filesep 'tests/nonPolarisedTFReflectivityCalculation/customLayersInputs'],'inputs');
save([root filesep 'tests/normalTFReflectivityCalculation/customLayersInputs'],'inputs');

% (b) Outputs
resultStruct = reflectivityCalculation(problemStruct,problemLimits,controls);
Expand All @@ -38,12 +38,12 @@
outputs.project = project;
outputs.result = result;

save([root filesep 'tests/nonPolarisedTFReflectivityCalculation/customLayersOutputs'],'outputs');
save([root filesep 'tests/normalTFReflectivityCalculation/customLayersOutputs'],'outputs');

% (c) TF Parameters
[qzshifts,scalefactors,bulkIn,bulkOut,resolutionParams,...
chis,reflectivity,simulation,shiftedData,backgrounds,layerSlds,sldProfiles,...
resampledLayers,subRoughs] = nonPolarisedTF.customLayers(problemStruct,controls);
resampledLayers,subRoughs] = normalTF.customLayers(problemStruct,controls);

TFParams.qzshifts = qzshifts;
TFParams.scalefactors = scalefactors;
Expand All @@ -61,7 +61,7 @@
TFParams.sldProfiles = sldProfiles;
TFParams.resampledLayers = resampledLayers;

save([root filesep 'tests/nonPolarisedTFReflectivityCalculation/customLayersTFParams'],'TFParams');
save([root filesep 'tests/normalTFReflectivityCalculation/customLayersTFParams'],'TFParams');

%% 2. Custom XY.
% (a) Inputs
Expand All @@ -80,7 +80,7 @@
inputs.controlsInput = controlsInput;
inputs.controls = controls;

save([root filesep 'tests/nonPolarisedTFReflectivityCalculation/customXYInputs'],'inputs');
save([root filesep 'tests/normalTFReflectivityCalculation/customXYInputs'],'inputs');

% (b) Outputs
resultStruct = reflectivityCalculation(problemStruct,problemLimits,controls);
Expand All @@ -98,12 +98,12 @@
outputs.project = project;
outputs.result = result;

save([root filesep 'tests/nonPolarisedTFReflectivityCalculation/customXYOutputs'],'outputs');
save([root filesep 'tests/normalTFReflectivityCalculation/customXYOutputs'],'outputs');

% (c) TF Parameters
[qzshifts,scalefactors,bulkIn,bulkOut,resolutionParams,...
chis,reflectivity,simulation,shiftedData,backgrounds,layerSlds,sldProfiles,...
resampledLayers, subRoughs] = nonPolarisedTF.customXY(problemStruct,controls);
resampledLayers, subRoughs] = normalTF.customXY(problemStruct,controls);

TFParams.qzshifts = qzshifts;
TFParams.scalefactors = scalefactors;
Expand All @@ -121,7 +121,7 @@
TFParams.sldProfiles = sldProfiles;
TFParams.resampledLayers = resampledLayers;

save([root filesep 'tests/nonPolarisedTFReflectivityCalculation/customXYTFParams'],'TFParams');
save([root filesep 'tests/normalTFReflectivityCalculation/customXYTFParams'],'TFParams');

%% 3. Standard Layers
% (a) Inputs
Expand All @@ -140,7 +140,7 @@
inputs.controlsInput = controlsInput;
inputs.controls = controls;

save([root filesep 'tests/nonPolarisedTFReflectivityCalculation/standardLayersInputs'],'inputs');
save([root filesep 'tests/normalTFReflectivityCalculation/standardLayersInputs'],'inputs');

% (b) Outputs
resultStruct = reflectivityCalculation(problemStruct,problemLimits,controls);
Expand All @@ -158,12 +158,12 @@
outputs.project = project;
outputs.result = result;

save([root filesep 'tests/nonPolarisedTFReflectivityCalculation/standardLayersOutputs'],'outputs');
save([root filesep 'tests/normalTFReflectivityCalculation/standardLayersOutputs'],'outputs');

% (c) TF Parameters
[qzshifts,scalefactors,bulkIn,bulkOut,resolutionParams,...
chis,reflectivity,simulation,shiftedData,backgrounds,layerSlds,sldProfiles,...
resampledLayers,subRoughs] = nonPolarisedTF.standardLayers(problemStruct,controls);
resampledLayers,subRoughs] = normalTF.standardLayers(problemStruct,controls);

TFParams.qzshifts = qzshifts;
TFParams.scalefactors = scalefactors;
Expand All @@ -181,7 +181,7 @@
TFParams.sldProfiles = sldProfiles;
TFParams.resampledLayers = resampledLayers;

save([root filesep 'tests/nonPolarisedTFReflectivityCalculation/standardLayersTFParams'],'TFParams');
save([root filesep 'tests/normalTFReflectivityCalculation/standardLayersTFParams'],'TFParams');

%% 4. Converting between RAT and RASCAL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
%
% Add the custom file to the project....

project.addCustomFile('DSPC Model','customBilayer.m','matlab','tests/nonPolarisedTFReflectivityCalculation/');
project.addCustomFile('DSPC Model','customBilayer.m','matlab','tests/normalTFReflectivityCalculation/');
%%
%
%
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading