You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/specreduce/extract.py:667, in HorneExtract.call(self, image, trace_object, disp_axis, crossdisp_axis, bkgrd_prof, spatial_profile, n_bins_interpolated_profile, interp_degree_interpolated_profile, variance, mask, unit)
658 img = _align_along_trace(
659 img,
660 trace_object.trace,
661 disp_axis=disp_axis,
662 crossdisp_axis=crossdisp_axis)
664 if self.spatial_profile == 'gaussian':
665
666 # fit profile to average (mean) profile along crossdisp axis
--> 667 fit_ext_kernel = self._fit_gaussian_spatial_profile(img,
668 disp_axis,
669 crossdisp_axis,
670 or_mask,
671 bkgrd_prof)
673 # this is just creating an array of the trace to shift the mean
674 # when iterating over each wavelength. this needs to be fixed in the
675 # future to actually account for the trace shape in a non-flat trace
676 # (or possibly omitted all togehter as it might be redundant if
677 # _align_along_trace is correcting this already)
678 if isinstance(trace_object, FlatTrace):
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:23, in _check_func(checker, argname, thefunc, x0, args, numinputs, output_shape)
21 def _check_func(checker, argname, thefunc, x0, args, numinputs,
22 output_shape=None):
---> 23 res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
24 if (output_shape is not None) and (shape(res) != output_shape):
25 if (output_shape[0] != 1):
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/astropy/modeling/fitting.py:1189, in _NonLinearLSQFitter.objective_function(self, fps, fit_param_indices, *args)
1186 value = np.ravel(weights * (model.evaluate(*inputs, *fps) - meas))
1188 if not np.all(np.isfinite(value)):
-> 1189 raise NonFiniteValueError(
1190 "Objective function has encountered a non-finite value, "
1191 "this will cause the fit to fail!\n"
1192 "Please remove non-finite values from your input data before "
1193 "fitting to avoid this error."
1194 )
1196 return value
NonFiniteValueError: Objective function has encountered a non-finite value, this will cause the fit to fail!
Please remove non-finite values from your input data before fitting to avoid this error.
The text was updated successfully, but these errors were encountered:
NonFiniteValueError Traceback (most recent call last)
Cell In[17], line 1
----> 1 hextract.spectrum
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/specreduce/extract.py:309, in HorneExtract.spectrum(self)
307 @Property
308 def spectrum(self):
--> 309 return self.call()
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/specreduce/extract.py:667, in HorneExtract.call(self, image, trace_object, disp_axis, crossdisp_axis, bkgrd_prof, spatial_profile, n_bins_interpolated_profile, interp_degree_interpolated_profile, variance, mask, unit)
658 img = _align_along_trace(
659 img,
660 trace_object.trace,
661 disp_axis=disp_axis,
662 crossdisp_axis=crossdisp_axis)
664 if self.spatial_profile == 'gaussian':
665
666 # fit profile to average (mean) profile along crossdisp axis
--> 667 fit_ext_kernel = self._fit_gaussian_spatial_profile(img,
668 disp_axis,
669 crossdisp_axis,
670 or_mask,
671 bkgrd_prof)
673 # this is just creating an array of the trace to shift the mean
674 # when iterating over each wavelength. this needs to be fixed in the
675 # future to actually account for the trace shape in a non-flat trace
676 # (or possibly omitted all togehter as it might be redundant if
677 # _align_along_trace is correcting this already)
678 if isinstance(trace_object, FlatTrace):
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/specreduce/extract.py:463, in HorneExtract._fit_gaussian_spatial_profile(self, img, disp_axis, crossdisp_axis, or_mask, bkgrd_prof)
460 ext_prof = gauss_prof + models.Const1D(0, fixed={'amplitude': True})
462 fitter = fitting.LevMarLSQFitter()
--> 463 fit_ext_kernel = fitter(ext_prof, xd_pixels[~row_mask], coadd[~row_mask])
465 return fit_ext_kernel
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/astropy/modeling/fitting.py:303, in fitter_unit_support..wrapper(self, model, x, y, z, **kwargs)
298 raise NotImplementedError(
299 "This model does not support being fit to data with units."
300 )
302 else:
--> 303 return func(self, model, x, y, z=z, **kwargs)
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/astropy/modeling/fitting.py:1434, in _NonLinearLSQFitter.call(self, model, x, y, z, weights, maxiter, acc, epsilon, estimate_jacobian, filter_non_finite, inplace)
1427 farg = (
1428 model_copy,
1429 weights,
1430 ) + _convert_input(x, y, z)
1432 fkwarg = {"fit_param_indices": set(fit_param_indices)}
-> 1434 init_values, fitparams, cov_x = self._run_fitter(
1435 model_copy, farg, fkwarg, maxiter, acc, epsilon, estimate_jacobian
1436 )
1438 self._compute_param_cov(
1439 model_copy, y, init_values, cov_x, fitparams, farg, fkwarg, weights
1440 )
1442 model_copy.sync_constraints = True
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/astropy/modeling/fitting.py:1509, in LevMarLSQFitter._run_fitter(self, model, farg, fkwarg, maxiter, acc, epsilon, estimate_jacobian)
1507 dfunc = self._wrap_deriv
1508 init_values, _, _ = model_to_fit_params(model)
-> 1509 fitparams, cov_x, dinfo, mess, ierr = optimize.leastsq(
1510 self.objective_function,
1511 init_values,
1512 args=farg,
1513 Dfun=dfunc,
1514 col_deriv=model.col_fit_deriv,
1515 maxfev=maxiter,
1516 epsfcn=epsilon,
1517 xtol=acc,
1518 full_output=True,
1519 )
1520 fitter_to_model_params(model, fitparams)
1521 self.fit_info.update(dinfo)
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:425, in leastsq(func, x0, args, Dfun, full_output, col_deriv, ftol, xtol, gtol, maxfev, epsfcn, factor, diag)
423 if not isinstance(args, tuple):
424 args = (args,)
--> 425 shape, dtype = _check_func('leastsq', 'func', func, x0, args, n)
426 m = shape[0]
428 if n > m:
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/scipy/optimize/_minpack_py.py:23, in _check_func(checker, argname, thefunc, x0, args, numinputs, output_shape)
21 def _check_func(checker, argname, thefunc, x0, args, numinputs,
22 output_shape=None):
---> 23 res = atleast_1d(thefunc(*((x0[:numinputs],) + args)))
24 if (output_shape is not None) and (shape(res) != output_shape):
25 if (output_shape[0] != 1):
File ~/opt/miniconda3/envs/da-workshop/lib/python3.12/site-packages/astropy/modeling/fitting.py:1189, in _NonLinearLSQFitter.objective_function(self, fps, fit_param_indices, *args)
1186 value = np.ravel(weights * (model.evaluate(*inputs, *fps) - meas))
1188 if not np.all(np.isfinite(value)):
-> 1189 raise NonFiniteValueError(
1190 "Objective function has encountered a non-finite value, "
1191 "this will cause the fit to fail!\n"
1192 "Please remove non-finite values from your input data before "
1193 "fitting to avoid this error."
1194 )
1196 return value
NonFiniteValueError: Objective function has encountered a non-finite value, this will cause the fit to fail!
Please remove non-finite values from your input data before fitting to avoid this error.
The text was updated successfully, but these errors were encountered: