Merge lp:~ma5dev/madanalysis5/ma5_pyhf into lp:~ma5dev/madanalysis5/v1.9_beta

Proposed by Jack Y. Araz
Status: Merged
Approved by: Benjamin Fuks
Approved revision: 150
Merged at revision: 147
Proposed branch: lp:~ma5dev/madanalysis5/ma5_pyhf
Merge into: lp:~ma5dev/madanalysis5/v1.9_beta
Diff against target: 165 lines (+60/-19)
4 files modified
madanalysis/install/install_pad.py (+8/-3)
madanalysis/interpreter/cmd_install.py (+38/-6)
madanalysis/interpreter/ma5_interpreter.py (+11/-2)
madanalysis/system/detect_pad.py (+3/-8)
To merge this branch: bzr merge lp:~ma5dev/madanalysis5/ma5_pyhf
Reviewer Review Type Date Requested Status
Jack Y. Araz Needs Resubmitting
Benjamin Fuks Needs Fixing
Review via email: mp+398157@code.launchpad.net

Commit message

installation of PADForSFS bind to FastJet

Description of the change

this commit has been pushed on top of latest commit on v1.9_beta

revno: 143
committer: Benjamin Fuks <email address hidden>
branch nick: v1.9_beta
timestamp: Tue 2021-01-12 10:29:05 +0100
message:
  Bug fix with the mg5 interface

To post a comment you must log in.
lp:~ma5dev/madanalysis5/ma5_pyhf updated
148. By Jack Y. Araz

mg5 integration for PADForSFS

Revision history for this message
Benjamin Fuks (fuks) wrote :

Hi Jack,

Can you please change this behaviour:
+ # If FastJet is installed, install PADForSFS
+ if self.main.archi_info.has_fastjet and install_padforsfs:
+ self.logger.info('Installing PAD for SFS')
+ if not installer.Execute('padforsfs'):
+ self.logger.error('Impossible to install PAD For SFS.')
+ return False

If fastjet is not installed, then the code should propose the user to "install fastjet and then install the PADForSFS". Can you please implement that change? Thanks in advance. I will merge the code when done. The MG5 thingie looks good.

Cheers,

Benj

review: Needs Fixing
Revision history for this message
Jack Y. Araz (jackaraz) wrote :

Hi Benjamin

By suggestion do you mean ask the user if they want to install FJ or not? Or just like a warning? Are we allowed to interact with the user through Mg5 interface? If so I'll do that accordingly.

Cheers
Jack

> Hi Jack,
>
> Can you please change this behaviour:
> + # If FastJet is installed, install PADForSFS
> + if self.main.archi_info.has_fastjet and install_padforsfs:
> + self.logger.info('Installing PAD for SFS')
> + if not installer.Execute('padforsfs'):
> + self.logger.error('Impossible to install PAD For SFS.')
> + return False
>
> If fastjet is not installed, then the code should propose the user to "install
> fastjet and then install the PADForSFS". Can you please implement that change?
> Thanks in advance. I will merge the code when done. The MG5 thingie looks
> good.
>
> Cheers,
>
> Benj

lp:~ma5dev/madanalysis5/ma5_pyhf updated
149. By Jack Y. Araz

fastjet installation requirement before PADForSFS installation

Revision history for this message
Jack Y. Araz (jackaraz) wrote :

Hi Benjamin

pad4sfs will ask for fastjet installation from now on.

cheers
jack

review: Needs Resubmitting
lp:~ma5dev/madanalysis5/ma5_pyhf updated
150. By Benjamin Fuks

Small typo fixes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'madanalysis/install/install_pad.py'
2--- madanalysis/install/install_pad.py 2021-02-09 21:05:56 +0000
3+++ madanalysis/install/install_pad.py 2021-02-19 16:32:46 +0000
4@@ -169,7 +169,8 @@
5 if self.padname in ['PAD', 'PADForSFS']:
6 json_struct_name = [x for x in self.files.keys() if 'json' in x]
7 if len(json_struct_name) == 1:
8- logging.getLogger('MA5').debug(" ** Getting the list of pyhf-compatible analyses in " + self.downloaddir+"/"+json_struct_name[0])
9+ logging.getLogger('MA5').debug(" ** Getting the list of pyhf-compatible analyses in " +\
10+ self.downloaddir+"/"+json_struct_name[0])
11 json_input = open(os.path.join(self.downloaddir,json_struct_name[0]));
12 for line in json_input:
13 if len(line.strip())==0 or line.strip().startswith('#'):
14@@ -216,11 +217,15 @@
15 logging.getLogger('MA5').debug(' --> Creating a skeleton analysis for ' + new_analysis)
16 TheCommand = ['./newAnalyzer.py', new_analysis, new_analysis]
17 logging.getLogger('MA5').debug(' --> ' + ' '.join(TheCommand))
18- ok, out= ShellCommand.ExecuteWithLog(TheCommand,logname,self.installdir+'/Build/SampleAnalyzer',silent=False)
19+ ok, out= ShellCommand.ExecuteWithLog(TheCommand,logname,
20+ self.installdir+'/Build/SampleAnalyzer',
21+ silent=False)
22 if not ok:
23 return False
24 ## Making space for the new files
25- for onefile in ['Build/SampleAnalyzer/User/Analyzer/'+new_analysis+'.cpp', 'Build/SampleAnalyzer/User/Analyzer/'+new_analysis+'.h', 'Build/Main/main.bak']:
26+ for onefile in ['Build/SampleAnalyzer/User/Analyzer/'+new_analysis+'.cpp',
27+ 'Build/SampleAnalyzer/User/Analyzer/'+new_analysis+'.h',
28+ 'Build/Main/main.bak']:
29 TheCommand = ['rm', '-f', os.path.join(self.installdir,onefile)]
30 logging.getLogger('MA5').debug(' --> ' + ' '.join(TheCommand))
31 ok= ShellCommand.Execute(TheCommand,self.main.archi_info.ma5dir+'/tools')
32
33=== modified file 'madanalysis/interpreter/cmd_install.py'
34--- madanalysis/interpreter/cmd_install.py 2021-02-09 23:40:40 +0000
35+++ madanalysis/interpreter/cmd_install.py 2021-02-19 16:32:46 +0000
36@@ -22,13 +22,11 @@
37 ################################################################################
38
39
40-from __future__ import absolute_import
41+from __future__ import absolute_import
42 from madanalysis.interpreter.cmd_base import CmdBase
43 from madanalysis.install.install_manager import InstallManager
44 import logging, os
45
46-import six.moves.urllib.request, six.moves.urllib.parse , six.moves.urllib.error
47-
48 class CmdInstall(CmdBase):
49 """Command INSTALL"""
50
51@@ -144,14 +142,48 @@
52 if self.main.archi_info.has_fastjet:
53 padsfs_install_check = installer.Execute('PADForSFS')
54 else:
55- self.logger.warning('PADForSFS can not be installed without FastJet.')
56+ self.logger.warning("PADForSFS requires FastJet to be installed.")
57+ self.logger.info("Would you like to install FastJet? [Y/N]")
58+ while True:
59+ answer = input("Answer : ")
60+ if answer.lower() in ['y','n','yes','no']:
61+ break
62+ if answer.lower() in ['y','yes']:
63+ if not installer.Execute('fastjet'):
64+ return False
65+ if not installer.Execute('fastjet-contrib'):
66+ return False
67+ if not installer.Execute('PADForSFS'):
68+ return False
69+ padsfs_install_check = 'restart'
70 if inst_delphes(self.main,installer,'delphes',True):
71 pad_install_check = installer.Execute('PAD')
72 else:
73- self.logger.warning('Delphes is not installed (and will be installed). Then please exit MA5 and re-install the PAD')
74+ self.logger.warning('Delphes is not installed (and will be installed). '+
75+ 'Then please exit MA5 and re-install the PAD')
76+ if 'restart' in [pad_install_check, padsfs_install_check]:
77+ return 'restart'
78 return any([pad_install_check, padsfs_install_check])
79 elif args[0]=='PADForSFS':
80- return installer.Execute('PADForSFS')
81+ padsfs_install_check = False
82+ if self.main.archi_info.has_fastjet:
83+ padsfs_install_check = installer.Execute('PADForSFS')
84+ else:
85+ self.logger.warning("PADForSFS requires FastJet to be installed.")
86+ self.logger.info("Would you like to install FastJet? [Y/N]")
87+ while True:
88+ answer = input("Answer : ")
89+ if answer.lower() in ['y','n','yes','no']:
90+ break
91+ if answer.lower() in ['y','yes']:
92+ if not installer.Execute('fastjet'):
93+ return False
94+ if not installer.Execute('fastjet-contrib'):
95+ return False
96+ if not installer.Execute('PADForSFS'):
97+ return False
98+ return 'restart'
99+ return padsfs_install_check
100 elif args[0]=='pyhf':
101 return installer.Execute('pyhf')
102 else:
103
104=== modified file 'madanalysis/interpreter/ma5_interpreter.py'
105--- madanalysis/interpreter/ma5_interpreter.py 2020-09-29 21:01:19 +0000
106+++ madanalysis/interpreter/ma5_interpreter.py 2021-02-19 16:32:46 +0000
107@@ -258,7 +258,7 @@
108 # initialization
109 install_delphes = False
110 install_delphesMA5tune = False
111- user_info = UserInfo()
112+ user_info = UserInfo()
113
114 # A few useful methods
115 def validate_bool_key(key):
116@@ -327,8 +327,10 @@
117 install_delphes = validate_bool_key(key)
118 elif key=='with-delphesMA5tune':
119 install_delphesMA5tune = validate_bool_key(key)
120+ elif key in ['with-PADForSFS','with-padforsfs','PADForSFS']:
121+ install_padforsfs = value
122 else:
123- raise UNK_OPT('Unknown options for further_install')
124+ raise UNK_OPT('Unknown options for further_install : '+str(key))
125
126 # Muting the logger
127 lvl = self.logger.getEffectiveLevel()
128@@ -368,6 +370,13 @@
129 self.logger.error('Impossible to install fastjet.')
130 return False
131
132+ # If FastJet is installed, install PADForSFS
133+ if self.main.archi_info.has_fastjet and install_padforsfs:
134+ self.logger.info('Installing PAD for SFS')
135+ if not installer.Execute('padforsfs'):
136+ self.logger.error('Impossible to install PAD For SFS.')
137+ return False
138+
139 # Delphes installation
140 if self.main.archi_info.has_root and user_info.delphes_veto and install_delphes:
141 self.logger.warning('Delphes has been both vetoed and non-vetoed. Ignoring veto.')
142
143=== modified file 'madanalysis/system/detect_pad.py'
144--- madanalysis/system/detect_pad.py 2021-02-11 00:05:52 +0000
145+++ madanalysis/system/detect_pad.py 2021-02-19 16:32:46 +0000
146@@ -22,16 +22,11 @@
147 ################################################################################
148
149
150-from __future__ import absolute_import
151-import logging
152-import glob
153-import os
154-import sys
155-import re
156-import platform
157-from shell_command import ShellCommand
158+from __future__ import absolute_import
159+from shell_command import ShellCommand
160 from madanalysis.enumeration.detect_status_type import DetectStatusType
161 from madanalysis.system.config_checker import ConfigChecker
162+import logging, os
163
164
165 class DetectPAD:

Subscribers

People subscribed via source and target branches

to all changes: