From 43ddcca750b473873e5e0edbf5dcf650993a0ac5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:45:08 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.6 → v0.6.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.6...v0.6.3) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 10fefab4..2daa27d8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.6 + rev: v0.6.3 hooks: - id: ruff args: [ --fix ] From a06f6ce2b998328765c474208b57b839ff1d00ee Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Sep 2024 17:45:15 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- dev/notebooks/lanczos_interp_devel.ipynb | 54 +++++++++++++++++------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/dev/notebooks/lanczos_interp_devel.ipynb b/dev/notebooks/lanczos_interp_devel.ipynb index b8f1b4b1..6a0f5b10 100644 --- a/dev/notebooks/lanczos_interp_devel.ipynb +++ b/dev/notebooks/lanczos_interp_devel.ipynb @@ -21,14 +21,24 @@ "source": [ "fig, axs = pplt.subplots(figsize=(7, 7))\n", "\n", + "\n", "def _s(x, c, m):\n", - " return 1.0 / (1.0 + np.exp(-(x-m)/c))\n", + " return 1.0 / (1.0 + np.exp(-(x - m) / c))\n", + "\n", "\n", "def _approx(order, tol):\n", - " plaw = np.exp(4.8 + 9.2e-4 * np.log(tol/1e-8)**2 - 0.33 * np.log(tol/1e-8) - 0.66 * np.log(order))\n", - " sval = _s(np.log(order), np.log(15), 0.1) * (1.0 - _s(np.log(tol), np.log(1e-2), 0.1))\n", + " plaw = np.exp(\n", + " 4.8\n", + " + 9.2e-4 * np.log(tol / 1e-8) ** 2\n", + " - 0.33 * np.log(tol / 1e-8)\n", + " - 0.66 * np.log(order)\n", + " )\n", + " sval = _s(np.log(order), np.log(15), 0.1) * (\n", + " 1.0 - _s(np.log(tol), np.log(1e-2), 0.1)\n", + " )\n", " return np.maximum(sval * 1.5 + (1.0 - sval) * plaw, 0.55)\n", "\n", + "\n", "m = []\n", "orders = np.arange(1, 31, dtype=int)\n", "tols = np.logspace(-8, 0, 10)\n", @@ -37,19 +47,20 @@ "for j, tol in enumerate(tols):\n", " yv = []\n", " for i in orders:\n", - " lz = galsim.interpolant.Lanczos(i, gsparams=galsim.GSParams(kvalue_accuracy=tol))\n", + " lz = galsim.interpolant.Lanczos(\n", + " i, gsparams=galsim.GSParams(kvalue_accuracy=tol)\n", + " )\n", " yv.append(lz._i.urange())\n", " vals[j, :] = np.array(yv)\n", " m.append(axs.loglog(orders, yv, label=\"log10(tol) = %d\" % np.log10(tol)))\n", " axs.loglog(\n", - " orders, \n", - " _approx(orders, tol), \n", - " \":\", \n", + " orders,\n", + " _approx(orders, tol),\n", + " \":\",\n", " color=\"k\",\n", " )\n", "axs.legend(m, loc=\"ur\", ncols=4, frameon=False)\n", - "axs.format(xlabel=\"Lanczos order\", ylabel=\"urange [$2\\pi$/pixels]\")\n", - " " + "axs.format(xlabel=\"Lanczos order\", ylabel=\"urange [$2\\pi$/pixels]\")" ] }, { @@ -63,25 +74,33 @@ "source": [ "print(\"_posflux_conserve_dc = {\")\n", "for i in orders:\n", - " lz = galsim.interpolant.Lanczos(i, conserve_dc=True, gsparams=galsim.GSParams(kvalue_accuracy=tol))\n", + " lz = galsim.interpolant.Lanczos(\n", + " i, conserve_dc=True, gsparams=galsim.GSParams(kvalue_accuracy=tol)\n", + " )\n", " print(\" %d: %r,\" % (i, lz.positive_flux))\n", "print(\"}\")\n", "\n", "print(\"_posflux_no_conserve_dc = {\")\n", "for i in orders:\n", - " lz = galsim.interpolant.Lanczos(i, conserve_dc=False, gsparams=galsim.GSParams(kvalue_accuracy=tol))\n", + " lz = galsim.interpolant.Lanczos(\n", + " i, conserve_dc=False, gsparams=galsim.GSParams(kvalue_accuracy=tol)\n", + " )\n", " print(\" %d: %r,\" % (i, lz.positive_flux))\n", "print(\"}\")\n", "\n", "print(\"_negflux_conserve_dc = {\")\n", "for i in orders:\n", - " lz = galsim.interpolant.Lanczos(i, conserve_dc=True, gsparams=galsim.GSParams(kvalue_accuracy=tol))\n", + " lz = galsim.interpolant.Lanczos(\n", + " i, conserve_dc=True, gsparams=galsim.GSParams(kvalue_accuracy=tol)\n", + " )\n", " print(\" %d: %r,\" % (i, lz.negative_flux))\n", "print(\"}\")\n", "\n", "print(\"_negflux_no_conserve_dc = {\")\n", "for i in orders:\n", - " lz = galsim.interpolant.Lanczos(i, conserve_dc=False, gsparams=galsim.GSParams(kvalue_accuracy=tol))\n", + " lz = galsim.interpolant.Lanczos(\n", + " i, conserve_dc=False, gsparams=galsim.GSParams(kvalue_accuracy=tol)\n", + " )\n", " print(\" %d: %r,\" % (i, lz.negative_flux))\n", "print(\"}\")" ] @@ -96,16 +115,19 @@ "outputs": [], "source": [ "with np.printoptions(floatmode=\"unique\"):\n", - "\n", " print(\"_unit_integrals_no_conserve_dc = {\")\n", " for i in orders:\n", - " lz = galsim.interpolant.Lanczos(i, conserve_dc=False, gsparams=galsim.GSParams(kvalue_accuracy=tol))\n", + " lz = galsim.interpolant.Lanczos(\n", + " i, conserve_dc=False, gsparams=galsim.GSParams(kvalue_accuracy=tol)\n", + " )\n", " print(\" %d: jnp.%s, dtype=float),\" % (i, repr(lz.unit_integrals())[:-1]))\n", " print(\"}\")\n", "\n", " print(\"_unit_integrals_conserve_dc = {\")\n", " for i in orders:\n", - " lz = galsim.interpolant.Lanczos(i, conserve_dc=True, gsparams=galsim.GSParams(kvalue_accuracy=tol))\n", + " lz = galsim.interpolant.Lanczos(\n", + " i, conserve_dc=True, gsparams=galsim.GSParams(kvalue_accuracy=tol)\n", + " )\n", " print(\" %d: jnp.%s, dtype=float),\" % (i, repr(lz.unit_integrals())[:-1]))\n", " print(\"}\")" ]