From 9b77771da77bf727ba8da16e7b0dc1818cf10718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guilherme=20Castel=C3=A3o?= Date: Mon, 31 Jul 2023 16:45:13 -0700 Subject: [PATCH] Fix notebook on fuzzy logic (#73) * fix: Outdated syntax to apply fuzzy logic * Thanks to @alkis05 for reporting bug #72 --- AUTHORS.rst | 1 + docs/notebooks/fuzzy_logic.ipynb | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/AUTHORS.rst b/AUTHORS.rst index cc612ef5..7a28d56b 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -15,3 +15,4 @@ Contributors * @BillMills: - PR #47, re-introduce Argo density inversion as inherited QCCheck. - PR #53, update fuzzy logic to handle edge-case NaNs rather than masks. - Reported bug that resulted on PR #61. +* @alkis05: Reported bug #72, outdated fuzzy logic notebook. diff --git a/docs/notebooks/fuzzy_logic.ipynb b/docs/notebooks/fuzzy_logic.ipynb index b4ff1cf1..5169edf1 100644 --- a/docs/notebooks/fuzzy_logic.ipynb +++ b/docs/notebooks/fuzzy_logic.ipynb @@ -153,17 +153,17 @@ "x_QC = np.linspace(0.0, 1.0, 200)\n", "\n", "# Generate fuzzy membership functions\n", - "data['spike_lo'] = fuzz.zmf(data['x_spike'], cfg['fuzzylogic']['features']['spike']['low'])\n", - "data['spike_md'] = fuzz.trapmf(data['x_spike'], cfg['fuzzylogic']['features']['spike']['medium'])\n", - "data['spike_hi'] = fuzz.smf(data['x_spike'], cfg['fuzzylogic']['features']['spike']['high'])\n", + "data['spike_lo'] = fuzz.zmf(data['x_spike'], cfg['fuzzylogic']['features']['spike']['low']['params'])\n", + "data['spike_md'] = fuzz.trapmf(data['x_spike'], cfg['fuzzylogic']['features']['spike']['medium']['params'])\n", + "data['spike_hi'] = fuzz.smf(data['x_spike'], cfg['fuzzylogic']['features']['spike']['high']['params'])\n", "\n", - "data['clim_lo'] = fuzz.zmf(data['x_clim'], cfg['fuzzylogic']['features']['woa_normbias']['low'])\n", - "data['clim_md'] = fuzz.trapmf(data['x_clim'], cfg['fuzzylogic']['features']['woa_normbias']['medium'])\n", - "data['clim_hi'] = fuzz.smf(data['x_clim'], cfg['fuzzylogic']['features']['woa_normbias']['high'])\n", + "data['clim_lo'] = fuzz.zmf(data['x_clim'], cfg['fuzzylogic']['features']['woa_normbias']['low']['params'])\n", + "data['clim_md'] = fuzz.trapmf(data['x_clim'], cfg['fuzzylogic']['features']['woa_normbias']['medium']['params'])\n", + "data['clim_hi'] = fuzz.smf(data['x_clim'], cfg['fuzzylogic']['features']['woa_normbias']['high']['params'])\n", "\n", - "data['grad_lo'] = fuzz.zmf(data['x_grad'], cfg['fuzzylogic']['features']['gradient']['low'])\n", - "data['grad_md'] = fuzz.trapmf(data['x_grad'], cfg['fuzzylogic']['features']['gradient']['medium'])\n", - "data['grad_hi'] = fuzz.smf(data['x_grad'], cfg['fuzzylogic']['features']['gradient']['high'])\n", + "data['grad_lo'] = fuzz.zmf(data['x_grad'], cfg['fuzzylogic']['features']['gradient']['low']['params'])\n", + "data['grad_md'] = fuzz.trapmf(data['x_grad'], cfg['fuzzylogic']['features']['gradient']['medium']['params'])\n", + "data['grad_hi'] = fuzz.smf(data['x_grad'], cfg['fuzzylogic']['features']['gradient']['high']['params'])\n", "\n", "QC_lo = fuzz.trimf(x_QC, [0.0, 0.225, 0.45])\n", "QC_md = fuzz.trimf(x_QC, [0.275, 0.5, 0.725])\n",