From 84144488551a58f8b1a34b1de541a7be4d7364a6 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" <git@edgarpierre.fr> Date: Sun, 9 Feb 2025 22:29:56 +0100 Subject: [PATCH 1/7] Enhance serve workflow by modifying build command to execute during HTML generation --- .forgejo/workflows/serve.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/serve.yaml b/.forgejo/workflows/serve.yaml index d6094bf..6e3215b 100644 --- a/.forgejo/workflows/serve.yaml +++ b/.forgejo/workflows/serve.yaml @@ -13,7 +13,7 @@ jobs: - name: Install dependencies run: ./.env/bin/pip install mystmd jupyterlab_myst ipykernel altair pandas - name: Build static HTML - run: ./.env/bin/myst build --html + run: ./.env/bin/myst build --execute --html - name: Copy files run: | rm -rf /data/srv/forgejo-runner/cours4.0 From ec450c6092e749f3a4434a70ae3f171fc169bae0 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" <git@edgarpierre.fr> Date: Sun, 9 Feb 2025 22:33:16 +0100 Subject: [PATCH 2/7] Update serve workflow to include 'jupyter' dependency in installation --- .forgejo/workflows/serve.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/serve.yaml b/.forgejo/workflows/serve.yaml index 6e3215b..85e4709 100644 --- a/.forgejo/workflows/serve.yaml +++ b/.forgejo/workflows/serve.yaml @@ -11,7 +11,7 @@ jobs: - name: Initialize virtual environment run: /usr/bin/python -m venv .env - name: Install dependencies - run: ./.env/bin/pip install mystmd jupyterlab_myst ipykernel altair pandas + run: ./.env/bin/pip install mystmd jupyter jupyterlab_myst ipykernel altair pandas - name: Build static HTML run: ./.env/bin/myst build --execute --html - name: Copy files From cb665904ee4e7913d9474f8a8e74fb3934840e74 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" <git@edgarpierre.fr> Date: Sun, 9 Feb 2025 22:36:53 +0100 Subject: [PATCH 3/7] Fix serve workflow to correct 'jupyterlab' dependency in installation --- .forgejo/workflows/serve.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/serve.yaml b/.forgejo/workflows/serve.yaml index 85e4709..a5d7fe9 100644 --- a/.forgejo/workflows/serve.yaml +++ b/.forgejo/workflows/serve.yaml @@ -11,7 +11,7 @@ jobs: - name: Initialize virtual environment run: /usr/bin/python -m venv .env - name: Install dependencies - run: ./.env/bin/pip install mystmd jupyter jupyterlab_myst ipykernel altair pandas + run: ./.env/bin/pip install mystmd jupyterlab jupyterlab_myst ipykernel altair pandas - name: Build static HTML run: ./.env/bin/myst build --execute --html - name: Copy files From a31ab300c216d23e737a363b6ee350cbfd0b1b5c Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" <git@edgarpierre.fr> Date: Sun, 9 Feb 2025 22:40:57 +0100 Subject: [PATCH 4/7] Fix serve workflow to correctly install 'jupyter' dependency and update build command for HTML generation --- .forgejo/workflows/serve.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/serve.yaml b/.forgejo/workflows/serve.yaml index a5d7fe9..6bd8ab9 100644 --- a/.forgejo/workflows/serve.yaml +++ b/.forgejo/workflows/serve.yaml @@ -11,9 +11,11 @@ jobs: - name: Initialize virtual environment run: /usr/bin/python -m venv .env - name: Install dependencies - run: ./.env/bin/pip install mystmd jupyterlab jupyterlab_myst ipykernel altair pandas + run: ./.env/bin/pip install mystmd jupyter jupyterlab_myst ipykernel altair pandas - name: Build static HTML - run: ./.env/bin/myst build --execute --html + run: | + . ./env/bin/activate + myst build --execute --html - name: Copy files run: | rm -rf /data/srv/forgejo-runner/cours4.0 From 1a992a81748cd5a1189e55e84e5d0d3011be1f6c Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" <git@edgarpierre.fr> Date: Sun, 9 Feb 2025 22:40:57 +0100 Subject: [PATCH 5/7] Fix serve workflow to correctly install 'jupyter' dependency and update build command for HTML generation --- .forgejo/workflows/serve.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/serve.yaml b/.forgejo/workflows/serve.yaml index a5d7fe9..8f8b4ba 100644 --- a/.forgejo/workflows/serve.yaml +++ b/.forgejo/workflows/serve.yaml @@ -11,9 +11,11 @@ jobs: - name: Initialize virtual environment run: /usr/bin/python -m venv .env - name: Install dependencies - run: ./.env/bin/pip install mystmd jupyterlab jupyterlab_myst ipykernel altair pandas + run: ./.env/bin/pip install mystmd jupyter jupyterlab_myst ipykernel altair pandas - name: Build static HTML - run: ./.env/bin/myst build --execute --html + run: | + . .env/bin/activate + myst build --execute --html - name: Copy files run: | rm -rf /data/srv/forgejo-runner/cours4.0 From 1e808ae6b843fb7c12d36d3ca41adccc2b327fd3 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" <git@edgarpierre.fr> Date: Sun, 9 Feb 2025 22:43:18 +0100 Subject: [PATCH 6/7] Remove unused imports from 02-signaux.md --- cours/SIN/02-signaux.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/cours/SIN/02-signaux.md b/cours/SIN/02-signaux.md index 1a4929f..899f7cd 100644 --- a/cours/SIN/02-signaux.md +++ b/cours/SIN/02-signaux.md @@ -34,10 +34,7 @@ et un niveau **bas** ("Low"). :tags: [remove-input] import altair as alt import pandas as pd -import matplotlib.pyplot as plt -import numpy as np import random -from scipy.interpolate import CubicSpline random.seed(25) From d3c9023ed9a19d3375ccf2ff7659fafe94607346 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" <git@edgarpierre.fr> Date: Mon, 10 Feb 2025 18:34:49 +0100 Subject: [PATCH 7/7] Refactor signal examples in 02-signaux.md to improve clarity and consistency --- cours/SIN/02-signaux.md | 101 +++++++++++++++++++++++++++++++++++----- 1 file changed, 89 insertions(+), 12 deletions(-) diff --git a/cours/SIN/02-signaux.md b/cours/SIN/02-signaux.md index 899f7cd..42b4433 100644 --- a/cours/SIN/02-signaux.md +++ b/cours/SIN/02-signaux.md @@ -33,15 +33,15 @@ et un niveau **bas** ("Low"). ```{code-cell} python :tags: [remove-input] import altair as alt +import numpy as np import pandas as pd -import random -random.seed(25) +rng = np.random.default_rng(25) n = 16 -t = range(n+1) -s = random.choices([0, 1], k=n) -s += s[-1:] +t = np.arange(n+1) +s = rng.choice([0, 1], n+1) +s[-1] = s[-2] data = pd.DataFrame({ "t": t, "s": s, @@ -49,24 +49,101 @@ data = pd.DataFrame({ alt.Chart( data ).mark_line( - interpolate="step-after" + interpolate="step-after", + strokeWidth=3, ).encode( alt.X("t:Q").axis(title="Temps (s)").scale(domain=(0,n)), - alt.Y("s:Q", axis=alt.Axis(title="Signal logique", tickMinStep=1.0)).scale(domain=(0,1)), + alt.Y("s:Q", axis=alt.Axis(title="Signal logique", values=[0, 1], format=".0f")).scale(domain=(0,1)), ).properties( width="container", + height=100, ) - ``` Exemple de signal logique ```` -Le signal logique en @logique est par exemple à l'état haut entre 1 s et 3 s, -et à l'état bas entre 8 s et 11 s. -Lorsque le signal passe de l'état bas à l'état haut (comme à 1 s), +Le signal logique en @logique est par exemple à l'état haut entre 2 s et 3 s, +et à l'état bas entre 3 s et 6 s. +Lorsque le signal passe de l'état bas à l'état haut (comme à 2 s), on parle de **front montant**. Dans le cas contraire (comme à 3 s), on parle de **front descendant**. ## Les signaux analogiques -Un signal analogique est un signal qui peut prendre un ensemble continu de valeurs. \ No newline at end of file +Un signal analogique est un signal qui peut prendre un ensemble continu de valeurs. +Un exemple de signal analogique est donné en @analogique. + +````{figure} +:label: analogique +```{code-cell} python +:tags: [remove-input] +import altair as alt +import numpy as np +import pandas as pd + +rng = np.random.default_rng(25) + +n = 20 +t_max = 16 + +t = np.linspace(0, t_max, n) + +s = 5 * rng.random(n) +s[-1] = s[-2] +data = pd.DataFrame({ + "t": t, + "s": s, +}) +alt.Chart( + data +).mark_line( + interpolate="basis", + strokeWidth=3, +).encode( + alt.X("t:Q").axis(title="Temps (s)").scale(domain=(0,t_max)), + alt.Y("s:Q", axis=alt.Axis(title="Signal analogique")).scale(domain=(0,5)), +).properties( + width="container", + height=200, +) +``` +Exemple de signal analogique +```` + +## Les signaux numériques +Un signal numérique est un signal qui peut prendre un ensemble discret de valeur, +c'est-à-dire un ensemble précis de valeurs distinctes (généralement des nombres entiers). + +````{figure} +:label: numerique +```{code-cell} python +:tags: [remove-input] +import altair as alt +import numpy as np +import pandas as pd + +rng = np.random.default_rng(25) + +n = 16 +t = np.arange(n+1) +s = rng.integers(0, 16, n+1) +s[-1] = s[-2] +data = pd.DataFrame({ + "t": t, + "s": s, +}) +alt.Chart( + data +).mark_line( + interpolate="step-after", + strokeWidth=3, +).encode( + alt.X("t:Q").axis(title="Temps (s)").scale(domain=(0,n)), + alt.Y("s:Q", axis=alt.Axis(title="Signal numérique", values=np.arange(0, 16))).scale(domain=(0,15)), +).properties( + width="container", + height=200, +) +``` +Exemple de signal numérique +```` \ No newline at end of file