Skip to content

Commit

Permalink
I swear I'm not doing this on purpose... I was passing the start para…
Browse files Browse the repository at this point in the history
…meters incorrectly to the model to get the raw output unit. (by the way, beforehand I was actually using the model self call method, which actually auto-converts the output to the set unit of the model, so wasn't helping us here). For issue #1267
  • Loading branch information
DavidT3 committed Nov 21, 2024
1 parent dd422ef commit 4b63a26
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xga/products/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This code is a part of X-ray: Generate and Analyse (XGA), a module designed for the XMM Cluster Survey (XCS).
# Last modified by David J Turner (turne540@msu.edu) 20/11/2024, 22:53. Copyright (c) The Contributors
# Last modified by David J Turner (turne540@msu.edu) 20/11/2024, 22:56. Copyright (c) The Contributors

import inspect
import os
Expand Down Expand Up @@ -826,7 +826,7 @@ def find_to_replace(start_pos: np.ndarray, par_lims: np.ndarray) -> np.ndarray:

# Trying to read out the raw output unit of the model with current start parameters, rather than the
# final unit set by each model - this is to make sure we're doing regression on data of the right unit
raw_mod_unit = model.model(self.radii[0], model.start_pars).unit
raw_mod_unit = model.model(self.radii[0], *model.start_pars).unit

# I'm just defining these here so that the lines don't get too long for PEP standards
y_data = (self.values.copy() - self._background).to(raw_mod_unit).value
Expand Down Expand Up @@ -1032,7 +1032,7 @@ def nlls_fit(self, model: BaseModel1D, num_samples: int, show_warn: bool) -> Tup

# Trying to read out the raw output unit of the model with current start parameters, rather than the
# final unit set by each model - this is to make sure we're doing regression on data of the right unit
raw_mod_unit = model.model(self.radii[0], model.start_pars).unit
raw_mod_unit = model.model(self.radii[0], *model.start_pars).unit

y_data = (self.values.copy() - self._background).to(raw_mod_unit).value
y_errs = self.values_err.copy().to(raw_mod_unit).value
Expand Down

0 comments on commit 4b63a26

Please sign in to comment.