pep8speaks: Hello @ksunden! Thanks for submitting the PR.

 - In the file [`WrightTools/kit/_array.py`](https://github.com/wright-group/WrightTools/blob/405cd2cd8b838ac1bbf3b676aaaeb5f7a6de2a3d/WrightTools/kit/_array.py), following are the PEP8 issues :

> [Line 216:35](https://github.com/wright-group/WrightTools/blob/405cd2cd8b838ac1bbf3b676aaaeb5f7a6de2a3d/WrightTools/kit/_array.py#L216): [E712](https://duckduckgo.com/?q=pep8%20E712) comparison to False should be 'if cond is False:' or 'if not cond:'

 - In the file [`tests/kit/remove_nans_1D.py`](https://github.com/wright-group/WrightTools/blob/405cd2cd8b838ac1bbf3b676aaaeb5f7a6de2a3d/tests/kit/remove_nans_1D.py), following are the PEP8 issues :

> [Line 30:1](https://github.com/wright-group/WrightTools/blob/405cd2cd8b838ac1bbf3b676aaaeb5f7a6de2a3d/tests/kit/remove_nans_1D.py#L30): [E302](https://duckduckgo.com/?q=pep8%20E302) expected 2 blank lines, found 1


ksunden: ```
>>> a = np.array([np.nan, 1, 2, 2])
>>> np.isnan(a)
array([ True, False, False, False])
>>> not np.isnan(a)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    not np.isnan(a)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any()
 or a.all()
>>> np.isnan(a) == False
array([False,  True,  True,  True])
>>> np.isnan(a) is False
False
```
Hush, pep8speaks, that doesn't work here....
diff --git a/WrightTools/kit/_array.py b/WrightTools/kit/_array.py
index 66cfb11..16136f1 100644
--- a/WrightTools/kit/_array.py
+++ b/WrightTools/kit/_array.py
@@ -210,17 +210,10 @@ def remove_nans_1D(*args):
     tuple
         Tuple of 1D arrays in same order as given, with nan indicies removed.
     """
-    # find all indicies to keep
-    bads = np.array([])
-    for arr in args:
-        bad = np.array(np.where(np.isnan(arr))).flatten()
-        bads = np.hstack((bad, bads))
-    if hasattr(args, 'shape') and len(args.shape) == 1:
-        goods = [i for i in np.arange(args.shape[0]) if i not in bads]
-    else:
-        goods = [i for i in np.arange(len(args[0])) if i not in bads]
-    # apply
-    return tuple(a[goods] for a in args)
+    vals = np.isnan(args[0])
+    for a in args:
+        vals |= np.isnan(a)
+    return tuple(np.array(a)[vals == False] for a in args)
 
 
 def share_nans(*arrs):

remove_nans_1D fails for list
```
>>> wt.kit.remove_nans_1D([np.nan, 1, 2, 2])
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    wt.kit.remove_nans_1D([np.nan, 1, 2, 2])
  File "/home/kyle/wright/WrightTools/WrightTools/kit/_array.py", line 223, in rem
ove_nans_1D
    return tuple(a[goods] for a in args)
  File "/home/kyle/wright/WrightTools/WrightTools/kit/_array.py", line 223, in <ge
nexpr>
    return tuple(a[goods] for a in args)
TypeError: list indices must be integers or slices, not list
>>> wt.kit.remove_nans_1D(np.array([np.nan, 1, 2, 2]))
(array([1., 2., 2.]),)
```
diff --git a/tests/kit/remove_nans_1D.py b/tests/kit/remove_nans_1D.py
old mode 100644
new mode 100755
index 31d15ab..8c09a16
--- a/tests/kit/remove_nans_1D.py
+++ b/tests/kit/remove_nans_1D.py
@@ -1,3 +1,4 @@
+#! /usr/bin/env python3
 """Test remove_nans_1D."""
 
 
@@ -18,10 +19,20 @@ def test_simple():
     assert wt.kit.remove_nans_1D(arr)[0].all() == np.arange(0, 6, dtype=float).all()
 
 
-def test_list():
+def test_multiple():
     arrs = [np.random.random(21) for _ in range(5)]
     arrs[0][0] = np.nan
     arrs[1][-1] = np.nan
     arrs = wt.kit.remove_nans_1D(*arrs)
     for arr in arrs:
         assert arr.size == 19
+
+
+def test_list():
+    assert np.all(wt.kit.remove_nans_1D([np.nan, 1, 2, 3])[0] == np.array([1, 2, 3]))
+
+
+if __name__ == "__main__":
+    test_simple()
+    test_multiple()
+    test_list()

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-cov flake8 pydocstyle
apt-get update apt-get install -y gcc libfreetype6-dev hdf5-tools libhdf5-dev libopenblas-dev
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
appdirs==1.4.4
attrs==22.2.0
cached-property==1.5.2
certifi==2021.5.30
coverage==6.2
cycler==0.11.0
flake8==5.0.4
h5py==3.1.0
imageio==2.15.0
importlib-metadata==4.2.0
iniconfig==1.1.1
kiwisolver==1.3.1
matplotlib==3.3.4
mccabe==0.7.0
numexpr==2.8.1
numpy==1.19.5
packaging==21.3
Pillow==8.4.0
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pydocstyle==6.3.0
pyflakes==2.5.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
python-dateutil==2.9.0.post0
pytz==2025.2
scipy==1.5.4
six==1.17.0
snowballstemmer==2.2.0
tidy_headers==1.0.3
tomli==1.2.3
typing_extensions==4.1.1
-e git+https://github.com/wright-group/WrightTools.git@a11e47d7786f63dcc595c8e9ccf121e73a16407b#egg=WrightTools
zipp==3.6.0

name: WrightTools
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - appdirs==1.4.4
      - attrs==22.2.0
      - cached-property==1.5.2
      - coverage==6.2
      - cycler==0.11.0
      - flake8==5.0.4
      - h5py==3.1.0
      - imageio==2.15.0
      - importlib-metadata==4.2.0
      - iniconfig==1.1.1
      - kiwisolver==1.3.1
      - matplotlib==3.3.4
      - mccabe==0.7.0
      - numexpr==2.8.1
      - numpy==1.19.5
      - packaging==21.3
      - pillow==8.4.0
      - pluggy==1.0.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pydocstyle==6.3.0
      - pyflakes==2.5.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - scipy==1.5.4
      - six==1.17.0
      - snowballstemmer==2.2.0
      - tidy-headers==1.0.3
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/WrightTools

tests/kit/remove_nans_1D.py::test_list
tests/kit/remove_nans_1D.py::test_simple tests/kit/remove_nans_1D.py::test_multiple
WrightTools/kit/_array.py
WrightTools/kit/_array.py