|
101 | 101 | "\n", |
102 | 102 | "# PSF definition\n", |
103 | 103 | "psf = pbm.NumericPSF()\n", |
| 104 | + "#psf = pbm.GaussianPSF(sx=0.2e-6, sy=0.2e-6, sz=0.8e-6)\n", |
104 | 105 | "\n", |
105 | 106 | "# Particle simulation definition\n", |
106 | 107 | "S = pbm.ParticlesSimulation(t_step=t_step, t_max=t_max, \n", |
|
143 | 144 | "S.compact_name()" |
144 | 145 | ] |
145 | 146 | }, |
| 147 | + { |
| 148 | + "cell_type": "code", |
| 149 | + "execution_count": null, |
| 150 | + "metadata": {}, |
| 151 | + "outputs": [], |
| 152 | + "source": [ |
| 153 | + "S.psf.hash()" |
| 154 | + ] |
| 155 | + }, |
| 156 | + { |
| 157 | + "cell_type": "code", |
| 158 | + "execution_count": null, |
| 159 | + "metadata": {}, |
| 160 | + "outputs": [], |
| 161 | + "source": [ |
| 162 | + "S.psf" |
| 163 | + ] |
| 164 | + }, |
146 | 165 | { |
147 | 166 | "cell_type": "code", |
148 | 167 | "execution_count": null, |
|
234 | 253 | "print('Simulation file size: %d MB' % (S.store.h5file.get_filesize()/1024./1024.))" |
235 | 254 | ] |
236 | 255 | }, |
| 256 | + { |
| 257 | + "cell_type": "code", |
| 258 | + "execution_count": null, |
| 259 | + "metadata": {}, |
| 260 | + "outputs": [], |
| 261 | + "source": [ |
| 262 | + "S.compact_name()" |
| 263 | + ] |
| 264 | + }, |
237 | 265 | { |
238 | 266 | "cell_type": "code", |
239 | 267 | "execution_count": null, |
|
256 | 284 | "metadata": {}, |
257 | 285 | "outputs": [], |
258 | 286 | "source": [ |
259 | | - "S.hash()" |
| 287 | + "S.compact_name()" |
260 | 288 | ] |
261 | 289 | }, |
262 | 290 | { |
|
268 | 296 | "S = pbm.ParticlesSimulation.from_datafile(S.hash()[:4]) # Read-only by default" |
269 | 297 | ] |
270 | 298 | }, |
| 299 | + { |
| 300 | + "cell_type": "code", |
| 301 | + "execution_count": null, |
| 302 | + "metadata": {}, |
| 303 | + "outputs": [], |
| 304 | + "source": [ |
| 305 | + "S.psf_pytables.attrs" |
| 306 | + ] |
| 307 | + }, |
271 | 308 | { |
272 | 309 | "cell_type": "code", |
273 | 310 | "execution_count": null, |
|
277 | 314 | "S" |
278 | 315 | ] |
279 | 316 | }, |
| 317 | + { |
| 318 | + "cell_type": "code", |
| 319 | + "execution_count": null, |
| 320 | + "metadata": {}, |
| 321 | + "outputs": [], |
| 322 | + "source": [ |
| 323 | + "S.compact_name()" |
| 324 | + ] |
| 325 | + }, |
| 326 | + { |
| 327 | + "cell_type": "markdown", |
| 328 | + "metadata": {}, |
| 329 | + "source": [ |
| 330 | + "> **BUG**: hash changed with GaussianPSF!" |
| 331 | + ] |
| 332 | + }, |
280 | 333 | { |
281 | 334 | "cell_type": "markdown", |
282 | 335 | "metadata": {}, |
|
336 | 389 | "plot_emission(S, slice_=(0, 2e6, 10), em_th=0.05)" |
337 | 390 | ] |
338 | 391 | }, |
| 392 | + { |
| 393 | + "cell_type": "code", |
| 394 | + "execution_count": null, |
| 395 | + "metadata": {}, |
| 396 | + "outputs": [], |
| 397 | + "source": [ |
| 398 | + "def plot_tracks_r(S, slice_=None, particles=None):\n", |
| 399 | + " if slice_ is None:\n", |
| 400 | + " slice_ = (0, 100e3, 100)\n", |
| 401 | + " duration = (slice_[1] - slice_[0])*S.t_step\n", |
| 402 | + " slice_ = slice(*slice_)\n", |
| 403 | + " em = S.emission[:, slice_]\n", |
| 404 | + " t = np.arange(em.shape[1])*(S.t_step*1e3)\n", |
| 405 | + " \n", |
| 406 | + " if particles is None:\n", |
| 407 | + " particles = range(S.num_particles)\n", |
| 408 | + " \n", |
| 409 | + " fig, ax = plt.subplots(1, 1, figsize=(11, 5), sharey=True)\n", |
| 410 | + " plt.subplots_adjust(left=0.05, right=0.93, top=0.95, bottom=0.09,\n", |
| 411 | + " wspace=0.05)\n", |
| 412 | + " plt.suptitle(\"Total: %.1f s, Visualized: %.2f ms\" % (\n", |
| 413 | + " S.t_step*S.n_samples, duration*1e3))\n", |
| 414 | + "\n", |
| 415 | + " for ip in particles:\n", |
| 416 | + " x, y, z = S.position[ip, :, slice_]\n", |
| 417 | + " r = np.sqrt(x**2 + y**2 + z**2) * 1e6\n", |
| 418 | + " plot_kwargs = dict(ls='', marker='o', mew=0, ms=4, alpha=0.8, \n", |
| 419 | + " label='P%d' % ip)\n", |
| 420 | + " ax.plot(t, r, **plot_kwargs)\n", |
| 421 | + "\n", |
| 422 | + " ax.set_ylabel(\"r (um)\")\n", |
| 423 | + " ax.legend(bbox_to_anchor=(1.01, 1), loc=2, borderaxespad=0.)\n", |
| 424 | + " ax.set_ylim(0)" |
| 425 | + ] |
| 426 | + }, |
| 427 | + { |
| 428 | + "cell_type": "code", |
| 429 | + "execution_count": null, |
| 430 | + "metadata": {}, |
| 431 | + "outputs": [], |
| 432 | + "source": [ |
| 433 | + "plot_tracks_r(S, slice_=(0, 2e6, 1000))" |
| 434 | + ] |
| 435 | + }, |
339 | 436 | { |
340 | 437 | "cell_type": "code", |
341 | 438 | "execution_count": null, |
|
395 | 492 | "plot_tracks(S) #particles=[2, 5, 7, 22, 30])" |
396 | 493 | ] |
397 | 494 | }, |
| 495 | + { |
| 496 | + "cell_type": "code", |
| 497 | + "execution_count": null, |
| 498 | + "metadata": {}, |
| 499 | + "outputs": [], |
| 500 | + "source": [ |
| 501 | + "#plot_tracks(S, slice_=(1.9e6, 2e6, 100), particles=[1])" |
| 502 | + ] |
| 503 | + }, |
398 | 504 | { |
399 | 505 | "cell_type": "code", |
400 | 506 | "execution_count": null, |
|
404 | 510 | "S.store.close()" |
405 | 511 | ] |
406 | 512 | }, |
| 513 | + { |
| 514 | + "cell_type": "code", |
| 515 | + "execution_count": null, |
| 516 | + "metadata": {}, |
| 517 | + "outputs": [], |
| 518 | + "source": [ |
| 519 | + "if hasattr(S, 'ts_store'):\n", |
| 520 | + " S.ts_store.close() # needed if timestamp file is already present" |
| 521 | + ] |
| 522 | + }, |
407 | 523 | { |
408 | 524 | "cell_type": "markdown", |
409 | 525 | "metadata": {}, |
|
415 | 531 | "- [PyBroMo - 2. Generate smFRET data, including mixtures](PyBroMo - 2. Generate smFRET data, including mixtures.ipynb)" |
416 | 532 | ] |
417 | 533 | }, |
| 534 | + { |
| 535 | + "cell_type": "code", |
| 536 | + "execution_count": null, |
| 537 | + "metadata": {}, |
| 538 | + "outputs": [], |
| 539 | + "source": [ |
| 540 | + "S.compact_name()" |
| 541 | + ] |
| 542 | + }, |
418 | 543 | { |
419 | 544 | "cell_type": "code", |
420 | 545 | "execution_count": null, |
|
581 | 706 | "pos, ts" |
582 | 707 | ] |
583 | 708 | }, |
| 709 | + { |
| 710 | + "cell_type": "code", |
| 711 | + "execution_count": null, |
| 712 | + "metadata": {}, |
| 713 | + "outputs": [], |
| 714 | + "source": [ |
| 715 | + "S.store.close()\n", |
| 716 | + "S.ts_store.close()" |
| 717 | + ] |
| 718 | + }, |
584 | 719 | { |
585 | 720 | "cell_type": "code", |
586 | 721 | "execution_count": null, |
|
592 | 727 | "metadata": { |
593 | 728 | "anaconda-cloud": {}, |
594 | 729 | "kernelspec": { |
595 | | - "display_name": "Python 3.6 (py36)", |
| 730 | + "display_name": "py37-sm", |
596 | 731 | "language": "python", |
597 | | - "name": "py36" |
| 732 | + "name": "py37-sm" |
598 | 733 | }, |
599 | 734 | "language_info": { |
600 | 735 | "codemirror_mode": { |
|
606 | 741 | "name": "python", |
607 | 742 | "nbconvert_exporter": "python", |
608 | 743 | "pygments_lexer": "ipython3", |
609 | | - "version": "3.6.7" |
| 744 | + "version": "3.7.2" |
610 | 745 | }, |
611 | 746 | "toc": { |
| 747 | + "base_numbering": 1, |
612 | 748 | "nav_menu": {}, |
613 | 749 | "number_sections": true, |
614 | 750 | "sideBar": true, |
615 | 751 | "skip_h1_title": false, |
| 752 | + "title_cell": "Table of Contents", |
| 753 | + "title_sidebar": "Contents", |
616 | 754 | "toc_cell": false, |
617 | 755 | "toc_position": { |
618 | 756 | "height": "591.867px", |
|
0 commit comments