Skip to content

Commit

Permalink
Merge pull request #80 from LSSTDESC/u/jrbogart/remove_redshift_property
Browse files Browse the repository at this point in the history
remove redshift property from BaseObject interface
  • Loading branch information
JoanneBogart authored Nov 2, 2023
2 parents 37b3960 + a4063f9 commit d527f8f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
19 changes: 1 addition & 18 deletions skycatalogs/objects/base_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ class BaseObject(object):
_bp500 = galsim.Bandpass(galsim.LookupTable([499, 500, 501], [0, 1, 0]),
wave_type='nm').withZeropoint('AB')

def __init__(self, ra, dec, id, object_type, belongs_to, belongs_index,
redshift=None):
def __init__(self, ra, dec, id, object_type, belongs_to, belongs_index):
'''
Save at least minimum info needed a fixed (not SSO) object to
determine if it's in a region and discover all its other properties.
Expand All @@ -89,20 +88,15 @@ def __init__(self, ra, dec, id, object_type, belongs_to, belongs_index,
must appear in catalog config file
belongs_to ObjectCollection collection this object belongs to
belongs_index int index of object within its collection
redshift float
'''
self._ra = ra
self._dec = dec
self._id = str(id)
self._object_type = object_type
self._redshift = redshift
self._belongs_to = belongs_to
self._belongs_index = belongs_index
self._logger = belongs_to._sky_catalog._logger

# All objects also include redshift information. Also MW extinction,
# but extinction is by subcomponent for galaxies

@property
def ra(self):
return self._ra
Expand All @@ -119,14 +113,6 @@ def id(self):
def object_type(self):
return self._object_type

@property
def redshift(self):
if self._redshift:
return self._redshift
if self._belongs_to:
self._redshift = self.get_native_attribute('redshift')
return self._redshift

@property
def partition_id(self):
if self._belongs_to:
Expand Down Expand Up @@ -620,9 +606,6 @@ def append_object_list(self, object_list):
for e in object_list._located:
self.append_collection(e.collection)

def redshifts(self):
return self.get_native_attribute('redshift')

def get_native_attribute(self, attribute_name):
'''
Retrieve a particular attribute for a source.
Expand Down
6 changes: 2 additions & 4 deletions skycatalogs/objects/snana_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
class SnanaObject(BaseObject):
_type_name = 'snana'

def __init__(self, ra, dec, id, object_type, belongs_to, belongs_index,
redshift=None):
super().__init__(ra, dec, id, object_type, belongs_to, belongs_index,
redshift)
def __init__(self, ra, dec, id, object_type, belongs_to, belongs_index):
super().__init__(ra, dec, id, object_type, belongs_to, belongs_index)
self._mjds = None
self._lambda = None

Expand Down

0 comments on commit d527f8f

Please sign in to comment.