Skip to content

Commit fa070a9

Browse files
author
Lisa Glover
committed
Updated the readme and the scripts with instructions for getting the VTS library from the releases, added a readme to the libraries folder so that the folder exists in the repo
1 parent b3ec23c commit fa070a9

File tree

4 files changed

+25
-28
lines changed

4 files changed

+25
-28
lines changed

README.md

+22-26
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,38 @@
11
# Using VTS in a Jupyter notebook
22

3-
This is likely to change once `python` scripting is formally supported by `VTS`.
3+
This information will likely change as more support for `python` and `.NET` is introduced.
44

5-
## macOS installation details
6-
7-
This is a record of how I got `vts` working in `JupyterLab`.
5+
## Installation details
86

97
### Step 1: Install .NET 6
108

119
You will need version 6 of .NET which is available from Microsoft below
1210

1311
https://dotnet.microsoft.com/en-us/download/dotnet/6.0
1412

15-
I saved everything to `$HOME/Documents/Code/dotnet6`
13+
14+
***On MacOS:***
15+
Save everything to `$HOME/Documents/Code/dotnet6`
1616

1717
Do not forget to update your `~/.bash_profile` or whatever you use so that this directory is in your path. Also define `DOTNET_ROOT`
1818

1919
PATH=$PATH:$HOME/Documents/Code/dotnet6
2020

2121
export DOTNET_ROOT=$HOME/Documents/Code/dotnet6
2222

23-
### Step 2: Install VTS
24-
25-
Follow the guidelines at https://github.com/VirtualPhotonics/VTS/wiki/Getting-Started-on-Mac Briefly, clone the `.git` repo
23+
### Step 2: Clone the scripting repository
2624

2725
git clone https://github.com/VirtualPhotonics/vts.git
2826

29-
This will create the directory `vts` that is needed for the next step
30-
31-
Install both `powershell` and `nuget` using [Homebrew](https://brew.sh)
32-
33-
brew install powershell
34-
brew install nuget
27+
### Step 3: Download the VTS libraries
3528

36-
Now build VTS. If you don't have `matlab` don't worry, it seemed to work fine without completing the `matlab` tests
29+
Get the latest VTS libraries for the specific platform from [releases](https://github.com/VirtualPhotonics/Vts.Scripting.Python/releases) and extract them into the **libraries** folder under **scripting**.
3730

38-
pwsh
39-
cd vts
40-
./BuildTestRelease.ps1
41-
exit
42-
43-
### Step 3: Install pythonnet
31+
### Step 4: Install pythonnet
4432

4533
pip install pythonnet
4634

47-
Because `pythonnet` under macOS (or linux) defaults to `mono`, two more things need to added to `~/.bash_profile`
35+
***Note for MacOS and Linux:*** Because `pythonnet` under macOS (or linux) defaults to `mono`, two more things need to added to `~/.bash_profile`
4836

4937
export PYTHONNET_RUNTIME=coreclr
5038
export PYTHONNET_PYDLL=/usr/local/bin/python3
@@ -54,15 +42,18 @@ Obviously use the path for python on your system (`which python3` will tell you
5442
Next start a `JupyterLab` notebook to verify that things are installed correctly
5543

5644
import clr
57-
5845
clr.AddReference("System")
5946
from System import Console
6047
Console.WriteLine("Hello from .NET 6!")
6148

6249
The final test is importing from `Vts.dll`
50+
51+
from pythonnet import set_runtime
52+
set_runtime("coreclr")
6353

6454
import clr
65-
clr.AddReference("/path/to/vts/src/Vts/publish/local/Vts.dll")
55+
clr.AddReference("/path/to/libraries/Vts.dll")
56+
6657
from Vts import *
6758

6859
where, of course, "/path/to" above has been adapted to your system
@@ -71,8 +62,12 @@ where, of course, "/path/to" above has been adapted to your system
7162

7263
To run `VTS` programs in `python` include the following the header
7364

65+
```
66+
from pythonnet import set_runtime
67+
set_runtime("coreclr")
68+
7469
import clr
75-
clr.AddReference("/path/to/vts/src/Vts/publish/local/Vts.dll")
70+
clr.AddReference("/path/to/libraries/Vts.dll")
7671
7772
from Vts import *
7873
from Vts.Common import *
@@ -87,4 +82,5 @@ To run `VTS` programs in `python` include the following the header
8782
from Vts.MonteCarlo.Factories import *
8883
from Vts.MonteCarlo.PhotonData import *
8984
from Vts.MonteCarlo.PostProcessing import *
90-
from System import Array, Double
85+
from System import Array, Double
86+
```

scripting/libraries/readme.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The VTS libraries should be copied into this folder. Get the latest VTS library (VTS.dll) and its dependencies from the releases section of this repository https://github.com/VirtualPhotonics/Vts.Scripting.Python/releases

scripting/monte_carlo/demo_01_r_of_rho_simple.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"\n",
1414
"* [.NET 6](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) has been installed\n",
1515
"\n",
16-
"* The [VTS libraries](https://github.com/VirtualPhotonics/VTS) have been downloaded from the zip file in downloads and extracted to the libraries folder"
16+
"* 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"
1717
]
1818
},
1919
{

scripting/monte_carlo/demo_02_DAW_vs_CAW.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"\n",
1515
"* [.NET 6](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) has been installed\n",
1616
"\n",
17-
"* The [VTS libraries](https://github.com/VirtualPhotonics/VTS) have been downloaded from the zip file in downloads and extracted to the libraries folder"
17+
"* 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"
1818
]
1919
},
2020
{

0 commit comments

Comments
 (0)