specutils
specutils copied to clipboard
Handle uncertainties of 0 in fitting weights
Currently, if given weights="unc" in fitting, specutils naively tries to convert the spectrum's uncertainty attribute to StdDevUncertainty and then invert those values to use for weights in the model fit. This leads to a failed np.isfinite check in astropy model fitting if some/all of the uncertainties are 0. We need to handle these cases more elegantly, and potentially provide a couple arguments to let the users define how they want them handled.