oscarbranson / latools

Tools for the reproducible reduction of LA-ICPMS data.
http://latools.readthedocs.io
MIT License
15 stars 10 forks source link

error with calibrate #67

Open tosca-har opened 3 years ago

tosca-har commented 3 years ago

error when calling eg.calibrate(srms_used=[ 'NIST612', 'NIST610']) Works for 2 of the runs, but not other 2. Files have been split by long data script and then read in with REPRODUCE config.

ValueError Traceback (most recent call last)

in 21 eg.ratio() 22 eg.trace_plots() ---> 23 eg.calibrate(srms_used=[ 'NIST612', 'NIST610']) 24 eg.calibration_plot() 25 eg.trace_plots() /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/latools/helpers/logging.py in wrapper(self, *args, **kwargs) 16 @wraps(func) 17 def wrapper(self, *args, **kwargs): ---> 18 a = func(self, *args, **kwargs) 19 self.log.append(func.__name__ + ' :: args={} kwargs={}'.format(args, kwargs)) 20 return a /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/latools/latools.py in calibrate(self, analytes, drift_correct, srms_used, zero_intercept, n_min, reload_srm_database) 1661 1662 if not hasattr(self, 'srmtabs'): -> 1663 self.srm_id_auto(srms_used=srms_used, n_min=n_min, reload_srm_database=reload_srm_database) 1664 1665 # make container for calibration params /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/latools/latools.py in srm_id_auto(self, srms_used, analytes, n_min, reload_srm_database) 1579 classifier = KMeans(len(srms_used)).fit(_srmid) 1580 # apply classifier to measured data -> 1581 std_classes = classifier.predict(_stdid) 1582 1583 # get srm names from classes /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/cluster/_kmeans.py in predict(self, X, sample_weight) 1154 check_is_fitted(self) 1155 -> 1156 X = self._check_test_data(X) 1157 x_squared_norms = row_norms(X, squared=True) 1158 sample_weight = _check_sample_weight(sample_weight, X, dtype=X.dtype) /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/cluster/_kmeans.py in _check_test_data(self, X) 856 857 def _check_test_data(self, X): --> 858 X = self._validate_data(X, accept_sparse='csr', reset=False, 859 dtype=[np.float64, np.float32], 860 order='C', accept_large_sparse=False) /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/base.py in _validate_data(self, X, y, reset, validate_separately, **check_params) 419 out = X 420 elif isinstance(y, str) and y == 'no_validation': --> 421 X = check_array(X, **check_params) 422 out = X 423 else: /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/utils/validation.py in inner_f(*args, **kwargs) 61 extra_args = len(args) - len(all_args) 62 if extra_args <= 0: ---> 63 return f(*args, **kwargs) 64 65 # extra_args > 0 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, estimator) 718 719 if force_all_finite: --> 720 _assert_all_finite(array, 721 allow_nan=force_all_finite == 'allow-nan') 722 /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/sklearn/utils/validation.py in _assert_all_finite(X, allow_nan, msg_dtype) 101 not allow_nan and not np.isfinite(X).all()): 102 type_err = 'infinity' if allow_nan else 'NaN, infinity' --> 103 raise ValueError( 104 msg_err.format 105 (type_err, ValueError: Input contains NaN, infinity or a value too large for dtype('float64').