Skip to content

Commit

Permalink
more flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sjperkins committed Jan 26, 2024
1 parent 4863069 commit 8fe3c73
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 27 deletions.
15 changes: 8 additions & 7 deletions africanus/averaging/bda_avg.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def row_average(meta, ant1, ant2, flag_row=None,
time_centroid=None, exposure=None, uvw=None,
weight=None, sigma=None):
return row_average_impl(meta, ant1, ant2, flag_row=flag_row,
time_centroid=time_centroid, exposure=exposure, uvw=uvw,
weight=weight, sigma=sigma)
time_centroid=time_centroid, exposure=exposure,
uvw=uvw, weight=weight, sigma=sigma)


def row_average_impl(meta, ant1, ant2, flag_row=None,
Expand Down Expand Up @@ -575,12 +575,13 @@ def bda(time, interval, antenna1, antenna2,
min_nchan=1):

return bda_impl(time, interval, antenna1, antenna2,
time_centroid=time_centroid, exposure=exposure, flag_row=flag_row,
uvw=uvw, weight=weight, sigma=sigma,
time_centroid=time_centroid, exposure=exposure,
flag_row=flag_row, uvw=uvw, weight=weight, sigma=sigma,
chan_freq=chan_freq, chan_width=chan_width,
effective_bw=effective_bw, resolution=resolution,
visibilities=visibilities, flag=flag,
weight_spectrum=weight_spectrum, sigma_spectrum=sigma_spectrum,
weight_spectrum=weight_spectrum,
sigma_spectrum=sigma_spectrum,
max_uvw_dist=max_uvw_dist, max_fov=max_fov,
decorrelation=decorrelation,
time_bin_secs=time_bin_secs, min_nchan=min_nchan)
Expand Down Expand Up @@ -625,8 +626,8 @@ def nb_bda_impl(time, interval, antenna1, antenna2,
min_nchan=min_nchan)

row_avg = row_average(meta, antenna1, antenna2, flag_row, # noqa: F841
time_centroid, exposure, uvw,
weight=weight, sigma=sigma)
time_centroid, exposure, uvw,
weight=weight, sigma=sigma)

row_chan_avg = row_chan_average(meta, # noqa: F841
flag_row=flag_row,
Expand Down
1 change: 0 additions & 1 deletion africanus/averaging/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from africanus.util.numba import (is_numba_type_none,
intrinsic,
njit,
JIT_OPTIONS,
overload)


Expand Down
1 change: 0 additions & 1 deletion africanus/averaging/tests/test_bda_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest

from africanus.averaging.bda_mapping import bda_mapper, Binner
from africanus.util.numba import njit


@pytest.fixture(scope="session", params=[4096])
Expand Down
22 changes: 15 additions & 7 deletions africanus/averaging/time_and_channel_avg.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ def row_chan_average(row_meta, chan_meta,
return row_chan_average_impl(row_meta, chan_meta,
flag_row=flag_row, weight=weight,
visibilities=visibilities, flag=flag,
weight_spectrum=weight_spectrum, sigma_spectrum=sigma_spectrum)
weight_spectrum=weight_spectrum,
sigma_spectrum=sigma_spectrum)


def row_chan_average_impl(row_meta, chan_meta,
Expand Down Expand Up @@ -558,8 +559,10 @@ def impl(row_meta, chan_meta, flag_row=None, weight=None,
@njit(**JIT_OPTIONS)
def chan_average(chan_meta, chan_freq=None, chan_width=None,
effective_bw=None, resolution=None):
return chan_average_impl(chan_meta, chan_freq=chan_freq, chan_width=chan_width,
effective_bw=effective_bw, resolution=resolution)
return chan_average_impl(chan_meta, chan_freq=chan_freq,
chan_width=chan_width,
effective_bw=effective_bw,
resolution=resolution)


def chan_average_impl(chan_meta, chan_freq=None, chan_width=None,
Expand Down Expand Up @@ -636,13 +639,18 @@ def time_and_channel(time, interval, antenna1, antenna2,
weight_spectrum=None, sigma_spectrum=None,
time_bin_secs=1.0, chan_bin_size=1):
return time_and_channel_impl(time, interval, antenna1, antenna2,
time_centroid=time_centroid, exposure=exposure, flag_row=flag_row,
time_centroid=time_centroid,
exposure=exposure,
flag_row=flag_row,
uvw=uvw, weight=weight, sigma=sigma,
chan_freq=chan_freq, chan_width=chan_width,
effective_bw=effective_bw, resolution=resolution,
effective_bw=effective_bw,
resolution=resolution,
visibilities=visibilities, flag=flag,
weight_spectrum=weight_spectrum, sigma_spectrum=sigma_spectrum,
time_bin_secs=time_bin_secs, chan_bin_size=chan_bin_size)
weight_spectrum=weight_spectrum,
sigma_spectrum=sigma_spectrum,
time_bin_secs=time_bin_secs,
chan_bin_size=chan_bin_size)


def time_and_channel_impl(time, interval, antenna1, antenna2,
Expand Down
7 changes: 6 additions & 1 deletion africanus/averaging/time_and_channel_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
import numba

from africanus.averaging.support import unique_time, unique_baselines
from africanus.util.numba import is_numba_type_none, njit, jit, JIT_OPTIONS, overload
from africanus.util.numba import (
is_numba_type_none,
njit,
jit,
JIT_OPTIONS,
overload)


class RowMapperError(Exception):
Expand Down
5 changes: 3 additions & 2 deletions africanus/calibration/utils/compute_and_corrupt_vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ def jones_mul(a1j, model, a2j, uvw, freq, lm, out):
@njit(**JIT_OPTIONS)
def compute_and_corrupt_vis(time_bin_indices, time_bin_counts, antenna1,
antenna2, jones, model, uvw, freq, lm):
return compute_and_corrupt_vis_impl(time_bin_indices, time_bin_counts, antenna1,
antenna2, jones, model, uvw, freq, lm)
return compute_and_corrupt_vis_impl(time_bin_indices, time_bin_counts,
antenna1, antenna2, jones, model,
uvw, freq, lm)


def compute_and_corrupt_vis_impl(time_bin_indices, time_bin_counts, antenna1,
Expand Down
4 changes: 3 additions & 1 deletion africanus/coordinates/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import numpy as np

from africanus.util.docs import DocstringTemplate
from africanus.util.numba import is_numba_type_none, jit, JIT_OPTIONS, njit, overload
from africanus.util.numba import (is_numba_type_none,
jit, JIT_OPTIONS,
njit, overload)
from africanus.util.requirements import requires_optional

try:
Expand Down
3 changes: 2 additions & 1 deletion africanus/dft/kernels.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-


from africanus.util.numba import is_numba_type_none, njit, overload, JIT_OPTIONS
from africanus.util.numba import (is_numba_type_none, njit,
overload, JIT_OPTIONS)
from africanus.util.docs import doc_tuple_to_str
from collections import namedtuple

Expand Down
1 change: 0 additions & 1 deletion africanus/experimental/rime/fused/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def nb_rime(*args):

argstart = len(args) // 2
names = args[:argstart]
inargs = args[argstart:]

if not all(isinstance(n, types.Literal) for n in names):
raise TypeError(f"{names} must be a Tuple of Literal strings")
Expand Down
4 changes: 2 additions & 2 deletions africanus/gridding/wgridder/vis2im.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def _dirty_internal(uvw, freq, vis, freq_bin_idx, freq_bin_counts, nx, ny,
# need a copy here if using multiple row chunks
freq_bin_idx2 = freq_bin_idx - freq_bin_idx.min()
nband = freq_bin_idx.size
if type(vis[0, 0]) == np.complex64:
if type(vis[0, 0]) is np.complex64:
real_type = np.float32
elif type(vis[0, 0]) == np.complex128:
elif type(vis[0, 0]) is np.complex128:
real_type = np.float64
else:
raise ValueError("Vis of incorrect type")
Expand Down
11 changes: 8 additions & 3 deletions africanus/rime/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import numpy as np

from africanus.util.docs import DocstringTemplate
from africanus.util.numba import is_numba_type_none, JIT_OPTIONS, njit, overload
from africanus.util.numba import (is_numba_type_none, JIT_OPTIONS,
njit, overload)


JONES_NOT_PRESENT = 0
Expand Down Expand Up @@ -418,8 +419,12 @@ def predict_vis(time_index, antenna1, antenna2,
dde1_jones=None, source_coh=None, dde2_jones=None,
die1_jones=None, base_vis=None, die2_jones=None):
return predict_vis_impl(time_index, antenna1, antenna2,
dde1_jones=dde1_jones, source_coh=source_coh, dde2_jones=dde2_jones,
die1_jones=die1_jones, base_vis=base_vis, die2_jones=die2_jones)
dde1_jones=dde1_jones,
source_coh=source_coh,
dde2_jones=dde2_jones,
die1_jones=die1_jones,
base_vis=base_vis,
die2_jones=die2_jones)


def predict_vis_impl(time_index, antenna1, antenna2,
Expand Down

0 comments on commit 8fe3c73

Please sign in to comment.