Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 6
Modified SLD profiles.#440
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
c6c0d4e9fb02ed01834b9bc2d7a6e8431162759cfd7253235a5fc28330c4a653a0e683db4d1c782259e5File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,76 @@ | ||
| function SLDProfile = makeSLDProfile(bulkIn,bulkOut,layers,ssub,nrepeats) | ||
| function SLD = makeSLDProfile(bulkIn,bulkOut,layers,lastRough,nRepeats) | ||
| numberOfLayers = size(layers,1); | ||
| bulkIn = bulkIn * 1e6; | ||
| bulkOut = bulkOut * 1e6; | ||
| if numberOfLayers>0 | ||
| if size(layers,1) > 0 | ||
| % Make a z range for the profile... | ||
| % Find the maximum thickness, including any long roughness tail on final layer... | ||
| totalThickness = sum(layers(:,1)); | ||
| totalRange = (totalThickness*nrepeats) + 150; | ||
| x = 0:totalRange; | ||
| Lays = zeros(length(x),(numberOfLayers*nrepeats)+2); | ||
| boxCen = 0; | ||
| boxWidth = 100; | ||
| roughnessValues = layers(:,3)'; | ||
| roughnessValues(end+1) = ssub; | ||
| nextLayerRoughness = roughnessValues(1); | ||
| airBox = asymconvstep(x,boxWidth,boxCen,nextLayerRoughness,nextLayerRoughness,bulkIn); | ||
| lastBoxEdge = boxCen + (0.5 * boxWidth); | ||
| for n = 1:nrepeats | ||
| for i = 1:numberOfLayers | ||
| layerThickness = layers(i,1); | ||
| layerSLD = layers(i,2); | ||
| layerRoughness = roughnessValues(i); | ||
| nextLayerRoughness = roughnessValues(i+1); | ||
| thisBoxCentre = lastBoxEdge + (0.5 * layerThickness); | ||
| thisBox = asymconvstep(x,layerThickness,thisBoxCentre,layerRoughness,nextLayerRoughness,layerSLD); | ||
| Lays(:,i+(numberOfLayers*(n-1))) = thisBox; | ||
| lastBoxEdge = thisBoxCentre + (0.5 * layerThickness); | ||
| outerLayerCentre = totalThickness - (layers(end,1)/2); | ||
| % Find the point which covers 99% of the outer error function.. | ||
| outerLayerTailLim = (erfcinv(0.01) * sqrt(2) * layers(end,3)) + outerLayerCentre; | ||
| % We need to make sure the total SLD range includes this... | ||
| outerLayerTailExtension = outerLayerTailLim - outerLayerCentre; | ||
Collaborator There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The variables | ||
| totalRange = ((totalThickness + outerLayerTailExtension)*nRepeats); | ||
| % Add some extra range at the end for bulk_out... | ||
| totalRange = totalRange + 100; | ||
| z = 0:totalRange; | ||
| % Scale the SLDs... | ||
| layers(:,2) = layers(:,2) * 1e6; | ||
| % Repeat the stack according to 'nRepeats'... | ||
| layers = repmat(layers,nRepeats,1); | ||
| % Add an aditional 'layer' for the transition to bulk out... | ||
| outLayer = [0 bulkOut lastRough]; | ||
| layers = [layers; outLayer]; | ||
| % Pre-definitions.... | ||
| nLayers = size(layers,1); | ||
| allFuncs = zeros(length(z),nLayers); | ||
| alpha = zeros(1,nLayers); | ||
| lastLayerSLD = bulkIn; | ||
| thisPos = 50; | ||
| % Make the profile by adding an error function for each interface (we | ||
| % use 'normcdf' because it scales more easily than 'erf'...) | ||
| for i = 1:nLayers | ||
| nextRough = layers(i,3); | ||
| nextLayerSLD = layers(i,2); | ||
| diff = nextLayerSLD - lastLayerSLD; | ||
| thisFun = normcdf(z,thisPos,nextRough); | ||
| if diff < 0 | ||
| thisFun = -thisFun; | ||
| end | ||
| end | ||
| layerRoughness = nextLayerRoughness; | ||
| layerThickness = (x(end)-lastBoxEdge)*2; | ||
| layerSLD = bulkOut; | ||
| nextLayerRoughness = ssub; | ||
| thisBoxCentre = x(end); | ||
| Lays(:,(numberOfLayers*nrepeats)+1) = asymconvstep(x,layerThickness,thisBoxCentre,layerRoughness,nextLayerRoughness,layerSLD); | ||
| Lays(:,(numberOfLayers*nrepeats)+2) = airBox; | ||
| SLD = sum(Lays,2); | ||
| allFuncs(:,i) = thisFun(:); | ||
| alpha(i) = abs(diff); | ||
| thisPos = layers(i,1) + thisPos; | ||
| lastLayerSLD = nextLayerSLD; | ||
| end | ||
| totalFuncs = allFuncs.* alpha; | ||
| total = sum(totalFuncs,2); | ||
| else | ||
| x = 0:100; | ||
| subsBoxCen = max(x); | ||
| airBoxCen = 0; | ||
| widths = max(x); | ||
| airBox = asymconvstep(x,widths,airBoxCen,ssub,ssub,bulkIn); | ||
| subBox = asymconvstep(x,widths,subsBoxCen,ssub,ssub,bulkOut); | ||
| SLD = airBox + subBox; | ||
| % If we have no layers (i.e. just a bare interface), we only need one | ||
| % cdf... | ||
| z = 0:100; | ||
| pos = 50; | ||
| diff = bulkOut - bulkIn; | ||
| thisFun = normcdf(z,pos,lastRough); | ||
| if diff < 1 | ||
| thisFun = -thisFun; | ||
| end | ||
| total = thisFun * abs(diff); | ||
| end | ||
| SLDProfile = [x(:), SLD(:)]; | ||
| total = (total + bulkIn) * 1e-6; | ||
| SLD = [z(:) total(:)]; | ||
| end | ||
| end | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build for this pull request is failing, this change is probably the reason why.