Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove redshift property from BaseObject interface #80

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
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
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