From 69873047d7454ea9153fefa7f4a76ccb046aa29e Mon Sep 17 00:00:00 2001 From: Jonathan Niehof Date: Tue, 27 Oct 2026 12:49:03 -0600 Subject: [PATCH 01/14] Update to ruff 0.16.10 --- .pre-commit-config.yaml | 2 +- pyproject.toml | 4 +-- uv.lock | 62 ++++++++++++++++++++--------------------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 136a830a..1392d485 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,7 +20,7 @@ repos: | docs/.*\.(svg|png)$ # documentation images ) - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.15.2" + rev: "v0.16.10" hooks: - id: ruff-check args: [--fix] diff --git a/pyproject.toml b/pyproject.toml index 7e851cea..e98d5523 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ test = [ dev = [ "dotenv>=0.9.9", "pre-commit>=4.0", - "ruff==0.15.2", + "ruff==0.16.10", ] [tool.setuptools] @@ -58,4 +58,4 @@ addopts = "-ra" [tool.ruff] target-version = "py310" -lint.ignore = ["E741"] +lint.ignore = ["DTZ001", "DTZ005", "E741"] diff --git a/uv.lock b/uv.lock index e7be1f08..7ca5b9b3 100644 --- a/uv.lock +++ b/uv.lock @@ -575,6 +575,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/36/41/04e2a649058b0713b00d6c9bd22da35618bb157289e05d068e51fddf8d7e/dunamai-1.25.0-py3-none-any.whl", hash = "sha256:7f9dc687dd3256e613b6cc978d9daabfd2bb5deb8adc541fc135ee423ffa98ab", size = 27022, upload-time = "2025-07-04T19:25:54.863Z" }, ] +[[package]] +name = "et-xmlfile" +version = "2.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d3/38/af70d7ab1ae9d4da450eeec1fa3918940a5fafb9055e934af8d6eb0c2313/et_xmlfile-2.0.0.tar.gz", hash = "sha256:dab3f4764309081ce75662649be815c4c9081e88f0837825f90fd28317d4da54", size = 17234, upload-time = "2024-10-25T17:25:40.039Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c1/8b/5fe2cc11fee489817272089c4203e679c63b570a5aaeb18d852ae3cbba6a/et_xmlfile-2.0.0-py3-none-any.whl", hash = "sha256:7a91720bc756843502c3b7504c77b8fe44217c85c537d85037f0f536151b2caa", size = 18059, upload-time = "2024-10-25T17:25:39.051Z" }, +] + [[package]] name = "exceptiongroup" version = "1.3.1" @@ -605,15 +614,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/01/a4/9b63d595d748e3aff8812b65eacc1a2c4bd90b7c2012e08e72373b4835eb/filelock-3.32.4-py3-none-any.whl", hash = "sha256:22e58ca3b1ae3b98993b762d7338367ae64fe50252bf78d59da3bfebcdf1cedd", size = 99864, upload-time = "2026-08-23T17:37:53.913Z" }, ] -[[package]] -name = "et-xmlfile" -version = "2.0.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d3/38/af70d7ab1ae9d4da450eeec1fa3918940a5fafb9055e934af8d6eb0c2313/et_xmlfile-2.0.0.tar.gz", hash = "sha256:dab3f4764309081ce75662649be815c4c9081e88f0837825f90fd28317d4da54", size = 17234, upload-time = "2024-10-25T17:25:40.039Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/c1/8b/5fe2cc11fee489817272089c4203e679c63b570a5aaeb18d852ae3cbba6a/et_xmlfile-2.0.0-py3-none-any.whl", hash = "sha256:7a91720bc756843502c3b7504c77b8fe44217c85c537d85037f0f536151b2caa", size = 18059, upload-time = "2024-10-25T17:25:39.051Z" }, -] - [[package]] name = "fonttools" version = "4.61.1" @@ -828,7 +828,7 @@ requires-dist = [ { name = "pytest", marker = "extra == 'test'", specifier = ">=8.3" }, { name = "pytest-xdist", marker = "extra == 'test'", specifier = ">=3.6" }, { name = "requests", specifier = "==2.32.3" }, - { name = "ruff", marker = "extra == 'dev'", specifier = "==0.15.2" }, + { name = "ruff", marker = "extra == 'dev'", specifier = "==0.16.10" }, { name = "sammi-cdf", specifier = "==1.0.0" }, { name = "scikit-learn", specifier = "==1.6.1" }, { name = "scipy", specifier = ">=1.13.1" }, @@ -1941,27 +1941,27 @@ wheels = [ [[package]] name = "ruff" -version = "0.15.2" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/06/04/eab13a954e763b0606f460443fcbf6bb5a0faf06890ea3754ff16523dce5/ruff-0.15.2.tar.gz", hash = "sha256:14b965afee0969e68bb871eba625343b8673375f457af4abe98553e8bbb98342", size = 4558148, upload-time = "2026-02-19T22:32:20.271Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/2f/70/3a4dc6d09b13cb3e695f28307e5d889b2e1a66b7af9c5e257e796695b0e6/ruff-0.15.2-py3-none-linux_armv6l.whl", hash = "sha256:120691a6fdae2f16d65435648160f5b81a9625288f75544dc40637436b5d3c0d", size = 10430565, upload-time = "2026-02-19T22:32:41.824Z" }, - { url = "https://files.pythonhosted.org/packages/71/0b/bb8457b56185ece1305c666dc895832946d24055be90692381c31d57466d/ruff-0.15.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:a89056d831256099658b6bba4037ac6dd06f49d194199215befe2bb10457ea5e", size = 10820354, upload-time = "2026-02-19T22:32:07.366Z" }, - { url = "https://files.pythonhosted.org/packages/2d/c1/e0532d7f9c9e0b14c46f61b14afd563298b8b83f337b6789ddd987e46121/ruff-0.15.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e36dee3a64be0ebd23c86ffa3aa3fd3ac9a712ff295e192243f814a830b6bd87", size = 10170767, upload-time = "2026-02-19T22:32:13.188Z" }, - { url = "https://files.pythonhosted.org/packages/47/e8/da1aa341d3af017a21c7a62fb5ec31d4e7ad0a93ab80e3a508316efbcb23/ruff-0.15.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a9fb47b6d9764677f8c0a193c0943ce9a05d6763523f132325af8a858eadc2b9", size = 10529591, upload-time = "2026-02-19T22:32:02.547Z" }, - { url = "https://files.pythonhosted.org/packages/93/74/184fbf38e9f3510231fbc5e437e808f0b48c42d1df9434b208821efcd8d6/ruff-0.15.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f376990f9d0d6442ea9014b19621d8f2aaf2b8e39fdbfc79220b7f0c596c9b80", size = 10260771, upload-time = "2026-02-19T22:32:36.938Z" }, - { url = "https://files.pythonhosted.org/packages/05/ac/605c20b8e059a0bc4b42360414baa4892ff278cec1c91fff4be0dceedefd/ruff-0.15.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2dcc987551952d73cbf5c88d9fdee815618d497e4df86cd4c4824cc59d5dd75f", size = 11045791, upload-time = "2026-02-19T22:32:31.642Z" }, - { url = "https://files.pythonhosted.org/packages/fd/52/db6e419908f45a894924d410ac77d64bdd98ff86901d833364251bd08e22/ruff-0.15.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:42a47fd785cbe8c01b9ff45031af875d101b040ad8f4de7bbb716487c74c9a77", size = 11879271, upload-time = "2026-02-19T22:32:29.305Z" }, - { url = "https://files.pythonhosted.org/packages/3e/d8/7992b18f2008bdc9231d0f10b16df7dda964dbf639e2b8b4c1b4e91b83af/ruff-0.15.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:cbe9f49354866e575b4c6943856989f966421870e85cd2ac94dccb0a9dcb2fea", size = 11303707, upload-time = "2026-02-19T22:32:22.492Z" }, - { url = "https://files.pythonhosted.org/packages/d7/02/849b46184bcfdd4b64cde61752cc9a146c54759ed036edd11857e9b8443b/ruff-0.15.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b7a672c82b5f9887576087d97be5ce439f04bbaf548ee987b92d3a7dede41d3a", size = 11149151, upload-time = "2026-02-19T22:32:44.234Z" }, - { url = "https://files.pythonhosted.org/packages/70/04/f5284e388bab60d1d3b99614a5a9aeb03e0f333847e2429bebd2aaa1feec/ruff-0.15.2-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:72ecc64f46f7019e2bcc3cdc05d4a7da958b629a5ab7033195e11a438403d956", size = 11091132, upload-time = "2026-02-19T22:32:24.691Z" }, - { url = "https://files.pythonhosted.org/packages/fa/ae/88d844a21110e14d92cf73d57363fab59b727ebeabe78009b9ccb23500af/ruff-0.15.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:8dcf243b15b561c655c1ef2f2b0050e5d50db37fe90115507f6ff37d865dc8b4", size = 10504717, upload-time = "2026-02-19T22:32:26.75Z" }, - { url = "https://files.pythonhosted.org/packages/64/27/867076a6ada7f2b9c8292884ab44d08fd2ba71bd2b5364d4136f3cd537e1/ruff-0.15.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:dab6941c862c05739774677c6273166d2510d254dac0695c0e3f5efa1b5585de", size = 10263122, upload-time = "2026-02-19T22:32:10.036Z" }, - { url = "https://files.pythonhosted.org/packages/e7/ef/faf9321d550f8ebf0c6373696e70d1758e20ccdc3951ad7af00c0956be7c/ruff-0.15.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1b9164f57fc36058e9a6806eb92af185b0697c9fe4c7c52caa431c6554521e5c", size = 10735295, upload-time = "2026-02-19T22:32:39.227Z" }, - { url = "https://files.pythonhosted.org/packages/2f/55/e8089fec62e050ba84d71b70e7834b97709ca9b7aba10c1a0b196e493f97/ruff-0.15.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:80d24fcae24d42659db7e335b9e1531697a7102c19185b8dc4a028b952865fd8", size = 11241641, upload-time = "2026-02-19T22:32:34.617Z" }, - { url = "https://files.pythonhosted.org/packages/23/01/1c30526460f4d23222d0fabd5888868262fd0e2b71a00570ca26483cd993/ruff-0.15.2-py3-none-win32.whl", hash = "sha256:fd5ff9e5f519a7e1bd99cbe8daa324010a74f5e2ebc97c6242c08f26f3714f6f", size = 10507885, upload-time = "2026-02-19T22:32:15.635Z" }, - { url = "https://files.pythonhosted.org/packages/5c/10/3d18e3bbdf8fc50bbb4ac3cc45970aa5a9753c5cb51bf9ed9a3cd8b79fa3/ruff-0.15.2-py3-none-win_amd64.whl", hash = "sha256:d20014e3dfa400f3ff84830dfb5755ece2de45ab62ecea4af6b7262d0fb4f7c5", size = 11623725, upload-time = "2026-02-19T22:32:04.947Z" }, - { url = "https://files.pythonhosted.org/packages/6d/78/097c0798b1dab9f8affe73da9642bb4500e098cb27fd8dc9724816ac747b/ruff-0.15.2-py3-none-win_arm64.whl", hash = "sha256:cabddc5822acdc8f7b5527b36ceac55cc51eec7b1946e60181de8fe83ca8876e", size = 10941649, upload-time = "2026-02-19T22:32:18.108Z" }, +version = "0.16.10" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c4/49/23802c45f093eb14bde54b141d2b2f058edfa63a06db7beed047308cc08f/ruff-0.16.10.tar.gz", hash = "sha256:eff4728c4eaae93f0955cd264d24b2ab348e74bf59986ccf282ba6dc16b3b017", size = 4958724, upload-time = "2026-10-01T18:03:21.697Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2f/21/ebce22e1d90cdb2cd691026b9c6e9bec6499f0b396089481755b5d49efff/ruff-0.16.10-py3-none-linux_armv6l.whl", hash = "sha256:488b0fe3f3574210e5cf80d9f59b9e3ab17a127a8155de3f307b392589cfb511", size = 10095557, upload-time = "2026-10-01T18:02:36.072Z" }, + { url = "https://files.pythonhosted.org/packages/cb/98/a54de85876a8b2612bfa0d84c7b9abfb39c6a3354aee7800b09c1649b9e3/ruff-0.16.10-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:e748ff95c934c4e978783b8e687bc174e7bd84e8ad24e3243e1ecfcda5e0282d", size = 10340577, upload-time = "2026-10-01T18:02:39.258Z" }, + { url = "https://files.pythonhosted.org/packages/9f/16/1a5a4a2657effe4806110f2b907313802f1367fcdbb29e8122766e407fab/ruff-0.16.10-py3-none-macosx_11_0_arm64.whl", hash = "sha256:3031a4a2e8e7b8a46f70be45f198c35a11ece509a94b80334d8d397a33c67550", size = 9774282, upload-time = "2026-10-01T18:02:41.79Z" }, + { url = "https://files.pythonhosted.org/packages/6e/fb/470085af734da396e68cd80fb0a3e7c109a459716ae59588c0f6fab8a17d/ruff-0.16.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:494401c86df4c4c25f69b9419605d944467ee98c42fb6ad405ef4fa40b8fb67d", size = 9920895, upload-time = "2026-10-01T18:02:44.458Z" }, + { url = "https://files.pythonhosted.org/packages/57/de/f10cffe4f88a37ea6615ec460f01bf76f0bc1477737a35d9ee61a630a78b/ruff-0.16.10-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d203abc0ff2b773ee33d00ab8df0bb67046fbc7c07b119332f08b9b345cf8221", size = 9902707, upload-time = "2026-10-01T18:02:47.041Z" }, + { url = "https://files.pythonhosted.org/packages/ff/44/3fdcedf83ae60ef837dd239170e480dce606a9142cfa2db911afdf855fd9/ruff-0.16.10-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:bd83d1235a5258d318477bc5b576303974cbdef5df0c01a1bff14efcc23bd12a", size = 10619287, upload-time = "2026-10-01T18:02:49.485Z" }, + { url = "https://files.pythonhosted.org/packages/c1/62/02e76a5574002153618eafbb70e159468addc72a5d2c488e65cbb4639d2d/ruff-0.16.10-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bc2610fb269fa56dd8a68669ae470fa6272902668c0fc2ebc3aa112b2633d5b8", size = 11339942, upload-time = "2026-10-01T18:02:52.008Z" }, + { url = "https://files.pythonhosted.org/packages/6b/c4/cde27d47ad8d4126c587e608c67c46e7feac11763f606d261a1bc8a489e6/ruff-0.16.10-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3e70175e29cc94c26ea296c80e470180b744b7419026898e58f520c6ab32578e", size = 10934316, upload-time = "2026-10-01T18:02:54.811Z" }, + { url = "https://files.pythonhosted.org/packages/e4/03/17234145f302a645a123e8c3bb2411ecf4669fbc350de3b0d803230a1729/ruff-0.16.10-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f33f43a864a8483eebd160e713336c8bab02c934feaff0a33cf5ccb41546d09a", size = 10387968, upload-time = "2026-10-01T18:02:57.497Z" }, + { url = "https://files.pythonhosted.org/packages/71/29/2493af60240ee7644b38a4b821f5f9c3b5a4fa3178770fe1d0c685217395/ruff-0.16.10-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:1dfc6f0088149fb6a362c1c446bcbb3fd2157b3852fe2fa68409276eab9ad9b3", size = 10537906, upload-time = "2026-10-01T18:03:00.006Z" }, + { url = "https://files.pythonhosted.org/packages/2e/9a/f56b28f3b143bb9e518c34fb89ab191b626bca8b70dbf8af0d2e2d473572/ruff-0.16.10-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:6553498afc35f580f036030795810b9e6bcea31604b0fd9e8d352795473042e3", size = 10012938, upload-time = "2026-10-01T18:03:03.006Z" }, + { url = "https://files.pythonhosted.org/packages/c2/c4/fca37362848ea4d4d80712df13632e645e7c7cfb1bdedf140699ac7a090b/ruff-0.16.10-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a3b8471dea115d37f123882be852bed13403746d3a76c11de4a19ec5f9ff5a03", size = 9897945, upload-time = "2026-10-01T18:03:05.818Z" }, + { url = "https://files.pythonhosted.org/packages/7d/c7/e0bc57664d6e0c61fd22f620af260fe9662d7e1ddb320ea7f160e76ef165/ruff-0.16.10-py3-none-musllinux_1_2_i686.whl", hash = "sha256:92e59a70bcbd9d3a5483656da906ec28edfdacfce00afd99edb8b4e9d15644be", size = 10333134, upload-time = "2026-10-01T18:03:08.25Z" }, + { url = "https://files.pythonhosted.org/packages/21/aa/5c9f3b68737c0e4a33a1db5dfab44f7b786d96ca91a7233112ddab1e6dc2/ruff-0.16.10-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:7ae7375f803b5520dc9f546bed7e3a0acb70b91812e9bb4b19927de22f25b77d", size = 10741702, upload-time = "2026-10-01T18:03:10.775Z" }, + { url = "https://files.pythonhosted.org/packages/78/fa/0f9c2020dc316c53d983be011720b8157cc052b97e3f4dfa7db6d0f880a6/ruff-0.16.10-py3-none-win32.whl", hash = "sha256:2a12e01cb9156c10c466f63b46eaae5ecea28dfbd21b5836353ae498e7d1349a", size = 10139176, upload-time = "2026-10-01T18:03:13.267Z" }, + { url = "https://files.pythonhosted.org/packages/99/29/cfb0df9448d4d4ad48c2de029ada9ebd71baa6da983a6c77ee6c6cd0fe82/ruff-0.16.10-py3-none-win_amd64.whl", hash = "sha256:97f2015c92aa97105b0eab19eb5d224884399281cfc5da86a92db4ab5e7fb2ca", size = 10584734, upload-time = "2026-10-01T18:03:16.006Z" }, + { url = "https://files.pythonhosted.org/packages/fc/05/c16957eb287c3fc062e032619a25868d93d408a844b725bcf514f7a378ff/ruff-0.16.10-py3-none-win_arm64.whl", hash = "sha256:25a65fe998c4e6861ec079ada5826a2fc605e6cbccbe9dcd7fac1f54e791621b", size = 10366440, upload-time = "2026-10-01T18:03:19.04Z" }, ] [[package]] From 1d009ed2ce5a26ddb7336bde38cfe483e9278ac2 Mon Sep 17 00:00:00 2001 From: Jonathan Niehof Date: Tue, 27 Oct 2026 12:49:31 -0600 Subject: [PATCH 02/14] Run ruff check --fix with new ruff --- docs/swapi/figure_src/figure_utils.py | 5 +- .../figure_src/plot_alpha_peak_finding.py | 3 +- .../figure_src/plot_calibration_curves.py | 2 +- .../plot_collapsed_response_grid.py | 4 +- docs/swapi/figure_src/plot_fit_accuracy.py | 33 ++-- .../figure_src/plot_passband_boundaries.py | 2 +- .../figure_src/plot_pui_cutoff_staircase.py | 3 - .../swapi/figure_src/plot_pui_distribution.py | 3 - .../plot_pui_reference_comparison.py | 7 +- docs/swapi/figure_src/plot_real_data_fit.py | 26 +-- docs/swapi/figure_src/plot_spectra.py | 15 +- docs/swapi/figure_src/plot_uncertainty_mc.py | 36 ++-- .../figure_src/plot_validation_scatter.py | 17 +- imap_l3_data_processor.py | 10 +- .../cdf/imap_attribute_manager.py | 3 +- .../codice/l3/hi/codice_hi_processor.py | 10 +- ...odice_hi_l3a_direct_events_dependencies.py | 2 +- .../codice_hi_mass_correction_lookup_table.py | 2 +- ...odice_lo_l3a_direct_events_dependencies.py | 6 +- ...ce_lo_l3b_3d_distributions_dependencies.py | 2 +- .../codice/l3/lo/codice_lo_processor.py | 24 +-- .../science/efficiency_lookup.py | 2 +- .../science/geometric_factor_lookup.py | 4 +- .../science/mass_species_bin_lookup.py | 3 +- imap_l3_processing/codice/l3/lo/models.py | 2 +- .../l3/lo/science/codice_lo_calculations.py | 12 +- imap_l3_processing/codice/quality_flags.py | 2 +- imap_l3_processing/glows/glows_processor.py | 29 ++-- .../glows/l3a/glows_l3a_dependencies.py | 4 +- .../glows/l3a/glows_toolkit/direct_event.py | 1 + .../glows/l3a/glows_toolkit/funcs.py | 4 +- .../glows_toolkit/l1a_data_direct_events.py | 13 +- .../l3a/glows_toolkit/l1a_data_histogram.py | 6 +- .../glows_toolkit/l1b_data_direct_events.py | 8 +- .../l3a/glows_toolkit/l1b_data_histogram.py | 18 +- .../l3a/glows_toolkit/l2_data_histogram.py | 16 +- .../glows/l3a/glows_toolkit/l3a_data.py | 2 +- .../glows/l3a/glows_toolkit/reader.py | 8 +- .../science/bad_angle_flag_configuration.py | 3 +- ...ime_independent_background_lookup_table.py | 9 +- imap_l3_processing/glows/l3a/utils.py | 6 +- .../glows/l3bc/glows_l3bc_initializer.py | 13 +- .../glows/l3bc/l3bc_toolkit/funcs.py | 16 +- .../l3bc/l3bc_toolkit/l3b_DailyIonRate.py | 2 +- .../l3bc_toolkit/l3c_CarringtonSolarWind.py | 11 +- imap_l3_processing/glows/l3bc/models.py | 5 +- imap_l3_processing/glows/l3bc/utils.py | 5 +- .../glows/l3d/glows_l3d_dependencies.py | 12 +- .../glows/l3d/glows_l3d_initializer.py | 19 +-- .../glows/l3d/science/generate_l3d.py | 1 - .../glows/l3d/science/toolkit/funcs.py | 16 +- .../science/toolkit/l3d_SolarParamHistory.py | 10 +- imap_l3_processing/glows/l3d/utils.py | 5 +- .../glows/l3e/glows_l3e_dependencies.py | 2 +- .../glows/l3e/glows_l3e_initializer.py | 19 +-- .../glows/l3e/glows_l3e_utils.py | 17 +- imap_l3_processing/glows/quality_flags.py | 1 - .../hi/hi_combined_initializer.py | 6 +- imap_l3_processing/hi/hi_processor.py | 23 ++- imap_l3_processing/hi/hi_sp_initializer.py | 2 +- imap_l3_processing/hi/utils.py | 11 +- imap_l3_processing/hit/l3/hit_processor.py | 8 +- imap_l3_processing/hit/l3/models.py | 3 +- .../hit/l3/pha/pha_event_reader.py | 8 +- .../hit/l3/pha/science/calculate_pha.py | 19 +-- .../hit/l3/sectored_products/models.py | 14 +- imap_l3_processing/hit/l3/utils.py | 3 +- imap_l3_processing/hit/quality_flags.py | 2 +- .../lo/l3/lo_l3_spectral_fit_dependencies.py | 1 + imap_l3_processing/lo/lo_processor.py | 14 +- .../lo/lo_txt_to_cdf_converter_spike.py | 16 +- .../maps/hilo_l3_survival_dependencies.py | 6 +- imap_l3_processing/maps/map_combination.py | 2 +- imap_l3_processing/maps/map_descriptors.py | 5 +- imap_l3_processing/maps/map_initializer.py | 2 +- imap_l3_processing/maps/map_models.py | 26 +-- imap_l3_processing/maps/mpfit.py | 3 +- imap_l3_processing/maps/quality_flags.py | 2 +- .../maps/rectangular_survival_probability.py | 4 +- imap_l3_processing/maps/sp_map_initializer.py | 6 +- imap_l3_processing/maps/spectral_fit.py | 2 +- .../maps/survival_probability_processing.py | 14 +- imap_l3_processing/models.py | 12 +- .../predicted_ephemeris_tracker.py | 5 +- imap_l3_processing/swapi/l3a/chunk_fits.py | 20 +-- imap_l3_processing/swapi/l3a/models.py | 2 +- .../pickup_ion/calculate_pickup_ion_values.py | 2 +- .../pickup_ion/collapsed_response_grid.py | 6 +- .../density_of_neutral_helium_lookup_table.py | 3 +- .../vasyliunas_siscoe_distribution.py | 2 +- .../alpha/calculate_initial_guess.py | 3 +- .../alpha/fit_solar_wind_alpha_model.py | 9 +- .../l3a/science/solar_wind/forward_model.py | 14 +- .../science/solar_wind/integration_limits.py | 6 +- .../proton/calculate_initial_guess.py | 15 +- .../solar_wind/proton/escape_local_minimum.py | 1 - .../proton/fit_solar_wind_proton_model.py | 7 +- .../science/solar_wind/trim_open_aperture.py | 1 - .../swapi/l3a/swapi_l3a_dependencies.py | 17 +- imap_l3_processing/swapi/l3a/utils.py | 17 +- .../calculate_solar_wind_differential_flux.py | 2 +- .../l3b/science/calculate_solar_wind_vdf.py | 8 +- imap_l3_processing/swapi/quality_flags.py | 2 +- .../swapi/response/azimuthal_transmission.py | 1 - .../swapi/response/passband_grid.py | 4 +- .../swapi/response/swapi_response.py | 5 +- imap_l3_processing/swapi/swapi_processor.py | 14 +- .../swe/l3/science/moment_calculations.py | 36 ++-- .../swe/l3/science/pitch_calculations.py | 4 +- .../swe/l3/swe_l3_dependencies.py | 6 +- imap_l3_processing/swe/l3/utils.py | 4 +- imap_l3_processing/swe/quality_flags.py | 2 +- imap_l3_processing/swe/swe_processor.py | 36 ++-- imap_l3_processing/ultra/models.py | 4 +- .../science/ultra_survival_probability.py | 7 +- .../ultra/ultra_combined_nsp_initializer.py | 2 +- .../ultra/ultra_l3_dependencies.py | 9 +- .../ultra_l3_to_rectangular_dependencies.py | 1 + imap_l3_processing/ultra/ultra_processor.py | 21 ++- .../ultra/ultra_sp_initializer.py | 6 +- imap_l3_processing/utils.py | 29 ++-- run_local.py | 44 ++--- scripts/clean_metadata.py | 2 +- ...te_more_accurate_l3a_direct_event_input.py | 2 +- scripts/convert_hit_event_type_to_csv.py | 3 +- ...le_glows_l3e_survival_probabilities_cdf.py | 2 +- scripts/glows/download_l2_prod_data.py | 2 +- scripts/glows/download_validation_data.py | 2 +- .../create_cdf_from_instrument_team_data.py | 2 +- scripts/hi/create_hi_full_spin_deps.py | 6 +- ...tack_arrays_to_match_number_of_energies.py | 2 +- scripts/hit/create_l1a_direct-event_data.py | 2 +- scripts/hit/hit_plots.py | 2 +- scripts/run_spectral_index.py | 6 +- ...ha_sw_temperature_density_lut_generator.py | 5 +- scripts/swapi/fit_and_plot_pui.py | 19 +-- scripts/swapi/generate_reference_integrals.py | 7 +- .../generate_with_predicted_ephemeris.py | 2 +- scripts/swapi/pui_xarray_reference.py | 2 +- scripts/swapi/pui_xarray_reference_50sweep.py | 9 +- scripts/swapi/sample_wind_solar_wind.py | 2 +- ...alpha_sw_speed_temperature_density_demo.py | 16 +- scripts/swapi/view_one_pui_spectrum.py | 6 +- scripts/swe/calculate_rebin_by_pitch_angle.py | 2 +- ...ci_using_swapi_with_predicted_ephemeris.py | 2 +- scripts/swe/read_ace.py | 1 - scripts/swe/swe_l2.py | 3 +- scripts/swe/swe_l2_old.py | 3 +- scripts/time_shift_cdf.py | 8 +- scripts/ultra/create_example_ultra_l2_map.py | 2 +- ...ple_ultra_l3_survival_probabilities_cdf.py | 4 +- ...c_l2_and_glows_with_matching_date_range.py | 2 +- ...create_l2_cdf_from_instrument_team_data.py | 2 +- tests/cdf/test_cdf_utils.py | 4 +- tests/cdf/test_yaml_var_metadata.py | 2 +- ..._codice_hi_mass_correction_lookup_table.py | 1 - ...t_codice_l3a_direct_events_dependencies.py | 2 +- .../test_codice_pitch_angle_dependencies.py | 2 +- .../codice/l3/hi/test_codice_hi_processor.py | 4 +- tests/codice/l3/hi/test_models.py | 6 +- .../science/test_angle_lookups.py | 2 +- .../lo/science/test_codice_lo_calculations.py | 16 +- ...odice_lo_l3a_direct_events_dependencies.py | 10 +- ...e_lo_l3a_partial_densities_dependencies.py | 8 +- ...ce_lo_l3b_3d_distributions_dependencies.py | 10 +- .../codice/l3/lo/test_codice_lo_processor.py | 30 ++-- tests/codice/l3/lo/test_models.py | 44 ++--- .../test_calculate_daily_lightcurve.py | 4 +- .../glows/l3a/test_glows_l3a_dependencies.py | 8 +- tests/glows/l3a/test_models.py | 40 ++--- tests/glows/l3a/test_utils.py | 4 +- tests/glows/l3bc/l3bc_toolkit/test_funcs.py | 1 - .../glows/l3bc/science/test_generate_l3bc.py | 2 +- tests/glows/l3bc/test_dependency_validator.py | 5 +- .../l3bc/test_glows_l3bc_dependencies.py | 2 +- .../glows/l3bc/test_glows_l3bc_initializer.py | 2 +- tests/glows/l3bc/test_models.py | 12 +- tests/glows/l3bc/test_utils.py | 5 +- .../glows/l3d/test_glows_l3d_dependencies.py | 2 +- tests/glows/l3d/test_glows_l3d_initializer.py | 6 +- tests/glows/l3d/test_l3d_utils.py | 8 +- tests/glows/l3d/test_models.py | 18 +- .../glows/l3e/test_glows_l3e_dependencies.py | 8 +- tests/glows/l3e/test_glows_l3e_hi_model.py | 2 +- tests/glows/l3e/test_glows_l3e_initializer.py | 6 +- tests/glows/l3e/test_glows_l3e_lo_model.py | 32 ++-- tests/glows/l3e/test_glows_l3e_ultra_model.py | 32 ++-- tests/glows/l3e/test_glows_l3e_utils.py | 16 +- tests/glows/l3e/test_reprocess_info.py | 12 +- tests/glows/test_glows_processor.py | 16 +- tests/hi/test_hi_combined_dependencies.py | 2 +- tests/hi/test_hi_combined_initializer.py | 2 +- tests/hi/test_hi_processor.py | 4 +- tests/hi/test_hi_sp_initializer.py | 8 +- tests/hi/test_hi_spectral_fit_dependencies.py | 8 +- tests/hi/test_utils.py | 10 +- tests/hit/l3/hit_test_builders.py | 4 +- .../hit/l3/pha/science/test_calculate_pha.py | 8 +- .../test_cosine_correction_lookup_table.py | 4 +- .../l3/pha/science/test_gain_lookup_table.py | 2 +- .../l3/pha/science/test_range_fit_lookup.py | 4 +- tests/hit/l3/pha/test_l3_pha_dependencies.py | 24 +-- tests/hit/l3/pha/test_pha_event_reader.py | 8 +- .../test_sectored_products_algorithms.py | 2 +- tests/hit/l3/sectored_products/test_models.py | 2 +- tests/hit/l3/test_hit_processor.py | 16 +- tests/hit/l3/test_l3_sectored_dependencies.py | 6 +- tests/integration/integration_test_helpers.py | 9 +- .../test_glows_processor_integration.py | 26 +-- .../test_hit_processor_integration.py | 6 +- .../test_map_processor_integration.py | 7 +- .../test_swapi_processor_integration.py | 8 +- .../test_swe_processor_integration.py | 2 +- tests/lo/l3/test_lo_combined_dependencies.py | 4 +- ..._isn_background_subtracted_dependencies.py | 2 +- .../test_lo_l3_spectral_fit_dependencies.py | 2 +- tests/lo/l3/test_lo_sp_initializer.py | 6 +- tests/lo/test_lo_processor.py | 6 +- tests/maps/test_builders.py | 13 +- .../test_hilo_l3_survival_dependencies.py | 4 +- tests/maps/test_map_combination.py | 30 ++-- tests/maps/test_map_descriptors.py | 10 +- tests/maps/test_map_models.py | 34 ++-- .../test_rectangular_survival_probability.py | 10 +- tests/maps/test_spectral_fit.py | 6 +- .../test_survival_probability_processing.py | 8 +- ...test_convert_product_definition_to_yaml.py | 2 +- tests/swapi/_helpers.py | 4 +- .../pickup_ion/test_goodness_of_fit.py | 2 +- .../alpha/test_fit_solar_wind_alpha_model.py | 9 +- .../proton/test_calculate_initial_guess.py | 9 +- .../proton/test_escape_local_minimum.py | 2 +- .../test_fit_solar_wind_proton_model.py | 8 +- .../test_optimize_solar_wind_proton_params.py | 10 +- .../science/solar_wind/test_forward_model.py | 5 +- .../solar_wind/test_integration_limits.py | 2 +- .../solar_wind/test_trim_open_aperture.py | 11 +- .../test_uncertainty_calibration.py | 3 +- tests/swapi/l3a/test_chunk_fits.py | 34 ++-- tests/swapi/l3a/test_models.py | 78 ++++----- .../swapi/l3a/test_swapi_l3a_dependencies.py | 16 +- tests/swapi/l3a/test_utils.py | 4 +- .../science/test_calculate_solar_wind_vdf.py | 4 +- tests/swapi/l3b/test_models.py | 4 +- .../swapi/l3b/test_swapi_l3b_dependencies.py | 10 +- .../response/test_azimuthal_transmission.py | 4 +- tests/swapi/response/test_passband_grid.py | 2 +- tests/swapi/response/test_swapi_response.py | 2 +- tests/swapi/test_swapi_processor.py | 16 +- tests/swe/l3/science/test_models.py | 154 +++++++++--------- .../l3/science/test_moments_calculation.py | 33 ++-- .../swe/l3/science/test_pitch_calculations.py | 13 +- tests/swe/l3/test_swe_l3_dependencies.py | 4 +- tests/swe/l3/test_utils.py | 8 +- tests/swe/test_swe_processor.py | 24 +-- .../3S5_l1b_ram_maps/archive/map_SCFrame.py | 11 +- .../3S5_l1b_ram_maps/crap/new_patch_arc2.py | 10 +- .../3S5_l1b_ram_maps/csv2yaml.py | 1 - .../3S5_l1b_ram_maps/csv_to_soc.py | 9 +- .../3S5_l1b_ram_maps/l1b_to_spin.py | 14 +- .../3S5_l1b_ram_maps/map_SCFrame.py | 11 +- .../3S5_l1b_ram_maps/new_patch_arc2.py | 10 +- .../3S5_l1b_ram_maps/new_patch_arc2_linear.py | 8 +- .../3S5_l1b_ram_maps/old/csv2yaml.py | 1 - .../3S5_l1b_ram_maps/plot_map_DN.py | 6 +- tests/test_data_utils.py | 2 +- tests/test_helpers.py | 27 +-- tests/test_imap_l3_data_processor.py | 6 +- tests/test_pitch_angles.py | 4 +- tests/test_processor.py | 2 +- tests/test_utils.py | 28 ++-- tests/ultra/test_models.py | 8 +- .../test_ultra_combined_nsp_initializer.py | 2 +- tests/ultra/test_ultra_l3_dependencies.py | 6 +- .../test_ultra_l3_survival_probabillity.py | 6 +- ...st_ultra_l3_to_rectangular_dependencies.py | 4 +- tests/ultra/test_ultra_processor.py | 14 +- tests/ultra/test_ultra_sp_initializer.py | 6 +- 278 files changed, 1276 insertions(+), 1330 deletions(-) diff --git a/docs/swapi/figure_src/figure_utils.py b/docs/swapi/figure_src/figure_utils.py index 9e92b4dd..84623c6c 100644 --- a/docs/swapi/figure_src/figure_utils.py +++ b/docs/swapi/figure_src/figure_utils.py @@ -4,15 +4,15 @@ import os import sys import time +from collections.abc import Callable from pathlib import Path -from typing import Callable, TypeVar +from typing import TypeVar import numpy as np REPO_ROOT = Path(__file__).resolve().parents[3] sys.path.insert(0, str(REPO_ROOT)) -# ruff: disable[E402] from imap_l3_processing.constants import ( METERS_PER_KILOMETER, PROTON_CHARGE_COULOMBS, @@ -20,7 +20,6 @@ ) from imap_l3_processing.swapi.constants import SWAPI_K_FACTOR from imap_l3_processing.swapi.response.swapi_response import SwapiResponse -# ruff: enable[E402] FIGURES_DIR = REPO_ROOT / "docs" / "swapi" / "figures" diff --git a/docs/swapi/figure_src/plot_alpha_peak_finding.py b/docs/swapi/figure_src/plot_alpha_peak_finding.py index a4e9466c..6cf26ef1 100644 --- a/docs/swapi/figure_src/plot_alpha_peak_finding.py +++ b/docs/swapi/figure_src/plot_alpha_peak_finding.py @@ -34,6 +34,8 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[3])) +from figure_utils import FIGURES_DIR, load_swapi_response + from imap_l3_processing.constants import ( ALPHA_MASS_PER_CHARGE_M_P_PER_E, ALPHA_PARTICLE_MASS_KG, @@ -70,7 +72,6 @@ ) from imap_l3_processing.swapi.response.deadtime import deadtime_factor from imap_l3_processing.utils import SpiceKernelTypes -from figure_utils import FIGURES_DIR, load_swapi_response DATE_YYYYMMDD = "20260101" N_SWEEPS = 5 diff --git a/docs/swapi/figure_src/plot_calibration_curves.py b/docs/swapi/figure_src/plot_calibration_curves.py index ba062887..e96022be 100644 --- a/docs/swapi/figure_src/plot_calibration_curves.py +++ b/docs/swapi/figure_src/plot_calibration_curves.py @@ -17,9 +17,9 @@ import matplotlib.pyplot as plt import numpy as np import pandas as pd +from figure_utils import FIGURES_DIR, load_swapi_response from imap_l3_processing.swapi.response.swapi_response import SwapiResponse -from figure_utils import FIGURES_DIR, load_swapi_response _AREA_CSV = ( Path(__file__).resolve().parents[3] diff --git a/docs/swapi/figure_src/plot_collapsed_response_grid.py b/docs/swapi/figure_src/plot_collapsed_response_grid.py index 21f9a6b1..7211d9a5 100644 --- a/docs/swapi/figure_src/plot_collapsed_response_grid.py +++ b/docs/swapi/figure_src/plot_collapsed_response_grid.py @@ -23,13 +23,13 @@ import matplotlib.pyplot as plt import numpy as np import pandas as pd +from figure_utils import FIGURES_DIR, REPO_ROOT, load_swapi_response +from imap_l3_processing.constants import HE_PUI_PARTICLE_MASS_PER_CHARGE_M_P_PER_E from imap_l3_processing.swapi.l3a.science.pickup_ion.collapsed_response_grid import ( build_collapsed_response_grid, solar_wind_frame_speed_range, ) -from figure_utils import FIGURES_DIR, REPO_ROOT, load_swapi_response -from imap_l3_processing.constants import HE_PUI_PARTICLE_MASS_PER_CHARGE_M_P_PER_E _REFERENCE_CSV_PATH = ( REPO_ROOT diff --git a/docs/swapi/figure_src/plot_fit_accuracy.py b/docs/swapi/figure_src/plot_fit_accuracy.py index 040aa57f..5ec33786 100644 --- a/docs/swapi/figure_src/plot_fit_accuracy.py +++ b/docs/swapi/figure_src/plot_fit_accuracy.py @@ -29,19 +29,13 @@ import types +import matplotlib import numpy as np import pandas as pd from uncertainties import UFloat -import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt - -from imap_l3_processing.constants import ( - PROTON_MASS_KG, - PROTON_MASS_PER_CHARGE_M_P_PER_E, -) -from imap_l3_processing.swapi.constants import SWAPI_LIVETIME_S from figure_utils import ( COARSE_BIN_INDICES_IN_SWEEP, COARSE_SWEEP_VOLTAGES_MEAN_V, @@ -50,20 +44,26 @@ load_swapi_response, run_parallel_map, ) -from imap_l3_processing.swapi.l3a.science.solar_wind.proton.fit_solar_wind_proton_model import ( - fit_solar_wind_proton_model, + +from imap_l3_processing.constants import ( + PROTON_MASS_KG, + PROTON_MASS_PER_CHARGE_M_P_PER_E, ) -from imap_l3_processing.swapi.l3a.science.solar_wind.proton.calculate_initial_guess import ( - calculate_initial_guess, +from imap_l3_processing.swapi.constants import SWAPI_LIVETIME_S +from imap_l3_processing.swapi.l3a.science.solar_wind.fit_context import ( + build_solar_wind_fit_context, ) from imap_l3_processing.swapi.l3a.science.solar_wind.forward_model import ( model_solar_wind_ideal_coincidence_rates, ) -from imap_l3_processing.swapi.response.deadtime import deadtime_factor -from imap_l3_processing.swapi.l3a.science.solar_wind.fit_context import ( - build_solar_wind_fit_context, -) from imap_l3_processing.swapi.l3a.science.solar_wind.params import SolarWindParams +from imap_l3_processing.swapi.l3a.science.solar_wind.proton.calculate_initial_guess import ( + calculate_initial_guess, +) +from imap_l3_processing.swapi.l3a.science.solar_wind.proton.fit_solar_wind_proton_model import ( + fit_solar_wind_proton_model, +) +from imap_l3_processing.swapi.response.deadtime import deadtime_factor _N_SWEEPS = 5 _N_BINS = len(COARSE_SWEEP_VOLTAGES_MEAN_V) @@ -188,10 +188,11 @@ def _process_one(i): result = fit_solar_wind_proton_model(fit_ctx) except Exception as e: print(f" case {i}: fit failed ({type(e).__name__}: {e}); flagging bad") + from uncertainties import ufloat + from imap_l3_processing.swapi.l3a.science.solar_wind.proton.fit_solar_wind_proton_model import ( ProtonSolarWindFitResult, ) - from uncertainties import ufloat nan_uf = ufloat(float("nan"), float("nan")) result = ProtonSolarWindFitResult( diff --git a/docs/swapi/figure_src/plot_passband_boundaries.py b/docs/swapi/figure_src/plot_passband_boundaries.py index 57abb5c8..5187f9b2 100644 --- a/docs/swapi/figure_src/plot_passband_boundaries.py +++ b/docs/swapi/figure_src/plot_passband_boundaries.py @@ -8,10 +8,10 @@ matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np +from figure_utils import FIGURES_DIR, load_swapi_response from imap_l3_processing.swapi.response.passband_grid import PassbandGrid from imap_l3_processing.swapi.response.swapi_response import SwapiResponse -from figure_utils import FIGURES_DIR, load_swapi_response _ELEVATION_DISPLAY_LIMIT_DEG = 15.0 _ACTIVE_ELEVATION_SAMPLE_COUNT = 300 diff --git a/docs/swapi/figure_src/plot_pui_cutoff_staircase.py b/docs/swapi/figure_src/plot_pui_cutoff_staircase.py index 7187749a..a075e092 100644 --- a/docs/swapi/figure_src/plot_pui_cutoff_staircase.py +++ b/docs/swapi/figure_src/plot_pui_cutoff_staircase.py @@ -28,14 +28,12 @@ REPO_ROOT = Path(__file__).resolve().parents[3] sys.path.insert(0, str(REPO_ROOT)) -# ruff: disable[E402] import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import pandas as pd - from figure_utils import FIGURES_DIR, load_swapi_response from imap_l3_processing.constants import ( @@ -60,7 +58,6 @@ from imap_l3_processing.swapi.l3a.utils import ( velocity_components_to_angles_in_instrument_frame, ) -# ruff: enable[E402] _SW_SPEED_KMS = 450.0 _SW_AZIMUTH_DEG = 0.0 diff --git a/docs/swapi/figure_src/plot_pui_distribution.py b/docs/swapi/figure_src/plot_pui_distribution.py index 5e1b3767..f8fc254c 100644 --- a/docs/swapi/figure_src/plot_pui_distribution.py +++ b/docs/swapi/figure_src/plot_pui_distribution.py @@ -22,13 +22,11 @@ REPO_ROOT = Path(__file__).resolve().parents[3] sys.path.insert(0, str(REPO_ROOT)) -# ruff: disable[E402] import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np - from figure_utils import FIGURES_DIR from imap_l3_processing.constants import ONE_AU_IN_KM @@ -39,7 +37,6 @@ FittingParameters, VasyliunasSiscoeDistribution, ) -# ruff: enable[E402] _CUTOFF_SPEED_KMS = 450.0 _SW_SPEED_INERTIAL_KMS = 450.0 diff --git a/docs/swapi/figure_src/plot_pui_reference_comparison.py b/docs/swapi/figure_src/plot_pui_reference_comparison.py index 900b2b97..e39a32b2 100644 --- a/docs/swapi/figure_src/plot_pui_reference_comparison.py +++ b/docs/swapi/figure_src/plot_pui_reference_comparison.py @@ -21,17 +21,15 @@ REPO_ROOT = Path(__file__).resolve().parents[3] sys.path.insert(0, str(REPO_ROOT)) -# ruff: disable[E402] import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np import pandas as pd - from figure_utils import FIGURES_DIR + from imap_l3_processing.constants import HE_PUI_PARTICLE_MASS_PER_CHARGE_M_P_PER_E -# ruff: enable[E402] _REFERENCE_CSV_PATH = ( REPO_ROOT / "tests" / "test_data" / "swapi" / "pui_count_rate_reference.csv" @@ -61,6 +59,8 @@ def compute_production_rates(voltages_v: np.ndarray) -> np.ndarray: """Build the chunk-level collapsed response and call the in-development production kernel. Imports live inside the function so a broken module doesn't break the figure script at import time.""" + from figure_utils import load_swapi_response + from imap_l3_processing.constants import ONE_AU_IN_KM from imap_l3_processing.swapi.l3a.science.pickup_ion.calculate_coincidence_rate import ( calculate_coincidence_rate, @@ -75,7 +75,6 @@ def compute_production_rates(voltages_v: np.ndarray) -> np.ndarray: FittingParameters, VasyliunasSiscoeDistribution, ) - from figure_utils import load_swapi_response fitting_params = FittingParameters( cooling_index=_COOLING_INDEX, diff --git a/docs/swapi/figure_src/plot_real_data_fit.py b/docs/swapi/figure_src/plot_real_data_fit.py index af29fe15..7024ce7e 100644 --- a/docs/swapi/figure_src/plot_real_data_fit.py +++ b/docs/swapi/figure_src/plot_real_data_fit.py @@ -37,40 +37,40 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[3])) +import scipy.optimize +from figure_utils import FIGURES_DIR, REPO_ROOT, load_swapi_response + from imap_l3_processing.constants import ( BOLTZMANN_CONSTANT_JOULES_PER_KELVIN, ONE_SECOND_IN_NANOSECONDS, PROTON_MASS_KG, PROTON_MASS_PER_CHARGE_M_P_PER_E, ) -import scipy.optimize - +from imap_l3_processing.swapi.constants import ( + SWAPI_BIN_PERIOD_S, + SWAPI_COARSE_SWEEP_BINS, + SWAPI_FINE_SWEEP_BINS, + SWAPI_K_FACTOR, + SWAPI_L2_K_FACTOR, + SWAPI_LIVETIME_CENTER_OFFSET_S, + SWAPI_SCIENCE_BINS, +) from imap_l3_processing.swapi.l3a.science.solar_wind.fit_context import ( build_solar_wind_fit_context, ) from imap_l3_processing.swapi.l3a.science.solar_wind.forward_model import ( model_solar_wind_ideal_coincidence_rates, ) +from imap_l3_processing.swapi.l3a.science.solar_wind.params import SolarWindParams from imap_l3_processing.swapi.l3a.science.solar_wind.proton.fit_solar_wind_proton_model import ( fit_solar_wind_proton_model, ) -from imap_l3_processing.swapi.l3a.science.solar_wind.params import SolarWindParams from imap_l3_processing.swapi.l3a.utils import ( get_spacecraft_velocity_rtn, get_swapi_geometry, ) from imap_l3_processing.swapi.response.deadtime import deadtime_factor -from imap_l3_processing.swapi.constants import ( - SWAPI_BIN_PERIOD_S, - SWAPI_COARSE_SWEEP_BINS, - SWAPI_FINE_SWEEP_BINS, - SWAPI_K_FACTOR, - SWAPI_L2_K_FACTOR, - SWAPI_LIVETIME_CENTER_OFFSET_S, - SWAPI_SCIENCE_BINS, -) from imap_l3_processing.utils import SpiceKernelTypes -from figure_utils import FIGURES_DIR, REPO_ROOT, load_swapi_response _DOC_PATH = REPO_ROOT / "docs" / "swapi" / "proton-sw.md" _TABLE_BEGIN = "