From f8a75b215d9557ec5db59eb6dccad1d33ce82fd5 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 26 Mar 2025 17:34:36 +0100 Subject: [PATCH 01/13] move files to fit packaging structure --- __init__.py => src/tres/__init__.py | 0 interactions.py => src/tres/interactions.py | 0 TRES_options.py => src/tres/options.py | 0 TRES_plotting.py => src/tres/plotting.py | 0 rdc_TRES.py => src/tres/rdc.py | 0 rdc_TRES_csv.py => src/tres/rdc_csv.py | 0 TRES_setup.py => src/tres/setup.py | 0 tidal_friction_constant.py => src/tres/tidal_friction_constant.py | 0 TPS.py => src/tres/tps.py | 0 TRES.py => src/tres/tres.py | 0 triple_class.py => src/tres/triple_class.py | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename __init__.py => src/tres/__init__.py (100%) rename interactions.py => src/tres/interactions.py (100%) rename TRES_options.py => src/tres/options.py (100%) rename TRES_plotting.py => src/tres/plotting.py (100%) rename rdc_TRES.py => src/tres/rdc.py (100%) rename rdc_TRES_csv.py => src/tres/rdc_csv.py (100%) rename TRES_setup.py => src/tres/setup.py (100%) rename tidal_friction_constant.py => src/tres/tidal_friction_constant.py (100%) rename TPS.py => src/tres/tps.py (100%) rename TRES.py => src/tres/tres.py (100%) rename triple_class.py => src/tres/triple_class.py (100%) diff --git a/__init__.py b/src/tres/__init__.py similarity index 100% rename from __init__.py rename to src/tres/__init__.py diff --git a/interactions.py b/src/tres/interactions.py similarity index 100% rename from interactions.py rename to src/tres/interactions.py diff --git a/TRES_options.py b/src/tres/options.py similarity index 100% rename from TRES_options.py rename to src/tres/options.py diff --git a/TRES_plotting.py b/src/tres/plotting.py similarity index 100% rename from TRES_plotting.py rename to src/tres/plotting.py diff --git a/rdc_TRES.py b/src/tres/rdc.py similarity index 100% rename from rdc_TRES.py rename to src/tres/rdc.py diff --git a/rdc_TRES_csv.py b/src/tres/rdc_csv.py similarity index 100% rename from rdc_TRES_csv.py rename to src/tres/rdc_csv.py diff --git a/TRES_setup.py b/src/tres/setup.py similarity index 100% rename from TRES_setup.py rename to src/tres/setup.py diff --git a/tidal_friction_constant.py b/src/tres/tidal_friction_constant.py similarity index 100% rename from tidal_friction_constant.py rename to src/tres/tidal_friction_constant.py diff --git a/TPS.py b/src/tres/tps.py similarity index 100% rename from TPS.py rename to src/tres/tps.py diff --git a/TRES.py b/src/tres/tres.py similarity index 100% rename from TRES.py rename to src/tres/tres.py diff --git a/triple_class.py b/src/tres/triple_class.py similarity index 100% rename from triple_class.py rename to src/tres/triple_class.py From 73340865c68a95c50ef35c3ffadbc0606c9a1c8f Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 26 Mar 2025 17:35:23 +0100 Subject: [PATCH 02/13] adjust code to fit package structure --- src/tres/tres.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tres/tres.py b/src/tres/tres.py index 1fa16c6..f9c45a9 100644 --- a/src/tres/tres.py +++ b/src/tres/tres.py @@ -27,14 +27,14 @@ from seculartriple_TPS.interface import SecularTriple -from triple_class import Triple_Class -from TRES_plotting import plot_data_container, plot_function -from TRES_setup import make_particle_sets, setup_stellar_code -from TRES_options import REPORT_DEBUG, \ +from tres.triple_class import Triple_Class +from tres.plotting import plot_data_container, plot_function +from tres.setup import make_particle_sets, setup_stellar_code +from tres.options import REPORT_DEBUG, \ REPORT_TRIPLE_EVOLUTION, \ MAKE_PLOTS, \ REPORT_USER_WARNINGS -from interactions import corotating_spin_angular_frequency_binary, \ +from tres.interactions import corotating_spin_angular_frequency_binary, \ lang_spin_angular_frequency, \ break_up_angular_frequency, \ criticial_angular_frequency_CHE @@ -71,7 +71,7 @@ def initialize_triple_class(stars, bins, correct_params, #----- #for running TRES.py from other routines -def main(inner_primary_mass = 1.3|units.MSun, inner_secondary_mass = 0.5|units.MSun, outer_mass = 0.5|units.MSun, +def run_tres(inner_primary_mass = 1.3|units.MSun, inner_secondary_mass = 0.5|units.MSun, outer_mass = 0.5|units.MSun, inner_semimajor_axis = 1.0 |units.AU, outer_semimajor_axis = 100.0 |units.AU, inner_eccentricity = 0.1, outer_eccentricity= 0.5, relative_inclination = 80.0*np.pi/180.0, @@ -184,7 +184,7 @@ def main(inner_primary_mass = 1.3|units.MSun, inner_secondary_mass = 0.5|units.M return triple_class_object -def main_developer(stars, bins, correct_params, stellar_code, secular_code, +def run_tres_developer(stars, bins, correct_params, stellar_code, secular_code, relative_inclination = 80.0*np.pi/180.0, metallicity = 0.02, tend = 5.0 |units.Myr, tinit = 0.0 |units.Myr, number = 0, maximum_radius_change_factor = 0.005, From 620134641f080ee5b3afc8ce8da96e3fa05a7262 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 26 Mar 2025 17:39:37 +0100 Subject: [PATCH 03/13] more changes for package structure --- src/tres/interactions.py | 2 +- src/tres/setup.py | 6 +++--- src/tres/tps.py | 18 +++++++++--------- src/tres/triple_class.py | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/tres/interactions.py b/src/tres/interactions.py index 6ffb59f..e6cc117 100644 --- a/src/tres/interactions.py +++ b/src/tres/interactions.py @@ -3,7 +3,7 @@ import sys import scipy.integrate as integrate -from TRES_options import REPORT_BINARY_EVOLUTION, REPORT_FUNCTION_NAMES, REPORT_MASS_TRANSFER_STABILITY +from tres.options import REPORT_BINARY_EVOLUTION, REPORT_FUNCTION_NAMES, REPORT_MASS_TRANSFER_STABILITY #constants numerical_error = 1.e-6 diff --git a/src/tres/setup.py b/src/tres/setup.py index 683272e..a972b47 100644 --- a/src/tres/setup.py +++ b/src/tres/setup.py @@ -3,10 +3,10 @@ from amuse.units import units from seculartriple_TPS.interface import SecularTriple -from TRES_options import max_mass, absolute_min_mass, options_mesa, REPORT_USER_WARNINGS +from tres.options import max_mass, absolute_min_mass, options_mesa, REPORT_USER_WARNINGS -from interactions import * -from tidal_friction_constant import * +from tres.interactions import * +from tres.tidal_friction_constant import * import numpy as np diff --git a/src/tres/tps.py b/src/tres/tps.py index 4defcd3..e91ecbd 100644 --- a/src/tres/tps.py +++ b/src/tres/tps.py @@ -124,7 +124,7 @@ ## -s random seed -import TRES as TRES +from tres import run_tres from amuse.community.seba.interface import SeBa from seculartriple_TPS.interface import SecularTriple @@ -143,7 +143,7 @@ from amuse.ic.salpeter import new_salpeter_mass_distribution from amuse.ic.flatimf import new_flat_mass_distribution -from TRES_options import REPORT_TPS, \ +from tres.options import REPORT_TPS, \ REPORT_USER_WARNINGS_TPS, \ EXCLUDE_SSO, \ precision, min_mass, absolute_min_mass, absolute_max_mass @@ -823,7 +823,7 @@ def evolve_model(inner_primary_mass_max, inner_primary_mass_min,inner_secondary_ #do not use main_developer in TPS.py #memory of SeBa needs to be cleaned, in particular SeBa time #otherwise use evolve_for for particles indivicually -> many calls - tr = TRES.main(inner_primary_mass = triple_system.inner_primary_mass, + tr = run_tres(inner_primary_mass = triple_system.inner_primary_mass, inner_secondary_mass = triple_system.inner_secondary_mass, outer_mass = triple_system.outer_mass, inner_semimajor_axis = triple_system.inner_semi, @@ -882,7 +882,7 @@ def evolve_model(inner_primary_mass_max, inner_primary_mass_min,inner_secondary_ i_n += 1 nr_imt -= 1 - tr = TRES.main(inner_primary_mass = triple_system.inner_primary_mass, + tr = run_tres(inner_primary_mass = triple_system.inner_primary_mass, inner_secondary_mass = triple_system.inner_secondary_mass, outer_mass = triple_system.outer_mass, inner_semimajor_axis = triple_system.inner_semi, @@ -1008,18 +1008,18 @@ def test_initial_parameters(inner_primary_mass_max, inner_primary_mass_min, stop_at_CPU_time, max_CPU_time, file_name, file_type, dir_plots): if (inner_primary_mass_min < min_mass) or (inner_primary_mass_max > absolute_max_mass): - sys.exit("'error: inner primary mass not in allowed range [', min_mass, ',', absolute_max_mass, ']'. min_mass and absolute_max_mass settable in TRES_options.py") + sys.exit("'error: inner primary mass not in allowed range [', min_mass, ',', absolute_max_mass, ']'. min_mass and absolute_max_mass settable in tres.options") if (inner_secondary_mass_max > absolute_max_mass) : - sys.exit("'error: inner secondary mass not in allowed range [ < ', absolute_max_mass, ']'. absolute_max_mass settable in TRES_options.py") + sys.exit("'error: inner secondary mass not in allowed range [ < ', absolute_max_mass, ']'. absolute_max_mass settable in tres.options") if (outer_mass_max > absolute_max_mass) : - sys.exit("'error: outer mass not in allowed range [ < ', absolute_max_mass, ']'. absolute_max_mass settable in TRES_options.py") + sys.exit("'error: outer mass not in allowed range [ < ', absolute_max_mass, ']'. absolute_max_mass settable in tres.options") if (inner_secondary_mass_min < absolute_min_mass) : - sys.exit("'error: inner secondary mass not in allowed range [ >', absolute_min_mass, ']'. absolute_min_mass settable in TRES_options.py") + sys.exit("'error: inner secondary mass not in allowed range [ >', absolute_min_mass, ']'. absolute_min_mass settable in tres.options") if (outer_mass_min < absolute_min_mass) : - sys.exit("'error: outer mass not in allowed range [>', absolute_min_mass, ']'. absolute_min_mass settable in TRES_options.py") + sys.exit("'error: outer mass not in allowed range [>', absolute_min_mass, ']'. absolute_min_mass settable in tres.options") if (inner_primary_mass_max < inner_primary_mass_min): sys.exit('error: maximum inner primary mass smaller than minimum in primary mass') diff --git a/src/tres/triple_class.py b/src/tres/triple_class.py index be2e026..72da6b8 100644 --- a/src/tres/triple_class.py +++ b/src/tres/triple_class.py @@ -1,5 +1,5 @@ -from interactions import * -from tidal_friction_constant import * +from tres.interactions import * +from tres.tidal_friction_constant import * import sys import time @@ -24,9 +24,9 @@ # maximum_time_step_factor, \ # minimum_time_step -from TRES_options import * -from TRES_setup import setup_secular_code, setup_stellar_code -from TRES_plotting import plot_data_container +from tres.options import * +from tres.setup import setup_secular_code, setup_stellar_code +from tres.plotting import plot_data_container class Triple_Class: From ad517286bfcf0304db42af4e8ccf6825ffb47094 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 26 Mar 2025 17:46:00 +0100 Subject: [PATCH 04/13] Add pyproject.toml file for packaging TRES --- pyproject.toml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 pyproject.toml diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..04b4da9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,35 @@ +[build-system] +requires = ["setuptools >= 75.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "TRES" +version = "2025.03.0" +# dynamic = ["version"] +dependencies = [ + "numpy >= 1.24.3, <3", + "matplotlib >= 3.7.1, <4", + "scipy >= 1.9.0, <1.14", + "astropy >= 5.0, <7", + # "amuse-framework >= 2024", + # "amuse-seba >= 2024", +] +requires-python = ">= 3.8" +authors = [ + {name = "Silvia Toonen", email = "s.g.m.toonen@uva.nl"}, +] +description = "TRES" +readme = {file = "README.md", content-type = "text/markdown"} +license = {file = "LICENSE"} +keywords = ["astrophysics"] + +[project.urls] +Issues = "https://github.com/amusecode/TRES/issues" +Repository = "https://github.com/amusecode/TRES" + +[tool.pylint] +max-line-length = 120 + +[tool.black] +line-length = 120 +target-version = ["py38"] From 3d10074e440a5219ff72c4510b18f489405d3c72 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 26 Mar 2025 17:55:24 +0100 Subject: [PATCH 05/13] move seculartriple into package structure --- {seculartriple_TPS => src/tres/seculartriple}/Makefile | 0 {seculartriple_TPS => src/tres/seculartriple}/Makefile_old | 0 {seculartriple_TPS => src/tres/seculartriple}/__init__.py | 0 {seculartriple_TPS => src/tres/seculartriple}/interface.py | 0 {seculartriple_TPS => src/tres/seculartriple}/src/ODE_system.c | 0 {seculartriple_TPS => src/tres/seculartriple}/src/ODE_system.h | 0 {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode.c | 0 {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode.h | 0 .../tres/seculartriple}/src/cvode/cvode_band.c | 0 .../tres/seculartriple}/src/cvode/cvode_band.h | 0 .../tres/seculartriple}/src/cvode/cvode_bandpre.h | 0 .../tres/seculartriple}/src/cvode/cvode_dense.c | 0 .../tres/seculartriple}/src/cvode/cvode_dense.h | 0 .../tres/seculartriple}/src/cvode/cvode_diag.c | 0 .../tres/seculartriple}/src/cvode/cvode_diag.h | 0 .../tres/seculartriple}/src/cvode/cvode_diag_impl.h | 0 .../tres/seculartriple}/src/cvode/cvode_direct.c | 0 .../tres/seculartriple}/src/cvode/cvode_direct.h | 0 .../tres/seculartriple}/src/cvode/cvode_direct_impl.h | 0 .../tres/seculartriple}/src/cvode/cvode_impl.h | 0 .../tres/seculartriple}/src/cvode/cvode_io.c | 0 .../tres/seculartriple}/src/cvode/cvode_spbcgs.c | 0 .../tres/seculartriple}/src/cvode/cvode_spbcgs.h | 0 .../tres/seculartriple}/src/cvode/cvode_spgmr.c | 0 .../tres/seculartriple}/src/cvode/cvode_spgmr.h | 0 .../tres/seculartriple}/src/cvode/cvode_spils.c | 0 .../tres/seculartriple}/src/cvode/cvode_spils.h | 0 .../tres/seculartriple}/src/cvode/cvode_spils_impl.h | 0 .../tres/seculartriple}/src/cvode/cvode_sptfqmr.c | 0 .../tres/seculartriple}/src/cvode/cvode_sptfqmr.h | 0 .../tres/seculartriple}/src/cvode/nvector_serial.c | 0 .../tres/seculartriple}/src/cvode/nvector_serial.h | 0 .../tres/seculartriple}/src/cvode/sundials_band.c | 0 .../tres/seculartriple}/src/cvode/sundials_band.h | 0 .../tres/seculartriple}/src/cvode/sundials_config.h | 0 .../tres/seculartriple}/src/cvode/sundials_dense.c | 0 .../tres/seculartriple}/src/cvode/sundials_dense.h | 0 .../tres/seculartriple}/src/cvode/sundials_direct.c | 0 .../tres/seculartriple}/src/cvode/sundials_direct.h | 0 .../tres/seculartriple}/src/cvode/sundials_iterative.c | 0 .../tres/seculartriple}/src/cvode/sundials_iterative.h | 0 .../tres/seculartriple}/src/cvode/sundials_math.c | 0 .../tres/seculartriple}/src/cvode/sundials_math.h | 0 .../tres/seculartriple}/src/cvode/sundials_nvector.c | 0 .../tres/seculartriple}/src/cvode/sundials_nvector.h | 0 .../tres/seculartriple}/src/cvode/sundials_spbcgs.c | 0 .../tres/seculartriple}/src/cvode/sundials_spbcgs.h | 0 .../tres/seculartriple}/src/cvode/sundials_spgmr.c | 0 .../tres/seculartriple}/src/cvode/sundials_spgmr.h | 0 .../tres/seculartriple}/src/cvode/sundials_sptfqmr.c | 0 .../tres/seculartriple}/src/cvode/sundials_sptfqmr.h | 0 .../tres/seculartriple}/src/cvode/sundials_types.h | 0 .../tres/seculartriple}/src/helper_routines.c | 0 .../tres/seculartriple}/src/helper_routines.h | 0 {seculartriple_TPS => src/tres/seculartriple}/src/main_code.c | 0 {seculartriple_TPS => src/tres/seculartriple}/src/main_code.h | 0 .../tres/seculartriple}/src/tidal_friction_parameters.c | 0 .../tres/seculartriple}/src/tidal_friction_parameters.h | 0 .../tres/seculartriple}/tidal_friction_constant.py | 0 59 files changed, 0 insertions(+), 0 deletions(-) rename {seculartriple_TPS => src/tres/seculartriple}/Makefile (100%) rename {seculartriple_TPS => src/tres/seculartriple}/Makefile_old (100%) rename {seculartriple_TPS => src/tres/seculartriple}/__init__.py (100%) rename {seculartriple_TPS => src/tres/seculartriple}/interface.py (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/ODE_system.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/ODE_system.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_band.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_band.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_bandpre.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_dense.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_dense.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_diag.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_diag.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_diag_impl.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_direct.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_direct.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_direct_impl.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_impl.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_io.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_spbcgs.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_spbcgs.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_spgmr.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_spgmr.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_spils.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_spils.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_spils_impl.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_sptfqmr.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/cvode_sptfqmr.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/nvector_serial.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/nvector_serial.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_band.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_band.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_config.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_dense.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_dense.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_direct.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_direct.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_iterative.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_iterative.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_math.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_math.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_nvector.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_nvector.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_spbcgs.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_spbcgs.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_spgmr.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_spgmr.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_sptfqmr.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_sptfqmr.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/cvode/sundials_types.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/helper_routines.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/helper_routines.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/main_code.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/main_code.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/tidal_friction_parameters.c (100%) rename {seculartriple_TPS => src/tres/seculartriple}/src/tidal_friction_parameters.h (100%) rename {seculartriple_TPS => src/tres/seculartriple}/tidal_friction_constant.py (100%) diff --git a/seculartriple_TPS/Makefile b/src/tres/seculartriple/Makefile similarity index 100% rename from seculartriple_TPS/Makefile rename to src/tres/seculartriple/Makefile diff --git a/seculartriple_TPS/Makefile_old b/src/tres/seculartriple/Makefile_old similarity index 100% rename from seculartriple_TPS/Makefile_old rename to src/tres/seculartriple/Makefile_old diff --git a/seculartriple_TPS/__init__.py b/src/tres/seculartriple/__init__.py similarity index 100% rename from seculartriple_TPS/__init__.py rename to src/tres/seculartriple/__init__.py diff --git a/seculartriple_TPS/interface.py b/src/tres/seculartriple/interface.py similarity index 100% rename from seculartriple_TPS/interface.py rename to src/tres/seculartriple/interface.py diff --git a/seculartriple_TPS/src/ODE_system.c b/src/tres/seculartriple/src/ODE_system.c similarity index 100% rename from seculartriple_TPS/src/ODE_system.c rename to src/tres/seculartriple/src/ODE_system.c diff --git a/seculartriple_TPS/src/ODE_system.h b/src/tres/seculartriple/src/ODE_system.h similarity index 100% rename from seculartriple_TPS/src/ODE_system.h rename to src/tres/seculartriple/src/ODE_system.h diff --git a/seculartriple_TPS/src/cvode/cvode.c b/src/tres/seculartriple/src/cvode/cvode.c similarity index 100% rename from seculartriple_TPS/src/cvode/cvode.c rename to src/tres/seculartriple/src/cvode/cvode.c diff --git a/seculartriple_TPS/src/cvode/cvode.h b/src/tres/seculartriple/src/cvode/cvode.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode.h rename to src/tres/seculartriple/src/cvode/cvode.h diff --git a/seculartriple_TPS/src/cvode/cvode_band.c b/src/tres/seculartriple/src/cvode/cvode_band.c similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_band.c rename to src/tres/seculartriple/src/cvode/cvode_band.c diff --git a/seculartriple_TPS/src/cvode/cvode_band.h b/src/tres/seculartriple/src/cvode/cvode_band.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_band.h rename to src/tres/seculartriple/src/cvode/cvode_band.h diff --git a/seculartriple_TPS/src/cvode/cvode_bandpre.h b/src/tres/seculartriple/src/cvode/cvode_bandpre.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_bandpre.h rename to src/tres/seculartriple/src/cvode/cvode_bandpre.h diff --git a/seculartriple_TPS/src/cvode/cvode_dense.c b/src/tres/seculartriple/src/cvode/cvode_dense.c similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_dense.c rename to src/tres/seculartriple/src/cvode/cvode_dense.c diff --git a/seculartriple_TPS/src/cvode/cvode_dense.h b/src/tres/seculartriple/src/cvode/cvode_dense.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_dense.h rename to src/tres/seculartriple/src/cvode/cvode_dense.h diff --git a/seculartriple_TPS/src/cvode/cvode_diag.c b/src/tres/seculartriple/src/cvode/cvode_diag.c similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_diag.c rename to src/tres/seculartriple/src/cvode/cvode_diag.c diff --git a/seculartriple_TPS/src/cvode/cvode_diag.h b/src/tres/seculartriple/src/cvode/cvode_diag.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_diag.h rename to src/tres/seculartriple/src/cvode/cvode_diag.h diff --git a/seculartriple_TPS/src/cvode/cvode_diag_impl.h b/src/tres/seculartriple/src/cvode/cvode_diag_impl.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_diag_impl.h rename to src/tres/seculartriple/src/cvode/cvode_diag_impl.h diff --git a/seculartriple_TPS/src/cvode/cvode_direct.c b/src/tres/seculartriple/src/cvode/cvode_direct.c similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_direct.c rename to src/tres/seculartriple/src/cvode/cvode_direct.c diff --git a/seculartriple_TPS/src/cvode/cvode_direct.h b/src/tres/seculartriple/src/cvode/cvode_direct.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_direct.h rename to src/tres/seculartriple/src/cvode/cvode_direct.h diff --git a/seculartriple_TPS/src/cvode/cvode_direct_impl.h b/src/tres/seculartriple/src/cvode/cvode_direct_impl.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_direct_impl.h rename to src/tres/seculartriple/src/cvode/cvode_direct_impl.h diff --git a/seculartriple_TPS/src/cvode/cvode_impl.h b/src/tres/seculartriple/src/cvode/cvode_impl.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_impl.h rename to src/tres/seculartriple/src/cvode/cvode_impl.h diff --git a/seculartriple_TPS/src/cvode/cvode_io.c b/src/tres/seculartriple/src/cvode/cvode_io.c similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_io.c rename to src/tres/seculartriple/src/cvode/cvode_io.c diff --git a/seculartriple_TPS/src/cvode/cvode_spbcgs.c b/src/tres/seculartriple/src/cvode/cvode_spbcgs.c similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_spbcgs.c rename to src/tres/seculartriple/src/cvode/cvode_spbcgs.c diff --git a/seculartriple_TPS/src/cvode/cvode_spbcgs.h b/src/tres/seculartriple/src/cvode/cvode_spbcgs.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_spbcgs.h rename to src/tres/seculartriple/src/cvode/cvode_spbcgs.h diff --git a/seculartriple_TPS/src/cvode/cvode_spgmr.c b/src/tres/seculartriple/src/cvode/cvode_spgmr.c similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_spgmr.c rename to src/tres/seculartriple/src/cvode/cvode_spgmr.c diff --git a/seculartriple_TPS/src/cvode/cvode_spgmr.h b/src/tres/seculartriple/src/cvode/cvode_spgmr.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_spgmr.h rename to src/tres/seculartriple/src/cvode/cvode_spgmr.h diff --git a/seculartriple_TPS/src/cvode/cvode_spils.c b/src/tres/seculartriple/src/cvode/cvode_spils.c similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_spils.c rename to src/tres/seculartriple/src/cvode/cvode_spils.c diff --git a/seculartriple_TPS/src/cvode/cvode_spils.h b/src/tres/seculartriple/src/cvode/cvode_spils.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_spils.h rename to src/tres/seculartriple/src/cvode/cvode_spils.h diff --git a/seculartriple_TPS/src/cvode/cvode_spils_impl.h b/src/tres/seculartriple/src/cvode/cvode_spils_impl.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_spils_impl.h rename to src/tres/seculartriple/src/cvode/cvode_spils_impl.h diff --git a/seculartriple_TPS/src/cvode/cvode_sptfqmr.c b/src/tres/seculartriple/src/cvode/cvode_sptfqmr.c similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_sptfqmr.c rename to src/tres/seculartriple/src/cvode/cvode_sptfqmr.c diff --git a/seculartriple_TPS/src/cvode/cvode_sptfqmr.h b/src/tres/seculartriple/src/cvode/cvode_sptfqmr.h similarity index 100% rename from seculartriple_TPS/src/cvode/cvode_sptfqmr.h rename to src/tres/seculartriple/src/cvode/cvode_sptfqmr.h diff --git a/seculartriple_TPS/src/cvode/nvector_serial.c b/src/tres/seculartriple/src/cvode/nvector_serial.c similarity index 100% rename from seculartriple_TPS/src/cvode/nvector_serial.c rename to src/tres/seculartriple/src/cvode/nvector_serial.c diff --git a/seculartriple_TPS/src/cvode/nvector_serial.h b/src/tres/seculartriple/src/cvode/nvector_serial.h similarity index 100% rename from seculartriple_TPS/src/cvode/nvector_serial.h rename to src/tres/seculartriple/src/cvode/nvector_serial.h diff --git a/seculartriple_TPS/src/cvode/sundials_band.c b/src/tres/seculartriple/src/cvode/sundials_band.c similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_band.c rename to src/tres/seculartriple/src/cvode/sundials_band.c diff --git a/seculartriple_TPS/src/cvode/sundials_band.h b/src/tres/seculartriple/src/cvode/sundials_band.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_band.h rename to src/tres/seculartriple/src/cvode/sundials_band.h diff --git a/seculartriple_TPS/src/cvode/sundials_config.h b/src/tres/seculartriple/src/cvode/sundials_config.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_config.h rename to src/tres/seculartriple/src/cvode/sundials_config.h diff --git a/seculartriple_TPS/src/cvode/sundials_dense.c b/src/tres/seculartriple/src/cvode/sundials_dense.c similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_dense.c rename to src/tres/seculartriple/src/cvode/sundials_dense.c diff --git a/seculartriple_TPS/src/cvode/sundials_dense.h b/src/tres/seculartriple/src/cvode/sundials_dense.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_dense.h rename to src/tres/seculartriple/src/cvode/sundials_dense.h diff --git a/seculartriple_TPS/src/cvode/sundials_direct.c b/src/tres/seculartriple/src/cvode/sundials_direct.c similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_direct.c rename to src/tres/seculartriple/src/cvode/sundials_direct.c diff --git a/seculartriple_TPS/src/cvode/sundials_direct.h b/src/tres/seculartriple/src/cvode/sundials_direct.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_direct.h rename to src/tres/seculartriple/src/cvode/sundials_direct.h diff --git a/seculartriple_TPS/src/cvode/sundials_iterative.c b/src/tres/seculartriple/src/cvode/sundials_iterative.c similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_iterative.c rename to src/tres/seculartriple/src/cvode/sundials_iterative.c diff --git a/seculartriple_TPS/src/cvode/sundials_iterative.h b/src/tres/seculartriple/src/cvode/sundials_iterative.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_iterative.h rename to src/tres/seculartriple/src/cvode/sundials_iterative.h diff --git a/seculartriple_TPS/src/cvode/sundials_math.c b/src/tres/seculartriple/src/cvode/sundials_math.c similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_math.c rename to src/tres/seculartriple/src/cvode/sundials_math.c diff --git a/seculartriple_TPS/src/cvode/sundials_math.h b/src/tres/seculartriple/src/cvode/sundials_math.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_math.h rename to src/tres/seculartriple/src/cvode/sundials_math.h diff --git a/seculartriple_TPS/src/cvode/sundials_nvector.c b/src/tres/seculartriple/src/cvode/sundials_nvector.c similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_nvector.c rename to src/tres/seculartriple/src/cvode/sundials_nvector.c diff --git a/seculartriple_TPS/src/cvode/sundials_nvector.h b/src/tres/seculartriple/src/cvode/sundials_nvector.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_nvector.h rename to src/tres/seculartriple/src/cvode/sundials_nvector.h diff --git a/seculartriple_TPS/src/cvode/sundials_spbcgs.c b/src/tres/seculartriple/src/cvode/sundials_spbcgs.c similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_spbcgs.c rename to src/tres/seculartriple/src/cvode/sundials_spbcgs.c diff --git a/seculartriple_TPS/src/cvode/sundials_spbcgs.h b/src/tres/seculartriple/src/cvode/sundials_spbcgs.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_spbcgs.h rename to src/tres/seculartriple/src/cvode/sundials_spbcgs.h diff --git a/seculartriple_TPS/src/cvode/sundials_spgmr.c b/src/tres/seculartriple/src/cvode/sundials_spgmr.c similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_spgmr.c rename to src/tres/seculartriple/src/cvode/sundials_spgmr.c diff --git a/seculartriple_TPS/src/cvode/sundials_spgmr.h b/src/tres/seculartriple/src/cvode/sundials_spgmr.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_spgmr.h rename to src/tres/seculartriple/src/cvode/sundials_spgmr.h diff --git a/seculartriple_TPS/src/cvode/sundials_sptfqmr.c b/src/tres/seculartriple/src/cvode/sundials_sptfqmr.c similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_sptfqmr.c rename to src/tres/seculartriple/src/cvode/sundials_sptfqmr.c diff --git a/seculartriple_TPS/src/cvode/sundials_sptfqmr.h b/src/tres/seculartriple/src/cvode/sundials_sptfqmr.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_sptfqmr.h rename to src/tres/seculartriple/src/cvode/sundials_sptfqmr.h diff --git a/seculartriple_TPS/src/cvode/sundials_types.h b/src/tres/seculartriple/src/cvode/sundials_types.h similarity index 100% rename from seculartriple_TPS/src/cvode/sundials_types.h rename to src/tres/seculartriple/src/cvode/sundials_types.h diff --git a/seculartriple_TPS/src/helper_routines.c b/src/tres/seculartriple/src/helper_routines.c similarity index 100% rename from seculartriple_TPS/src/helper_routines.c rename to src/tres/seculartriple/src/helper_routines.c diff --git a/seculartriple_TPS/src/helper_routines.h b/src/tres/seculartriple/src/helper_routines.h similarity index 100% rename from seculartriple_TPS/src/helper_routines.h rename to src/tres/seculartriple/src/helper_routines.h diff --git a/seculartriple_TPS/src/main_code.c b/src/tres/seculartriple/src/main_code.c similarity index 100% rename from seculartriple_TPS/src/main_code.c rename to src/tres/seculartriple/src/main_code.c diff --git a/seculartriple_TPS/src/main_code.h b/src/tres/seculartriple/src/main_code.h similarity index 100% rename from seculartriple_TPS/src/main_code.h rename to src/tres/seculartriple/src/main_code.h diff --git a/seculartriple_TPS/src/tidal_friction_parameters.c b/src/tres/seculartriple/src/tidal_friction_parameters.c similarity index 100% rename from seculartriple_TPS/src/tidal_friction_parameters.c rename to src/tres/seculartriple/src/tidal_friction_parameters.c diff --git a/seculartriple_TPS/src/tidal_friction_parameters.h b/src/tres/seculartriple/src/tidal_friction_parameters.h similarity index 100% rename from seculartriple_TPS/src/tidal_friction_parameters.h rename to src/tres/seculartriple/src/tidal_friction_parameters.h diff --git a/seculartriple_TPS/tidal_friction_constant.py b/src/tres/seculartriple/tidal_friction_constant.py similarity index 100% rename from seculartriple_TPS/tidal_friction_constant.py rename to src/tres/seculartriple/tidal_friction_constant.py From d2fc41909cccd7da1d4466154abb770b6a4b4a1f Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 26 Mar 2025 17:59:58 +0100 Subject: [PATCH 06/13] Update SecularTriple imports --- src/tres/setup.py | 3 ++- src/tres/tps.py | 4 ++-- src/tres/tres.py | 14 +++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/tres/setup.py b/src/tres/setup.py index a972b47..7eefeb3 100644 --- a/src/tres/setup.py +++ b/src/tres/setup.py @@ -1,7 +1,8 @@ from amuse.community.seba.interface import SeBa from amuse.datamodel import Particles from amuse.units import units -from seculartriple_TPS.interface import SecularTriple + +from tres.seculartriple import Seculartriple from tres.options import max_mass, absolute_min_mass, options_mesa, REPORT_USER_WARNINGS diff --git a/src/tres/tps.py b/src/tres/tps.py index e91ecbd..4594842 100644 --- a/src/tres/tps.py +++ b/src/tres/tps.py @@ -126,9 +126,9 @@ from tres import run_tres from amuse.community.seba.interface import SeBa -from seculartriple_TPS.interface import SecularTriple +from tres.seculartriple import Seculartriple -secular_code = SecularTriple() +secular_code = Seculartriple() import sys from amuse.units.optparse import OptionParser from amuse.units import units, constants diff --git a/src/tres/tres.py b/src/tres/tres.py index f9c45a9..77e9264 100644 --- a/src/tres/tres.py +++ b/src/tres/tres.py @@ -24,7 +24,7 @@ from amuse.community.mesa.interface import Mesa except ImportError: Mesa = None -from seculartriple_TPS.interface import SecularTriple +from tres.seculartriple import Seculartriple from tres.triple_class import Triple_Class @@ -126,9 +126,9 @@ def run_tres(inner_primary_mass = 1.3|units.MSun, inner_secondary_mass = 0.5|uni stellar_code.parameters.metallicity = metallicity if secular_code is None: - secular_code = SecularTriple() - # secular_code = SecularTriple(redirection='none') - # secular_code = SecularTriple(redirection='file', redirect_file='output_SecularTriple_TRES.txt') + secular_code = Seculartriple() + # secular_code = Seculartriple(redirection='none') + # secular_code = Seculartriple(redirection='file', redirect_file='output_SecularTriple_TRES.txt') clean_up_secular_code = True triple_class_object = Triple_Class(stars, bins, correct_params, stellar_code, secular_code, @@ -417,9 +417,9 @@ def parse_arguments(): # stellar_code = SeBa(redirection='file', redirect_file='output_SeBa_TRES.txt') stellar_code.parameters.metallicity = opt["metallicity"] - secular_code = SecularTriple() -# secular_code = SecularTriple(redirection='none') -# secular_code = SecularTriple(redirection='file', redirect_file='output_SecularTriple_TRES.txt') + secular_code = Seculartriple() +# secular_code = Seculartriple(redirection='none') +# secular_code = Seculartriple(redirection='file', redirect_file='output_SecularTriple_TRES.txt') triple_class_object = Triple_Class(stars, bins, correct_params, stellar_code, secular_code, opt["relative_inclination"], opt["tend"], opt["tinit"], From 4d6f1b011548c71c8585378e4883325357660cbc Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 26 Mar 2025 18:02:06 +0100 Subject: [PATCH 07/13] Add default AMUSE-style class name and import --- src/tres/seculartriple/__init__.py | 1 + src/tres/seculartriple/interface.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/tres/seculartriple/__init__.py b/src/tres/seculartriple/__init__.py index e69de29..4d10e0c 100644 --- a/src/tres/seculartriple/__init__.py +++ b/src/tres/seculartriple/__init__.py @@ -0,0 +1 @@ +from .interface import Seculartriple diff --git a/src/tres/seculartriple/interface.py b/src/tres/seculartriple/interface.py index 71d4eb8..69d258a 100644 --- a/src/tres/seculartriple/interface.py +++ b/src/tres/seculartriple/interface.py @@ -2311,3 +2311,6 @@ def extract_data_and_give_args(self,triple,inner_binary,outer_binary,star1,star2 self.model_time,self.time_step] ### NOTE: only time_step is used at the moment return args,skip_integration + + +Seculartriple = SecularTriple From 2d3ab2e9f34bf61473f5b659ec0b89df9a8e381b Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 26 Mar 2025 18:05:12 +0100 Subject: [PATCH 08/13] add fast imports --- src/tres/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tres/__init__.py b/src/tres/__init__.py index e69de29..93bc606 100644 --- a/src/tres/__init__.py +++ b/src/tres/__init__.py @@ -0,0 +1,2 @@ +from .tres import run_tres, run_tres_developer +from .tres import initialize_triple_class From 112d0de0cca01c4e04ddf81acafc1c9fbf84ee9a Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Wed, 26 Mar 2025 18:33:16 +0100 Subject: [PATCH 09/13] Update TRES examples --- example/example_template.ipynb | 35 +-- example/examples_TRES_AMUSE_book.py | 411 ++++++++++++++-------------- example/minimal_example.ipynb | 285 ++----------------- src/tres/__init__.py | 2 + 4 files changed, 250 insertions(+), 483 deletions(-) diff --git a/example/example_template.ipynb b/example/example_template.ipynb index 46283ba..199be69 100644 --- a/example/example_template.ipynb +++ b/example/example_template.ipynb @@ -10,18 +10,6 @@ "%autoreload 3" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# Add TRES to path\n", - "\n", - "import sys\n", - "sys.path.append(\"..\")" - ] - }, { "cell_type": "code", "execution_count": null, @@ -29,28 +17,35 @@ "outputs": [], "source": [ "from amuse.units import units\n", - "from amuse.community.seba.interface import SeBa\n", - "from seculartriple_TPS.interface import SecularTriple\n", + "from amuse.community.seba import Seba\n", + "from tres.seculartriple import Seculartriple\n", "\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", - "from TRES import main_developer\n", - "from tres_setup import make_particle_sets" + "from tres import run_tres_developer\n", + "from tres.setup import make_particle_sets" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3.10.6 ('amuse-tres-PsQP0NBr-py3.10')", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", "name": "python", - "version": "3.10.6" + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.1" }, - "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "2adc4102d3c5cc3c27614a3ecc3c3c429cb40eb1d735b73fcbb59a415fcc6b30" @@ -58,5 +53,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/example/examples_TRES_AMUSE_book.py b/example/examples_TRES_AMUSE_book.py index e66f4dc..d3fb750 100644 --- a/example/examples_TRES_AMUSE_book.py +++ b/example/examples_TRES_AMUSE_book.py @@ -1,15 +1,16 @@ +import sys, os + import numpy as np -import matplotlib.pyplot as plt +import matplotlib.pyplot as plt from amuse.datamodel import Particles from amuse.units import units -from amuse.community.seba.interface import SeBa - -import sys, os -sys.path.append(os.path.dirname(os.getcwd())) -import TRES as TRES -from seculartriple_TPS.interface import SecularTriple - - +from amuse.community.seba import Seba + +import tres +from tres import run_tres, run_tres_developer +from tres.seculartriple import Seculartriple + + bin_type = { 'all': -1, 'unknown': 0, 'merger': 1, @@ -26,13 +27,13 @@ 'common_envelope_energy_balance': 12, 'common_envelope_angular_momentum_balance': 13, 'double_common_envelope': 14, - } + } #simplest way of running TRES def example_1(): - print('TRES example 1') - tr = TRES.main() + print('TRES example 1') + tr = run_tres() print(tr.triple.eccentricity, tr.triple.child2.eccentricity) tr.stellar_code.stop() @@ -51,7 +52,7 @@ def example_1(): #possible stopping conditions: #stop_at_mass_transfer, stop_at_init_mass_transfer,stop_at_outer_mass_transfer, #stop_at_stable_mass_transfer, stop_at_eccentric_stable_mass_transfer, -#stop_at_unstable_mass_transfer, stop_at_eccentric_unstable_mass_transfer, +#stop_at_unstable_mass_transfer, stop_at_eccentric_unstable_mass_transfer, #stop_at_no_CHE, include_CHE, #stop_at_merger, stop_at_disintegrated, #stop_at_inner_collision, stop_at_outer_collision, @@ -66,9 +67,9 @@ def example_1(): #stop_at_CPU_time, #max_CPU_time, #file_name, file_type, dir_plots - + def example_2(): - print('TRES example 2') + print('TRES example 2') M1 = 1.5|units.MSun M2 = 0.6|units.MSun @@ -77,9 +78,9 @@ def example_2(): aout = 15000|units.RSun incl = 81.0*np.pi/180.0 - tr = TRES.main(inner_primary_mass = M1, inner_secondary_mass = M2, outer_mass = M3, - inner_semimajor_axis = ain, outer_semimajor_axis = aout, relative_inclination = incl) - print('final outer eccentricity: ', tr.triple.eccentricity) + tr = run_tres(inner_primary_mass = M1, inner_secondary_mass = M2, outer_mass = M3, + inner_semimajor_axis = ain, outer_semimajor_axis = aout, relative_inclination = incl) + print('final outer eccentricity: ', tr.triple.eccentricity) print('final inner eccentricity: ', tr.triple.child2.eccentricity) tr.stellar_code.stop() @@ -89,8 +90,8 @@ def example_2(): # example of Kozai-Lidov cycles in a triple with plotting # advanced level # uses TRES.main_developer() in stead of TRES.main() -def example_3(): - print('TRES example 3') +def example_3(): + print('TRES example 3') M1 = 1.3|units.MSun M2 = 0.5|units.MSun @@ -105,53 +106,53 @@ def example_3(): Oin = 0. metallicity = 0.02 - stars, bins, correct_params = TRES.make_particle_sets(M1,M2,M3, Ain, Aout, Ein, Eout, incl, Gin, Gout, Oin) + stars, bins, correct_params = tres.make_particle_sets(M1,M2,M3, Ain, Aout, Ein, Eout, incl, Gin, Gout, Oin) - stellar_code = SeBa() + stellar_code = Seba() stellar_code.parameters.metallicity = metallicity # stellar_code.particles.add_particles(stars) - secular_code = SecularTriple() - + secular_code = Seculartriple() + inner_eccentricity_array = [] - outer_eccentricity_array = [] - n_steps = 150 + outer_eccentricity_array = [] + n_steps = 150 time_array = (np.arange(n_steps)+1)*5|units.Myr/n_steps - - #make triple object and evolve for small timestep + + #make triple object and evolve for small timestep #needs to be bigger then 1e-4|units.Myr for secular code - tr = TRES.main_developer(stars, bins, correct_params, stellar_code, secular_code, incl, tend=1e-4|units.Myr) - - for i in range(len(time_array)): - tr.evolve_model(time_array[i]) - inner_eccentricity_array.append(tr.triple.child2.eccentricity) - outer_eccentricity_array.append(tr.triple.eccentricity) - - if tr.check_stopping_conditions()==False or tr.check_stopping_conditions_stellar()==False or tr.check_stopping_conditions_stellar_interaction()==False: - print('stopping conditions reached') - time_array = time_array[:len(inner_eccentricity_axis_array)] - time_array[-1] = tr.triple.time - break - - plt.plot(time_array.value_in(units.Myr), inner_eccentricity_array, label='inner eccentricity') - plt.plot(time_array.value_in(units.Myr), outer_eccentricity_array, label='outer eccentricity') - plt.plot(time_array.value_in(units.Myr), inner_eccentricity_array, 'k.') - plt.xlabel('time (Myr)') - plt.ylabel('eccentricity') - plt.legend(loc=0) - plt.show() + tr = run_tres_developer(stars, bins, correct_params, stellar_code, secular_code, incl, tend=1e-4|units.Myr) + + for i in range(len(time_array)): + tr.evolve_model(time_array[i]) + inner_eccentricity_array.append(tr.triple.child2.eccentricity) + outer_eccentricity_array.append(tr.triple.eccentricity) + + if tr.check_stopping_conditions()==False or tr.check_stopping_conditions_stellar()==False or tr.check_stopping_conditions_stellar_interaction()==False: + print('stopping conditions reached') + time_array = time_array[:len(inner_eccentricity_axis_array)] + time_array[-1] = tr.triple.time + break + + plt.plot(time_array.value_in(units.Myr), inner_eccentricity_array, label='inner eccentricity') + plt.plot(time_array.value_in(units.Myr), outer_eccentricity_array, label='outer eccentricity') + plt.plot(time_array.value_in(units.Myr), inner_eccentricity_array, 'k.') + plt.xlabel('time (Myr)') + plt.ylabel('eccentricity') + plt.legend(loc=0) + plt.show() tr.stellar_code.stop() tr.secular_code.stop() - - - - -# example of triple with wind mass loss leading to dynamical instability with plotting + + + + +# example of triple with wind mass loss leading to dynamical instability with plotting # advanced level # uses TRES.main_developer() in stead of TRES.main() -def example_4(): - print('TRES example 4') +def example_4(): + print('TRES example 4') M1 = 3.|units.MSun M2 = 0.5|units.MSun @@ -160,80 +161,80 @@ def example_4(): Aout = 6600|units.RSun Ein = 0.0 Eout = 0.5 - incl = 0.0 + incl = 0.0 Gin = 0.1 Gout = 0.5 Oin = 0. metallicity = 0.02 - stars, bins, correct_params = TRES.make_particle_sets(M1,M2,M3, Ain, Aout, Ein, Eout, incl, Gin, Gout, Oin) + stars, bins, correct_params = tres.make_particle_sets(M1,M2,M3, Ain, Aout, Ein, Eout, incl, Gin, Gout, Oin) - stellar_code = SeBa() + stellar_code = Seba() stellar_code.parameters.metallicity = metallicity # stellar_code.particles.add_particles(stars) - secular_code = SecularTriple() - + secular_code = Seculartriple() + inner_semimajor_axis_array = np.array([]) - outer_semimajor_axis_array = np.array([]) - mass_primary_array = np.array([]) - - time_array = (np.arange(25)+1)/25.*370 - time_array = np.append(time_array, (np.arange(100)+1)/100.*100 + 370) - time_array = np.append(time_array, (np.arange(100)+1)/100.*10 + 470) - time_array = time_array|units.Myr - - #make triple object and evolve for small timestep + outer_semimajor_axis_array = np.array([]) + mass_primary_array = np.array([]) + + time_array = (np.arange(25)+1)/25.*370 + time_array = np.append(time_array, (np.arange(100)+1)/100.*100 + 370) + time_array = np.append(time_array, (np.arange(100)+1)/100.*10 + 470) + time_array = time_array|units.Myr + + #make triple object and evolve for small timestep #needs to be bigger then 1e-4|units.Myr for secular code - tr = TRES.main_developer(stars, bins, correct_params, stellar_code, secular_code, incl, tend=1e-4|units.Myr) - - for i in range(len(time_array)): - tr.evolve_model(time_array[i]) - inner_semimajor_axis_array = np.append(inner_semimajor_axis_array, tr.triple.child2.semimajor_axis.value_in(units.RSun)) - outer_semimajor_axis_array = np.append(outer_semimajor_axis_array, tr.triple.semimajor_axis.value_in(units.RSun)) - mass_primary_array = np.append(mass_primary_array, tr.triple.child2.child1.mass.value_in(units.MSun)) - - if tr.check_stopping_conditions()==False or tr.check_stopping_conditions_stellar()==False or tr.check_stopping_conditions_stellar_interaction()==False: - print('stopping conditions reached') - time_array = time_array[:len(inner_semimajor_axis_array)] - time_array[-1] = tr.triple.time - break - - plt.plot(time_array.value_in(units.Myr), mass_primary_array, label='primary mass') - plt.xlabel('time (Myr)') - plt.ylabel('mass (MSun)') - plt.legend(loc=0) - plt.show() - - plt.semilogy(time_array.value_in(units.Myr), inner_semimajor_axis_array, label='inner semimajor axis') - plt.xlabel('time (Myr)') - plt.ylabel('outer semimajor axis (RSun)') - plt.show() - - plt.xlabel('time (Myr)') - plt.ylabel('inner semimajor axis (RSun)') - plt.semilogy(time_array.value_in(units.Myr), outer_semimajor_axis_array, label='outer semimajor axis') - plt.show() - - plt.plot(time_array.value_in(units.Myr), outer_semimajor_axis_array/inner_semimajor_axis_array) - plt.plot(time_array.value_in(units.Myr)[-1], outer_semimajor_axis_array[-1]/inner_semimajor_axis_array[-1], label='dynamical instability') - plt.xlabel('time (Myr)') - plt.ylabel('ratio of outer vs inner semimajor axis') - plt.legend(loc=0) - plt.show() - + tr = run_tres_developer(stars, bins, correct_params, stellar_code, secular_code, incl, tend=1e-4|units.Myr) + + for i in range(len(time_array)): + tr.evolve_model(time_array[i]) + inner_semimajor_axis_array = np.append(inner_semimajor_axis_array, tr.triple.child2.semimajor_axis.value_in(units.RSun)) + outer_semimajor_axis_array = np.append(outer_semimajor_axis_array, tr.triple.semimajor_axis.value_in(units.RSun)) + mass_primary_array = np.append(mass_primary_array, tr.triple.child2.child1.mass.value_in(units.MSun)) + + if tr.check_stopping_conditions()==False or tr.check_stopping_conditions_stellar()==False or tr.check_stopping_conditions_stellar_interaction()==False: + print('stopping conditions reached') + time_array = time_array[:len(inner_semimajor_axis_array)] + time_array[-1] = tr.triple.time + break + + plt.plot(time_array.value_in(units.Myr), mass_primary_array, label='primary mass') + plt.xlabel('time (Myr)') + plt.ylabel('mass (MSun)') + plt.legend(loc=0) + plt.show() + + plt.semilogy(time_array.value_in(units.Myr), inner_semimajor_axis_array, label='inner semimajor axis') + plt.xlabel('time (Myr)') + plt.ylabel('outer semimajor axis (RSun)') + plt.show() + + plt.xlabel('time (Myr)') + plt.ylabel('inner semimajor axis (RSun)') + plt.semilogy(time_array.value_in(units.Myr), outer_semimajor_axis_array, label='outer semimajor axis') + plt.show() + + plt.plot(time_array.value_in(units.Myr), outer_semimajor_axis_array/inner_semimajor_axis_array) + plt.plot(time_array.value_in(units.Myr)[-1], outer_semimajor_axis_array[-1]/inner_semimajor_axis_array[-1], label='dynamical instability') + plt.xlabel('time (Myr)') + plt.ylabel('ratio of outer vs inner semimajor axis') + plt.legend(loc=0) + plt.show() + tr.stellar_code.stop() tr.secular_code.stop() - - - -# example of triple with wind mass loss & mass transfer with plotting + + + +# example of triple with wind mass loss & mass transfer with plotting # advanced level # uses TRES.main_developer() in stead of TRES.main() def example_5(): - print('TRES example 5') - + print('TRES example 5') + M1 = 3.|units.MSun M2 = 0.5|units.MSun M3 = 0.5|units.MSun @@ -241,88 +242,88 @@ def example_5(): Aout = 80000|units.RSun Ein = 0.0 Eout = 0.5 - incl = 0.0 + incl = 0.0 Gin = 0.1 Gout = 0.5 Oin = 0. metallicity = 0.02 - - stars, bins, correct_params = TRES.make_particle_sets(M1,M2,M3, Ain, Aout, Ein, Eout, incl, Gin, Gout, Oin) + + stars, bins, correct_params = tres.make_particle_sets(M1,M2,M3, Ain, Aout, Ein, Eout, incl, Gin, Gout, Oin) - stellar_code = SeBa() + stellar_code = Seba() stellar_code.parameters.metallicity = metallicity # stellar_code.particles.add_particles(stars) - secular_code = SecularTriple() - + secular_code = Seculartriple() + inner_semimajor_axis_array = np.array([]) - outer_semimajor_axis_array = np.array([]) - radius_primary_array = np.array([]) - stellar_type_primary_array = np.array([]) - - time_array = (np.arange(25)+1)/25.*370 - time_array = np.append(time_array, (np.arange(100)+1)/100.*100 + 370) - time_array = np.append(time_array, (np.arange(100)+1)/100.*10 + 470) - time_array = time_array|units.Myr - - #make triple object and evolve for small timestep + outer_semimajor_axis_array = np.array([]) + radius_primary_array = np.array([]) + stellar_type_primary_array = np.array([]) + + time_array = (np.arange(25)+1)/25.*370 + time_array = np.append(time_array, (np.arange(100)+1)/100.*100 + 370) + time_array = np.append(time_array, (np.arange(100)+1)/100.*10 + 470) + time_array = time_array|units.Myr + + #make triple object and evolve for small timestep #needs to be bigger then 1e-4|units.Myr for secular code - tr = TRES.main_developer(stars, bins, correct_params, stellar_code, secular_code, incl, tend=1e-4|units.Myr, stop_at_mass_transfer=False) - - for i in range(len(time_array)): - tr.evolve_model(time_array[i]) - inner_semimajor_axis_array = np.append(inner_semimajor_axis_array, tr.triple.child2.semimajor_axis.value_in(units.RSun)) - outer_semimajor_axis_array = np.append(outer_semimajor_axis_array, tr.triple.semimajor_axis.value_in(units.RSun)) - radius_primary_array = np.append(radius_primary_array, tr.triple.child2.child1.radius.value_in(units.RSun)) - stellar_type_primary_array = np.append(stellar_type_primary_array, tr.triple.child2.child1.stellar_type.value_in(units.stellar_type)) - - if tr.check_stopping_conditions()==False or tr.check_stopping_conditions_stellar()==False or tr.check_stopping_conditions_stellar_interaction()==False: - print('stopping conditions reached') - time_array = time_array[:len(inner_semimajor_axis_array)] - time_array[-1] = tr.triple.time - break - - - plt.semilogy(time_array.value_in(units.Myr), inner_semimajor_axis_array, label='inner semimajor axis') - plt.semilogy(time_array.value_in(units.Myr), outer_semimajor_axis_array, label='outer semimajor axis') - plt.xlabel('time (Myr)') - plt.ylabel('semimajor axis (RSun)') - plt.legend(loc=0) - plt.show() - - w_ms = np.arange(len(stellar_type_primary_array))[stellar_type_primary_array<=1] - w_hg = np.arange(len(stellar_type_primary_array))[stellar_type_primary_array==2] - w_gb = np.arange(len(stellar_type_primary_array))[stellar_type_primary_array==3] - w_cheb = np.arange(len(stellar_type_primary_array))[stellar_type_primary_array==4] - w_agb = np.arange(len(stellar_type_primary_array))[stellar_type_primary_array==5] - w_wd = np.arange(len(stellar_type_primary_array))[(stellar_type_primary_array>=10) & (stellar_type_primary_array<=12)] - - plt.semilogy(time_array.value_in(units.Myr), radius_primary_array, 'k') - plt.semilogy(time_array.value_in(units.Myr)[w_ms], radius_primary_array[w_ms], '.', label='MS') - plt.semilogy(time_array.value_in(units.Myr)[w_hg], radius_primary_array[w_hg], '.', label='HG') - plt.semilogy(time_array.value_in(units.Myr)[w_gb], radius_primary_array[w_gb], '.', label='GB') - plt.semilogy(time_array.value_in(units.Myr)[w_cheb], radius_primary_array[w_cheb], '.', label='CHeB') - plt.semilogy(time_array.value_in(units.Myr)[w_agb], radius_primary_array[w_agb], '.', label='AGB') - plt.semilogy(time_array.value_in(units.Myr)[w_wd], radius_primary_array[w_wd], '.', label='WD') - plt.xlabel('time (Myr)') - plt.ylabel('primary radius (RSun)') - plt.legend(loc=0) - plt.show() - - + tr = run_tres_developer(stars, bins, correct_params, stellar_code, secular_code, incl, tend=1e-4|units.Myr, stop_at_mass_transfer=False) + + for i in range(len(time_array)): + tr.evolve_model(time_array[i]) + inner_semimajor_axis_array = np.append(inner_semimajor_axis_array, tr.triple.child2.semimajor_axis.value_in(units.RSun)) + outer_semimajor_axis_array = np.append(outer_semimajor_axis_array, tr.triple.semimajor_axis.value_in(units.RSun)) + radius_primary_array = np.append(radius_primary_array, tr.triple.child2.child1.radius.value_in(units.RSun)) + stellar_type_primary_array = np.append(stellar_type_primary_array, tr.triple.child2.child1.stellar_type.value_in(units.stellar_type)) + + if tr.check_stopping_conditions()==False or tr.check_stopping_conditions_stellar()==False or tr.check_stopping_conditions_stellar_interaction()==False: + print('stopping conditions reached') + time_array = time_array[:len(inner_semimajor_axis_array)] + time_array[-1] = tr.triple.time + break + + + plt.semilogy(time_array.value_in(units.Myr), inner_semimajor_axis_array, label='inner semimajor axis') + plt.semilogy(time_array.value_in(units.Myr), outer_semimajor_axis_array, label='outer semimajor axis') + plt.xlabel('time (Myr)') + plt.ylabel('semimajor axis (RSun)') + plt.legend(loc=0) + plt.show() + + w_ms = np.arange(len(stellar_type_primary_array))[stellar_type_primary_array<=1] + w_hg = np.arange(len(stellar_type_primary_array))[stellar_type_primary_array==2] + w_gb = np.arange(len(stellar_type_primary_array))[stellar_type_primary_array==3] + w_cheb = np.arange(len(stellar_type_primary_array))[stellar_type_primary_array==4] + w_agb = np.arange(len(stellar_type_primary_array))[stellar_type_primary_array==5] + w_wd = np.arange(len(stellar_type_primary_array))[(stellar_type_primary_array>=10) & (stellar_type_primary_array<=12)] + + plt.semilogy(time_array.value_in(units.Myr), radius_primary_array, 'k') + plt.semilogy(time_array.value_in(units.Myr)[w_ms], radius_primary_array[w_ms], '.', label='MS') + plt.semilogy(time_array.value_in(units.Myr)[w_hg], radius_primary_array[w_hg], '.', label='HG') + plt.semilogy(time_array.value_in(units.Myr)[w_gb], radius_primary_array[w_gb], '.', label='GB') + plt.semilogy(time_array.value_in(units.Myr)[w_cheb], radius_primary_array[w_cheb], '.', label='CHeB') + plt.semilogy(time_array.value_in(units.Myr)[w_agb], radius_primary_array[w_agb], '.', label='AGB') + plt.semilogy(time_array.value_in(units.Myr)[w_wd], radius_primary_array[w_wd], '.', label='WD') + plt.xlabel('time (Myr)') + plt.ylabel('primary radius (RSun)') + plt.legend(loc=0) + plt.show() + + tr.stellar_code.stop() tr.secular_code.stop() # most advanced level -# uses TRES.main_developer() in stead of TRES.main() -# make a cataclysmic variable & start the simulation with a stellar type of your choice +# uses TRES.main_developer() in stead of TRES.main() +# make a cataclysmic variable & start the simulation with a stellar type of your choice # we make the triple but don't evolve it, only the stars to 4500 Myr at which we strip off the envelope to make a white dwarf -# afterwards pickup the triple evolution - +# afterwards pickup the triple evolution + def example_6(): - print('TRES example 6') - + print('TRES example 6') + M1 = 1.3|units.MSun M2 = 0.5|units.MSun M3 = 0.5|units.MSun @@ -336,48 +337,48 @@ def example_6(): Oin = 0. metallicity = 0.02 - stars, bins, correct_params = TRES.make_particle_sets(M1,M2,M3, Ain, Aout, Ein, Eout, incl, Gin, Gout, Oin) + stars, bins, correct_params = tres.make_particle_sets(M1,M2,M3, Ain, Aout, Ein, Eout, incl, Gin, Gout, Oin) - stellar_code = SeBa() + stellar_code = Seba() stellar_code.parameters.metallicity = metallicity # stellar_code.particles.add_particles(stars) - secular_code = SecularTriple() + secular_code = Seculartriple() #make triple object (evolve for small timestep) #needs to be bigger then 1e-4|units.Myr for secular code - tr = TRES.main_developer(stars, bins, correct_params, stellar_code, secular_code, incl, tend=1e-4|units.Myr) - - #only evolve the stars until 4500Myr + tr = run_tres_developer(stars, bins, correct_params, stellar_code, secular_code, incl, tend=1e-4|units.Myr) + + #only evolve the stars until 4500Myr goal_time = 4500|units.Myr stellar_code.evolve_model(goal_time) channel_from_stellar = stellar_code.particles.new_channel_to(stars) channel_from_stellar.copy() - + # make modifications to stellar object # in this case remove some mass of the envelope (without effect on triple) donor_in_stellar_code = stars[0].as_set().get_intersecting_subset_in(stellar_code.particles)[0] - donor_in_stellar_code.change_mass((stars[0].core_mass-stars[0].mass), 0.|units.yr) + donor_in_stellar_code.change_mass((stars[0].core_mass-stars[0].mass), 0.|units.yr) minimum_time_step = 1.e-9 |units.Myr - stellar_code.evolve_model(goal_time+minimum_time_step) #to get updated radii - channel_from_stellar.copy() - - #possible adjust spins of stars, e.g. - corotating_frequency = TRES.corotating_spin_angular_frequency_binary(Ain, stars[0].mass, stars[1].mass) - stars[0].spin_angular_frequency = corotating_frequency - stars[1].spin_angular_frequency = corotating_frequency - - #adjust time for triple object as well - tr.triple.time = goal_time + minimum_time_step - tr.secular_code.model_time = goal_time + minimum_time_step #not redundant! - -# continue triple evolution until 5000Myr + stellar_code.evolve_model(goal_time+minimum_time_step) #to get updated radii + channel_from_stellar.copy() + + #possible adjust spins of stars, e.g. + corotating_frequency = tres.corotating_spin_angular_frequency_binary(Ain, stars[0].mass, stars[1].mass) + stars[0].spin_angular_frequency = corotating_frequency + stars[1].spin_angular_frequency = corotating_frequency + + #adjust time for triple object as well + tr.triple.time = goal_time + minimum_time_step + tr.secular_code.model_time = goal_time + minimum_time_step #not redundant! + +# continue triple evolution until 5000Myr tr.evolve_model(5000|units.Myr) - if tr.check_stopping_conditions()==False or tr.check_stopping_conditions_stellar()==False or tr.check_stopping_conditions_stellar_interaction()==False: - print('stopping conditions reached') + if tr.check_stopping_conditions()==False or tr.check_stopping_conditions_stellar()==False or tr.check_stopping_conditions_stellar_interaction()==False: + print('stopping conditions reached') print(tr.triple.eccentricity, tr.triple.child2.eccentricity) print(tr.triple.semimajor_axis, tr.triple.child2.semimajor_axis) - + tr.stellar_code.stop() tr.secular_code.stop() @@ -385,10 +386,10 @@ def example_6(): example_1() #example_2() -#example_3() +#example_3() #example_4() #example_5() #example_6() - - - + + + diff --git a/example/minimal_example.ipynb b/example/minimal_example.ipynb index 25f2561..ad2ed6d 100644 --- a/example/minimal_example.ipynb +++ b/example/minimal_example.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -12,36 +12,24 @@ }, { "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "# Add TRES to path\n", - "\n", - "import sys\n", - "sys.path.append(\"..\")" - ] - }, - { - "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from amuse.units import units\n", - "from amuse.community.seba.interface import SeBa\n", - "from seculartriple_TPS.interface import SecularTriple\n", + "from amuse.community.seba import Seba\n", + "from tres.seculartriple import Seculartriple\n", "\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "\n", - "from TRES import main_developer, initialize_triple_class\n", - "from tres_setup import make_particle_sets" + "from tres import run_tres_developer, initialize_triple_class\n", + "from tres.setup import make_particle_sets" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -69,64 +57,37 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " key initial_mass is_donor is_star mass parent\n", - " - MSun none none MSun none\n", - "==================== =========== =========== =========== =========== ===========\n", - "12680313779839093419 1.000e+01 False True 1.000e+01 14297637246665137321\n", - "10978989039604764050 8.000e+00 False True 8.000e+00 14297637246665137321\n", - " 7334785628966770775 5.000e+00 False True 5.000e+00 8073120004149095763\n", - "==================== =========== =========== =========== =========== ===========\n" - ] - } - ], + "outputs": [], "source": [ "print(stars)" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " key accretion_efficiency_mass_transfer accretion_efficiency_wind_child1_to_child2 accretion_efficiency_wind_child2_to_child1 argument_of_pericenter bin_type child1 child2 eccentricity is_mt_stable is_star longitude_of_ascending_node mass_transfer_rate parent part_dt_mt semimajor_axis specific_AM_loss_mass_transfer\n", - " - none none none none none none none none none none none MSun / yr none none AU none\n", - "==================== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== ===========\n", - "14297637246665137321 1.000e+00 0.000e+00 0.000e+00 0.000e+00 unknown 12680313779839093419 10978989039604764050 5.000e-01 True False 0.000e+00 0.000e+00 8073120004149095763 1.000e+00 1.000e+00 2.500e+00\n", - " 8073120004149095763 1.000e+00 0.000e+00 0.000e+00 0.000e+00 unknown 7334785628966770775 14297637246665137321 5.000e-01 True False -3.142e+00 0.000e+00 -- 1.000e+00 1.200e+01 2.500e+00\n", - "==================== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== =========== ===========\n" - ] - } - ], + "outputs": [], "source": [ "print(bins)" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Initialize the stellar and secular codes\n", "\n", - "stellar_code = SeBa()\n", - "secular_code = SecularTriple()" + "stellar_code = Seba()\n", + "secular_code = Seculartriple()" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -142,101 +103,16 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0\n", - "0.797678407704\n", - "binary star: \n", - "22.999654438 [MSun]\n", - "2581.1666718 [RSun]\n", - "0.500335116703\n", - "47715.4354306\n", - "-45957.7590771\n", - "-9.2375052478 [MSun / Myr]\n", - "1.0\n", - "0.0\n", - "0.0\n", - "2.5\n", - "True\n", - "\t\n", - "star:\n", - "5.0000000000 [Myr]\n", - "Main Sequence star\n", - "5.0000000000 [MSun]\n", - "2.5225884740 [RSun]\n", - "0.0000000000 [MSun]\n", - "0.0000000000 [RSun]\n", - "1.0000000000e-10 [MSun]\n", - "1.0000000000e-10 [RSun]\n", - "7.1944568517e+21 [MSun * RSun**2 * Myr**-2 / Myr]\n", - "17779.906061 [K]\n", - "-0.0000000000 [MSun / Myr]\n", - "4296578639.3 [Myr**-1]\n", - "False\n", - "\t\n", - "\t\n", - "binary star: \n", - "17.999654438 [MSun]\n", - "215.09673196 [RSun]\n", - "0.930165104093\n", - "54928.5062848\n", - "-45954.6174844\n", - "-80.313241129 [MSun / Myr]\n", - "1.0\n", - "0.0\n", - "0.0\n", - "2.5\n", - "True\n", - "\t\n", - "star:\n", - "5.0000000000 [Myr]\n", - "Main Sequence star\n", - "9.9996544378 [MSun]\n", - "4.0668412764 [RSun]\n", - "0.0000000000 [MSun]\n", - "0.0000000000 [RSun]\n", - "1.0000000000e-10 [MSun]\n", - "1.0000000000e-10 [RSun]\n", - "7.7595161068e+22 [MSun * RSun**2 * Myr**-2 / Myr]\n", - "25376.586954 [K]\n", - "-7.3783799789e-05 [MSun / Myr]\n", - "2343151245.1 [Myr**-1]\n", - "False\n", - "\t\n", - "\t\n", - "star:\n", - "5.0000000000 [Myr]\n", - "Main Sequence star\n", - "8.0000000000 [MSun]\n", - "3.4443310804 [RSun]\n", - "0.0000000000 [MSun]\n", - "0.0000000000 [RSun]\n", - "1.0000000000e-10 [MSun]\n", - "1.0000000000e-10 [RSun]\n", - "3.6506213693e+22 [MSun * RSun**2 * Myr**-2 / Myr]\n", - "22837.176854 [K]\n", - "-0.0000000000 [MSun / Myr]\n", - "2945820979.1 [Myr**-1]\n", - "False\n", - "\t\n", - "\t\n", - "\t\n", - "\t\n" - ] - } - ], + "outputs": [], "source": [ "triple.print_stellar_system()" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -247,101 +123,16 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "0\n", - "0.97372741032\n", - "binary star: \n", - "22.999242313 [MSun]\n", - "2581.2129240 [RSun]\n", - "0.500654264276\n", - "93691.5739051\n", - "-90626.9961368\n", - "-9.6859427118 [MSun / Myr]\n", - "1.0\n", - "0.0\n", - "0.0\n", - "2.5\n", - "True\n", - "\t\n", - "star:\n", - "10.000000000 [Myr]\n", - "Main Sequence star\n", - "5.0000000000 [MSun]\n", - "2.5861750006 [RSun]\n", - "0.0000000000 [MSun]\n", - "0.0000000000 [RSun]\n", - "1.0000000000e-10 [MSun]\n", - "1.0000000000e-10 [RSun]\n", - "7.3582359184e+21 [MSun * RSun**2 * Myr**-2 / Myr]\n", - "17659.062144 [K]\n", - "-0.0000000000 [MSun / Myr]\n", - "4087895267.4 [Myr**-1]\n", - "False\n", - "\t\n", - "\t\n", - "binary star: \n", - "17.999242313 [MSun]\n", - "215.09874250 [RSun]\n", - "0.896700602681\n", - "108929.182468\n", - "-90623.8545441\n", - "-104.48131461 [MSun / Myr]\n", - "1.0\n", - "0.0\n", - "0.0\n", - "2.5\n", - "True\n", - "\t\n", - "star:\n", - "10.000000000 [Myr]\n", - "Main Sequence star\n", - "9.9992423131 [MSun]\n", - "4.5574480693 [RSun]\n", - "0.0000000000 [MSun]\n", - "0.0000000000 [RSun]\n", - "1.0000000000e-10 [MSun]\n", - "1.0000000000e-10 [RSun]\n", - "9.0074883554e+22 [MSun * RSun**2 * Myr**-2 / Myr]\n", - "24882.454896 [K]\n", - "-9.2143270672e-05 [MSun / Myr]\n", - "1865351141.7 [Myr**-1]\n", - "False\n", - "\t\n", - "\t\n", - "star:\n", - "10.000000000 [Myr]\n", - "Main Sequence star\n", - "8.0000000000 [MSun]\n", - "3.6909988504 [RSun]\n", - "0.0000000000 [MSun]\n", - "0.0000000000 [RSun]\n", - "1.0000000000e-10 [MSun]\n", - "1.0000000000e-10 [RSun]\n", - "3.9624939727e+22 [MSun * RSun**2 * Myr**-2 / Myr]\n", - "22517.665386 [K]\n", - "-0.0000000000 [MSun / Myr]\n", - "2565146732.1 [Myr**-1]\n", - "False\n", - "\t\n", - "\t\n", - "\t\n", - "\t\n" - ] - } - ], + "outputs": [], "source": [ "triple.print_stellar_system()" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -350,7 +141,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -360,30 +151,9 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - }, - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjEAAAHPCAYAAACiH4sAAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8o6BhiAAAACXBIWXMAAA9hAAAPYQGoP6dpAABO30lEQVR4nO3dd3RU1d7G8e+kQyokQC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xYtWkTnzp0BSE1NpVu3bqxatYpBgwYxf/78/JYrIiI28POueN74cScJFzNwssCg22vz/F11cXfRpHVinnyfibmZAQMGMGXKFO68805WrlyZp9/p1asX8+bNY8CAAUyaNOmqbUePHqVWrVpYrVb27t1LaGhontrUmRgRkcLT2Rcpbvn5/s73mJibCQ8PByA2NjZP+2dkZOSMo3n00Uev2V6jRg3atm0LwIIFC2xUpYiI3MzPu+LpOPp/LPxr7Mvg9rVZ/Fw7BRgpMWx+d1JMTAwAlStXztP++/fvJzU1FYCIiIhc94mIiGDt2rVs3brVNkWKiMh1nU/J4D+LdvPTNp19kZLNpiEmPj6e6dOnA9CjR488/c7hw4cB8PPzw9vbO9d9goKCrto3N+np6aSnp+c8TkpKytPxRUTk//2yO57XF+wi4WI6ThYYeHttnr+zrhZslBLJZiEmKyuL3r17k5iYSFhYGAMHDszT7yUnJwPg6el53X28vLyAGweTDz74gHfeeScfFYuIyBX/PPtS56+zL0109kVKMJuNiRk0aBCrVq3C39+f+fPn4+bmZqum82T48OEkJibm/OR1TI6IiKNbvjuejqPX8NO2/5/3ZfGz7RRgpMSzyZmY559/nilTplCuXDlWrFhBvXr18vy7Vy4hpaSkXHefK5Pd3WiUsru7O+7u7nk+roiIo9PZF7F3hQ4xQ4cOZezYsfj5+bF8+fKcu5PyqmbNmgBcuHCB5OTkXMfFXDmrcmVfEREpnOW743lNY1/EzhUqxLz88suMGjUKX19fli9fft27i24kJCSEsmXLkpqayubNm7njjjuu2Wfz5s0ANG3atDDliog4vMTUTN5euIsfdfZFSoECj4l59dVX+fjjj/H19WXFihU0b968QO24ubnRtWtXAL755ptrth89epT169cD8OCDDxa0XBERh7cuJoF7PlvDj3+NfRl0u8a+iH0rUIh54403+PDDD/Hz88tzgBk/fjyhoaG5LkXw6quvYrFYmDZtGj///HPO86mpqfTv35/s7Gx69OiR59l6RUTk/6VlZvPOot30nrKB+KQ0avqXZf7TbXi1c6guH4ldy/flpIULF/Lf//4XgDp16vD555/nul9AQACff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IiMhNhYeH06NHD2JjY+nevTtHjhy5Zp+UlBRmz57NqVOncm1jx44dbNmyBScnJ/r161fomnQ5SURExAFt2bKFwYMH5zw+ePAgAF9++SWLFy/OeX7BggVUrlwZuDy3y4ULF1i2bBkhISE0btyY4OBgDMPgyJEjbN++nYyMDPbu3UulSpWuOeaVszB33313zuWpwrAYhmEUuhURERGxK6tXr87TytGHDx+mZs2aOY+tVitz5szh66+/JioqinPnzuHj40PlypVp3rw53bp1o2vXrri6ul7VTkZGBlWqVOHs2bPMnTuXnj17Fvo1KMSIiIiIXdKYGBEREbFLCjEiIiJilxRiRERExC4pxIiIiIhdUogRERERu6QQIyIiInZJIUZERETskkKMiIiI2CWFGBEREbFLCjEiIiJilxRiRERExC4pxIiIiIhd+j9KA0UjxNDISwAAAABJRU5ErkJggg==", - "text/plain": [ - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "plt.plot(triple.plot_data.times_array.number, triple.plot_data.a_in_array.number)" ] @@ -391,7 +161,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3.10.6 ('amuse-tres-PsQP0NBr-py3.10')", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -405,9 +175,8 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]" + "version": "3.13.1" }, - "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "2adc4102d3c5cc3c27614a3ecc3c3c429cb40eb1d735b73fcbb59a415fcc6b30" @@ -415,5 +184,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/src/tres/__init__.py b/src/tres/__init__.py index 93bc606..6610909 100644 --- a/src/tres/__init__.py +++ b/src/tres/__init__.py @@ -1,2 +1,4 @@ from .tres import run_tres, run_tres_developer from .tres import initialize_triple_class +from .tres import make_particle_sets +from .tres import corotating_spin_angular_frequency_binary From 672532672b55266ef7dcd1f70f1e0f14a2d331d9 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 15 Jul 2025 10:26:12 +0200 Subject: [PATCH 10/13] modernised/updated imports --- src/tres/tres.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/tres/tres.py b/src/tres/tres.py index 77e9264..3e64cc4 100644 --- a/src/tres/tres.py +++ b/src/tres/tres.py @@ -13,15 +13,15 @@ from amuse.support.console import set_printing_strategy try: - from amuse.community.seba.interface import SeBa + from amuse.community.seba import Seba except ImportError: - SeBa = None + Seba = None try: - from amuse.community.sse.interface import SSE + from amuse.community.sse import Sse except ImportError: - SSE = None + Sse = None try: - from amuse.community.mesa.interface import Mesa + from amuse.community.mesa import Mesa except ImportError: Mesa = None from tres.seculartriple import Seculartriple @@ -111,13 +111,13 @@ def run_tres(inner_primary_mass = 1.3|units.MSun, inner_secondary_mass = 0.5|uni clean_up_stellar_code = False clean_up_secular_code = False - if stellar_code is None or stellar_code.__module__.split(".")[-2]=="seba": - stellar_code = SeBa() - # stellar_code = SeBa(redirection='none') - # stellar_code = SeBa(redirection='file', redirect_file='output_SeBa_TRES.txt') - elif stellar_code.__module__.split(".")[-2]=="sse": - stellar_code = SSE() - elif stellar_code.__module__.split(".")[-2]=="mesa_r15140": + if stellar_code is None or stellar_code.__module__.split(".")[-2].lower()=="seba": + stellar_code = Seba() + # stellar_code = Seba(redirection='none') + # stellar_code = Seba(redirection='file', redirect_file='output_SeBa_TRES.txt') + elif stellar_code.__module__.split(".")[-2].lower()=="sse": + stellar_code = Sse() + elif stellar_code.__module__.split(".")[-2].lower()=="mesa_r15140": stellar_code = Mesa() else: print('No valid stellar evolution code selected. Options are SeBa (default), SSE or MESA') From 6b7377933a985d4cd0bba4412c19141696470f41 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 15 Jul 2025 10:29:37 +0200 Subject: [PATCH 11/13] Style updates --- src/tres/tres.py | 996 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 679 insertions(+), 317 deletions(-) diff --git a/src/tres/tres.py b/src/tres/tres.py index 3e64cc4..52a4d72 100644 --- a/src/tres/tres.py +++ b/src/tres/tres.py @@ -1,12 +1,13 @@ -# to do +# to do # minus sign in mean anomaly ## Triple: Triple evolution ## computes the evolution of a given triple ## given any initial conditions (M, m, l, A, a, E, e, i, G, g, O, o, T, z). - + import sys import numpy as np + # from interactions import * # from tidal_friction_constant import * from amuse.units import units @@ -30,69 +31,152 @@ from tres.triple_class import Triple_Class from tres.plotting import plot_data_container, plot_function from tres.setup import make_particle_sets, setup_stellar_code -from tres.options import REPORT_DEBUG, \ - REPORT_TRIPLE_EVOLUTION, \ - MAKE_PLOTS, \ - REPORT_USER_WARNINGS -from tres.interactions import corotating_spin_angular_frequency_binary, \ - lang_spin_angular_frequency, \ - break_up_angular_frequency, \ - criticial_angular_frequency_CHE - - -def initialize_triple_class(stars, bins, correct_params, - stellar_code, secular_code, relative_inclination = 80.0*np.pi/180.0, - metallicity = 0.02, tend = 5.0 |units.Myr, tinit = 0.0|units.Myr, - number = 0, maximum_radius_change_factor = 0.005, - stop_at_mass_transfer = True, stop_at_init_mass_transfer = True, stop_at_outer_mass_transfer = True, - stop_at_stable_mass_transfer = True, stop_at_eccentric_stable_mass_transfer = True, - stop_at_unstable_mass_transfer = False, stop_at_eccentric_unstable_mass_transfer = False, which_common_envelope = 2, - stop_at_no_CHE = False, include_CHE = False, - stop_at_merger = True, stop_at_disintegrated = True, stop_at_inner_collision = True, stop_at_outer_collision = True, - stop_at_dynamical_instability = True, stop_at_semisecular_regime = False, - stop_at_SN = False, SN_kick_distr = 2, impulse_kick_for_black_holes = True, fallback_kick_for_black_holes = True, - stop_at_CPU_time = False, max_CPU_time = 3600.0, file_name = "TRES.hdf", file_type = "hdf5", dir_plots = ""): - - triple = Triple_Class(stars, bins, correct_params, stellar_code, secular_code, - relative_inclination, tend, tinit, - number, maximum_radius_change_factor, - stop_at_mass_transfer, stop_at_init_mass_transfer, stop_at_outer_mass_transfer, - stop_at_stable_mass_transfer, stop_at_eccentric_stable_mass_transfer, - stop_at_unstable_mass_transfer, stop_at_eccentric_unstable_mass_transfer, which_common_envelope, - stop_at_no_CHE, include_CHE, - stop_at_merger, stop_at_disintegrated, stop_at_inner_collision, stop_at_outer_collision, - stop_at_dynamical_instability, stop_at_semisecular_regime, - stop_at_SN, SN_kick_distr, impulse_kick_for_black_holes, fallback_kick_for_black_holes, - stop_at_CPU_time, max_CPU_time, file_name, file_type, dir_plots) +from tres.options import REPORT_DEBUG, REPORT_TRIPLE_EVOLUTION, MAKE_PLOTS, REPORT_USER_WARNINGS +from tres.interactions import ( + corotating_spin_angular_frequency_binary, + lang_spin_angular_frequency, + break_up_angular_frequency, + criticial_angular_frequency_CHE, +) + + +def initialize_triple_class( + stars, + bins, + correct_params, + stellar_code, + secular_code, + relative_inclination=80.0 * np.pi / 180.0, + metallicity=0.02, + tend=5.0 | units.Myr, + tinit=0.0 | units.Myr, + number=0, + maximum_radius_change_factor=0.005, + stop_at_mass_transfer=True, + stop_at_init_mass_transfer=True, + stop_at_outer_mass_transfer=True, + stop_at_stable_mass_transfer=True, + stop_at_eccentric_stable_mass_transfer=True, + stop_at_unstable_mass_transfer=False, + stop_at_eccentric_unstable_mass_transfer=False, + which_common_envelope=2, + stop_at_no_CHE=False, + include_CHE=False, + stop_at_merger=True, + stop_at_disintegrated=True, + stop_at_inner_collision=True, + stop_at_outer_collision=True, + stop_at_dynamical_instability=True, + stop_at_semisecular_regime=False, + stop_at_SN=False, + SN_kick_distr=2, + impulse_kick_for_black_holes=True, + fallback_kick_for_black_holes=True, + stop_at_CPU_time=False, + max_CPU_time=3600.0, + file_name="TRES.hdf", + file_type="hdf5", + dir_plots="", +): + + triple = Triple_Class( + stars, + bins, + correct_params, + stellar_code, + secular_code, + relative_inclination, + tend, + tinit, + number, + maximum_radius_change_factor, + stop_at_mass_transfer, + stop_at_init_mass_transfer, + stop_at_outer_mass_transfer, + stop_at_stable_mass_transfer, + stop_at_eccentric_stable_mass_transfer, + stop_at_unstable_mass_transfer, + stop_at_eccentric_unstable_mass_transfer, + which_common_envelope, + stop_at_no_CHE, + include_CHE, + stop_at_merger, + stop_at_disintegrated, + stop_at_inner_collision, + stop_at_outer_collision, + stop_at_dynamical_instability, + stop_at_semisecular_regime, + stop_at_SN, + SN_kick_distr, + impulse_kick_for_black_holes, + fallback_kick_for_black_holes, + stop_at_CPU_time, + max_CPU_time, + file_name, + file_type, + dir_plots, + ) triple.stellar_code.parameters.metallicity = metallicity return triple -#----- -#for running TRES.py from other routines -def run_tres(inner_primary_mass = 1.3|units.MSun, inner_secondary_mass = 0.5|units.MSun, outer_mass = 0.5|units.MSun, - inner_semimajor_axis = 1.0 |units.AU, outer_semimajor_axis = 100.0 |units.AU, - inner_eccentricity = 0.1, outer_eccentricity= 0.5, - relative_inclination = 80.0*np.pi/180.0, - inner_argument_of_pericenter = 0.1, outer_argument_of_pericenter = 0.5, - inner_longitude_of_ascending_node = 0.0, - metallicity = 0.02, tend = 5.0 |units.Myr, tinit = 0.0|units.Myr, - number = 0, maximum_radius_change_factor = 0.005, - stop_at_mass_transfer = True, stop_at_init_mass_transfer = True, stop_at_outer_mass_transfer = True, - stop_at_stable_mass_transfer = True, stop_at_eccentric_stable_mass_transfer = True, - stop_at_unstable_mass_transfer = False, stop_at_eccentric_unstable_mass_transfer = False, which_common_envelope = 2, - stop_at_no_CHE = False, include_CHE = False, - stop_at_merger = True, stop_at_disintegrated = True, stop_at_inner_collision = True, stop_at_outer_collision = True, - stop_at_dynamical_instability = True, stop_at_semisecular_regime = False, - stop_at_SN = False, SN_kick_distr = 2, impulse_kick_for_black_holes = True, fallback_kick_for_black_holes = True, - stop_at_CPU_time = False, max_CPU_time = 3600.0, file_name = "TRES.hdf", file_type = "hdf5", dir_plots = "", - stellar_code=None, secular_code=None): - - set_printing_strategy("custom", - preferred_units = [units.MSun, units.RSun, units.Myr], - precision = 11, prefix = "", - separator = " [", suffix = "]") +# ----- +# for running TRES.py from other routines +def run_tres( + inner_primary_mass=1.3 | units.MSun, + inner_secondary_mass=0.5 | units.MSun, + outer_mass=0.5 | units.MSun, + inner_semimajor_axis=1.0 | units.AU, + outer_semimajor_axis=100.0 | units.AU, + inner_eccentricity=0.1, + outer_eccentricity=0.5, + relative_inclination=80.0 * np.pi / 180.0, + inner_argument_of_pericenter=0.1, + outer_argument_of_pericenter=0.5, + inner_longitude_of_ascending_node=0.0, + metallicity=0.02, + tend=5.0 | units.Myr, + tinit=0.0 | units.Myr, + number=0, + maximum_radius_change_factor=0.005, + stop_at_mass_transfer=True, + stop_at_init_mass_transfer=True, + stop_at_outer_mass_transfer=True, + stop_at_stable_mass_transfer=True, + stop_at_eccentric_stable_mass_transfer=True, + stop_at_unstable_mass_transfer=False, + stop_at_eccentric_unstable_mass_transfer=False, + which_common_envelope=2, + stop_at_no_CHE=False, + include_CHE=False, + stop_at_merger=True, + stop_at_disintegrated=True, + stop_at_inner_collision=True, + stop_at_outer_collision=True, + stop_at_dynamical_instability=True, + stop_at_semisecular_regime=False, + stop_at_SN=False, + SN_kick_distr=2, + impulse_kick_for_black_holes=True, + fallback_kick_for_black_holes=True, + stop_at_CPU_time=False, + max_CPU_time=3600.0, + file_name="TRES.hdf", + file_type="hdf5", + dir_plots="", + stellar_code=None, + secular_code=None, +): + + set_printing_strategy( + "custom", + preferred_units=[units.MSun, units.RSun, units.Myr], + precision=11, + prefix="", + separator=" [", + suffix="]", + ) inner_eccentricity = float(inner_eccentricity) outer_eccentricity = float(outer_eccentricity) @@ -101,370 +185,648 @@ def run_tres(inner_primary_mass = 1.3|units.MSun, inner_secondary_mass = 0.5|uni outer_argument_of_pericenter = float(outer_argument_of_pericenter) inner_longitude_of_ascending_node = float(inner_longitude_of_ascending_node) - stars, bins, correct_params = make_particle_sets(inner_primary_mass, inner_secondary_mass, outer_mass, - inner_semimajor_axis, outer_semimajor_axis, - inner_eccentricity, outer_eccentricity, - relative_inclination, - inner_argument_of_pericenter, outer_argument_of_pericenter, - inner_longitude_of_ascending_node) + stars, bins, correct_params = make_particle_sets( + inner_primary_mass, + inner_secondary_mass, + outer_mass, + inner_semimajor_axis, + outer_semimajor_axis, + inner_eccentricity, + outer_eccentricity, + relative_inclination, + inner_argument_of_pericenter, + outer_argument_of_pericenter, + inner_longitude_of_ascending_node, + ) clean_up_stellar_code = False clean_up_secular_code = False - if stellar_code is None or stellar_code.__module__.split(".")[-2].lower()=="seba": + if stellar_code is None or stellar_code.__module__.split(".")[-2].lower() == "seba": stellar_code = Seba() # stellar_code = Seba(redirection='none') # stellar_code = Seba(redirection='file', redirect_file='output_SeBa_TRES.txt') - elif stellar_code.__module__.split(".")[-2].lower()=="sse": + elif stellar_code.__module__.split(".")[-2].lower() == "sse": stellar_code = Sse() - elif stellar_code.__module__.split(".")[-2].lower()=="mesa_r15140": + elif stellar_code.__module__.split(".")[-2].lower() == "mesa_r15140": stellar_code = Mesa() else: - print('No valid stellar evolution code selected. Options are SeBa (default), SSE or MESA') - return triple_class_object # no codes initialized yet + print("No valid stellar evolution code selected. Options are SeBa (default), SSE or MESA") + return triple_class_object # no codes initialized yet clean_up_stellar_code = True stellar_code.parameters.metallicity = metallicity if secular_code is None: secular_code = Seculartriple() - # secular_code = Seculartriple(redirection='none') - # secular_code = Seculartriple(redirection='file', redirect_file='output_SecularTriple_TRES.txt') + # secular_code = Seculartriple(redirection='none') + # secular_code = Seculartriple(redirection='file', redirect_file='output_SecularTriple_TRES.txt') clean_up_secular_code = True - triple_class_object = Triple_Class(stars, bins, correct_params, stellar_code, secular_code, - relative_inclination, tend, tinit, - number, maximum_radius_change_factor, - stop_at_mass_transfer, stop_at_init_mass_transfer, stop_at_outer_mass_transfer, - stop_at_stable_mass_transfer, stop_at_eccentric_stable_mass_transfer, - stop_at_unstable_mass_transfer, stop_at_eccentric_unstable_mass_transfer, which_common_envelope, - stop_at_no_CHE, include_CHE, - stop_at_merger, stop_at_disintegrated, stop_at_inner_collision, stop_at_outer_collision, - stop_at_dynamical_instability, stop_at_semisecular_regime, - stop_at_SN, SN_kick_distr, impulse_kick_for_black_holes, fallback_kick_for_black_holes, - stop_at_CPU_time, max_CPU_time, file_name, file_type, dir_plots) - + triple_class_object = Triple_Class( + stars, + bins, + correct_params, + stellar_code, + secular_code, + relative_inclination, + tend, + tinit, + number, + maximum_radius_change_factor, + stop_at_mass_transfer, + stop_at_init_mass_transfer, + stop_at_outer_mass_transfer, + stop_at_stable_mass_transfer, + stop_at_eccentric_stable_mass_transfer, + stop_at_unstable_mass_transfer, + stop_at_eccentric_unstable_mass_transfer, + which_common_envelope, + stop_at_no_CHE, + include_CHE, + stop_at_merger, + stop_at_disintegrated, + stop_at_inner_collision, + stop_at_outer_collision, + stop_at_dynamical_instability, + stop_at_semisecular_regime, + stop_at_SN, + SN_kick_distr, + impulse_kick_for_black_holes, + fallback_kick_for_black_holes, + stop_at_CPU_time, + max_CPU_time, + file_name, + file_type, + dir_plots, + ) if triple_class_object.correct_params == False: if REPORT_USER_WARNINGS: - print('Choose a different system. The parameters of the given triple are incorrect.') - return triple_class_object # no codes initialized yet + print("Choose a different system. The parameters of the given triple are incorrect.") + return triple_class_object # no codes initialized yet elif stop_at_semisecular_regime == True and triple_class_object.semisecular_regime_at_initialisation == True: if REPORT_USER_WARNINGS: - print('Choose a different system. The given triple is in the semisecular regime at initialization.') + print("Choose a different system. The given triple is in the semisecular regime at initialization.") elif triple_class_object.dynamical_instability_at_initialisation == True: if REPORT_USER_WARNINGS: - print('Choose a different system. The given triple is dynamically unstable at initialization.') + print("Choose a different system. The given triple is dynamically unstable at initialization.") elif triple_class_object.mass_transfer_at_initialisation == True: if REPORT_USER_WARNINGS: - print('Choose a different system. There is mass transfer in the given triple at initialization.') + print("Choose a different system. There is mass transfer in the given triple at initialization.") elif stop_at_no_CHE == True and triple_class_object.CHE_at_initialisation == False: if REPORT_USER_WARNINGS: - print('Choose a different system. No chemically homogeneous evolution at initialization') - else: + print("Choose a different system. No chemically homogeneous evolution at initialization") + else: triple_class_object.evolve_model(tend) if REPORT_DEBUG or MAKE_PLOTS: plot_function(triple_class_object, dir_plots) triple_class_object.print_stellar_system() - stellar_code.particles.remove_particles(stars) - triple_set = triple_class_object.triple.as_set() - secular_code.triples.remove_particles(triple_set) + triple_set = triple_class_object.triple.as_set() + secular_code.triples.remove_particles(triple_set) del stars, bins, triple_set if clean_up_stellar_code: triple_class_object.stellar_code.stop() if REPORT_USER_WARNINGS: - print('Cleaning stellar evolution code') + print("Cleaning stellar evolution code") if clean_up_secular_code: triple_class_object.secular_code.stop() if REPORT_USER_WARNINGS: - print('Cleaning secular code') - - return triple_class_object + print("Cleaning secular code") - -def run_tres_developer(stars, bins, correct_params, stellar_code, secular_code, - relative_inclination = 80.0*np.pi/180.0, - metallicity = 0.02, tend = 5.0 |units.Myr, tinit = 0.0 |units.Myr, - number = 0, maximum_radius_change_factor = 0.005, - stop_at_mass_transfer = True, stop_at_init_mass_transfer = True, stop_at_outer_mass_transfer = True, - stop_at_stable_mass_transfer = True, stop_at_eccentric_stable_mass_transfer = True, - stop_at_unstable_mass_transfer = False, stop_at_eccentric_unstable_mass_transfer = False, which_common_envelope = 2, - stop_at_no_CHE = False, include_CHE = False, - stop_at_merger = True, stop_at_disintegrated = True, stop_at_inner_collision = True, stop_at_outer_collision = True, - stop_at_dynamical_instability = True, stop_at_semisecular_regime = False, - stop_at_SN = False, SN_kick_distr = 2, impulse_kick_for_black_holes = True, fallback_kick_for_black_holes = True, - stop_at_CPU_time = False, max_CPU_time = 3600.0, file_name = "TRES.hdf", file_type = "hdf5", dir_plots = ""): + return triple_class_object - set_printing_strategy("custom", - preferred_units = [units.MSun, units.RSun, units.Myr], - precision = 11, prefix = "", - separator = " [", suffix = "]") +def run_tres_developer( + stars, + bins, + correct_params, + stellar_code, + secular_code, + relative_inclination=80.0 * np.pi / 180.0, + metallicity=0.02, + tend=5.0 | units.Myr, + tinit=0.0 | units.Myr, + number=0, + maximum_radius_change_factor=0.005, + stop_at_mass_transfer=True, + stop_at_init_mass_transfer=True, + stop_at_outer_mass_transfer=True, + stop_at_stable_mass_transfer=True, + stop_at_eccentric_stable_mass_transfer=True, + stop_at_unstable_mass_transfer=False, + stop_at_eccentric_unstable_mass_transfer=False, + which_common_envelope=2, + stop_at_no_CHE=False, + include_CHE=False, + stop_at_merger=True, + stop_at_disintegrated=True, + stop_at_inner_collision=True, + stop_at_outer_collision=True, + stop_at_dynamical_instability=True, + stop_at_semisecular_regime=False, + stop_at_SN=False, + SN_kick_distr=2, + impulse_kick_for_black_holes=True, + fallback_kick_for_black_holes=True, + stop_at_CPU_time=False, + max_CPU_time=3600.0, + file_name="TRES.hdf", + file_type="hdf5", + dir_plots="", +): + + set_printing_strategy( + "custom", + preferred_units=[units.MSun, units.RSun, units.Myr], + precision=11, + prefix="", + separator=" [", + suffix="]", + ) bins.eccentricity[0] = float(bins.eccentricity[0]) bins.eccentricity[1] = float(bins.eccentricity[1]) bins.argument_of_pericenter[0] = float(bins.argument_of_pericenter[0]) bins.argument_of_pericenter[1] = float(bins.argument_of_pericenter[1]) bins.longitude_of_ascending_node[0] = float(bins.longitude_of_ascending_node[0]) - bins.longitude_of_ascending_node[1] = float(bins.longitude_of_ascending_node[1]) + bins.longitude_of_ascending_node[1] = float(bins.longitude_of_ascending_node[1]) relative_inclination = float(relative_inclination) - triple_class_object = Triple_Class(stars, bins, correct_params, stellar_code, secular_code, - relative_inclination, tend, tinit, - number, maximum_radius_change_factor, - stop_at_mass_transfer, stop_at_init_mass_transfer, stop_at_outer_mass_transfer, - stop_at_stable_mass_transfer, stop_at_eccentric_stable_mass_transfer, - stop_at_unstable_mass_transfer, stop_at_eccentric_unstable_mass_transfer, which_common_envelope, - stop_at_no_CHE, include_CHE, - stop_at_merger, stop_at_disintegrated, stop_at_inner_collision, stop_at_outer_collision, - stop_at_dynamical_instability, stop_at_semisecular_regime, - stop_at_SN, SN_kick_distr, impulse_kick_for_black_holes, fallback_kick_for_black_holes, - stop_at_CPU_time, max_CPU_time, file_name, file_type, dir_plots) - + triple_class_object = Triple_Class( + stars, + bins, + correct_params, + stellar_code, + secular_code, + relative_inclination, + tend, + tinit, + number, + maximum_radius_change_factor, + stop_at_mass_transfer, + stop_at_init_mass_transfer, + stop_at_outer_mass_transfer, + stop_at_stable_mass_transfer, + stop_at_eccentric_stable_mass_transfer, + stop_at_unstable_mass_transfer, + stop_at_eccentric_unstable_mass_transfer, + which_common_envelope, + stop_at_no_CHE, + include_CHE, + stop_at_merger, + stop_at_disintegrated, + stop_at_inner_collision, + stop_at_outer_collision, + stop_at_dynamical_instability, + stop_at_semisecular_regime, + stop_at_SN, + SN_kick_distr, + impulse_kick_for_black_holes, + fallback_kick_for_black_holes, + stop_at_CPU_time, + max_CPU_time, + file_name, + file_type, + dir_plots, + ) if triple_class_object.correct_params == False: if REPORT_USER_WARNINGS: - print('Choose a different system. The parameters of the given triple are incorrect.') - return triple_class_object # no codes initialized yet + print("Choose a different system. The parameters of the given triple are incorrect.") + return triple_class_object # no codes initialized yet elif stop_at_semisecular_regime == True and triple_class_object.semisecular_regime_at_initialisation == True: if REPORT_USER_WARNINGS: - print('Choose a different system. The given triple is in the semisecular regime at initialization.') + print("Choose a different system. The given triple is in the semisecular regime at initialization.") elif triple_class_object.dynamical_instability_at_initialisation == True: if REPORT_USER_WARNINGS: - print('Choose a different system. The given triple is dynamically unstable at initialization.') + print("Choose a different system. The given triple is dynamically unstable at initialization.") elif triple_class_object.mass_transfer_at_initialisation == True: if REPORT_USER_WARNINGS: - print('Choose a different system. There is mass transfer in the given triple at initialization.') + print("Choose a different system. There is mass transfer in the given triple at initialization.") elif stop_at_no_CHE == True and triple_class_object.CHE_at_initialisation == False: if REPORT_USER_WARNINGS: - print('Choose a different system. No chemically homogeneous evolution at initialization') - else: + print("Choose a different system. No chemically homogeneous evolution at initialization") + else: triple_class_object.evolve_model(tend) if REPORT_DEBUG or MAKE_PLOTS: plot_function(triple_class_object, dir_plots) triple_class_object.print_stellar_system() - + return triple_class_object +# ----- -#----- -#----- -#for running triple.py from the commandline +# ----- +# for running triple.py from the commandline def parse_arguments(): from amuse.units.optparse import OptionParser + parser = OptionParser() - parser.add_option("-M", "--M1", unit=units.MSun, - dest="inner_primary_mass", type="float", default = 1.3|units.MSun, - help="inner primary mass [%default]") - parser.add_option("-m", "--M2", unit=units.MSun, - dest="inner_secondary_mass", type="float", default = 0.5|units.MSun, - help="inner secondary mass [%default]") - parser.add_option("-l", "--M3", unit=units.MSun, - dest="outer_mass", type="float", default = 0.5|units.MSun, - help="outer mass [%default]") - - parser.add_option("-A", "--Ain", unit=units.RSun, - dest="inner_semimajor_axis", type="float", - default = 200.0 |units.RSun, - help="inner semi major axis [%default]") - parser.add_option("-a", "--Aout",unit=units.RSun, - dest="outer_semimajor_axis", type="float", - default = 20000.0 |units.RSun, - help="outer semi major axis [%default]") - parser.add_option("-E", "--Ein", - dest="inner_eccentricity", type="float", default = 0.1, - help="inner eccentricity [%default]") - parser.add_option("-e", "--Eout", - dest="outer_eccentricity", type="float", default = 0.5, - help="outer eccentricity [%default]") - parser.add_option("-i","-I", - dest="relative_inclination", type="float", default = 80.0*np.pi/180.0, - help="relative inclination [rad] [%default]") - parser.add_option("-G", "--Gin", - dest="inner_argument_of_pericenter", type="float", default = 0.1, - help="inner argument of pericenter [rad] [%default]") - parser.add_option("-g","--Gout", - dest="outer_argument_of_pericenter", type="float", default = 0.5, - help="outer argument of pericenter [rad] [%default]") - parser.add_option("-O", "--Oin", - dest="inner_longitude_of_ascending_node", type="float", default = 0.0, - help="inner longitude of ascending node [rad] [%default]") -## outer longitude of ascending nodes = inner - pi -# parser.add_option("-o", -# dest="outer_longitude_of_ascending_node", type="float", default = 0.0, -# help="outer longitude of ascending node [rad] [%default]") - - parser.add_option("-z", "-Z", dest="metallicity", type="float", default = 0.02, - help="metallicity [%default] %unit") - parser.add_option("-t", "-T", unit=units.Myr, - dest="tend", type="float", default = 5.0 |units.Myr, - help="end time [%default] %unit") - parser.add_option("--initial_time", unit=units.Myr, - dest="tinit", type="float", default = 0.0 |units.Myr, - help="initial time [%default] %unit") - parser.add_option("-N", dest="number", type="int", default = 0, - help="number ID of system [%default]") - parser.add_option("-r", dest="maximum_radius_change_factor", type="float", default = 0.01, - help="maximum_radius_change_factor [%default] %unit") - -# parser.add_option("--tidal", dest="tidal_terms", action="store_false", default = True, -# help="tidal terms included [%default] %unit") - - parser.add_option("--no_stop_at_mass_transfer", dest="stop_at_mass_transfer", action="store_false", default = True, - help="stop at mass transfer [%default] %unit") - parser.add_option("--no_stop_at_init_mass_transfer", dest="stop_at_init_mass_transfer", action="store_false", default = True, - help="stop if initially mass transfer[%default] %unit") - parser.add_option("--no_stop_at_outer_mass_transfer", dest="stop_at_outer_mass_transfer", action="store_false", default = True, - help="stop at triple mass transfer [%default] %unit") - -# if stop_at_mass_transfer is False, the following 4 stopping conditions can be used to further specify. -# if stop_at_mass_transfer is True, the following 4 are ignored. - parser.add_option("--stop_at_stable_mass_transfer", dest="stop_at_stable_mass_transfer", action="store_true", default = False, - help="stop at stable mass transfer [%default] %unit") - parser.add_option("--stop_at_eccentric_stable_mass_transfer", dest="stop_at_eccentric_stable_mass_transfer", action="store_true", - default = False, help="stop at eccentric stable mass transfer [%default] %unit") - #unstable mass transfer leads to common-envelope evolution - parser.add_option("--stop_at_unstable_mass_transfer", dest="stop_at_unstable_mass_transfer", action="store_true", - default = False, help="stop at unstable mass transfer [%default] %unit") - parser.add_option("--stop_at_eccentric_unstable_mass_transfer", dest="stop_at_eccentric_unstable_mass_transfer", - action="store_true", default = False, help="stop at eccentric unstable mass transfer [%default] %unit") - #0 alpha-ce + alpha-dce - #1 gamma-ce + alpha-dce - #2 seba style; combination of gamma-ce, alpha-ce & alpha-dce - parser.add_option("--CE", dest="which_common_envelope", type="int", default = 2, - help="which common envelope modeling [%default]") - - parser.add_option("--stop_at_no_CHE", dest="stop_at_no_CHE", - action="store_true", default = False, help="stop if no chemically homogeneous evolution [%default] %unit") - parser.add_option("--include_CHE", dest="include_CHE", - action="store_true", default = False, help="include chemically homogeneous evolution in the stellar evolution [%default] %unit") - - parser.add_option("--no_stop_at_merger", dest="stop_at_merger", action="store_false", default = True, - help="stop at merger [%default] %unit") - parser.add_option("--no_stop_at_disintegrated", dest="stop_at_disintegrated", action="store_false", default = True, - help="stop at disintegrated [%default] %unit") - parser.add_option("--no_stop_at_inner_collision", dest="stop_at_inner_collision", action="store_false",default = True, - help="stop at collision in inner binary[%default] %unit") - parser.add_option("--no_stop_at_outer_collision", dest="stop_at_outer_collision", action="store_false",default = True, - help="stop at collision in outer binary[%default] %unit") - parser.add_option("--no_stop_at_dynamical_instability", dest="stop_at_dynamical_instability", action="store_false", default = True, - help="stop at dynamical instability [%default] %unit") - parser.add_option("--stop_at_semisecular_regime", dest="stop_at_semisecular_regime", action="store_true", default = False, - help="stop at semisecular regime [%default] %unit") - - parser.add_option("--stop_at_SN", dest="stop_at_SN", action="store_true", default = False, - help="stop at supernova [%default] %unit") - #0 No kick - #1 Hobbs, Lorimer, Lyne & Kramer 2005, 360, 974 - #2 Arzoumanian ea 2002, 568, 289 - #3 Hansen & Phinney 1997, 291, 569 - #4 Paczynski 1990, 348, 485 - #5 Verbunt, Igoshev & Cator, 2017, 608, 57 - parser.add_option("--SN_kick_distr", dest="SN_kick_distr", type="int", default = 5, - help="which supernova kick distribution [%default]") - parser.add_option("--no_impulse_kick_for_black_holes", dest="impulse_kick_for_black_holes", action="store_false", default = True, - help="do not rescale the BH SN kick by mass -> impulse kick [%default]") - parser.add_option("--no_fallback_kick_for_black_holes", dest="fallback_kick_for_black_holes", action="store_false", default = True, - help="do not rescale the BH SN kick with fallback [%default]") - - - parser.add_option("--stop_at_CPU_time", dest="stop_at_CPU_time", action="store_true", default = False, - help="stop at CPU time [%default] %unit") - parser.add_option("--max_CPU_time", dest="max_CPU_time", type="float", default = 3600.0, - help="max CPU time [%default] %unit") - - parser.add_option("--stellar_evolution_code", dest="SE_code", type="int", default = 0, - help="which stellar evolution [%default]") - - parser.add_option("-f", dest="file_name", type ="string", default = "TRES.hdf",#"TRES.txt" - help="file name[%default]") - parser.add_option("-F", dest="file_type", type ="string", default = "hdf5",#"txt" - help="file type[%default]") - parser.add_option("--dir_plots", dest="dir_plots", type ="string", default = "",#"txt" - help="directory for plots for debugging mode [%default]") - + parser.add_option( + "-M", + "--M1", + unit=units.MSun, + dest="inner_primary_mass", + type="float", + default=1.3 | units.MSun, + help="inner primary mass [%default]", + ) + parser.add_option( + "-m", + "--M2", + unit=units.MSun, + dest="inner_secondary_mass", + type="float", + default=0.5 | units.MSun, + help="inner secondary mass [%default]", + ) + parser.add_option( + "-l", + "--M3", + unit=units.MSun, + dest="outer_mass", + type="float", + default=0.5 | units.MSun, + help="outer mass [%default]", + ) + + parser.add_option( + "-A", + "--Ain", + unit=units.RSun, + dest="inner_semimajor_axis", + type="float", + default=200.0 | units.RSun, + help="inner semi major axis [%default]", + ) + parser.add_option( + "-a", + "--Aout", + unit=units.RSun, + dest="outer_semimajor_axis", + type="float", + default=20000.0 | units.RSun, + help="outer semi major axis [%default]", + ) + parser.add_option( + "-E", "--Ein", dest="inner_eccentricity", type="float", default=0.1, help="inner eccentricity [%default]" + ) + parser.add_option( + "-e", "--Eout", dest="outer_eccentricity", type="float", default=0.5, help="outer eccentricity [%default]" + ) + parser.add_option( + "-i", + "-I", + dest="relative_inclination", + type="float", + default=80.0 * np.pi / 180.0, + help="relative inclination [rad] [%default]", + ) + parser.add_option( + "-G", + "--Gin", + dest="inner_argument_of_pericenter", + type="float", + default=0.1, + help="inner argument of pericenter [rad] [%default]", + ) + parser.add_option( + "-g", + "--Gout", + dest="outer_argument_of_pericenter", + type="float", + default=0.5, + help="outer argument of pericenter [rad] [%default]", + ) + parser.add_option( + "-O", + "--Oin", + dest="inner_longitude_of_ascending_node", + type="float", + default=0.0, + help="inner longitude of ascending node [rad] [%default]", + ) + ## outer longitude of ascending nodes = inner - pi + # parser.add_option("-o", + # dest="outer_longitude_of_ascending_node", type="float", default = 0.0, + # help="outer longitude of ascending node [rad] [%default]") + + parser.add_option("-z", "-Z", dest="metallicity", type="float", default=0.02, help="metallicity [%default] %unit") + parser.add_option( + "-t", "-T", unit=units.Myr, dest="tend", type="float", default=5.0 | units.Myr, help="end time [%default] %unit" + ) + parser.add_option( + "--initial_time", + unit=units.Myr, + dest="tinit", + type="float", + default=0.0 | units.Myr, + help="initial time [%default] %unit", + ) + parser.add_option("-N", dest="number", type="int", default=0, help="number ID of system [%default]") + parser.add_option( + "-r", + dest="maximum_radius_change_factor", + type="float", + default=0.01, + help="maximum_radius_change_factor [%default] %unit", + ) + + # parser.add_option("--tidal", dest="tidal_terms", action="store_false", default = True, + # help="tidal terms included [%default] %unit") + + parser.add_option( + "--no_stop_at_mass_transfer", + dest="stop_at_mass_transfer", + action="store_false", + default=True, + help="stop at mass transfer [%default] %unit", + ) + parser.add_option( + "--no_stop_at_init_mass_transfer", + dest="stop_at_init_mass_transfer", + action="store_false", + default=True, + help="stop if initially mass transfer[%default] %unit", + ) + parser.add_option( + "--no_stop_at_outer_mass_transfer", + dest="stop_at_outer_mass_transfer", + action="store_false", + default=True, + help="stop at triple mass transfer [%default] %unit", + ) + + # if stop_at_mass_transfer is False, the following 4 stopping conditions can be used to further specify. + # if stop_at_mass_transfer is True, the following 4 are ignored. + parser.add_option( + "--stop_at_stable_mass_transfer", + dest="stop_at_stable_mass_transfer", + action="store_true", + default=False, + help="stop at stable mass transfer [%default] %unit", + ) + parser.add_option( + "--stop_at_eccentric_stable_mass_transfer", + dest="stop_at_eccentric_stable_mass_transfer", + action="store_true", + default=False, + help="stop at eccentric stable mass transfer [%default] %unit", + ) + # unstable mass transfer leads to common-envelope evolution + parser.add_option( + "--stop_at_unstable_mass_transfer", + dest="stop_at_unstable_mass_transfer", + action="store_true", + default=False, + help="stop at unstable mass transfer [%default] %unit", + ) + parser.add_option( + "--stop_at_eccentric_unstable_mass_transfer", + dest="stop_at_eccentric_unstable_mass_transfer", + action="store_true", + default=False, + help="stop at eccentric unstable mass transfer [%default] %unit", + ) + # 0 alpha-ce + alpha-dce + # 1 gamma-ce + alpha-dce + # 2 seba style; combination of gamma-ce, alpha-ce & alpha-dce + parser.add_option( + "--CE", dest="which_common_envelope", type="int", default=2, help="which common envelope modeling [%default]" + ) + + parser.add_option( + "--stop_at_no_CHE", + dest="stop_at_no_CHE", + action="store_true", + default=False, + help="stop if no chemically homogeneous evolution [%default] %unit", + ) + parser.add_option( + "--include_CHE", + dest="include_CHE", + action="store_true", + default=False, + help="include chemically homogeneous evolution in the stellar evolution [%default] %unit", + ) + + parser.add_option( + "--no_stop_at_merger", + dest="stop_at_merger", + action="store_false", + default=True, + help="stop at merger [%default] %unit", + ) + parser.add_option( + "--no_stop_at_disintegrated", + dest="stop_at_disintegrated", + action="store_false", + default=True, + help="stop at disintegrated [%default] %unit", + ) + parser.add_option( + "--no_stop_at_inner_collision", + dest="stop_at_inner_collision", + action="store_false", + default=True, + help="stop at collision in inner binary[%default] %unit", + ) + parser.add_option( + "--no_stop_at_outer_collision", + dest="stop_at_outer_collision", + action="store_false", + default=True, + help="stop at collision in outer binary[%default] %unit", + ) + parser.add_option( + "--no_stop_at_dynamical_instability", + dest="stop_at_dynamical_instability", + action="store_false", + default=True, + help="stop at dynamical instability [%default] %unit", + ) + parser.add_option( + "--stop_at_semisecular_regime", + dest="stop_at_semisecular_regime", + action="store_true", + default=False, + help="stop at semisecular regime [%default] %unit", + ) + + parser.add_option( + "--stop_at_SN", dest="stop_at_SN", action="store_true", default=False, help="stop at supernova [%default] %unit" + ) + # 0 No kick + # 1 Hobbs, Lorimer, Lyne & Kramer 2005, 360, 974 + # 2 Arzoumanian ea 2002, 568, 289 + # 3 Hansen & Phinney 1997, 291, 569 + # 4 Paczynski 1990, 348, 485 + # 5 Verbunt, Igoshev & Cator, 2017, 608, 57 + parser.add_option( + "--SN_kick_distr", + dest="SN_kick_distr", + type="int", + default=5, + help="which supernova kick distribution [%default]", + ) + parser.add_option( + "--no_impulse_kick_for_black_holes", + dest="impulse_kick_for_black_holes", + action="store_false", + default=True, + help="do not rescale the BH SN kick by mass -> impulse kick [%default]", + ) + parser.add_option( + "--no_fallback_kick_for_black_holes", + dest="fallback_kick_for_black_holes", + action="store_false", + default=True, + help="do not rescale the BH SN kick with fallback [%default]", + ) + + parser.add_option( + "--stop_at_CPU_time", + dest="stop_at_CPU_time", + action="store_true", + default=False, + help="stop at CPU time [%default] %unit", + ) + parser.add_option( + "--max_CPU_time", dest="max_CPU_time", type="float", default=3600.0, help="max CPU time [%default] %unit" + ) + + parser.add_option( + "--stellar_evolution_code", dest="SE_code", type="int", default=0, help="which stellar evolution [%default]" + ) + + parser.add_option( + "-f", dest="file_name", type="string", default="TRES.hdf", help="file name[%default]" # "TRES.txt" + ) + parser.add_option("-F", dest="file_type", type="string", default="hdf5", help="file type[%default]") # "txt" + parser.add_option( + "--dir_plots", + dest="dir_plots", + type="string", + default="", # "txt" + help="directory for plots for debugging mode [%default]", + ) + options, args = parser.parse_args() return options.__dict__ -if __name__ == '__main__': +if __name__ == "__main__": opt = parse_arguments() - set_printing_strategy("custom", - preferred_units = [units.MSun, units.RSun, units.Myr], - precision = 11, prefix = "", - separator = " [", suffix = "]") - - stars, bins, correct_params = make_particle_sets(opt["inner_primary_mass"], opt["inner_secondary_mass"], opt["outer_mass"], - opt["inner_semimajor_axis"], opt["outer_semimajor_axis"], - opt["inner_eccentricity"], opt["outer_eccentricity"], - opt["relative_inclination"], - opt["inner_argument_of_pericenter"], opt["outer_argument_of_pericenter"], - opt["inner_longitude_of_ascending_node"]) - + set_printing_strategy( + "custom", + preferred_units=[units.MSun, units.RSun, units.Myr], + precision=11, + prefix="", + separator=" [", + suffix="]", + ) + + stars, bins, correct_params = make_particle_sets( + opt["inner_primary_mass"], + opt["inner_secondary_mass"], + opt["outer_mass"], + opt["inner_semimajor_axis"], + opt["outer_semimajor_axis"], + opt["inner_eccentricity"], + opt["outer_eccentricity"], + opt["relative_inclination"], + opt["inner_argument_of_pericenter"], + opt["outer_argument_of_pericenter"], + opt["inner_longitude_of_ascending_node"], + ) if opt["SE_code"] == 1: stellar_code = SSE() elif opt["SE_code"] == 2: stellar_code = Mesa() else: - stellar_code = SeBa() -# stellar_code = SeBa(redirection='none') -# stellar_code = SeBa(redirection='file', redirect_file='output_SeBa_TRES.txt') + stellar_code = SeBa() + # stellar_code = SeBa(redirection='none') + # stellar_code = SeBa(redirection='file', redirect_file='output_SeBa_TRES.txt') stellar_code.parameters.metallicity = opt["metallicity"] secular_code = Seculartriple() -# secular_code = Seculartriple(redirection='none') -# secular_code = Seculartriple(redirection='file', redirect_file='output_SecularTriple_TRES.txt') - - triple_class_object = Triple_Class(stars, bins, correct_params, stellar_code, secular_code, - opt["relative_inclination"], opt["tend"], opt["tinit"], - opt["number"], opt["maximum_radius_change_factor"], - opt["stop_at_mass_transfer"], opt["stop_at_init_mass_transfer"], opt["stop_at_outer_mass_transfer"], - opt["stop_at_stable_mass_transfer"], opt["stop_at_eccentric_stable_mass_transfer"], - opt["stop_at_unstable_mass_transfer"], opt["stop_at_eccentric_unstable_mass_transfer"], opt["which_common_envelope"], - opt["stop_at_no_CHE"], opt["include_CHE"], - opt["stop_at_merger"], opt["stop_at_disintegrated"], opt["stop_at_inner_collision"], opt["stop_at_outer_collision"], - opt["stop_at_dynamical_instability"], opt["stop_at_semisecular_regime"], - opt["stop_at_SN"], opt["SN_kick_distr"], opt["impulse_kick_for_black_holes"], opt["fallback_kick_for_black_holes"], - opt["stop_at_CPU_time"], opt["max_CPU_time"], opt["file_name"], opt["file_type"], opt["dir_plots"]) + # secular_code = Seculartriple(redirection='none') + # secular_code = Seculartriple(redirection='file', redirect_file='output_SecularTriple_TRES.txt') + + triple_class_object = Triple_Class( + stars, + bins, + correct_params, + stellar_code, + secular_code, + opt["relative_inclination"], + opt["tend"], + opt["tinit"], + opt["number"], + opt["maximum_radius_change_factor"], + opt["stop_at_mass_transfer"], + opt["stop_at_init_mass_transfer"], + opt["stop_at_outer_mass_transfer"], + opt["stop_at_stable_mass_transfer"], + opt["stop_at_eccentric_stable_mass_transfer"], + opt["stop_at_unstable_mass_transfer"], + opt["stop_at_eccentric_unstable_mass_transfer"], + opt["which_common_envelope"], + opt["stop_at_no_CHE"], + opt["include_CHE"], + opt["stop_at_merger"], + opt["stop_at_disintegrated"], + opt["stop_at_inner_collision"], + opt["stop_at_outer_collision"], + opt["stop_at_dynamical_instability"], + opt["stop_at_semisecular_regime"], + opt["stop_at_SN"], + opt["SN_kick_distr"], + opt["impulse_kick_for_black_holes"], + opt["fallback_kick_for_black_holes"], + opt["stop_at_CPU_time"], + opt["max_CPU_time"], + opt["file_name"], + opt["file_type"], + opt["dir_plots"], + ) if triple_class_object.correct_params == False: if REPORT_USER_WARNINGS: - print('Choose a different system. The parameters of the given triple are incorrect.' ) + print("Choose a different system. The parameters of the given triple are incorrect.") # no codes initialized yet - sys.exit('Choose a different system. The parameters of the given triple are incorrect.') - elif opt['stop_at_semisecular_regime'] == True and triple_class_object.semisecular_regime_at_initialisation == True: + sys.exit("Choose a different system. The parameters of the given triple are incorrect.") + elif opt["stop_at_semisecular_regime"] == True and triple_class_object.semisecular_regime_at_initialisation == True: if REPORT_USER_WARNINGS: - print('Choose a different system. The given triple is in the semisecular regime at initialization.') + print("Choose a different system. The given triple is in the semisecular regime at initialization.") elif triple_class_object.dynamical_instability_at_initialisation == True: if REPORT_USER_WARNINGS: - print('Choose a different system. The given triple is dynamically unstable at initialization.') + print("Choose a different system. The given triple is dynamically unstable at initialization.") elif triple_class_object.mass_transfer_at_initialisation == True: if REPORT_USER_WARNINGS: - print('Choose a different system. There is mass transfer in the given triple at initialization.') + print("Choose a different system. There is mass transfer in the given triple at initialization.") elif opt["stop_at_no_CHE"] == True and triple_class_object.CHE_at_initialisation == False: if REPORT_USER_WARNINGS: - print('Choose a different system. No chemically homogeneous evolution at initialization') - else: + print("Choose a different system. No chemically homogeneous evolution at initialization") + else: triple_class_object.evolve_model(opt["tend"]) if REPORT_DEBUG or MAKE_PLOTS: - plot_function(triple_class_object, opt['dir_plots']) + plot_function(triple_class_object, opt["dir_plots"]) triple_class_object.print_stellar_system() - - if REPORT_TRIPLE_EVOLUTION: - print('Simulation has finished succesfully') - - print('\nYou have used the TRES triple evolution code. Literature reference:') - print('** Toonen, Hamers & Portegies Zwart 2016, ComAC, 3, 6T:') + print("Simulation has finished succesfully") + + print("\nYou have used the TRES triple evolution code. Literature reference:") + print("** Toonen, Hamers & Portegies Zwart 2016, ComAC, 3, 6T:") print('... "The evolution of hierarchical triple star-systems" ') - + triple_class_object.stellar_code.stop() triple_class_object.secular_code.stop() - From fc43fe13ae01ca26101e70764d2c20d4c28a1f6f Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 15 Jul 2025 11:05:00 +0200 Subject: [PATCH 12/13] Move file, required for package structure --- src/tres/__init__.py | 8 ++++---- src/tres/{tres.py => run_tres.py} | 0 2 files changed, 4 insertions(+), 4 deletions(-) rename src/tres/{tres.py => run_tres.py} (100%) diff --git a/src/tres/__init__.py b/src/tres/__init__.py index 6610909..3ff8eb4 100644 --- a/src/tres/__init__.py +++ b/src/tres/__init__.py @@ -1,4 +1,4 @@ -from .tres import run_tres, run_tres_developer -from .tres import initialize_triple_class -from .tres import make_particle_sets -from .tres import corotating_spin_angular_frequency_binary +from .run_tres import run_tres, run_tres_developer +from .run_tres import initialize_triple_class +from .run_tres import make_particle_sets +from .run_tres import corotating_spin_angular_frequency_binary diff --git a/src/tres/tres.py b/src/tres/run_tres.py similarity index 100% rename from src/tres/tres.py rename to src/tres/run_tres.py From d322853d504d19d05ce2569a29749fc5c6b7d251 Mon Sep 17 00:00:00 2001 From: Steven Rieder Date: Tue, 15 Jul 2025 11:05:33 +0200 Subject: [PATCH 13/13] replace deprecated optparse with argparse --- src/tres/run_tres.py | 332 +++++++++++++++++++++---------------------- 1 file changed, 165 insertions(+), 167 deletions(-) diff --git a/src/tres/run_tres.py b/src/tres/run_tres.py index 52a4d72..0df1027 100644 --- a/src/tres/run_tres.py +++ b/src/tres/run_tres.py @@ -6,6 +6,7 @@ ## given any initial conditions (M, m, l, A, a, E, e, i, G, g, O, o, T, z). import sys +import argparse import numpy as np # from interactions import * @@ -74,8 +75,8 @@ def initialize_triple_class( fallback_kick_for_black_holes=True, stop_at_CPU_time=False, max_CPU_time=3600.0, - file_name="TRES.hdf", - file_type="hdf5", + file_name="TRES.amuse", + file_type="amuse", dir_plots="", ): @@ -162,8 +163,8 @@ def run_tres( fallback_kick_for_black_holes=True, stop_at_CPU_time=False, max_CPU_time=3600.0, - file_name="TRES.hdf", - file_type="hdf5", + file_name="TRES.amuse", + file_type="amuse", dir_plots="", stellar_code=None, secular_code=None, @@ -333,8 +334,8 @@ def run_tres_developer( fallback_kick_for_black_holes=True, stop_at_CPU_time=False, max_CPU_time=3600.0, - file_name="TRES.hdf", - file_type="hdf5", + file_name="TRES.amuse", + file_type="amuse", dir_plots="", ): @@ -424,242 +425,239 @@ def run_tres_developer( # ----- # for running triple.py from the commandline def parse_arguments(): - from amuse.units.optparse import OptionParser - - parser = OptionParser() - parser.add_option( + """ + Parse command line arguments and show default values. + """ + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter + ) + parser.add_argument( "-M", "--M1", - unit=units.MSun, + type=units.MSun, dest="inner_primary_mass", - type="float", default=1.3 | units.MSun, - help="inner primary mass [%default]", + help="inner primary mass", ) - parser.add_option( + parser.add_argument( "-m", "--M2", - unit=units.MSun, + type=units.MSun, dest="inner_secondary_mass", - type="float", default=0.5 | units.MSun, - help="inner secondary mass [%default]", + help="inner secondary mass", ) - parser.add_option( + parser.add_argument( "-l", "--M3", - unit=units.MSun, + type=units.MSun, dest="outer_mass", - type="float", default=0.5 | units.MSun, - help="outer mass [%default]", + help="outer mass", ) - parser.add_option( + parser.add_argument( "-A", "--Ain", - unit=units.RSun, + type=units.RSun, dest="inner_semimajor_axis", - type="float", default=200.0 | units.RSun, - help="inner semi major axis [%default]", + help="inner semi major axis", ) - parser.add_option( + parser.add_argument( "-a", "--Aout", - unit=units.RSun, + type=units.RSun, dest="outer_semimajor_axis", - type="float", default=20000.0 | units.RSun, - help="outer semi major axis [%default]", + help="outer semi major axis", ) - parser.add_option( - "-E", "--Ein", dest="inner_eccentricity", type="float", default=0.1, help="inner eccentricity [%default]" + parser.add_argument( + "-E", "--Ein", dest="inner_eccentricity", type=float, default=0.1, help="inner eccentricity" ) - parser.add_option( - "-e", "--Eout", dest="outer_eccentricity", type="float", default=0.5, help="outer eccentricity [%default]" + parser.add_argument( + "-e", "--Eout", dest="outer_eccentricity", type=float, default=0.5, help="outer eccentricity" ) - parser.add_option( + parser.add_argument( "-i", "-I", dest="relative_inclination", - type="float", + type=float, default=80.0 * np.pi / 180.0, - help="relative inclination [rad] [%default]", + help="relative inclination [rad]", ) - parser.add_option( + parser.add_argument( "-G", "--Gin", dest="inner_argument_of_pericenter", - type="float", + type=float, default=0.1, - help="inner argument of pericenter [rad] [%default]", + help="inner argument of pericenter [rad]", ) - parser.add_option( + parser.add_argument( "-g", "--Gout", dest="outer_argument_of_pericenter", - type="float", + type=float, default=0.5, - help="outer argument of pericenter [rad] [%default]", + help="outer argument of pericenter [rad]", ) - parser.add_option( + parser.add_argument( "-O", "--Oin", dest="inner_longitude_of_ascending_node", - type="float", + type=float, default=0.0, - help="inner longitude of ascending node [rad] [%default]", + help="inner longitude of ascending node [rad]", ) ## outer longitude of ascending nodes = inner - pi - # parser.add_option("-o", - # dest="outer_longitude_of_ascending_node", type="float", default = 0.0, - # help="outer longitude of ascending node [rad] [%default]") + # parser.add_argument("-o", + # dest="outer_longitude_of_ascending_node", type=float, default = 0.0, + # help="outer longitude of ascending node [rad]") - parser.add_option("-z", "-Z", dest="metallicity", type="float", default=0.02, help="metallicity [%default] %unit") - parser.add_option( - "-t", "-T", unit=units.Myr, dest="tend", type="float", default=5.0 | units.Myr, help="end time [%default] %unit" + parser.add_argument("-z", "-Z", dest="metallicity", type=float, default=0.02, help="metallicity") + parser.add_argument( + "-t", "-T", type=units.Myr, dest="tend", default=5.0 | units.Myr, help="end time" ) - parser.add_option( + parser.add_argument( "--initial_time", - unit=units.Myr, + type=units.Myr, dest="tinit", - type="float", default=0.0 | units.Myr, - help="initial time [%default] %unit", + help="initial time", ) - parser.add_option("-N", dest="number", type="int", default=0, help="number ID of system [%default]") - parser.add_option( + parser.add_argument("-N", dest="number", type=int, default=0, help="number ID of system") + parser.add_argument( "-r", dest="maximum_radius_change_factor", - type="float", + type=float, default=0.01, - help="maximum_radius_change_factor [%default] %unit", + help="maximum_radius_change_factor", ) - # parser.add_option("--tidal", dest="tidal_terms", action="store_false", default = True, - # help="tidal terms included [%default] %unit") + # parser.add_argument("--tidal", dest="tidal_terms", action="store_false", default = True, + # help="tidal terms included") - parser.add_option( + parser.add_argument( "--no_stop_at_mass_transfer", dest="stop_at_mass_transfer", action="store_false", default=True, - help="stop at mass transfer [%default] %unit", + help="stop at mass transfer", ) - parser.add_option( + parser.add_argument( "--no_stop_at_init_mass_transfer", dest="stop_at_init_mass_transfer", action="store_false", default=True, - help="stop if initially mass transfer[%default] %unit", + help="stop if initially mass transfer", ) - parser.add_option( + parser.add_argument( "--no_stop_at_outer_mass_transfer", dest="stop_at_outer_mass_transfer", action="store_false", default=True, - help="stop at triple mass transfer [%default] %unit", + help="stop at triple mass transfer", ) # if stop_at_mass_transfer is False, the following 4 stopping conditions can be used to further specify. # if stop_at_mass_transfer is True, the following 4 are ignored. - parser.add_option( + parser.add_argument( "--stop_at_stable_mass_transfer", dest="stop_at_stable_mass_transfer", action="store_true", default=False, - help="stop at stable mass transfer [%default] %unit", + help="stop at stable mass transfer", ) - parser.add_option( + parser.add_argument( "--stop_at_eccentric_stable_mass_transfer", dest="stop_at_eccentric_stable_mass_transfer", action="store_true", default=False, - help="stop at eccentric stable mass transfer [%default] %unit", + help="stop at eccentric stable mass transfer", ) # unstable mass transfer leads to common-envelope evolution - parser.add_option( + parser.add_argument( "--stop_at_unstable_mass_transfer", dest="stop_at_unstable_mass_transfer", action="store_true", default=False, - help="stop at unstable mass transfer [%default] %unit", + help="stop at unstable mass transfer", ) - parser.add_option( + parser.add_argument( "--stop_at_eccentric_unstable_mass_transfer", dest="stop_at_eccentric_unstable_mass_transfer", action="store_true", default=False, - help="stop at eccentric unstable mass transfer [%default] %unit", + help="stop at eccentric unstable mass transfer", ) # 0 alpha-ce + alpha-dce # 1 gamma-ce + alpha-dce # 2 seba style; combination of gamma-ce, alpha-ce & alpha-dce - parser.add_option( - "--CE", dest="which_common_envelope", type="int", default=2, help="which common envelope modeling [%default]" + parser.add_argument( + "--CE", dest="which_common_envelope", type=int, default=2, help="which common envelope modeling" ) - parser.add_option( + parser.add_argument( "--stop_at_no_CHE", dest="stop_at_no_CHE", action="store_true", default=False, - help="stop if no chemically homogeneous evolution [%default] %unit", + help="stop if no chemically homogeneous evolution", ) - parser.add_option( + parser.add_argument( "--include_CHE", dest="include_CHE", action="store_true", default=False, - help="include chemically homogeneous evolution in the stellar evolution [%default] %unit", + help="include chemically homogeneous evolution in the stellar evolution", ) - parser.add_option( + parser.add_argument( "--no_stop_at_merger", dest="stop_at_merger", action="store_false", default=True, - help="stop at merger [%default] %unit", + help="stop at merger", ) - parser.add_option( + parser.add_argument( "--no_stop_at_disintegrated", dest="stop_at_disintegrated", action="store_false", default=True, - help="stop at disintegrated [%default] %unit", + help="stop at disintegrated", ) - parser.add_option( + parser.add_argument( "--no_stop_at_inner_collision", dest="stop_at_inner_collision", action="store_false", default=True, - help="stop at collision in inner binary[%default] %unit", + help="stop at collision in inner binary", ) - parser.add_option( + parser.add_argument( "--no_stop_at_outer_collision", dest="stop_at_outer_collision", action="store_false", default=True, - help="stop at collision in outer binary[%default] %unit", + help="stop at collision in outer binary", ) - parser.add_option( + parser.add_argument( "--no_stop_at_dynamical_instability", dest="stop_at_dynamical_instability", action="store_false", default=True, - help="stop at dynamical instability [%default] %unit", + help="stop at dynamical instability", ) - parser.add_option( + parser.add_argument( "--stop_at_semisecular_regime", dest="stop_at_semisecular_regime", action="store_true", default=False, - help="stop at semisecular regime [%default] %unit", + help="stop at semisecular regime", ) - parser.add_option( - "--stop_at_SN", dest="stop_at_SN", action="store_true", default=False, help="stop at supernova [%default] %unit" + parser.add_argument( + "--stop_at_SN", dest="stop_at_SN", action="store_true", default=False, help="stop at supernova" ) # 0 No kick # 1 Hobbs, Lorimer, Lyne & Kramer 2005, 360, 974 @@ -667,61 +665,61 @@ def parse_arguments(): # 3 Hansen & Phinney 1997, 291, 569 # 4 Paczynski 1990, 348, 485 # 5 Verbunt, Igoshev & Cator, 2017, 608, 57 - parser.add_option( + parser.add_argument( "--SN_kick_distr", dest="SN_kick_distr", - type="int", + type=int, default=5, - help="which supernova kick distribution [%default]", + help="which supernova kick distribution", ) - parser.add_option( + parser.add_argument( "--no_impulse_kick_for_black_holes", dest="impulse_kick_for_black_holes", action="store_false", default=True, - help="do not rescale the BH SN kick by mass -> impulse kick [%default]", + help="do not rescale the BH SN kick by mass -> impulse kick", ) - parser.add_option( + parser.add_argument( "--no_fallback_kick_for_black_holes", dest="fallback_kick_for_black_holes", action="store_false", default=True, - help="do not rescale the BH SN kick with fallback [%default]", + help="do not rescale the BH SN kick with fallback ", ) - parser.add_option( + parser.add_argument( "--stop_at_CPU_time", dest="stop_at_CPU_time", action="store_true", default=False, - help="stop at CPU time [%default] %unit", + help="stop at CPU time", ) - parser.add_option( - "--max_CPU_time", dest="max_CPU_time", type="float", default=3600.0, help="max CPU time [%default] %unit" + parser.add_argument( + "--max_CPU_time", dest="max_CPU_time", type=float, default=3600.0, help="max CPU time" ) - parser.add_option( - "--stellar_evolution_code", dest="SE_code", type="int", default=0, help="which stellar evolution [%default]" + parser.add_argument( + "--stellar_evolution_code", dest="SE_code", type=int, default=0, help="which stellar evolution" ) - parser.add_option( - "-f", dest="file_name", type="string", default="TRES.hdf", help="file name[%default]" # "TRES.txt" + parser.add_argument( + "-f", dest="file_name", type=str, default="TRES.amuse", help="file name" # "TRES.txt" ) - parser.add_option("-F", dest="file_type", type="string", default="hdf5", help="file type[%default]") # "txt" - parser.add_option( + parser.add_argument("-F", dest="file_type", type=str, default="amuse", help="file type") # "txt" + parser.add_argument( "--dir_plots", dest="dir_plots", - type="string", + type=str, default="", # "txt" - help="directory for plots for debugging mode [%default]", + help="directory for plots for debugging mode", ) - options, args = parser.parse_args() - return options.__dict__ + arguments = parser.parse_args() + return arguments.__dict__ if __name__ == "__main__": - opt = parse_arguments() + args = parse_arguments() set_printing_strategy( "custom", @@ -733,28 +731,28 @@ def parse_arguments(): ) stars, bins, correct_params = make_particle_sets( - opt["inner_primary_mass"], - opt["inner_secondary_mass"], - opt["outer_mass"], - opt["inner_semimajor_axis"], - opt["outer_semimajor_axis"], - opt["inner_eccentricity"], - opt["outer_eccentricity"], - opt["relative_inclination"], - opt["inner_argument_of_pericenter"], - opt["outer_argument_of_pericenter"], - opt["inner_longitude_of_ascending_node"], - ) - - if opt["SE_code"] == 1: + args["inner_primary_mass"], + args["inner_secondary_mass"], + args["outer_mass"], + args["inner_semimajor_axis"], + args["outer_semimajor_axis"], + args["inner_eccentricity"], + args["outer_eccentricity"], + args["relative_inclination"], + args["inner_argument_of_pericenter"], + args["outer_argument_of_pericenter"], + args["inner_longitude_of_ascending_node"], + ) + + if args["SE_code"] == 1: stellar_code = SSE() - elif opt["SE_code"] == 2: + elif args["SE_code"] == 2: stellar_code = Mesa() else: stellar_code = SeBa() # stellar_code = SeBa(redirection='none') # stellar_code = SeBa(redirection='file', redirect_file='output_SeBa_TRES.txt') - stellar_code.parameters.metallicity = opt["metallicity"] + stellar_code.parameters.metallicity = args["metallicity"] secular_code = Seculartriple() # secular_code = Seculartriple(redirection='none') @@ -766,36 +764,36 @@ def parse_arguments(): correct_params, stellar_code, secular_code, - opt["relative_inclination"], - opt["tend"], - opt["tinit"], - opt["number"], - opt["maximum_radius_change_factor"], - opt["stop_at_mass_transfer"], - opt["stop_at_init_mass_transfer"], - opt["stop_at_outer_mass_transfer"], - opt["stop_at_stable_mass_transfer"], - opt["stop_at_eccentric_stable_mass_transfer"], - opt["stop_at_unstable_mass_transfer"], - opt["stop_at_eccentric_unstable_mass_transfer"], - opt["which_common_envelope"], - opt["stop_at_no_CHE"], - opt["include_CHE"], - opt["stop_at_merger"], - opt["stop_at_disintegrated"], - opt["stop_at_inner_collision"], - opt["stop_at_outer_collision"], - opt["stop_at_dynamical_instability"], - opt["stop_at_semisecular_regime"], - opt["stop_at_SN"], - opt["SN_kick_distr"], - opt["impulse_kick_for_black_holes"], - opt["fallback_kick_for_black_holes"], - opt["stop_at_CPU_time"], - opt["max_CPU_time"], - opt["file_name"], - opt["file_type"], - opt["dir_plots"], + args["relative_inclination"], + args["tend"], + args["tinit"], + args["number"], + args["maximum_radius_change_factor"], + args["stop_at_mass_transfer"], + args["stop_at_init_mass_transfer"], + args["stop_at_outer_mass_transfer"], + args["stop_at_stable_mass_transfer"], + args["stop_at_eccentric_stable_mass_transfer"], + args["stop_at_unstable_mass_transfer"], + args["stop_at_eccentric_unstable_mass_transfer"], + args["which_common_envelope"], + args["stop_at_no_CHE"], + args["include_CHE"], + args["stop_at_merger"], + args["stop_at_disintegrated"], + args["stop_at_inner_collision"], + args["stop_at_outer_collision"], + args["stop_at_dynamical_instability"], + args["stop_at_semisecular_regime"], + args["stop_at_SN"], + args["SN_kick_distr"], + args["impulse_kick_for_black_holes"], + args["fallback_kick_for_black_holes"], + args["stop_at_CPU_time"], + args["max_CPU_time"], + args["file_name"], + args["file_type"], + args["dir_plots"], ) if triple_class_object.correct_params == False: @@ -803,7 +801,7 @@ def parse_arguments(): print("Choose a different system. The parameters of the given triple are incorrect.") # no codes initialized yet sys.exit("Choose a different system. The parameters of the given triple are incorrect.") - elif opt["stop_at_semisecular_regime"] == True and triple_class_object.semisecular_regime_at_initialisation == True: + elif args["stop_at_semisecular_regime"] == True and triple_class_object.semisecular_regime_at_initialisation == True: if REPORT_USER_WARNINGS: print("Choose a different system. The given triple is in the semisecular regime at initialization.") elif triple_class_object.dynamical_instability_at_initialisation == True: @@ -812,13 +810,13 @@ def parse_arguments(): elif triple_class_object.mass_transfer_at_initialisation == True: if REPORT_USER_WARNINGS: print("Choose a different system. There is mass transfer in the given triple at initialization.") - elif opt["stop_at_no_CHE"] == True and triple_class_object.CHE_at_initialisation == False: + elif args["stop_at_no_CHE"] == True and triple_class_object.CHE_at_initialisation == False: if REPORT_USER_WARNINGS: print("Choose a different system. No chemically homogeneous evolution at initialization") else: - triple_class_object.evolve_model(opt["tend"]) + triple_class_object.evolve_model(args["tend"]) if REPORT_DEBUG or MAKE_PLOTS: - plot_function(triple_class_object, opt["dir_plots"]) + plot_function(triple_class_object, args["dir_plots"]) triple_class_object.print_stellar_system() if REPORT_TRIPLE_EVOLUTION: