Skip to content

Commit

Permalink
Renames non-polarised TF to normal TF
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenNneji committed Nov 28, 2024
1 parent 59dd43a commit 4628433
Show file tree
Hide file tree
Showing 59 changed files with 96 additions and 76 deletions.
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
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 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 @@ -163,11 +163,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 @@ -176,11 +176,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
Expand Up @@ -4,7 +4,7 @@
resolution,background,backgroundAction,params,parallelPoints,resampleMinAngle,resampleNPoints,useImaginary)

% This is the main reflectivity calculation for all Layers models in the
% non polarised target function.
% normal target function.
%
% The function first arranges the
% roughness' in the correct order according
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,problemCells,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 individual cell arrays
Expand Down Expand Up @@ -44,7 +44,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 @@ -120,7 +120,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 @@ -39,7 +39,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 @@ -133,7 +133,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
16 changes: 8 additions & 8 deletions targetFunctions/reflectivityCalculation.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
% (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
% * oil water - Target function for oil-water samples
%
% * domains - Target function for samples consisting of domains which are larger than the beam lateral coherence length.
% * domains - Target function for samples consisting of domains which are larger than the beam lateral coherence length.
%
% * magnetic - Target function for cases for polarised neutrons with polarisation analysis.
% * magnetic - Target function for cases for polarised neutrons with polarisation analysis.
%

% Decide which target function we are calling and call the relevant routines
targetFunction = problemStruct.TF;
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,problemCells,controls);
subRoughs] = normalTF.standardLayers(problemStruct,problemCells,controls);

case coderEnums.modelTypes.CustomLayers

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

case coderEnums.modelTypes.CustomXY

[qzshifts,scalefactors,bulkIns,bulkOuts,...
resolutionParams,chis,reflectivity,simulation,shiftedData,...
backgrounds,layerSlds,sldProfiles,resampledLayers,...
subRoughs] = nonPolarisedTF.customXY(problemStruct,problemCells,controls);
subRoughs] = normalTF.customXY(problemStruct,problemCells,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.
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 @@ -21,7 +21,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,problemCells,problemLimits,controls);
Expand All @@ -39,12 +39,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,problemCells,controls);
resampledLayers,subRoughs] = normalTF.customLayers(problemStruct,problemCells,controls);

TFParams.qzshifts = qzshifts;
TFParams.scalefactors = scalefactors;
Expand All @@ -62,7 +62,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 @@ -82,7 +82,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,problemCells,problemLimits,controls);
Expand All @@ -100,12 +100,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,problemCells,controls);
resampledLayers, subRoughs] = normalTF.customXY(problemStruct,problemCells,controls);

TFParams.qzshifts = qzshifts;
TFParams.scalefactors = scalefactors;
Expand All @@ -123,7 +123,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 @@ -144,7 +144,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,problemCells,problemLimits,controls);
Expand All @@ -162,12 +162,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,problemCells,controls);
resampledLayers,subRoughs] = normalTF.standardLayers(problemStruct,problemCells,controls);

TFParams.qzshifts = qzshifts;
TFParams.scalefactors = scalefactors;
Expand All @@ -185,7 +185,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

0 comments on commit 4628433

Please sign in to comment.