-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Data and Function Background types (#276)
* Staging commit * Copied the Standard Layers example to 'miscelaneous'. Renamed it 'backgroundTypes' - this will be the example folder for this * Modified projectClass to allow data backgrounds * Data background implemented. Needs testing * Implemented all background types for standard layers for evaluation (does not compile) * Adds data and custom file names as fields to project "toStruct" struct * Fixes build and tests * Adds code to expand all contrast data to six columns * Applies the "function" background type to all calculation and model types * Moves "applyBackgroundFunction" into the contrast loop as "constructBackground" * Modifies "constructBackground" to work for unequal data and simulation sizes * Modifies "constructBackground" to work from simulation limits * Removes background parameters from "applyBackgroundCorrection", using background array instead * Refactors results struct to replace "backgroundParams" with "backgrounds" * Removes variable definitions unnecessary for compilation * Adds routine "makeSimulationRange" * Fixes array size discrepancies and "shiftedDat" bug * Adds cell array "contrastBackgroundTypes" * Converts "contrastBackgroundParams" to a cell array * Adds "source" column to background and resolution tables * Renames "addDataBackgroundToContrastData" as "insertDataBackgroundIntoContrastData" * Adds code to raise error if no contrasts are defined * Disables support for non-matlab background functions * Moves reduction of "shiftedData" to three columns to "applyBackgroundCorrection" * Reinstates checkIndices for backgroundParams * Tidies up code * Adds test for insert data routine and includes new examples in tests * Tidies up code and removes unecessary routines * Addresses review comments * Addresses further review comments --------- Co-authored-by: arwelHughes <[email protected]> Co-authored-by: arwel <[email protected]>
- Loading branch information
1 parent
c944de7
commit 35f0252
Showing
99 changed files
with
1,981 additions
and
1,465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function contrastData = insertDataBackgroundIntoContrastData(contrastData,backgroundData) | ||
% Deal with a Data background. The data and errors in this case are | ||
% inserted into columns 5 and 6 of the relevant datafile. | ||
% | ||
% Currently, we throw an error if the qz column (column 1) of the two | ||
% datafiles are different. Eventually this will be replaced by an | ||
% interpolation to make it more general. | ||
|
||
% Get the arrays from the cells | ||
dataArray = contrastData{:}; | ||
backgroundArray = backgroundData{:}; | ||
|
||
% Check that we have the same q | ||
if ~isequal(dataArray(:,1), backgroundArray(:,1)) | ||
throw(exceptions.invalidValue("q points must be equal for Data and Background Data")); | ||
end | ||
|
||
% Insert background data into columns 5 and 6 of contrast data | ||
dataArray(:,5) = backgroundArray(:,2); | ||
dataArray(:,6) = backgroundArray(:,3); | ||
|
||
% Package as a cell array for output... | ||
contrastData = {dataArray}; | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.