Skip to content

Commit d83fc83

Browse files
author
Lisa Glover
authored
Merge pull request #11 from VirtualPhotonics/hotfix/10-fix-the-asenumerable-issue-in-the-script-samples
hotfix-10-fix-the-asenumerable-issue-in-the-script-samples
2 parents 09f7f84 + cb0ba83 commit d83fc83

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

scripting/monte_carlo/demo_01_r_of_rho_simple.ipynb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"#Import the Operating System so we can access the files for the VTS library\n",
2626
"import os\n",
2727
"current_directory = os.getcwd()\n",
28-
"publish_local = current_directory.replace(\"monte_carlo\", \"libraries\\Vts.dll\")"
28+
"library_directory = current_directory.replace(\"monte_carlo\", \"libraries\")\n",
29+
"vts_path = os.path.join(library_directory, \"Vts.dll\")"
2930
]
3031
},
3132
{
@@ -62,7 +63,7 @@
6263
"from pythonnet import set_runtime\n",
6364
"set_runtime(\"coreclr\")\n",
6465
"import clr\n",
65-
"clr.AddReference(publish_local)\n",
66+
"clr.AddReference(vts_path)\n",
6667
"import numpy as np\n",
6768
"import plotly.graph_objects as go\n",
6869
"import plotly.express as px\n",
@@ -120,7 +121,7 @@
120121
"detectorResults = Array.CreateInstance(ROfRhoDetector,1)\n",
121122
"detectorResults[0] = simulationOutput.ResultsDictionary[\"ROfRho\"]\n",
122123
"logReflectance = [r for r in detectorResults[0].Mean]\n",
123-
"detectorMidpoints = [mp for mp in detectorRange.AsEnumerable()]\n",
124+
"detectorMidpoints = [mp for mp in detectorRange]\n",
124125
"\n",
125126
"xLabel = \"ρ [mm]\"\n",
126127
"yLabel = \"log(R(ρ)) [mm-2]\"\n",

scripting/monte_carlo/demo_02_DAW_vs_CAW.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"#Import the Operating System so we can access the files for the VTS library\n",
2828
"import os\n",
2929
"current_directory = os.getcwd()\n",
30-
"publish_local = current_directory.replace(\"monte_carlo\", \"libraries\\Vts.dll\")"
30+
"library_directory = current_directory.replace(\"monte_carlo\", \"libraries\")\n",
31+
"vts_path = os.path.join(library_directory, \"Vts.dll\")"
3132
]
3233
},
3334
{
@@ -68,7 +69,7 @@
6869
"from pythonnet import set_runtime\n",
6970
"set_runtime(\"coreclr\")\n",
7071
"import clr\n",
71-
"clr.AddReference(publish_local)\n",
72+
"clr.AddReference(vts_path)\n",
7273
"import numpy as np\n",
7374
"import plotly.graph_objects as go\n",
7475
"import plotly.express as px\n",
@@ -144,12 +145,12 @@
144145
"detectorResults1 = Array.CreateInstance(ROfRhoDetector,1)\n",
145146
"detectorResults1[0] = simulationOutput1.ResultsDictionary[\"ROfRho\"]\n",
146147
"logReflectance1 = [r for r in detectorResults1[0].Mean]\n",
147-
"detectorMidpoints1 = [mp for mp in detectorRange.AsEnumerable()]\n",
148+
"detectorMidpoints1 = [mp for mp in detectorRange]\n",
148149
"\n",
149150
"detectorResults2 = Array.CreateInstance(ROfRhoDetector,1)\n",
150151
"detectorResults2[0] = simulationOutput2.ResultsDictionary[\"ROfRho\"]\n",
151152
"logReflectance2 = [r for r in detectorResults2[0].Mean]\n",
152-
"detectorMidpoints2 = [mp for mp in detectorRange.AsEnumerable()]\n",
153+
"detectorMidpoints2 = [mp for mp in detectorRange]\n",
153154
"\n",
154155
"xLabel = \"ρ [mm]\"\n",
155156
"yLabel = \"log(R(ρ)) [mm-2]\"\n",

scripting/monte_carlo/vts-trial.ipynb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
"\n",
1616
"* [.NET 6](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) has been installed\n",
1717
"\n",
18-
"* [VTS git repository](https://github.com/VirtualPhotonics/VTS) has been cloned\n",
19-
"\n",
2018
"* [pythonnet](https://pypi.org/project/pythonnet) has been installed and configured\n",
2119
"\n",
22-
"Replace `/path/to/vts` with the directory containing the git clone of `VTS`"
20+
"* The latest [VTS libraries](https://github.com/VirtualPhotonics/Vts.Scripting.Python/releases) have been downloaded from the zip file in releases and extracted to the libraries folder"
2321
]
2422
},
2523
{
@@ -36,7 +34,12 @@
3634
"import numpy as np\n",
3735
"import matplotlib.pyplot as plt\n",
3836
"\n",
39-
"clr.AddReference(\"/path/to/vts/publish/local/Vts.dll\")"
37+
"#Import the Operating System so we can get the file path for the Vts library\n",
38+
"import os\n",
39+
"current_directory = os.getcwd()\n",
40+
"library_directory = current_directory.replace(\"monte_carlo\", \"libraries\")\n",
41+
"vts_path = os.path.join(library_directory, \"Vts.dll\")\n",
42+
"clr.AddReference(vts_path)"
4043
]
4144
},
4245
{
@@ -277,7 +280,7 @@
277280
"name": "python",
278281
"nbconvert_exporter": "python",
279282
"pygments_lexer": "ipython3",
280-
"version": "3.12.3"
283+
"version": "3.11.5"
281284
}
282285
},
283286
"nbformat": 4,

0 commit comments

Comments
 (0)