Skip to content

Commit

Permalink
Fix initializing linear component for cube fit
Browse files Browse the repository at this point in the history
  • Loading branch information
rosteen committed Sep 16, 2024
1 parent 325498b commit bd1f425
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jdaviz/configs/default/plugins/model_fitting/initializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def initialize(self, instance, x, y):
instance : `~astropy.modeling.Model`
The initialized model.
"""
if y.ndim == 3:
# For cube fitting, need to collapse before this calculation
y = np.nanmean(y, axis=(0,1))
slope, intercept = np.polynomial.Polynomial.fit(x.value.flatten(), y.value.flatten(), 1)

instance.slope.value = slope
Expand Down

0 comments on commit bd1f425

Please sign in to comment.