|
23 | 23 | "collapsed": false,
|
24 | 24 | "jupyter": {
|
25 | 25 | "outputs_hidden": false
|
26 |
| - } |
| 26 | + }, |
| 27 | + "tags": [] |
27 | 28 | },
|
28 | 29 | "outputs": [],
|
29 | 30 | "source": [
|
|
33 | 34 | "import yt\n",
|
34 | 35 | "from yt.visualization.volume_rendering.transfer_function_helper import (\n",
|
35 | 36 | " TransferFunctionHelper,\n",
|
36 |
| - ")\n", |
37 |
| - "\n", |
38 |
| - "\n", |
39 |
| - "def showme(im):\n", |
40 |
| - " # screen out NaNs\n", |
41 |
| - " im[im != im] = 0.0\n", |
42 |
| - "\n", |
43 |
| - " # Create an RGBA bitmap to display\n", |
44 |
| - " imb = yt.write_bitmap(im, None)\n", |
45 |
| - " return Image(imb)" |
| 37 | + ")" |
46 | 38 | ]
|
47 | 39 | },
|
48 | 40 | {
|
|
59 | 51 | "collapsed": false,
|
60 | 52 | "jupyter": {
|
61 | 53 | "outputs_hidden": false
|
62 |
| - } |
| 54 | + }, |
| 55 | + "tags": [] |
63 | 56 | },
|
64 | 57 | "outputs": [],
|
65 | 58 | "source": [
|
|
80 | 73 | "collapsed": false,
|
81 | 74 | "jupyter": {
|
82 | 75 | "outputs_hidden": false
|
83 |
| - } |
| 76 | + }, |
| 77 | + "tags": [] |
84 | 78 | },
|
85 | 79 | "outputs": [],
|
86 | 80 | "source": [
|
|
101 | 95 | "collapsed": false,
|
102 | 96 | "jupyter": {
|
103 | 97 | "outputs_hidden": false
|
104 |
| - } |
| 98 | + }, |
| 99 | + "tags": [] |
105 | 100 | },
|
106 | 101 | "outputs": [],
|
107 | 102 | "source": [
|
|
129 | 124 | "collapsed": false,
|
130 | 125 | "jupyter": {
|
131 | 126 | "outputs_hidden": false
|
132 |
| - } |
| 127 | + }, |
| 128 | + "tags": [] |
133 | 129 | },
|
134 | 130 | "outputs": [],
|
135 | 131 | "source": [
|
|
150 | 146 | "collapsed": false,
|
151 | 147 | "jupyter": {
|
152 | 148 | "outputs_hidden": false
|
153 |
| - } |
| 149 | + }, |
| 150 | + "tags": [] |
154 | 151 | },
|
155 | 152 | "outputs": [],
|
156 | 153 | "source": [
|
|
159 | 156 | "tfh.set_bounds()\n",
|
160 | 157 | "tfh.set_log(True)\n",
|
161 | 158 | "tfh.build_transfer_function()\n",
|
162 |
| - "tfh.tf.add_layers(\n", |
163 |
| - " 8,\n", |
164 |
| - " w=0.01,\n", |
165 |
| - " mi=4.0,\n", |
166 |
| - " ma=8.0,\n", |
167 |
| - " col_bounds=[4.0, 8.0],\n", |
168 |
| - " alpha=np.logspace(-1, 2, 7),\n", |
169 |
| - " colormap=\"RdBu_r\",\n", |
170 |
| - ")\n", |
171 | 159 | "tfh.tf.map_to_colormap(6.0, 8.0, colormap=\"Reds\")\n",
|
172 | 160 | "tfh.tf.map_to_colormap(-1.0, 6.0, colormap=\"Blues_r\")\n",
|
173 | 161 | "\n",
|
|
196 | 184 | "\n",
|
197 | 185 | "source = sc.get_source()\n",
|
198 | 186 | "source.set_transfer_function(tfh.tf)\n",
|
199 |
| - "im2 = sc.render()\n", |
200 |
| - "\n", |
201 |
| - "showme(im2[:, :, :3])" |
| 187 | + "sc.render()\n", |
| 188 | + "sc.show()" |
202 | 189 | ]
|
203 | 190 | },
|
| 191 | + { |
| 192 | + "cell_type": "code", |
| 193 | + "execution_count": null, |
| 194 | + "metadata": {}, |
| 195 | + "outputs": [], |
| 196 | + "source": [] |
| 197 | + }, |
204 | 198 | {
|
205 | 199 | "cell_type": "markdown",
|
206 | 200 | "metadata": {},
|
|
215 | 209 | "collapsed": false,
|
216 | 210 | "jupyter": {
|
217 | 211 | "outputs_hidden": false
|
218 |
| - } |
| 212 | + }, |
| 213 | + "tags": [] |
219 | 214 | },
|
220 | 215 | "outputs": [],
|
221 | 216 | "source": [
|
|
224 | 219 | "tfh2.set_bounds()\n",
|
225 | 220 | "tfh2.set_log(True)\n",
|
226 | 221 | "tfh2.build_transfer_function()\n",
|
227 |
| - "tfh2.tf.add_layers(\n", |
228 |
| - " 8,\n", |
229 |
| - " w=0.01,\n", |
230 |
| - " mi=4.0,\n", |
231 |
| - " ma=8.0,\n", |
232 |
| - " col_bounds=[4.0, 8.0],\n", |
233 |
| - " alpha=np.logspace(-1, 2, 7),\n", |
234 |
| - " colormap=\"RdBu_r\",\n", |
235 |
| - ")\n", |
236 | 222 | "tfh2.tf.map_to_colormap(6.0, 8.0, colormap=\"Reds\", scale=5.0)\n",
|
237 | 223 | "tfh2.tf.map_to_colormap(-1.0, 6.0, colormap=\"Blues_r\", scale=1.0)\n",
|
238 | 224 | "\n",
|
|
258 | 244 | "outputs": [],
|
259 | 245 | "source": [
|
260 | 246 | "source.set_transfer_function(tfh2.tf)\n",
|
261 |
| - "im3 = sc.render()\n", |
262 |
| - "\n", |
263 |
| - "showme(im3[:, :, :3])" |
| 247 | + "sc.render()\n", |
| 248 | + "sc.show()" |
264 | 249 | ]
|
265 | 250 | },
|
266 | 251 | {
|
|
287 | 272 | "name": "python",
|
288 | 273 | "nbconvert_exporter": "python",
|
289 | 274 | "pygments_lexer": "ipython3",
|
290 |
| - "version": "3.10.12" |
| 275 | + "version": "3.10.11" |
291 | 276 | }
|
292 | 277 | },
|
293 | 278 | "nbformat": 4,
|
|
0 commit comments