Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/bagle/model_fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,10 @@ def callback_plotter(self, nSamples, nlive, nPar,
def get_modified_mag_err(self, cube, filt_index):
mag_err = copy.deepcopy(self.data['mag_err' + str(filt_index + 1)])

if self.add_error_on_photometry:
if (self.add_error_on_photometry and \
not isinstance(self.add_error_on_photometry, (list, np.ndarray))) or \
(isinstance(self.add_error_on_photometry, (list, np.ndarray)) \
and self.add_error_on_photometry[filt_index]):
add_err_name = 'add_err' + str(filt_index + 1)
if isinstance(cube, dict) or isinstance(cube, Row):
add_err = cube[add_err_name]
Expand All @@ -953,7 +956,10 @@ def get_modified_mag_err(self, cube, filt_index):
add_err = cube[add_err_idx]
mag_err = np.hypot(mag_err, add_err)

if self.multiply_error_on_photometry:
if (self.multiply_error_on_photometry and \
not isinstance(self.multiply_error_on_photometry, (list, np.ndarray))) or \
(isinstance(self.multiply_error_on_photometry, (list, np.ndarray)) \
and self.multiply_error_on_photometry[filt_index]):
mult_err_name = 'mult_err' + str(filt_index + 1)
if isinstance(cube, dict) or isinstance(cube, Row):
mult_err = cube[mult_err_name]
Expand All @@ -962,7 +968,7 @@ def get_modified_mag_err(self, cube, filt_index):
mult_err = cube[mult_err_idx]
mag_err *= mult_err

return mag_err
return mag_err


def write_params_yaml(self):
Expand Down