From 5a14ae8c6ab39eccdcbe5fb89153f132fe6c8adb Mon Sep 17 00:00:00 2001 From: Jakub Ostrowski Date: Wed, 13 Jul 2022 19:05:10 +0200 Subject: [PATCH] calc_feh method might be used with custom solar chemical composition. --- astero_sdb/__init__.py | 2 +- astero_sdb/star.py | 25 ++++++++++++++++--------- pyproject.toml | 2 +- setup.py | 2 +- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/astero_sdb/__init__.py b/astero_sdb/__init__.py index 8ce9b36..7525d19 100644 --- a/astero_sdb/__init__.py +++ b/astero_sdb/__init__.py @@ -1 +1 @@ -__version__ = '0.1.3' +__version__ = '0.1.4' diff --git a/astero_sdb/star.py b/astero_sdb/star.py index e0047d7..73fc1a1 100644 --- a/astero_sdb/star.py +++ b/astero_sdb/star.py @@ -621,14 +621,27 @@ def periods_range(self, return p_min, p_max @staticmethod - def calc_feh(z: float) -> float: + def calc_feh(z: float, + solar_h1: float = 0.7154, + solar_h2: float = 1.43e-5, + solar_he3: float = 4.49e-5, + solar_he4: float = 0.2702551) -> float: """Calculates [Fe/H] from metallicity. - Assumes solar chemical composition from Asplund et al. (2009). + By default, assumes solar chemical composition from + Asplund et al. (2009). Parameters ---------- z : float Metallicity. + solar_h1 : float, optional + Solar H1 abundance. Default: 0.7154. + solar_h2 : float, optional + Solar deuterium abundance. Default: 1.43e-5. + solar_he3 : float, optional + Solar He3 abundance. Default: 4.49e-5. + solar_he4 : float, optional + Solar He4 abundance. Default: 0.2702551. Returns ---------- @@ -636,11 +649,6 @@ def calc_feh(z: float) -> float: Calculated [Fe/H]. """ - solar_h1 = 0.7154 - solar_h2 = 1.43e-5 - solar_he3 = 4.49e-5 - solar_he4 = 0.2702551 - solar_x = solar_h1 + solar_h2 solar_y = solar_he3 + solar_he4 solar_z = 1.0 - solar_x - solar_y @@ -651,8 +659,7 @@ def calc_feh(z: float) -> float: def chi2_single(x_model: np.array, x_obs: float, sigma: float) -> np.ndarray: - """Calculates a single component of chi^2 - function. + """Calculates a single component of chi^2 function. Parameters ---------- diff --git a/pyproject.toml b/pyproject.toml index da8af78..1307114 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta' [project] name = 'astero_sdb' -version = '0.1.3' +version = '0.1.4' description = 'Tools for asteroseismology of sdB stars using MESA and GYRE models' readme = 'README.md' authors = [{ name = 'Jakub Ostrowski', email = 'cespenar1@gmail.com' }] diff --git a/setup.py b/setup.py index c3e8340..e4008fe 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup(name='astero_sdb', - version='0.1.3', + version='0.1.4', description='Tools for asteroseismology of sdB stars using MESA and GYRE models.', url='https://github.com/cespenar/astero_sdb', author='Jakub Ostrowski',