diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ac04d6b..f23a96f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.15.20" + rev: "v0.16.1" hooks: - id: ruff-format - id: ruff-check diff --git a/docs/conf.py b/docs/conf.py index f1b0b84..0a420f6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -143,7 +143,7 @@ "name": "Radionets Project", "url": "https://github.com/radionets-project", "type": "url", - "icon": "https://avatars.githubusercontent.com/u/77392854?s=200&v=4", # noqa: E501 + "icon": "https://avatars.githubusercontent.com/u/77392854?s=200&v=4", }, ], "logo": { diff --git a/src/radiotools/fiducial/fiducial.py b/src/radiotools/fiducial/fiducial.py index 094e315..e61e760 100644 --- a/src/radiotools/fiducial/fiducial.py +++ b/src/radiotools/fiducial/fiducial.py @@ -1,11 +1,11 @@ import warnings from pathlib import Path -import astropy.units as units import matplotlib import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np +from astropy import units from astropy.constants import c from astropy.io import fits from astropy.io.fits import PrimaryHDU diff --git a/src/radiotools/info.py b/src/radiotools/info.py index cfc7781..7df906a 100644 --- a/src/radiotools/info.py +++ b/src/radiotools/info.py @@ -55,7 +55,7 @@ def _info_version(): print("\n*** radiotools version info ***\n") print(f"version: {radiotools.__version__}") - print("") + print() def _info_dependencies(): @@ -68,7 +68,7 @@ def _info_dependencies(): for dep in deps: req = Requirement(dep) - print(f"{req.name:>20} -- {str(req.specifier)}") + print(f"{req.name:>20} -- {req.specifier!s}") def _info_tools(): @@ -77,7 +77,7 @@ def _info_tools(): # https://github.com/cta-observatory/ctapipe/blob/main/src/ctapipe/tools/info.py print("\n*** radiotools cli-tools ***\n") print("The following can be executed by typing radiotools-:") - print("") + print() tools = { ep.name: ep.value for ep in distribution("radiotools").entry_points @@ -103,8 +103,8 @@ def _info_tools(): for name, descr in sorted(description.items()): text = f"{name:<30s} -- {descr}" print(wrapper.fill(text)) - print("") - print("") + print() + print() if __name__ == "__main__": diff --git a/src/radiotools/layouts/layouts.py b/src/radiotools/layouts/layouts.py index a195970..790fb6b 100644 --- a/src/radiotools/layouts/layouts.py +++ b/src/radiotools/layouts/layouts.py @@ -431,7 +431,7 @@ def save(self, path, fmt="pyvisgen", overwrite=False, rel_to_site=None): "station_name X Y Z dish_dia el_low el_high SEFD altitude\n" ) - for i in range(0, len(self.x)): + for i in range(len(self.x)): row = map( str, [ @@ -455,7 +455,7 @@ def save(self, path, fmt="pyvisgen", overwrite=False, rel_to_site=None): data.append("# X Y Z dish_dia station_name\n") - for i in range(0, len(self.x)): + for i in range(len(self.x)): row = map( str, [ @@ -935,7 +935,7 @@ def geocentric2geodetic(x, y, z): alt = alt.value else: lon, lat, alt = np.array([]), np.array([]), np.array([]) - for i in range(0, len(x)): + for i in range(len(x)): loc = EarthLocation.from_geocentric(x[i], y[i], z[i], "m") lon = np.append(lon, loc.lon.deg) lat = np.append(lat, loc.lon.deg) @@ -967,7 +967,7 @@ def geodetic2geocentric(lon, lat, alt): z = z.value else: x, y, z = np.array([]), np.array([]), np.array([]) - for i in range(0, len(lon)): + for i in range(len(lon)): loc = EarthLocation.from_geodetic(lon=lon[i], lat=lat[i], height=alt[i]) x = np.append(x, loc.x.value) y = np.append(y, loc.y.value) diff --git a/src/radiotools/utils/__init__.py b/src/radiotools/utils/__init__.py index ada03a9..2156f96 100644 --- a/src/radiotools/utils/__init__.py +++ b/src/radiotools/utils/__init__.py @@ -1,10 +1,10 @@ from .utils import beam2pix, get_array_names, pix2beam, rms, rmtree, uvfits2ms __all__ = [ - "get_array_names", "beam2pix", + "get_array_names", "pix2beam", "rms", - "uvfits2ms", "rmtree", + "uvfits2ms", ] diff --git a/src/radiotools/visibility/visibility.py b/src/radiotools/visibility/visibility.py index 20779be..6380a7f 100644 --- a/src/radiotools/visibility/visibility.py +++ b/src/radiotools/visibility/visibility.py @@ -411,7 +411,7 @@ def _time_delta(self, r1, r2): return max(0, delta) def get_optimal_date(self, print_result: bool = False) -> list: - """Computes the best date to observe the target source. + r"""Computes the best date to observe the target source. Returns a list of three :class:`~pandas.Timestamp` where the first and last are the best date :math:`\pm` `obs_length / 2`. @@ -470,7 +470,7 @@ def get_optimal_date(self, print_result: bool = False) -> list: result = times[int(np.argmax(dt.sum(axis=0)))] if print_result: - print("") + print() tab = Table(title="*** Best observation time ***") tab.add_column("Station ID", justify="right", style="cyan") tab.add_column("Obs. time start") @@ -485,6 +485,6 @@ def get_optimal_date(self, print_result: bool = False) -> list: ) console = Console() console.print(tab) - print("") + print() return result