Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 8, 2024
1 parent 3224a3c commit 2009530
Show file tree
Hide file tree
Showing 13 changed files with 0 additions and 34 deletions.
1 change: 0 additions & 1 deletion nata/containers/ParticleDataset_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def __init__(
particles: Union[int, np.ndarray] = _extract_from_data,
dtype: np.dtype = _extract_from_data,
) -> None:

if not isinstance(data, np.ndarray):
data = np.asanyarray(data)

Expand Down
1 change: 0 additions & 1 deletion nata/plots/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def scale_from_str(name: str):


def mpl_norm_from_scale(scale: Scale, colorrange: Sequence[Numbers]):

if not scale or isinstance(scale, LinearScale):
return mpl.colors.Normalize(vmin=colorrange[0], vmax=colorrange[1])

Expand Down
3 changes: 0 additions & 3 deletions nata/plots/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def __init__(
size: Optional[Sequence[Numbers]] = None,
theme: Theme = Theme(name="light"),
):

self.theme = theme

with mpl.rc_context(rc=self.theme.rc):
Expand Down Expand Up @@ -81,7 +80,6 @@ def scatter(
size=None,
alpha=None,
):

has_colors = (
color is not None
and isinstance(color, (Sequence, np.ndarray))
Expand Down Expand Up @@ -135,7 +133,6 @@ def image(
colormap=None,
colorbar=None,
):

with mpl.rc_context(rc=self.theme.rc):
img = self.backend_ax.imshow(
np.transpose(color),
Expand Down
1 change: 0 additions & 1 deletion nata/plots/kinds.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
@dataclass
class PlotKind:
def to_dict(self):

kind_dict = {}
for field in fields(self):
kind_dict[field.name] = getattr(self, field.name)
Expand Down
1 change: 0 additions & 1 deletion nata/plugins/plot/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def plot_collection(
interactive: bool = True,
n: int = 0,
) -> Figure:

# check if collection is not empty
if not collection.store:
raise ValueError("Collection is empty.")
Expand Down
1 change: 0 additions & 1 deletion nata/plugins/plot/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def plot_dataset(
interact = False

if interact:

if start not in range(len(data)):
raise ValueError("invalid start index")

Expand Down
2 changes: 0 additions & 2 deletions nata/plugins/plot/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def plot_data_array(
theme: Optional[Union[Theme, str]] = None,
kind: Optional[PlotKind] = None,
):

if kind and not is_valid_plot_kind(data, kind):
raise ValueError(f"invalid plot kind for {type(data)} `{data.name}`")

Expand Down Expand Up @@ -109,7 +108,6 @@ def plot_data_array(
)

elif data.ndim == 2:

if not kind.colorbar:
kind.colorbar = Colorbar(
label=f"{data.label}" + (f" [{data.unit}]" if data.unit else "")
Expand Down
2 changes: 0 additions & 2 deletions nata/plugins/plot/particle.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def plot_particle_array(
theme: Optional[Union[Theme, str]] = None,
kind: Optional[PlotKind] = None,
):

if kind and not is_valid_plot_kind(data, kind):
raise ValueError(f"invalid plot kind for {type(data)} `{data.name}`")

Expand Down Expand Up @@ -84,7 +83,6 @@ def plot_particle_array(
)

if isinstance(kind, Scatter):

# check that color is either:
# - an array with the right size
# - an array with size 3/4 representing an RGB/RGBA value
Expand Down
10 changes: 0 additions & 10 deletions nata/utils/zdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def __read_float64(self):
return np.fromfile(self.__file, dtype="<f8", count=1)[0]

def __read_string(self):

length = self.__read_uint32()

if length > 0:
Expand Down Expand Up @@ -207,7 +206,6 @@ def __read_float64_arr(self, nx):
return data

def __read_arr(self, dtype, nx):

if dtype == 5:
data = self.__read_int32_arr(nx)
elif dtype == 3:
Expand Down Expand Up @@ -235,7 +233,6 @@ def __read_arr(self, dtype, nx):
# -----------------------------------------------------------------------------

def read_record(self, skip=False):

rec = ZDF_Record()
rec.pos = self.__file.tell()

Expand Down Expand Up @@ -396,7 +393,6 @@ def read_part_info(self, rec=False):
# -----------------------------------------------------------------------------

def read_track_info(self, rec=False):

if rec is False:
rec = self.read_record()

Expand Down Expand Up @@ -448,7 +444,6 @@ def read_track_info(self, rec=False):
# --------------------------------------------------------------------------

def read_dataset(self, rec=False):

if rec is False:
rec = self.read_record()

Expand Down Expand Up @@ -494,7 +489,6 @@ def read_dataset(self, rec=False):
# --------------------------------------------------------------------------

def read_cdset(self, rec=False, pos=0):

if rec is False:
rec = self.read_record()

Expand Down Expand Up @@ -547,7 +541,6 @@ def read_cdset(self, rec=False, pos=0):

name = ""
while name != end_name:

# Read next record
rec = self.read_record()

Expand Down Expand Up @@ -580,7 +573,6 @@ def read_cdset(self, rec=False, pos=0):
] = chunk

else:

self.__record_skip(rec)

# If requested, position file pointer at the end of the cdset_start
Expand Down Expand Up @@ -671,7 +663,6 @@ def read_element(self, rec=False, name=False, type_id=False):
# -----------------------------------------------------------------------------

def read_part_data(self, quants):

# Read all quantities
data = dict()

Expand Down Expand Up @@ -706,7 +697,6 @@ def read_part_data(self, quants):
# -----------------------------------------------------------------------------

def read_track_data(self, trackInfo):

rec = self.read_record()
if rec.name != "itermap":
print(
Expand Down
3 changes: 0 additions & 3 deletions tests/plugins/fft_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@


def test_array_fft_invalid_ndim():

with pytest.raises(ValueError, match="0 dimensional GridArrays"):
GridArray.from_array(1).fft()


def test_array_fft_invalid_axis():

for invalid_axis in [2, -3]:
with pytest.raises(ValueError, match="invalid axis index"):
GridArray.from_array(
Expand Down Expand Up @@ -107,6 +105,5 @@ def test_dataset_fft_selection():


def test_dataset_fft_invalid_ndim():

with pytest.raises(ValueError, match="0 dimensional GridDatasets"):
GridDataset.from_array(np.arange(5)).fft()
2 changes: 0 additions & 2 deletions tests/plugins/slice_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def test_array_slice_selection():


def test_array_slice_invalid_ndim():

with pytest.raises(ValueError, match="0 dimensional GridArrays"):
GridArray.from_array(1).slice(constant="axis0", value=0)

Expand All @@ -61,6 +60,5 @@ def test_dataset_slice_selection():


def test_dataset_slice_invalid_ndim():

with pytest.raises(ValueError, match="0 dimensional GridDatasets"):
GridDataset.from_array(np.arange(5)).slice(constant="axis0", value=1)
2 changes: 0 additions & 2 deletions tests/plugins/streak_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def test_streak_shape():


def test_streak_axes_shape():

time = np.arange(3)
x = np.arange(10)

Expand All @@ -37,6 +36,5 @@ def test_streak_axes_shape():


def test_streak_invalid_ndim():

with pytest.raises(ValueError, match="0 dimensional GridDatasets"):
GridDataset.from_array(np.arange(5)).streak()
5 changes: 0 additions & 5 deletions tests/plugins/transpose_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


def test_array_transpose_invalid_axes():

grid = GridArray.from_array(np.arange(7 * 6).reshape((7, 6)))

for invalid_axes in [
Expand All @@ -24,7 +23,6 @@ def test_array_transpose_invalid_axes():


def test_array_transpose_shape():

data = np.zeros((7, 6, 5))
grid = GridArray.from_array(data)

Expand All @@ -40,7 +38,6 @@ def test_array_transpose_shape():


def test_array_transpose_axes():

data = np.zeros((7, 6, 5))
grid = GridArray.from_array(data)

Expand All @@ -52,7 +49,6 @@ def test_array_transpose_axes():


def test_array_transpose_data():

data = np.arange(7 * 6 * 5).reshape((7, 6, 5))
grid = GridArray.from_array(data)

Expand All @@ -62,7 +58,6 @@ def test_array_transpose_data():


def test_dataset_transpose_shape():

data = np.zeros((7, 6, 5))
grid = GridDataset.from_array(data)

Expand Down

0 comments on commit 2009530

Please sign in to comment.