Skip to content

Commit

Permalink
Added the mean_wavel attribute to ObjectBox
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasstolker committed Jun 28, 2021
1 parent 1dada33 commit 4aa085b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions species/core/box.py
Expand Up @@ -73,6 +73,7 @@ def create_box(boxtype,
box = ObjectBox()
box.name = kwargs['name']
box.filters = kwargs['filters']
box.mean_wavel = kwargs['mean_wavel']
box.magnitude = kwargs['magnitude']
box.flux = kwargs['flux']
box.distance = kwargs['distance']
Expand Down Expand Up @@ -317,6 +318,7 @@ def __init__(self):

self.name = None
self.filters = None
self.mean_wavel = None
self.magnitude = None
self.flux = None
self.distance = None
Expand Down
6 changes: 6 additions & 0 deletions species/data/database.py
Expand Up @@ -1782,6 +1782,7 @@ def get_object(self,

magnitude = {}
flux = {}
mean_wavel = {}

for observatory in dset.keys():
if observatory not in ['distance', 'spectrum']:
Expand All @@ -1792,13 +1793,17 @@ def get_object(self,
magnitude[name] = dset[name][0:2]
flux[name] = dset[name][2:4]

filter_trans = read_filter.ReadFilter(name)
mean_wavel[name] = filter_trans.mean_wavelength()

phot_filters = list(magnitude.keys())

else:

magnitude = None
flux = None
phot_filters = None
mean_wavel = None

if inc_spec and f'objects/{object_name}/spectrum' in h5_file:
spectrum = {}
Expand Down Expand Up @@ -1830,6 +1835,7 @@ def get_object(self,
return box.create_box('object',
name=object_name,
filters=phot_filters,
mean_wavel=mean_wavel,
magnitude=magnitude,
flux=flux,
distance=distance,
Expand Down

0 comments on commit 4aa085b

Please sign in to comment.