.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/music_cont_out_proxy_example/receiver_script.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_auto_examples_music_cont_out_proxy_example_receiver_script.py: Music example receiver script ------------------------------ .. only:: html ---- Run this example as a Jupyter notebook: .. card:: :width: 25% :margin: 2 :text-align: center :link: https://lab.ebrains.eu/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fnest%2Fnest-simulator-examples&urlpath=lab%2Ftree%2Fnest-simulator-examples%2Fnotebooks%2Fnotebooks%2Fmusic_cont_out_proxy_example%2Freceiver_script.ipynb&branch=main :link-alt: JupyterHub service .. image:: https://nest-simulator.org/TryItOnEBRAINS.png .. grid:: 1 1 1 1 :padding: 0 0 2 0 .. grid-item:: :class: sd-text-muted :margin: 0 0 3 0 :padding: 0 0 3 0 :columns: 4 See :ref:`our guide ` for more information and troubleshooting. ---- .. GENERATED FROM PYTHON SOURCE LINES 27-53 .. code-block:: Python import sys from itertools import dropwhile, takewhile import music import numpy setup = music.Setup() stoptime = setup.config("stoptime") timestep = setup.config("timestep") comm = setup.comm rank = comm.Get_rank() pin = setup.publishContInput("in") data = numpy.array([0.0, 0.0], dtype=numpy.double) pin.map(data, interpolate=False) runtime = setup.runtime(timestep) mintime = timestep maxtime = stoptime + timestep start = dropwhile(lambda t: t < mintime, runtime) times = takewhile(lambda t: t < maxtime, start) for time in times: val = data sys.stdout.write(f"t={time}\treceiver {rank}: received {val}\n") .. _sphx_glr_download_auto_examples_music_cont_out_proxy_example_receiver_script.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: receiver_script.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: receiver_script.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_