Skip to content

Commit

Permalink
Removed MulensData.coords instances, including property and setter
Browse files Browse the repository at this point in the history
  • Loading branch information
rapoliveira committed Feb 29, 2024
1 parent 55e98c7 commit 50663d2
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 41 deletions.
16 changes: 0 additions & 16 deletions source/MulensModel/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,14 +745,6 @@ def _update_coords(self, coords=None):
if self._model is not None:
self._model.coords = self._coords

# We run the command below with try, because _update_coords() is called
# by _set_datasets before self._datasets is set.
try:
for dataset in self._datasets:
dataset.coords = self._coords
except Exception:
pass

@property
def model(self):
"""an instance of :py:class:`~MulensModel.model.Model`"""
Expand Down Expand Up @@ -789,15 +781,7 @@ def _set_datasets(self, new_value):
can be called by __init__ or @datasets.setter
passes datasets to property self._model
"""
if isinstance(new_value, list):
for dataset in new_value:
if dataset.coords is not None:
self._update_coords(coords=dataset.coords)

if isinstance(new_value, MulensData):
if new_value.coords is not None:
self._update_coords(coords=new_value.coords)

new_value = [new_value]

if new_value is None:
Expand Down
17 changes: 0 additions & 17 deletions source/MulensModel/mulensdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from MulensModel.utils import Utils, PlotUtils
from MulensModel.satelliteskycoord import SatelliteSkyCoord
from MulensModel.coordinates import Coordinates


class MulensData(object):
Expand Down Expand Up @@ -129,8 +128,6 @@ def __init__(self, data_list=None, file_name=None,
self._file_name = file_name
self._input_fmt = phot_fmt

self._coords = None

if plot_properties is None:
plot_properties = dict()
self._plot_properties = plot_properties
Expand Down Expand Up @@ -566,20 +563,6 @@ def set_limb_darkening_weights(self, weights):

self._limb_darkening_weights = weights

@property
def coords(self):
"""
:py:class:`~MulensModel.coordinates.Coordinates`
Sky coordinates of data.
See :py:class:`~MulensModel.coordinates.Coordinates`.
"""
return self._coords

@coords.setter
def coords(self, new_value):
self._coords = Coordinates(new_value)

@property
def time(self):
"""
Expand Down
6 changes: 2 additions & 4 deletions source/MulensModel/tests/test_Coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ def check_event_coords(event, ra, dec):
"""
np.testing.assert_almost_equal(event.coords.ra.value, ra)
np.testing.assert_almost_equal(event.model.coords.ra.value, ra)
np.testing.assert_almost_equal(event.datasets[0].coords.ra.value, ra)
np.testing.assert_almost_equal(event.coords.dec.value, dec)
np.testing.assert_almost_equal(event.model.coords.dec.value, dec)
np.testing.assert_almost_equal(event.datasets[0].coords.dec.value, dec)


def test_event_coords_ra_dec_1():
Expand All @@ -81,8 +79,8 @@ def test_event_coords_ra_dec_1():

event.coords = '{0} {1}'.format(ra_2_str, dec_2_str)

np.testing.assert_almost_equal(data.coords.ra.value, ra_2)
np.testing.assert_almost_equal(data.coords.dec.value, dec_2)
np.testing.assert_almost_equal(event.coords.ra.value, ra_2)
np.testing.assert_almost_equal(event.coords.dec.value, dec_2)


def test_event_coords_ra_dec_2():
Expand Down
2 changes: 1 addition & 1 deletion source/MulensModel/tests/test_Event.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_event_get_chi2_1():

ev.fix_blend_flux = fix_blend_flux
np.testing.assert_almost_equal(ev.get_chi2(), 459.09826, decimal=4)
assert(ev.blend_fluxes == [0.])
assert (ev.blend_fluxes == [0.])


def test_event_get_chi2_2():
Expand Down
3 changes: 0 additions & 3 deletions source/MulensModel/tests/test_MulensData.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ def test_copy():
assert value_1 is not value_2
assert np.all(value_1 == value_2)

assert data_1.coords is None
assert data_2.coords is None


def test_scale_errorbars():
"""
Expand Down

0 comments on commit 50663d2

Please sign in to comment.