|
79 | 79 | "rs = np.random.RandomState(seed=1)\n", |
80 | 80 | "print('Initial random state:', pbm.hash_(rs.get_state()))\n", |
81 | 81 | "\n", |
| 82 | + "# Simulation time step (seconds)\n", |
| 83 | + "t_step = 0.5e-6\n", |
| 84 | + "\n", |
| 85 | + "# Time duration of the simulation (seconds)\n", |
| 86 | + "t_max = 1\n", |
| 87 | + "\n", |
82 | 88 | "# Diffusion coefficient\n", |
83 | 89 | "Du = 12.0 # um^2 / s\n", |
84 | 90 | "D1 = Du*(1e-6)**2 # m^2 / s\n", |
|
87 | 93 | "# Simulation box definition\n", |
88 | 94 | "box = pbm.Box(x1=-4.e-6, x2=4.e-6, y1=-4.e-6, y2=4.e-6, z1=-6e-6, z2=6e-6)\n", |
89 | 95 | "\n", |
90 | | - "# PSF definition\n", |
91 | | - "psf = pbm.NumericPSF()\n", |
92 | | - "\n", |
93 | 96 | "# Particles definition\n", |
94 | | - "P = pbm.Particles(num_particles=2, D=D1, box=box, rs=rs)\n", |
95 | | - "P.add(num_particles=3, D=D2)\n", |
96 | | - "\n", |
97 | | - "# Simulation time step (seconds)\n", |
98 | | - "t_step = 0.5e-6\n", |
| 97 | + "P = pbm.Particles.from_specs(\n", |
| 98 | + " num_particles=(3, 1),\n", |
| 99 | + " D=(D1, D2),\n", |
| 100 | + " box=box, rs=rs)\n", |
99 | 101 | "\n", |
100 | | - "# Time duration of the simulation (seconds)\n", |
101 | | - "t_max = 1\n", |
| 102 | + "# PSF definition\n", |
| 103 | + "psf = pbm.NumericPSF()\n", |
102 | 104 | "\n", |
103 | 105 | "# Particle simulation definition\n", |
104 | 106 | "S = pbm.ParticlesSimulation(t_step=t_step, t_max=t_max, \n", |
|
215 | 217 | "print('Current random state:', pbm.hash_(rs.get_state()))" |
216 | 218 | ] |
217 | 219 | }, |
218 | | - { |
219 | | - "cell_type": "code", |
220 | | - "execution_count": null, |
221 | | - "metadata": {}, |
222 | | - "outputs": [], |
223 | | - "source": [ |
224 | | - "position = S.position[:]\n", |
225 | | - "position.shape, position.dtype" |
226 | | - ] |
227 | | - }, |
228 | 220 | { |
229 | 221 | "cell_type": "markdown", |
230 | 222 | "metadata": {}, |
|
252 | 244 | ] |
253 | 245 | }, |
254 | 246 | { |
255 | | - "cell_type": "code", |
256 | | - "execution_count": null, |
| 247 | + "cell_type": "markdown", |
257 | 248 | "metadata": {}, |
258 | | - "outputs": [], |
259 | 249 | "source": [ |
260 | | - "S.compact_name()" |
| 250 | + "# Load trajectories" |
261 | 251 | ] |
262 | 252 | }, |
263 | 253 | { |
264 | | - "cell_type": "markdown", |
| 254 | + "cell_type": "code", |
| 255 | + "execution_count": null, |
265 | 256 | "metadata": {}, |
| 257 | + "outputs": [], |
266 | 258 | "source": [ |
267 | | - "# Load trajectories" |
| 259 | + "S.hash()" |
268 | 260 | ] |
269 | 261 | }, |
270 | 262 | { |
|
273 | 265 | "metadata": {}, |
274 | 266 | "outputs": [], |
275 | 267 | "source": [ |
276 | | - "#S = pbm.ParticlesSimulation.from_datafile('9125') # Read-only by default\n", |
277 | | - "S = pbm.ParticlesSimulation.from_datafile('4500')" |
| 268 | + "S = pbm.ParticlesSimulation.from_datafile(S.hash()[:4]) # Read-only by default" |
278 | 269 | ] |
279 | 270 | }, |
280 | 271 | { |
|
413 | 404 | "S.store.close()" |
414 | 405 | ] |
415 | 406 | }, |
416 | | - { |
417 | | - "cell_type": "code", |
418 | | - "execution_count": null, |
419 | | - "metadata": {}, |
420 | | - "outputs": [], |
421 | | - "source": [ |
422 | | - "S.ts_store.close()" |
423 | | - ] |
424 | | - }, |
425 | | - { |
426 | | - "cell_type": "code", |
427 | | - "execution_count": null, |
428 | | - "metadata": {}, |
429 | | - "outputs": [], |
430 | | - "source": [ |
431 | | - "S.compact_name()" |
432 | | - ] |
433 | | - }, |
434 | | - { |
435 | | - "cell_type": "code", |
436 | | - "execution_count": null, |
437 | | - "metadata": {}, |
438 | | - "outputs": [], |
439 | | - "source": [ |
440 | | - "S.position" |
441 | | - ] |
442 | | - }, |
443 | 407 | { |
444 | 408 | "cell_type": "markdown", |
445 | 409 | "metadata": {}, |
|
510 | 474 | "source": [ |
511 | 475 | "ts_params2 = dict(\n", |
512 | 476 | " max_rates=(250e3, 180e3), \n", |
513 | | - " populations=(slice(0,2), slice(2, 2+3)),\n", |
| 477 | + " populations=(slice(0,3), slice(3, 3+1)),\n", |
514 | 478 | " bg_rate=1.2e3\n", |
515 | 479 | ")\n", |
516 | 480 | "\n", |
|
658 | 622 | "width": "212px" |
659 | 623 | }, |
660 | 624 | "toc_section_display": "block", |
661 | | - "toc_window_display": true |
| 625 | + "toc_window_display": false |
662 | 626 | } |
663 | 627 | }, |
664 | 628 | "nbformat": 4, |
|
0 commit comments