.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/plot_imageseq.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_plot_imageseq.py: ImageSequences ============== .. GENERATED FROM PYTHON SOURCE LINES 8-9 Let's import some packages .. GENERATED FROM PYTHON SOURCE LINES 9-18 .. code-block:: Python from neo.core import ImageSequence from neo.core import RectangularRegionOfInterest, CircularRegionOfInterest, PolygonRegionOfInterest import matplotlib.pyplot as plt import quantities as pq import random .. GENERATED FROM PYTHON SOURCE LINES 19-23 Now we need to generate some data We will just make a nice box and then we can attach this ImageSequence to a variety of ROIs our ImageSequence will be 50 frames of 100x100 pixel images .. GENERATED FROM PYTHON SOURCE LINES 23-32 .. code-block:: Python l = [] for frame in range(50): l.append([]) for y in range(100): l[frame].append([]) for x in range(100): l[frame][y].append(random.randint(0, 50)) .. GENERATED FROM PYTHON SOURCE LINES 33-35 we then make our image sequence and pull out our results from the image_seq .. GENERATED FROM PYTHON SOURCE LINES 35-44 .. code-block:: Python image_seq = ImageSequence(l, sampling_rate=500 * pq.Hz, spatial_scale="m", units="V") result = image_seq.signal_from_region( CircularRegionOfInterest(image_seq, 50, 50, 25), CircularRegionOfInterest(image_seq, 10, 10, 5), PolygonRegionOfInterest(image_seq, (50, 25), (50, 45), (14, 65), (90, 80)), ) .. GENERATED FROM PYTHON SOURCE LINES 45-46 It is easy to plot our results using matplotlib .. GENERATED FROM PYTHON SOURCE LINES 46-54 .. code-block:: Python for i in range(len(result)): plt.figure() plt.plot(result[i].times, result[i]) plt.xlabel("seconde") plt.ylabel("valeur") plt.tight_layout() plt.show() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/images/sphx_glr_plot_imageseq_001.png :alt: plot imageseq :srcset: /examples/images/sphx_glr_plot_imageseq_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/images/sphx_glr_plot_imageseq_002.png :alt: plot imageseq :srcset: /examples/images/sphx_glr_plot_imageseq_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/images/sphx_glr_plot_imageseq_003.png :alt: plot imageseq :srcset: /examples/images/sphx_glr_plot_imageseq_003.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 13.633 seconds) .. _sphx_glr_download_examples_plot_imageseq.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_imageseq.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_imageseq.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_