From acd8e256e87f039e590e930a8955568f9222ebe1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 18:03:17 +0000 Subject: [PATCH 1/6] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/codespell-project/codespell: v2.4.2 → v2.4.3](https://github.com/codespell-project/codespell/compare/v2.4.2...v2.4.3) - [github.com/astral-sh/ruff-pre-commit: v0.15.20 → v0.16.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.20...v0.16.1) - [github.com/tox-dev/pyproject-fmt: v2.25.1 → v2.26.0](https://github.com/tox-dev/pyproject-fmt/compare/v2.25.1...v2.26.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 27fbf9a8f..7a4777f04 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -82,7 +82,7 @@ repos: - id: text-unicode-replacement-char - repo: https://github.com/codespell-project/codespell - rev: v2.4.2 + rev: v2.4.3 hooks: - id: codespell name: codespell (add false positives to pyproject.toml) @@ -100,7 +100,7 @@ repos: name: typos (add false positives to _typos.toml) - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.20 + rev: v0.16.1 hooks: - id: ruff-check name: ruff-check (see https://docs.astral.sh/ruff/rules) @@ -144,6 +144,6 @@ repos: - mdformat-ruff - repo: https://github.com/tox-dev/pyproject-fmt - rev: v2.25.1 + rev: v2.26.0 hooks: - id: pyproject-fmt From 5aaa6ae59de9a63a8b078df54673a003416ffd70 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 18:04:26 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xrtpy/__init__.py | 2 +- xrtpy/response/__init__.py | 10 +++++----- xrtpy/response/channel.py | 8 ++++---- xrtpy/util/__init__.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/xrtpy/__init__.py b/xrtpy/__init__.py index ba3646bec..5391886b0 100644 --- a/xrtpy/__init__.py +++ b/xrtpy/__init__.py @@ -14,4 +14,4 @@ __version__ = "0.0.0" # Then you can be explicit to control what ends up in the namespace, -__all__ = ["response", "__version__"] +__all__ = ["__version__", "response"] diff --git a/xrtpy/response/__init__.py b/xrtpy/response/__init__.py index 09c577109..d95a58ee7 100644 --- a/xrtpy/response/__init__.py +++ b/xrtpy/response/__init__.py @@ -16,15 +16,15 @@ from . import tools __all__ = [ - "Geometry", - "EntranceFilter", - "Mirror", - "Filter", "CCD", "Channel", - "resolve_filter_name", "EffectiveAreaFundamental", + "EntranceFilter", + "Filter", + "Geometry", + "Mirror", "TemperatureResponseFundamental", + "resolve_filter_name", "temperature_from_filter_ratio", "tools", ] diff --git a/xrtpy/response/channel.py b/xrtpy/response/channel.py index c8f13fafd..c079df200 100644 --- a/xrtpy/response/channel.py +++ b/xrtpy/response/channel.py @@ -8,12 +8,12 @@ from astropy import units as u __all__ = [ - "Geometry", - "EntranceFilter", - "Mirror", - "Filter", "CCD", "Channel", + "EntranceFilter", + "Filter", + "Geometry", + "Mirror", "resolve_filter_name", ] diff --git a/xrtpy/util/__init__.py b/xrtpy/util/__init__.py index ccec6ca65..8a46c9469 100644 --- a/xrtpy/util/__init__.py +++ b/xrtpy/util/__init__.py @@ -5,10 +5,10 @@ from .filters import solve_filter_name, validate_and_format_filters __all__ = [ + "SSW_MIRRORS", "epoch", "filename2repo_path", "make_exposure_map", - "SSW_MIRRORS", "solve_filter_name", "validate_and_format_filters", ] From aff388f9e2adb8e7222c017637393e884d243285 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 4 Aug 2026 16:08:00 -0400 Subject: [PATCH 3/6] pre-commit autoupdate again --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a4777f04..d640d712f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -94,7 +94,7 @@ repos: - repo: https://github.com/adhtruong/mirrors-typos # use mirrors-typos because `pre-commit autoupdate` drops the version # of the primary typos repo from v1.x.y to v1 - rev: v1.48.0 + rev: v1.49.0 hooks: - id: typos name: typos (add false positives to _typos.toml) @@ -144,6 +144,6 @@ repos: - mdformat-ruff - repo: https://github.com/tox-dev/pyproject-fmt - rev: v2.26.0 + rev: v2.27.0 hooks: - id: pyproject-fmt From 1dfaad6c608e2a767e4c5d4ccee72eca41650270 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 4 Aug 2026 16:11:12 -0400 Subject: [PATCH 4/6] ruff check --add-noqa --- xrtpy/image_correction/deconvolve.py | 2 +- xrtpy/response/effective_area.py | 4 +-- .../response/temperature_from_filter_ratio.py | 2 +- xrtpy/response/tests/test_effective_area.py | 36 +++++++++---------- xrtpy/util/filename2repo_path.py | 2 +- xrtpy/util/make_exposure_map.py | 20 +++++------ 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/xrtpy/image_correction/deconvolve.py b/xrtpy/image_correction/deconvolve.py index 616a0cec1..6052ed52e 100644 --- a/xrtpy/image_correction/deconvolve.py +++ b/xrtpy/image_correction/deconvolve.py @@ -115,7 +115,7 @@ def deconvolve(image_map, niter=5, verbose=False, psf1keV=False): tmp_deconv = tmp_deconv[xcen - ddx : xcen + ddx, ycen - ddy : ycen + ddy] deconv_data = np.minimum(tmp_deconv, 2500.0) - date = datetime.now().ctime() + date = datetime.now().ctime() # noqa: DTZ005 added_hist = f"{__name__}: ({date}) " + deconvolve_hist deconv_meta = image_meta deconv_meta["history"] = image_meta["history"] + added_hist diff --git a/xrtpy/response/effective_area.py b/xrtpy/response/effective_area.py index 30908a694..92c9fb580 100644 --- a/xrtpy/response/effective_area.py +++ b/xrtpy/response/effective_area.py @@ -207,7 +207,7 @@ def observation_date(self, date): -1 ].datetime.strftime("%Y/%m/%d") - modified_time_datetime = datetime.datetime.fromtimestamp( + modified_time_datetime = datetime.datetime.fromtimestamp( # noqa: DTZ006 modified_time_path ).strftime("%Y/%m/%d") @@ -500,7 +500,7 @@ def _transmission_equation(self): def _angular_wavenumber_CCD(self): """Define angular wavenumber on CCD.""" - index, _, cos_a, wavelength_max, _, _, _ = self._transmission_equation + index, _, cos_a, wavelength_max, _, _, _ = self._transmission_equation # noqa: RUF059 # Define wavevector angular_wavenumber = np.array( diff --git a/xrtpy/response/temperature_from_filter_ratio.py b/xrtpy/response/temperature_from_filter_ratio.py index 35f6711ed..132d4d5b0 100644 --- a/xrtpy/response/temperature_from_filter_ratio.py +++ b/xrtpy/response/temperature_from_filter_ratio.py @@ -754,7 +754,7 @@ def make_results_maps(hdr1, hdr2, T_e, EM, T_error, EMerror, extra_metadata): new_hdr["L1_file2"] = filename2 extra_values, extra_comments = split_values_comments(extra_metadata) new_hdr.update(extra_values) - create_date = datetime.now().ctime() + create_date = datetime.now().ctime() # noqa: DTZ005 new_hdr["history"] = f"Created by temperature_from_filter_ratio {create_date}\n" Thdr = new_hdr.copy() Thdr["BUNIT"] = "log10(K)" diff --git a/xrtpy/response/tests/test_effective_area.py b/xrtpy/response/tests/test_effective_area.py index 78941d828..1412e9b5d 100644 --- a/xrtpy/response/tests/test_effective_area.py +++ b/xrtpy/response/tests/test_effective_area.py @@ -38,31 +38,31 @@ ] valid_dates = [ - datetime(year=2006, month=9, day=25, hour=22, minute=1, second=1), - datetime(year=2007, month=9, day=22, hour=22, minute=1, second=1), - datetime(year=2009, month=9, day=22, hour=22, minute=1, second=1), - datetime(year=2010, month=9, day=22, hour=22, minute=1, second=1), - datetime(year=2012, month=9, day=22, hour=22, minute=1, second=1), - datetime(year=2015, month=9, day=22, hour=22, minute=1, second=1), - datetime(year=2017, month=9, day=22, hour=22, minute=1, second=1), - datetime(year=2019, month=9, day=23, hour=22, minute=1, second=1), - datetime(year=2020, month=9, day=23, hour=22, minute=1, second=1), - datetime(year=2021, month=9, day=23, hour=22, minute=1, second=1), - datetime(year=2022, month=9, day=23, hour=22, minute=1, second=1), + datetime(year=2006, month=9, day=25, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2007, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2009, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2010, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2012, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2015, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2017, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2019, month=9, day=23, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2020, month=9, day=23, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2021, month=9, day=23, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2022, month=9, day=23, hour=22, minute=1, second=1), # noqa: DTZ001 ] invalid_dates = [ - datetime(year=2006, month=8, day=25, hour=22, minute=1, second=1), - datetime(year=2005, month=9, day=22, hour=22, minute=1, second=1), - datetime(year=2002, month=9, day=22, hour=22, minute=1, second=1), - datetime(year=2000, month=9, day=22, hour=22, minute=1, second=1), - datetime(year=1990, month=9, day=22, hour=22, minute=1, second=1), + datetime(year=2006, month=8, day=25, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2005, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2002, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=2000, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 + datetime(year=1990, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 ] def test_ccd_contam_data_loads(): eff = EffectiveAreaFundamental( - "Al-poly", datetime(year=2013, month=9, day=22, hour=22, minute=1, second=1) + "Al-poly", datetime(year=2013, month=9, day=22, hour=22, minute=1, second=1) # noqa: DTZ001 ) data = eff.ccd_contam_data assert isinstance(data, dict) @@ -79,7 +79,7 @@ def test_channel_name(channel_name): @pytest.mark.parametrize("name", channel_names) def test_EffectiveArea_filter_name(name): instance = EffectiveAreaFundamental( - name, datetime(year=2013, month=9, day=22, hour=22, minute=0, second=0) + name, datetime(year=2013, month=9, day=22, hour=22, minute=0, second=0) # noqa: DTZ001 ) assert instance.name == name diff --git a/xrtpy/util/filename2repo_path.py b/xrtpy/util/filename2repo_path.py index 55b615808..6c25bea27 100644 --- a/xrtpy/util/filename2repo_path.py +++ b/xrtpy/util/filename2repo_path.py @@ -67,7 +67,7 @@ def filename2repo_path( mo = date[4:6] dy = date[6:] hr = "H" + time[0:2] + "00" - logging.info(f"yr, mo, dy, hr = {yr}, {mo}, {dy}, {hr}") + logging.info(f"yr, mo, dy, hr = {yr}, {mo}, {dy}, {hr}") # noqa: LOG015 if filename.name[:6] == "L1_XRT": if filename.name[-9:] == "qual.fits": path = root / "data_products" / "Level1_Qual" / yr / mo / dy / hr diff --git a/xrtpy/util/make_exposure_map.py b/xrtpy/util/make_exposure_map.py index a2bc07a5c..571977bed 100644 --- a/xrtpy/util/make_exposure_map.py +++ b/xrtpy/util/make_exposure_map.py @@ -58,28 +58,28 @@ def make_exposure_map(comp_image_file, qualfiles=None, retsatpix=False, verbose= logging.basicConfig(format="%(funcName)s: %(message)s", level=logging.INFO) comp_header = fits.getheader(comp_image_file) short_exp_filepath = Path(comp_header["SRTFNAME"]) - logging.info(f"short exp. file: {short_exp_filepath}") + logging.info(f"short exp. file: {short_exp_filepath}") # noqa: LOG015 short_exp_urlpath = filename2repo_path(short_exp_filepath, join=True) - logging.info(f"short exp. url: {short_exp_urlpath}") + logging.info(f"short exp. url: {short_exp_urlpath}") # noqa: LOG015 short_exp_filepath = download_file(short_exp_urlpath) if "MEDFNAME" in comp_header: triple = True - logging.info("Composite image is a triple") + logging.info("Composite image is a triple") # noqa: LOG015 if qualfiles is None: medium_exp_filename = Path(comp_header["MEDFNAME"]) medium_exp_qualpath = Path( medium_exp_filename.stem + ".qual" + medium_exp_filename.suffix ) medium_exp_urlpath = filename2repo_path(medium_exp_qualpath, join=True) - logging.info(f"medium exp. url: {medium_exp_urlpath}") + logging.info(f"medium exp. url: {medium_exp_urlpath}") # noqa: LOG015 medium_exp_qualpath = download_file(medium_exp_urlpath, allow_insecure=True) else: medium_exp_qualpath = Path(qualfiles[0]) else: medium_exp_filename = None triple = False - logging.info("Composite image is a double") + logging.info("Composite image is a double") # noqa: LOG015 if qualfiles is None: long_exp_filename = Path(comp_header["LNGFNAME"]) @@ -98,7 +98,7 @@ def make_exposure_map(comp_image_file, qualfiles=None, retsatpix=False, verbose= naxis2 = comp_header["NAXIS2"] srt_exp = fits.getval(short_exp_filepath, "EXPTIME") - logging.info(f"Short image exposure time = {srt_exp}") + logging.info(f"Short image exposure time = {srt_exp}") # noqa: LOG015 lng_hdu = fits.open(long_exp_qualpath) lng_exp = lng_hdu[0].header["EXPTIME"] lng_gmap = lng_hdu[0].data @@ -106,7 +106,7 @@ def make_exposure_map(comp_image_file, qualfiles=None, retsatpix=False, verbose= # do bit arithmetic to get saturated pixels lng_sat = (lng_gmap & 1).astype(bool) - logging.info(f"No. of saturated pixels in long exposure = {np.sum(lng_sat)}") + logging.info(f"No. of saturated pixels in long exposure = {np.sum(lng_sat)}") # noqa: LOG015 exp_map = np.ones((naxis1, naxis2)) * lng_exp exp_map[lng_sat] = srt_exp @@ -117,9 +117,9 @@ def make_exposure_map(comp_image_file, qualfiles=None, retsatpix=False, verbose= med_hdu.close() med_sat = (med_gmap & 1).astype(bool) exp_map[~med_sat & lng_sat] = med_exp - logging.info(f"No. of saturated pixels in medium exposure = {np.sum(med_sat)}") - logging.info(f"Medium image exposure time = {med_exp}") - logging.info(f"Long image exposure time = {lng_exp}") + logging.info(f"No. of saturated pixels in medium exposure = {np.sum(med_sat)}") # noqa: LOG015 + logging.info(f"Medium image exposure time = {med_exp}") # noqa: LOG015 + logging.info(f"Long image exposure time = {lng_exp}") # noqa: LOG015 if retsatpix: if triple: From 178576bb3ac383cfcd334eddfede2e2e5aa5b255 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 4 Aug 2026 16:14:26 -0400 Subject: [PATCH 5/6] pre-commit --- xrtpy/response/tests/test_effective_area.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xrtpy/response/tests/test_effective_area.py b/xrtpy/response/tests/test_effective_area.py index 1412e9b5d..16ed757c6 100644 --- a/xrtpy/response/tests/test_effective_area.py +++ b/xrtpy/response/tests/test_effective_area.py @@ -62,7 +62,8 @@ def test_ccd_contam_data_loads(): eff = EffectiveAreaFundamental( - "Al-poly", datetime(year=2013, month=9, day=22, hour=22, minute=1, second=1) # noqa: DTZ001 + "Al-poly", + datetime(year=2013, month=9, day=22, hour=22, minute=1, second=1), # noqa: DTZ001 ) data = eff.ccd_contam_data assert isinstance(data, dict) @@ -79,7 +80,8 @@ def test_channel_name(channel_name): @pytest.mark.parametrize("name", channel_names) def test_EffectiveArea_filter_name(name): instance = EffectiveAreaFundamental( - name, datetime(year=2013, month=9, day=22, hour=22, minute=0, second=0) # noqa: DTZ001 + name, + datetime(year=2013, month=9, day=22, hour=22, minute=0, second=0), # noqa: DTZ001 ) assert instance.name == name From 87ab6d0cbdff3198c12a7b168cec891bee2cfe68 Mon Sep 17 00:00:00 2001 From: Nick Murphy Date: Tue, 4 Aug 2026 16:16:30 -0400 Subject: [PATCH 6/6] Reduce frequency of pre-commit autoupdates --- .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 d640d712f..a3d920a69 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ ci: autofix_prs: false - autoupdate_schedule: monthly + autoupdate_schedule: quarterly repos: