BrownDwarf / gollum

A microservice for programmatic access to precomputed synthetic spectral model grids in astronomy
https://gollum-astro.readthedocs.io/
MIT License
20 stars 5 forks source link

fit_continuum appears to be broken #79

Closed gully closed 1 year ago

gully commented 1 year ago

The .fit_continuum() method appears to be broken on line 393-395:

coeffs = np.linalg.lstsq(A_matrix, y_peaks, rcond=None)

spec_out = self._copy(flux=np.dot(coeffs, A_full.T) * self.flux.unit)

I think I had written out the linear algebra previously, and we migrated to the more readable np.linalg.lstsq. However the output of that function (for numpy '1.21.6' at least) is a tuple of properties. The zeroth element of that tuple is what we desire, so accessing coeffs[0] should fix the problem.

smooth_flux = np.dot(coeffs[0], A_full.T) * self.flux.unit
spec_out = self._copy(flux= smooth_flux)