From 467b8e99abc62d5361f628ea37e1bcd4afcf3245 Mon Sep 17 00:00:00 2001 From: John Vincent Cauilan <64677361+johvincau@users.noreply.github.com> Date: Tue, 30 Jul 2024 07:27:35 -0500 Subject: [PATCH] Fix ParticleFilter to work with set inputs (#3092) --- openmc/filter.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openmc/filter.py b/openmc/filter.py index e005140ee..0f884cfcd 100644 --- a/openmc/filter.py +++ b/openmc/filter.py @@ -1,6 +1,6 @@ from __future__ import annotations from abc import ABCMeta -from collections.abc import Iterable +from collections.abc import Iterable, Sequence import hashlib from itertools import product from numbers import Real, Integral @@ -736,7 +736,7 @@ class ParticleFilter(Filter): Parameters ---------- - bins : str, or iterable of str + bins : str, or sequence of str The particles to tally represented as strings ('neutron', 'photon', 'electron', 'positron'). filter_id : int @@ -744,7 +744,7 @@ class ParticleFilter(Filter): Attributes ---------- - bins : iterable of str + bins : sequence of str The particles to tally id : int Unique identifier for the filter @@ -764,8 +764,8 @@ class ParticleFilter(Filter): @Filter.bins.setter def bins(self, bins): - bins = np.atleast_1d(bins) - cv.check_iterable_type('filter bins', bins, str) + cv.check_type('bins', bins, Sequence, str) + bins = np.atleast_1d(bins) for edge in bins: cv.check_value('filter bin', edge, _PARTICLES) self._bins = bins