|
11 | 11 | import clr |
12 | 12 | # Import the Operating System so we can access the files for the VTS library |
13 | 13 | import os |
| 14 | +import sys |
| 15 | +module_path = '../modules' |
| 16 | +sys.path.append(module_path) |
14 | 17 | file = '../libraries/Vts.dll' |
15 | 18 | clr.AddReference(os.path.abspath(file)) |
16 | 19 | import numpy as np |
17 | 20 | import plotly.graph_objects as go |
18 | | -import plotly.express as px |
19 | 21 | from Vts import * |
20 | 22 | from Vts.Common import * |
21 | 23 | from Vts.Extensions import * |
|
30 | 32 | from Vts.MonteCarlo.Factories import * |
31 | 33 | from Vts.MonteCarlo.PhotonData import * |
32 | 34 | from Vts.MonteCarlo.PostProcessing import * |
33 | | -from System import Array, Double, Object, Func, Math |
34 | | -clr.AddReference("System.Core") |
35 | | -from System.Linq import Enumerable |
| 35 | +from System import Array, Double, Math |
| 36 | +from graph_tools import heatmap |
36 | 37 |
|
37 | 38 | solver = TwoLayerSDAForwardSolver() |
38 | 39 | solver.SourceConfiguration = SourceConfiguration.Distributed |
|
75 | 76 | # reverse and concatenate |
76 | 77 | allFluenceRowsToPlot = np.concatenate((fluenceRowsToPlot[::-1], fluenceRowsToPlot)) |
77 | 78 |
|
78 | | -# Heatmap function to convert the data into a heat map |
79 | | -def heatmap(values, x, y, x_label="", y_label="", title=""): |
80 | | - """Create a heatmap chart.""" |
81 | | - # values should be a 2D array-like (list of lists or 2D numpy array) |
82 | | - fig = go.Figure(data=go.Heatmap( |
83 | | - z=values, |
84 | | - x=x, |
85 | | - y=y, |
86 | | - transpose=True, |
87 | | - colorscale='Hot', |
88 | | - colorbar=dict(title=title) |
89 | | - )) |
90 | | - fig.update_layout( |
91 | | - title=title, |
92 | | - xaxis_title=x_label, |
93 | | - yaxis_title=y_label, |
94 | | - yaxis_autorange='reversed' |
95 | | - ) |
96 | | - return fig |
97 | | - |
98 | 79 | fluenceChart = heatmap(allFluenceRowsToPlot.tolist(), allRhos.tolist(), list(zs), "ρ [mm]", "z [mm]", "log(Φ(ρ, z) [mm-2])") |
99 | 80 | fluenceChart.add_hline(y=topLayerThickness, line_dash="dash", line_color="white", line_width=2) |
100 | 81 | fluenceChart.show(renderer="browser") |
0 commit comments