Skip to content

Commit 0d497f0

Browse files
author
jngaravitoc
committed
adding tutorials
1 parent a78391e commit 0d497f0

File tree

4 files changed

+439
-107
lines changed

4 files changed

+439
-107
lines changed

EXPtools/utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from . import halo
22
from . import coefficients
3+
from . import indexing

EXPtools/visuals/visuals3D.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ def field3Dcontour(field, contour_range, contour_name, size, **kwargs):
2525

2626
volume = k3d.volume(field.astype(np.float32),
2727
alpha_coef=1.0,
28-
color_range=contour_range, #*field_max,
28+
color_range=contour_range,
2929
color_map=(np.array(k3d.colormaps.paraview_color_maps.Cool_to_Warm_Extended).reshape(-1,4)
3030
* np.array([1,1.0,1.0,1.0])).astype(np.float32),
31-
name=contour_name)
31+
name=contour_name, compression_level=7)
3232

3333
# Where this values come from?
3434
volume.opacity_function = [0. , 0. , 0.21327923, 0.98025 , 0.32439035,
@@ -104,5 +104,5 @@ def field3Drender(volumes, contour_ranges, size, contour_names=['Inner', 'Outter
104104
orbit_name=kwargs['orbits_names'][orb], width=10)
105105
render += o
106106

107-
107+
render.grid = (-size[0], -size[1], -size[2], size[0], size[1], size[2])
108108
return render

docs/tutorials/3d_fields_render_visualization.ipynb

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"import numpy as np\n",
2121
"import pyEXP\n",
2222
"import EXPtools \n",
23-
"import matplotlib.pyplot as plt"
23+
"import matplotlib.pyplot as plt\n",
24+
"import k3d"
2425
]
2526
},
2627
{
@@ -95,41 +96,64 @@
9596
},
9697
{
9798
"cell_type": "code",
98-
"execution_count": 19,
99+
"execution_count": 6,
99100
"id": "79b66056",
100101
"metadata": {},
101102
"outputs": [],
102103
"source": [
103-
"rend = EXPtools.visuals.field3Drender(np.array([field]), contour_ranges=[np.array([-0.1, 0.1]), np.array([-0.8, 0.8])],\n",
104+
"rend = EXPtools.visuals.field3Drender(np.array([field]), contour_ranges=[np.array([-3000, 3000]), \n",
105+
" np.array([-9000, 9000])],\n",
106+
" size=[-100, 100, -100, 100, -100, 100])"
107+
]
108+
},
109+
{
110+
"cell_type": "code",
111+
"execution_count": 7,
112+
"id": "30fc043a",
113+
"metadata": {},
114+
"outputs": [],
115+
"source": [
116+
"rend2 = EXPtools.visuals.field3Drender(np.array([field]), contour_ranges=[np.array([-1000, 1000]), \n",
117+
" np.array([-90000, 90000])],\n",
104118
" size=[-100, 100, -100, 100, -100, 100])"
105119
]
106120
},
107121
{
108122
"cell_type": "code",
109-
"execution_count": 20,
123+
"execution_count": 8,
110124
"id": "30e35046",
111125
"metadata": {
112126
"scrolled": false
113127
},
128+
"outputs": [],
129+
"source": [
130+
"plot = k3d.plot()"
131+
]
132+
},
133+
{
134+
"cell_type": "code",
135+
"execution_count": 12,
136+
"id": "39c1d5c3",
137+
"metadata": {},
114138
"outputs": [
115139
{
116140
"data": {
117141
"application/vnd.jupyter.widget-view+json": {
118-
"model_id": "8c566d6df0c648bd9b86c4c9952a9534",
142+
"model_id": "f6f6a584c57749e58837f67293cf345a",
119143
"version_major": 2,
120144
"version_minor": 0
121145
},
122146
"text/plain": [
123147
"Plot(antialias=3, axes=['x', 'y', 'z'], axes_helper=1.0, axes_helper_colors=[16711680, 65280, 255], background…"
124148
]
125149
},
126-
"execution_count": 20,
150+
"execution_count": 12,
127151
"metadata": {},
128152
"output_type": "execute_result"
129153
}
130154
],
131155
"source": [
132-
"rend"
156+
"rend2"
133157
]
134158
},
135159
{
@@ -142,6 +166,28 @@
142166
"# Symphony fields"
143167
]
144168
},
169+
{
170+
"cell_type": "code",
171+
"execution_count": 13,
172+
"id": "5448615a",
173+
"metadata": {},
174+
"outputs": [
175+
{
176+
"ename": "TypeError",
177+
"evalue": "unsupported operand type(s) for +: 'Plot' and 'Plot'",
178+
"output_type": "error",
179+
"traceback": [
180+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
181+
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
182+
"Cell \u001b[0;32mIn[13], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mrend\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m+\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mrend2\u001b[49m\n",
183+
"\u001b[0;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'Plot' and 'Plot'"
184+
]
185+
}
186+
],
187+
"source": [
188+
"rend. + rend2"
189+
]
190+
},
145191
{
146192
"cell_type": "code",
147193
"execution_count": 2,

docs/tutorials/EXP_workflow_external_halo.ipynb

Lines changed: 382 additions & 97 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)