
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "auto_examples/spike_fns/plot_maxspike.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        Click :ref:`here <sphx_glr_download_auto_examples_spike_fns_plot_maxspike.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_auto_examples_spike_fns_plot_maxspike.py:


===========
MaxSpike
===========
:class:`~sinabs.activation.MaxSpike` activation function.

.. GENERATED FROM PYTHON SOURCE LINES 7-24



.. image-sg:: /auto_examples/spike_fns/images/sphx_glr_plot_maxspike_001.png
   :alt: plot maxspike
   :srcset: /auto_examples/spike_fns/images/sphx_glr_plot_maxspike_001.png
   :class: sphx-glr-single-img





.. code-block:: default


    import matplotlib.pyplot as plt
    import torch

    import sinabs.activation as sina

    v_mem = torch.linspace(0, 5.5, 500)

    spike_threshold = 1.0
    activations = sina.MaxSpike(max_num_spikes_per_bin=2).apply(
        v_mem, spike_threshold, sina.MultiGaussian()
    )
    plt.plot(v_mem, activations)
    plt.xlabel("Neuron membrane potential")
    plt.ylabel("Spike activation")
    plt.ylim(top=5.2)
    plt.tight_layout()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** ( 0 minutes  0.132 seconds)


.. _sphx_glr_download_auto_examples_spike_fns_plot_maxspike.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example


    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_maxspike.py <plot_maxspike.py>`

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_maxspike.ipynb <plot_maxspike.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
