Skip to content

Commit d26ba91

Browse files
poojanagrawalkatiebreivik
authored andcommitted
added path validity checks for METISSE as stellar engine (COSMIC-PopSynth#634)
1 parent 8b9194b commit d26ba91

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

src/cosmic/utils.py

+35
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import json
3030
import itertools
3131
import os.path
32+
import glob
3233

3334
from configparser import ConfigParser
3435
from .bse_utils.zcnsts import zcnsts
@@ -1101,6 +1102,40 @@ def error_check(BSEDict, SSEDict, filters=None, convergence=None, sampling=None)
11011102
)
11021103
)
11031104

1105+
flag = "path_to_tracks"
1106+
if SSEDict["stellar_engine"] == "metisse":
1107+
if SSEDict[flag] == '':
1108+
raise ValueError(
1109+
"If you want to use METISSE as the stellar engine, {0} needs to be a non-empty string".format (
1110+
flag
1111+
)
1112+
)
1113+
else:
1114+
metallicity_file = glob.glob(SSEDict[flag]+'*_metallicity.in')
1115+
if metallicity_file == []:
1116+
raise ValueError(
1117+
"No metallicity file found in {0}. Make sure that {1} is valid".format (
1118+
SSEDict[flag], flag
1119+
)
1120+
)
1121+
1122+
flag = "path_to_he_tracks"
1123+
if SSEDict["stellar_engine"] == "metisse":
1124+
if SSEDict[flag] == '':
1125+
raise Warning(
1126+
"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 (
1127+
flag
1128+
)
1129+
)
1130+
else:
1131+
metallicity_file = glob.glob(SSEDict[flag]+'*_metallicity.in')
1132+
if metallicity_file == []:
1133+
raise Warning(
1134+
"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 (
1135+
SSEDict[flag], flag
1136+
)
1137+
)
1138+
11041139
# BSEDict
11051140
flag = "dtp"
11061141
if flag in BSEDict.keys():

0 commit comments

Comments
 (0)