forked from rpoleski/MulensModel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ulens_model_plot.py
33 lines (25 loc) · 889 Bytes
/
ulens_model_plot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
Script for plotting the model using UlensModelFit class.
All the settings are read from a YAML file.
"""
import sys
from os import path
import yaml
from ulens_model_fit import UlensModelFit
if __name__ == '__main__':
if len(sys.argv) != 2:
raise ValueError('Exactly one argument needed - YAML file')
input_file = sys.argv[1]
input_file_root = path.splitext(input_file)[0]
with open(input_file, 'r') as data:
settings = yaml.safe_load(data)
# Remove settings that are not used for plotting:
keys = ["starting_parameters", "min_values", "max_values",
"fitting_parameters"]
for key in keys:
settings[key] = None
if "plots" in settings:
if "triangle" in settings["plots"]:
settings["plots"].pop("triangle")
ulens_model_fit = UlensModelFit(**settings)
ulens_model_fit.plot_best_model()