Skip to content

Commit 6368706

Browse files
committed
Updated the PHD plots to use all Rho values
1 parent 531b2e7 commit 6368706

2 files changed

Lines changed: 9 additions & 16 deletions

File tree

forward-solvers/phd-of-rho-and-z-two-layer-compute-fluence.py

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
solver = TwoLayerSDAForwardSolver()
3434
solver.SourceConfiguration = SourceConfiguration.Distributed
3535

36-
distributedSolver = DistributedPointSourceSDAForwardSolver()
37-
3836
topLayerThickness = 5
3937
opRegions = Array.CreateInstance(IOpticalPropertyRegion, 2)
4038
opRegions[0] = LayerOpticalPropertyRegion(DoubleRange(0, topLayerThickness, 2), OpticalProperties(0.1, 1, 0.8, 1.4))
@@ -58,38 +56,33 @@
5856
zs = 0.1 + zs_delta * np.arange(100)
5957
print(zs)
6058

59+
allRhos = np.concatenate((-rhos[::-1], rhos))
60+
print("*********************************** RHOS *****************************************")
61+
print(allRhos.tolist())
62+
6163
opRegionsArray = Array[Array[IOpticalPropertyRegion]]([opRegions])
6264
# predict the tissue's fluence(rho, z) for the given optical properties
63-
fluence = solver.FluenceOfRhoAndZ(opRegionsArray, rhos, zs );
6465
independentAxes = Array.CreateInstance(IndependentVariableAxis, 1)
6566
independentAxes[0] = IndependentVariableAxis.Z
6667
independentValues = Array.CreateInstance(Array[Double], 2)
67-
independentValues[0] = Array[Double](rhos.tolist())
68+
independentValues[0] = Array[Double](allRhos.tolist())
6869
independentValues[1] = Array[Double](zs.tolist())
69-
fluenceOfRhoAndZ = ComputationFactory.ComputeFluence(distributedSolver, FluenceSolutionDomainType.FluenceOfRhoAndZ, independentAxes, independentValues, opRegions, Array[Double](rhos.tolist()))
70+
fluenceOfRhoAndZ = ComputationFactory.ComputeFluence(solver, FluenceSolutionDomainType.FluenceOfRhoAndZ, independentAxes, independentValues, opRegions, Array[Double](allRhos.tolist()))
7071

7172
#PHD
7273
sourceDetectorSeparation = 10
7374
opArray = Array.CreateInstance(OpticalProperties, 2)
7475
opArray[0] = OpticalProperties(0.1, 1, 0.8, 1.4)
7576
opArray[1] = OpticalProperties(0.01, 1, 0.8, 1.4)
7677

77-
phdOfRhoAndZ = ComputationFactory.GetPHD(ForwardSolverType.TwoLayerSDA, fluence, sourceDetectorSeparation, opArray, Array[Double](rhos.tolist()), Array[Double](zs.tolist()))
78-
79-
allRhos = np.concatenate((-rhos[::-1], rhos))
80-
print("*********************************** RHOS *****************************************")
81-
print(allRhos.tolist())
78+
phdOfRhoAndZ = ComputationFactory.GetPHD(ForwardSolverType.TwoLayerSDA, fluenceOfRhoAndZ, sourceDetectorSeparation, opArray, Array[Double](allRhos.tolist()), Array[Double](zs.tolist()))
8279

8380
# log transform
8481
log_phd = [Math.Log(f) for f in phdOfRhoAndZ]
85-
log_fluence = [Math.Log(f) for f in fluenceOfRhoAndZ]
8682

8783
size = len(zs)
8884
# split into rows
8985
phdRowsToPlot = np.array([log_phd[i:i+size] for i in range(0, len(log_phd), size)])
90-
fluenceRowsToPlot = np.array([log_fluence[i:i+size] for i in range(0, len(log_fluence), size)])
91-
# reverse and concatenate
92-
allFluenceRowsToPlot = np.concatenate((fluenceRowsToPlot[::-1], phdRowsToPlot))
9386

9487
def heatmap(values, x, y, x_label="", y_label="", title=""):
9588
"""Create a heatmap chart."""
@@ -110,5 +103,5 @@ def heatmap(values, x, y, x_label="", y_label="", title=""):
110103
)
111104
return fig
112105

113-
fluenceChart = heatmap(allFluenceRowsToPlot.tolist(), allRhos.tolist(), list(zs), "ρ [mm]", "z [mm]", "log(phd(ρ, z) [mm-2])")
106+
fluenceChart = heatmap(phdRowsToPlot.tolist(), allRhos.tolist(), list(zs), "ρ [mm]", "z [mm]", "log(phd(ρ, z) [mm-2])")
114107
fluenceChart.show(renderer="browser")

forward-solvers/phd-of-rho-and-z-two-layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@ def heatmap(values, x, y, x_label="", y_label="", title=""):
103103
)
104104
return fig
105105

106-
fluenceChart = heatmap(fluenceRowsToPlot.tolist(), list(rhos), list(zs), "ρ [mm]", "z [mm]", "log(phd(ρ, z) [mm-2])")
106+
fluenceChart = heatmap(fluenceRowsToPlot.tolist(), allRhos.tolist(), list(zs), "ρ [mm]", "z [mm]", "log(phd(ρ, z) [mm-2])")
107107
fluenceChart.show(renderer="browser")

0 commit comments

Comments
 (0)