diff --git a/XAS.py b/XAS.py
index 8d1b29896d165a13984d3c831ed942ec95dde2b6..54b3c255af654dbff0369700d5dc90f96a60ed8c 100644
--- a/XAS.py
+++ b/XAS.py
@@ -32,9 +32,17 @@ def absorption(T, Io):
                 counts: length of T
     """
 
+    T = np.array(T)
+    Io = np.array(Io)
+
     counts = len(T)
     assert counts == len(Io), "T and Io must have the same length"
 
+    # remove not number from the data
+    good = np.logical_and(np.isfinite(T), np.isfinite(Io))
+    T = T[good]
+    Io = Io[good]
+    
     # return type of the structured array
     fdtype = [('muA', 'f8'), ('sigmaA', 'f8'), ('weights', 'f8'),
         ('muT', 'f8'), ('sigmaT', 'f8'), ('muIo', 'f8'), ('sigmaIo', 'f8'),