Skip to content

Commit 7a9990a

Browse files
authored
Merge pull request #22 from VirtualPhotonics/glover-patch-1
2 parents 11c6a40 + 92e4b64 commit 7a9990a

File tree

1 file changed

+6
-83
lines changed

1 file changed

+6
-83
lines changed

README.md

Lines changed: 6 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,9 @@
1-
# Using VTS in a Jupyter notebook
1+
# VTS Python Scripts
22

3-
This information will likely change as more support for `python` and `.NET` is introduced.
3+
This repository contains Python scripts that work within Jupyter Notebooks or Jupyter Labs as well as scripts that can be run from the command line. These scripts use PythonNet to access the VTS libraries.
44

5-
## Installation details
5+
For detailed instructions on using these scripts, view our [Wiki documentation](https://github.com/VirtualPhotonics/Vts.Scripting.Python/wiki).
66

7-
### Step 1: Install .NET 8
8-
9-
You will need version 8 of .NET which is available from Microsoft below
10-
11-
https://dotnet.microsoft.com/en-us/download/dotnet/8.0
12-
13-
14-
***On MacOS:***
15-
Save everything to `$HOME/Documents/Code/dotnet8`
16-
17-
Do not forget to update your `~/.bash_profile` or whatever you use so that this directory is in your path. Also define `DOTNET_ROOT`
18-
19-
PATH=$PATH:$HOME/Documents/Code/dotnet8
20-
21-
export DOTNET_ROOT=$HOME/Documents/Code/dotnet8
22-
23-
### Step 2: Clone the scripting repository
24-
25-
git clone https://github.com/VirtualPhotonics/vts.git
26-
27-
### Step 3: Download the VTS libraries
28-
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**.
30-
31-
### Step 4: Install pythonnet
32-
33-
pip install pythonnet
34-
35-
***Note for MacOS and Linux:*** Because `pythonnet` under macOS (or linux) defaults to `mono`, two more things need to added to `~/.bash_profile`
36-
37-
export PYTHONNET_RUNTIME=coreclr
38-
export PYTHONNET_PYDLL=/usr/local/bin/python3
39-
40-
Obviously use the path for python on your system (`which python3` will tell you)
41-
42-
Next start a `JupyterLab` notebook to verify that things are installed correctly
43-
44-
import clr
45-
clr.AddReference("System")
46-
from System import Console
47-
Console.WriteLine("Hello from .NET 8!")
48-
49-
The final test is importing from `Vts.dll`
50-
51-
from pythonnet import set_runtime
52-
set_runtime("coreclr")
53-
54-
import clr
55-
clr.AddReference("/path/to/libraries/Vts.dll")
56-
57-
from Vts import *
58-
59-
where, of course, "/path/to" above has been adapted to your system
60-
61-
### Step 4: Run programs
62-
63-
To run `VTS` programs in `python` include the following the header
64-
65-
```
66-
from pythonnet import set_runtime
67-
set_runtime("coreclr")
68-
69-
import clr
70-
clr.AddReference("/path/to/libraries/Vts.dll")
71-
72-
from Vts import *
73-
from Vts.Common import *
74-
from Vts.Extensions import *
75-
from Vts.Modeling.Optimizers import *
76-
from Vts.Modeling.ForwardSolvers import *
77-
from Vts.Factories import *
78-
from Vts.MonteCarlo import *
79-
from Vts.MonteCarlo.Sources import *
80-
from Vts.MonteCarlo.Tissues import *
81-
from Vts.MonteCarlo.Detectors import *
82-
from Vts.MonteCarlo.Factories import *
83-
from Vts.MonteCarlo.PhotonData import *
84-
from Vts.MonteCarlo.PostProcessing import *
85-
from System import Array, Double
86-
```
7+
### Getting Started
8+
* [Jupyter Notebooks/Labs](https://github.com/VirtualPhotonics/Vts.Scripting.Python/wiki/Getting-Started-with-Jupyter-Notebooks)
9+
* [Command-Line Scripts](https://github.com/VirtualPhotonics/Vts.Scripting.Python/wiki/Getting-Started-with-Command‐Line)

0 commit comments

Comments
 (0)