Skip to content

Commit

Permalink
Added ReadModel.get_spec_res for returning the spectral resolution as…
Browse files Browse the repository at this point in the history
… stored in the database
  • Loading branch information
tomasstolker committed May 5, 2021
1 parent eb2f116 commit a429519
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
8 changes: 8 additions & 0 deletions docs/species.data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ species.data.leggett module
:undoc-members:
:show-inheritance:

species.data.morley2012 module
------------------------------

.. automodule:: species.data.morley2012
:members:
:undoc-members:
:show-inheritance:

species.data.petitcode module
-----------------------------

Expand Down
1 change: 0 additions & 1 deletion species/data/morley2012.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def add_morley2012(input_path: str,
print(f'\r{print_message}', end='')

data_wavel, data_flux = np.loadtxt(os.path.join(data_folder, filename), unpack=True)
print(data_wavel)

teff.append(teff_val)
logg.append(logg_val)
Expand Down
21 changes: 21 additions & 0 deletions species/read/read_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1201,3 +1201,24 @@ def get_parameters(self) -> List[str]:
h5_file.close()

return param

@typechecked
def get_spec_res(self) -> float:
"""
Function for extracting the spectral resolution as stored in the database.
Returns
-------
float
Spectral resolution.
"""

wavel_points = self.get_wavelengths()

wavel_mean = (wavel_points[1:]+wavel_points[:-1])/2.

# R = lambda / delta_lambda / 2, because twice as many points as R are
# required to resolve two features that are lambda / R apart
spec_res = wavel_mean / np.diff(wavel_points) / 2.

return np.mean(spec_res)

0 comments on commit a429519

Please sign in to comment.