-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MC/PP: added validation to MCCL and MCPP to check that tissue OPs (e.…
…g. mua, musp, n) are non-negative. Found out that MCLL and MCPP run with negative values! So fixed that with input validation check. Also corrected headers of some tests because summary was confusing.
- Loading branch information
1 parent
919bc10
commit 82fdc44
Showing
7 changed files
with
126 additions
and
3 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
54 changes: 54 additions & 0 deletions
54
...teCarlo/DataStructuresValidation/PostProcessorInputs/PostProcessorInputValidationTests.cs
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,54 @@ | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using Vts.Common; | ||
using Vts.MonteCarlo; | ||
using Vts.MonteCarlo.Detectors; | ||
using Vts.MonteCarlo.Tissues; | ||
|
||
namespace Vts.Test.MonteCarlo.DataStructuresValidation.PostProcessorInputs | ||
{ | ||
[TestFixture] | ||
public class PostProcessorInputValidationTests | ||
{ | ||
/// <summary> | ||
/// Test to check that post-processor perturbed OPs are not negative | ||
/// </summary> | ||
[Test] | ||
public void validate_tissue_optical_properties_are_non_negative() | ||
{ | ||
var tissueInput = new MultiLayerTissueInput( | ||
new ITissueRegion[] | ||
{ | ||
new LayerTissueRegion( | ||
new DoubleRange(double.NegativeInfinity, 0.0), | ||
new OpticalProperties( 0.0, 1e-10, 1.0, 1.0)), | ||
new LayerTissueRegion( | ||
new DoubleRange(0.0, 100.0), | ||
new OpticalProperties(-1.0, 1.0, 0.8, 1.4)), // make mua negative | ||
new LayerTissueRegion( | ||
new DoubleRange(100.0, double.PositiveInfinity), | ||
new OpticalProperties(0.0, 1e-10, 1.0, 1.0)) | ||
}); | ||
var input = new PostProcessorInput( | ||
new List<IDetectorInput>() | ||
{ | ||
new pMCROfRhoDetectorInput() | ||
{ | ||
Rho=new DoubleRange(0.0, 100.0), | ||
// set perturbed ops to reference ops | ||
PerturbedOps = new List<OpticalProperties>() | ||
{ | ||
tissueInput.Regions[0].RegionOP, | ||
tissueInput.Regions[1].RegionOP, | ||
tissueInput.Regions[2].RegionOP | ||
}, | ||
PerturbedRegionsIndices = new List<int>() { 1 } | ||
} | ||
}, | ||
"","","" | ||
); | ||
var result = PostProcessorInputValidation.ValidateInput(input,""); | ||
Assert.IsFalse(result.IsValid); | ||
} | ||
} | ||
} |
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