From 7977ff80daab06d4416169ff8cdc4fb7c71b685e Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 22 Mar 2024 20:55:54 +0530 Subject: [PATCH] DOC: Add custom `:button_text:` for all examples See https://github.com/jupyterlite/jupyterlite-sphinx/issues/157 --- doc/source/ref/cwt.rst | 3 +++ doc/source/ref/signal-extension-modes.rst | 2 ++ doc/source/ref/wavelets.rst | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/doc/source/ref/cwt.rst b/doc/source/ref/cwt.rst index 6971e299..f0d5ab53 100644 --- a/doc/source/ref/cwt.rst +++ b/doc/source/ref/cwt.rst @@ -90,6 +90,7 @@ A variety of continuous wavelets have been implemented. A list of the available wavelet names compatible with ``cwt`` can be obtained by: .. try_examples:: + :button_text: Try it in your browser! >>> import pywt >>> wavelist = pywt.wavelist(kind='continuous') @@ -207,6 +208,7 @@ sampled at 100 Hz, a center frequency of 1.0 corresponds to ~100 Hz at particular wavelet, one would analyze a signal using ``scales >= 2``. .. try_examples:: + :button_text: Try it in your browser! >>> import numpy as np >>> import pywt @@ -237,6 +239,7 @@ frequency fs. This function is useful for specifying the transform as a function of frequency directly. .. try_examples:: + :button_text: Try it in your browser! >>> import numpy as np >>> import pywt diff --git a/doc/source/ref/signal-extension-modes.rst b/doc/source/ref/signal-extension-modes.rst index 1b39e2e6..9ea76a66 100644 --- a/doc/source/ref/signal-extension-modes.rst +++ b/doc/source/ref/signal-extension-modes.rst @@ -90,6 +90,7 @@ computations can be performed with the `periodization`_ mode: **Example:** .. try_examples:: + :button_text: Try it in your browser! >>> import pywt >>> print(pywt.Modes.modes) @@ -105,6 +106,7 @@ Notice that you can use any of the following ways of passing wavelet and mode parameters: .. try_examples:: + :button_text: Try it in your browser! >>> import pywt >>> (a, d) = pywt.dwt([1,2,3,4,5,6], 'db2', 'smooth') diff --git a/doc/source/ref/wavelets.rst b/doc/source/ref/wavelets.rst index 7211bb3d..8fe6c319 100644 --- a/doc/source/ref/wavelets.rst +++ b/doc/source/ref/wavelets.rst @@ -49,6 +49,7 @@ Custom discrete wavelets are also supported through the **Example:** .. try_examples:: + :button_text: Try it in your browser! >>> import pywt >>> wavelet = pywt.Wavelet('db1') @@ -129,6 +130,7 @@ Custom discrete wavelets are also supported through the **Example:** .. try_examples:: + :button_text: Try it in your browser! >>> def format_array(arr): ... return "[%s]" % ", ".join(["%.14f" % x for x in arr]) @@ -172,6 +174,7 @@ Approximating wavelet and scaling functions - ``Wavelet.wavefun()`` **Example:** .. try_examples:: + :button_text: Try it in your browser! >>> import pywt >>> wavelet = pywt.Wavelet('db2') @@ -187,6 +190,7 @@ Approximating wavelet and scaling functions - ``Wavelet.wavefun()`` **Example:** .. try_examples:: + :button_text: Try it in your browser! >>> import pywt >>> wavelet = pywt.Wavelet('bior3.5') @@ -240,6 +244,7 @@ from plain Python lists of filter coefficients and a *filter bank-like* object. **Example:** .. try_examples:: + :button_text: Try it in your browser! >>> import pywt, math >>> c = math.sqrt(2)/2 @@ -274,6 +279,7 @@ from plain Python lists of filter coefficients and a *filter bank-like* object. **Example:** .. try_examples:: + :button_text: Try it in your browser! >>> import pywt >>> wavelet = pywt.ContinuousWavelet('gaus1') @@ -329,6 +335,7 @@ from plain Python lists of filter coefficients and a *filter bank-like* object. **Example:** .. try_examples:: + :button_text: Try it in your browser! >>> import pywt >>> wavelet = pywt.ContinuousWavelet('gaus1') @@ -359,6 +366,7 @@ Approximating wavelet functions - ``ContinuousWavelet.wavefun()`` **Example:** .. try_examples:: + :button_text: Try it in your browser! >>> import pywt >>> wavelet = pywt.ContinuousWavelet('gaus1') @@ -376,6 +384,7 @@ Approximating wavelet functions - ``ContinuousWavelet.wavefun()`` **Example:** .. try_examples:: + :button_text: Try it in your browser! >>> import pywt >>> wavelet = pywt.DiscreteContinuousWavelet('db1')