Skip to content

Commit f1da5b8

Browse files
committed
add some selections to ruff linting
1 parent bbdc754 commit f1da5b8

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,6 @@
3030
[tool.ruff]
3131
# In addition to the standard set of exclusions, omit all tests, plus a specific file.
3232
extend-exclude = [ "src/py21cmwedge/notebooks" ]
33+
34+
[tool.ruff.lint]
35+
select = [ "E", "I", "F" ]

src/py21cmwedge/uvgridder.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,7 @@ def uvw_to_dict(self):
238238
Assumes W term is zero or very very small.
239239
Elements of dictionary are lists of bls keyed by uv lengths
240240
"""
241-
uvw_array = np.copy(self.uvw_array)
242-
for _u, _v in uvw_array[:2].T:
241+
for _u, _v in self.uvw_array[:2].T:
243242
if np.linalg.norm([_u, _v]) == 0:
244243
continue
245244
uv = "{0:.3f},{1:.3f}".format(_u, _v)
@@ -258,13 +257,11 @@ def uv_weights(self, u, v, spatial_function="triangle"):
258257
convolve_beam: bool
259258
when set to true, perform an FFT convolution with the supplied beam
260259
spatial_function: string
261-
must be one of ["nearest", "triangle"]. Nearest modes performs delta function like assignment into a uv-bin
262-
triangle performs simple distance based weighting of uv-bins based on self.wavelength_scale slope
260+
must be one of ["nearest", "triangle"].
261+
Nearest modes performs delta function like assignment into a uv-bin
262+
triangle performs simple distance based weighting of uv-bins based
263+
on self.wavelength_scale slope
263264
"""
264-
# weights = 1. - np.abs(uv - grid)/np.diff(grid)[0]
265-
# weights = 1. - (np.abs(uv - grid)/np.diff(grid)[0])**2
266-
# weights = np.exp( - (uv - grid)**2/(2*np.diff(grid)[0]**2))
267-
# weights = np.exp( - abs(uv - grid)/(np.diff(grid)[0]))
268265
match spatial_function.casefold():
269266
case "triangle":
270267
_range = np.arange(self.uv_size) - (self.uv_size - 1) / 2.0
@@ -307,8 +304,10 @@ def __sum_uv__(self, uv_key, spatial_function="triangle"):
307304
Parameters
308305
----------
309306
spatial_function: string
310-
must be one of ["nearest", "triangle"]. Nearest modes performs delta function like assignment into a uv-bin
311-
triangle performs simple distance based weighting of uv-bins based on self.wavelength_scale slope
307+
must be one of ["nearest", "triangle"].
308+
Nearest modes performs delta function like assignment into a uv-bin
309+
triangle performs simple distance based weighting of uv-bins based
310+
on self.wavelength_scale slope
312311
"""
313312
uvbin = self.uvbins[uv_key]
314313
nbls = len(uvbin)
@@ -328,8 +327,10 @@ def grid_uvw(self, convolve_beam=True, spatial_function="triangle"):
328327
convolve_beam: bool
329328
when set to true, perform an FFT convolution with the supplied beam
330329
spatial_function: string
331-
must be one of ["nearest", "triangle"]. Nearest modes performs delta function like assignment into a uv-bin
332-
triangle performs simple distance based weighting of uv-bins based on self.wavelength_scale slope
330+
must be one of ["nearest", "triangle"].
331+
Nearest modes performs delta function like assignment into a uv-bin
332+
triangle performs simple distance based weighting of uv-bins based
333+
on self.wavelength_scale slope
333334
"""
334335
self.uv_size = (
335336
int(np.round(self.bl_len_max / self.wavelength / self.uv_delta).max() * 1.1)
@@ -367,8 +368,10 @@ def calc_all(
367368
convolve_beam: bool
368369
when set to true, perform an FFT convolution with the supplied beam
369370
spatial_function: string
370-
must be one of ["nearest", "triangle"]. Nearest modes performs delta function like assignment into a uv-bin
371-
triangle performs simple distance based weighting of uv-bins based on self.wavelength_scale slope
371+
must be one of ["nearest", "triangle"].
372+
Nearest modes performs delta function like assignment into a uv-bin
373+
triangle performs simple distance based weighting of uv-bins based
374+
on self.wavelength_scale slope
372375
"""
373376
if refresh_all:
374377
self.uvbins = {}

0 commit comments

Comments
 (0)