Skip to content

Commit 7d21e6f

Browse files
committed
Added comments and removed print commands used for debugging
1 parent 61bf4d0 commit 7d21e6f

3 files changed

Lines changed: 10 additions & 23 deletions

File tree

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,20 @@
5858
arrayOP = Array[Array[IOpticalPropertyRegion]]([opRegions])
5959
# predict the tissue's fluence(rho, z) for the given optical properties
6060
fluenceOfRhoAndZ = solver.FluenceOfRhoAndZ(arrayOP, rhos, zs );
61-
#print("*********************************** FLUENCE *****************************************")
62-
#print(list(fluenceOfRhoAndZ))
6361

6462
allRhos = np.concatenate((-rhos[::-1], rhos))
65-
print("*********************************** RHOS *****************************************")
66-
print(allRhos.tolist())
6763

6864
# log transform
6965
log_fluence = [Math.Log(f) for f in fluenceOfRhoAndZ]
7066

7167
size = len(zs)
7268
# split into rows
7369
fluenceRowsToPlot = np.array([log_fluence[i:i+size] for i in range(0, len(log_fluence), size)])
74-
#print("*********************************** FLUENCE ROWS TO PLOT *****************************************")
75-
#print(fluenceRowsToPlot)
7670

7771
# reverse and concatenate
7872
allFluenceRowsToPlot = np.concatenate((fluenceRowsToPlot[::-1], fluenceRowsToPlot))
79-
#print("*********************************** ALL FLUENCE ROWS TO PLOT *****************************************")
80-
#print(allFluenceRowsToPlot.tolist())
8173

74+
# Heatmap function to convert the data into a heat map
8275
def heatmap(values, x, y, x_label="", y_label="", title=""):
8376
"""Create a heatmap chart."""
8477
# values should be a 2D array-like (list of lists or 2D numpy array)

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# This is an example of python code using VTS to Compute fluence for a two-layer
2-
# medium as a function of radial extent and depth at a given set of optical properties
1+
# This is an example of python code using VTS to Compute photon hitting density for a two-layer
2+
# medium at a given set of optical properties
3+
# This sample uses ComputeFluence in place of calling FluenceOfRhoAndZ on the forward solver object
4+
# and it uses a distributed point source SDA Forward Solver
35
#
46
# Import PythonNet
57
from pythonnet import load
@@ -56,8 +58,6 @@
5658
print(zs)
5759

5860
allRhos = np.concatenate((-rhos[::-1], rhos))
59-
print("*********************************** RHOS *****************************************")
60-
print(allRhos.tolist())
6161

6262
opRegionsArray = Array[Array[IOpticalPropertyRegion]]([opRegions])
6363
# predict the tissue's fluence(rho, z) for the given optical properties
@@ -66,6 +66,7 @@
6666
independentValues = Array.CreateInstance(Array[Double], 2)
6767
independentValues[0] = Array[Double](allRhos.tolist())
6868
independentValues[1] = Array[Double](zs.tolist())
69+
# Call the static method ComputeFluence in ComputationFactory to get the fluence data
6970
fluenceOfRhoAndZ = ComputationFactory.ComputeFluence(solver, FluenceSolutionDomainType.FluenceOfRhoAndZ, independentAxes, independentValues, opRegions, Array[Double](allRhos.tolist()))
7071

7172
#PHD
@@ -83,6 +84,7 @@
8384
# split into rows
8485
phdRowsToPlot = np.array([log_phd[i:i+size] for i in range(0, len(log_phd), size)])
8586

87+
# Heatmap function to convert the data into a heat map
8688
def heatmap(values, x, y, x_label="", y_label="", title=""):
8789
"""Create a heatmap chart."""
8890
# values should be a 2D array-like (list of lists or 2D numpy array)

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# This is an example of python code using VTS to Compute fluence for a two-layer
2-
# medium as a function of radial extent and depth at a given set of optical properties
1+
# This is an example of python code using VTS to Compute photon hitting density for a two-layer
2+
# medium at a given set of optical properties
33
#
44
# Import PythonNet
55
from pythonnet import load
@@ -59,31 +59,23 @@
5959
opRegionsArray = Array[Array[IOpticalPropertyRegion]]([opRegions])
6060
# predict the tissue's fluence(rho, z) for the given optical properties
6161
fluenceOfRhoAndZ = solver.FluenceOfRhoAndZ(opRegionsArray, allRhos, zs );
62-
#print("*********************************** FLUENCE *****************************************")
63-
#print(list(fluenceOfRhoAndZ))
6462

6563
#PHD
66-
print("*********************************** Fluence *****************************************")
67-
print('len(fluenceOfRhoAndZ)=',len(fluenceOfRhoAndZ))
6864
sourceDetectorSeparation = 10
6965
opArray = Array.CreateInstance(OpticalProperties, 2)
7066
opArray[0] = OpticalProperties(0.1, 1, 0.8, 1.4)
7167
opArray[1] = OpticalProperties(0.01, 1, 0.8, 1.4)
7268

7369
phdOfRhoAndZ = ComputationFactory.GetPHD(solver, fluenceOfRhoAndZ, sourceDetectorSeparation, opArray, Array[Double](allRhos.tolist()), Array[Double](zs.tolist()))
7470

75-
print("*********************************** RHOS *****************************************")
76-
print(allRhos.tolist())
77-
7871
# log transform
7972
log_fluence = [Math.Log(f) for f in phdOfRhoAndZ]
8073

8174
size = len(zs)
8275
# split into rows
8376
fluenceRowsToPlot = np.array([log_fluence[i:i+size] for i in range(0, len(log_fluence), size)])
84-
#print("*********************************** FLUENCE ROWS TO PLOT *****************************************")
85-
#print(fluenceRowsToPlot)
8677

78+
# Heatmap function to convert the data into a heat map
8779
def heatmap(values, x, y, x_label="", y_label="", title=""):
8880
"""Create a heatmap chart."""
8981
# values should be a 2D array-like (list of lists or 2D numpy array)

0 commit comments

Comments
 (0)