Skip to content

Commit

Permalink
added errorbars scaling as a parameter of mulensdata
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Mroz committed Apr 30, 2024
1 parent 3e96b60 commit 1a7df18
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions source/MulensModel/mulensdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ class MulensData(object):
Flags for good data, should be the same length as the
number of data points.
errorbars_scale: *dict*, optional
Scales magnitude error bars according to the function:
sigma_mag_new = sqrt((factor * sigma_mag)^2 + minimum^2)
Accepted keys:
``'factor'`` - *float*, Default: 1.0
``'minimum'`` - *float*, Default: 0.0
plot_properties: *dict*, optional
Specify properties for plotting, e.g. ``color``, ``marker``,
``label``, ``alpha``, ``zorder``, ``markersize``, ``visible``,
Expand Down Expand Up @@ -122,7 +132,7 @@ def __init__(self, data_list=None, file_name=None,
coords=None, ra=None, dec=None,
ephemerides_file=None, add_2450000=False,
add_2460000=False, bandpass=None, bad=None, good=None,
plot_properties=None, **kwargs):
errorbars_scale=None, plot_properties=None, **kwargs):

self._n_epochs = None
self._horizons = None
Expand Down Expand Up @@ -156,6 +166,10 @@ def __init__(self, data_list=None, file_name=None,
# Set up satellite properties (if applicable)
self._ephemerides_file = ephemerides_file

if errorbars_scale is not None:
self.scale_errorbars(
factor=errorbars_scale['factor'], minimum=errorbars_scale['minimum'])

def __repr__(self):
name = self._get_name()

Expand Down Expand Up @@ -857,7 +871,7 @@ def copy(self):
'add_2460000': self._init_keys['add246'],
'bandpass': self.bandpass, 'bad': np.array(self.bad),
'plot_properties': {**self.plot_properties}
}
}

out = MulensData(**kwargs)
out._file_name = self._file_name
Expand Down Expand Up @@ -904,7 +918,7 @@ def _scale_mag_err(self):

self._err_mag = new_err_mag
self._err_flux = Utils.get_flux_and_err_from_mag(
mag=self.mag, err_mag=self.err_mag)[1]
mag=self.mag, err_mag=self.err_mag)[1]

@property
def errorbars_scale_factors(self):
Expand Down

0 comments on commit 1a7df18

Please sign in to comment.