-
Notifications
You must be signed in to change notification settings - Fork 1
/
cl_scanner.py
69 lines (50 loc) · 1.91 KB
/
cl_scanner.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import datetime
import shutil
from pathlib import Path
import yaml
from utils import *
def transfer_output(input_point, input_path='./workdir/madanalysis5/ANALYSIS', output_path='./outputs'):
"""
Transfer information in madanalysis5 output folder to ./outputs
"""
input_path, output_path = Path(input_path), Path(output_path)
folder_path = output_path / 'folders' / f'ANALYSIS-{input_point}'
summary_path = folder_path / 'Output' / 'SAF' / 'CLs_output_summary.dat'
if input_path.exists():
shutil.move(str(input_path), str(folder_path))
shutil.copy(str(summary_path), str(output_path / 'summaries' / f'summary-{input_point}.txt'))
else:
print(f'{input_point:<10}: Missing workflow folder, moving on')
def run_cl(mChi, mPhi):
"""
One run to produce confidence limit output from ma5
"""
input_point = f'({mChi}, {mPhi})'
print(f'{input_point:<10}: Generating Param Card')
path, _ = make_param_card(mChi, mPhi)
print(f'{input_point:<10}: Adding Param Card to Input')
set_param_card(path)
print(f'{input_point:<10}: Executing Workflow')
run_flow(wf='fullma5.yml')
print(f'{input_point:<10}: Workflow Finished')
transfer_output(input_point)
print(f'{input_point:<10}: Transferred Output\n')
def scan_cl(input_points):
"""
Get madanalysis5 output folder for each input point.
"""
last_time = datetime.datetime.now().hour
total_hours = 0
for i in range(0, len(input_points)):
mChi, mPhi = input_points[i]
current_hour = datetime.datetime.now().hour
total_hours += current_hour - last_time
last_time = current_hour
print(f'{int(i / len(input_points) * 100)}% done at {total_hours} hours.')
run_cl(mChi, mPhi)
def main():
run_cl(800, 2500)
# scan_cl(INPUT_POINTS[INPUT_POINTS.index((1000, 2500)):])
if __name__ == '__main__':
main()
# run_cl(10, 100)