Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

added path validity checks for METISSE as stellar engine #634

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/cosmic/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import json
import itertools
import os.path
import glob

from configparser import ConfigParser
from .bse_utils.zcnsts import zcnsts
Expand Down Expand Up @@ -1101,6 +1102,40 @@ def error_check(BSEDict, SSEDict, filters=None, convergence=None, sampling=None)
)
)

flag = "path_to_tracks"
if SSEDict["stellar_engine"] == "metisse":
if SSEDict[flag] == '':
raise ValueError(
"If you want to use METISSE as the stellar engine, {0} needs to be a non-empty string".format (
flag
)
)
else:
metallicity_file = glob.glob(SSEDict[flag]+'*_metallicity.in')
if metallicity_file == []:
raise ValueError(
"No metallicity file found in {0}. Make sure that {1} is valid".format (
SSEDict[flag], flag
)
)

flag = "path_to_he_tracks"
if SSEDict["stellar_engine"] == "metisse":
if SSEDict[flag] == '':
raise Warning(
"If you want to use METISSE as the stellar engine,{0} needs to be a non-empty string, otheriwse SSE formulae will be used for helium stars".format (
flag
)
)
else:
metallicity_file = glob.glob(SSEDict[flag]+'*_metallicity.in')
if metallicity_file == []:
raise Warning(
"No metallicity file for helium star tracks found in {0}. Make sure that {1} is valid or SSE formulae will be used for helium stars".format (
SSEDict[flag], flag
)
)

# BSEDict
flag = "dtp"
if flag in BSEDict.keys():
Expand Down
Loading