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
=== modified file 'madanalysis/install/install_pad.py'
--- madanalysis/install/install_pad.py 2021-02-09 21:05:56 +0000
+++ madanalysis/install/install_pad.py 2021-02-19 16:32:46 +0000
@@ -169,7 +169,8 @@
169 if self.padname in ['PAD', 'PADForSFS']:169 if self.padname in ['PAD', 'PADForSFS']:
170 json_struct_name = [x for x in self.files.keys() if 'json' in x]170 json_struct_name = [x for x in self.files.keys() if 'json' in x]
171 if len(json_struct_name) == 1:171 if len(json_struct_name) == 1:
172 logging.getLogger('MA5').debug(" ** Getting the list of pyhf-compatible analyses in " + self.downloaddir+"/"+json_struct_name[0])172 logging.getLogger('MA5').debug(" ** Getting the list of pyhf-compatible analyses in " +\
173 self.downloaddir+"/"+json_struct_name[0])
173 json_input = open(os.path.join(self.downloaddir,json_struct_name[0]));174 json_input = open(os.path.join(self.downloaddir,json_struct_name[0]));
174 for line in json_input:175 for line in json_input:
175 if len(line.strip())==0 or line.strip().startswith('#'):176 if len(line.strip())==0 or line.strip().startswith('#'):
@@ -216,11 +217,15 @@
216 logging.getLogger('MA5').debug(' --> Creating a skeleton analysis for ' + new_analysis)217 logging.getLogger('MA5').debug(' --> Creating a skeleton analysis for ' + new_analysis)
217 TheCommand = ['./newAnalyzer.py', new_analysis, new_analysis]218 TheCommand = ['./newAnalyzer.py', new_analysis, new_analysis]
218 logging.getLogger('MA5').debug(' --> ' + ' '.join(TheCommand))219 logging.getLogger('MA5').debug(' --> ' + ' '.join(TheCommand))
219 ok, out= ShellCommand.ExecuteWithLog(TheCommand,logname,self.installdir+'/Build/SampleAnalyzer',silent=False)220 ok, out= ShellCommand.ExecuteWithLog(TheCommand,logname,
221 self.installdir+'/Build/SampleAnalyzer',
222 silent=False)
220 if not ok:223 if not ok:
221 return False224 return False
222 ## Making space for the new files225 ## Making space for the new files
223 for onefile in ['Build/SampleAnalyzer/User/Analyzer/'+new_analysis+'.cpp', 'Build/SampleAnalyzer/User/Analyzer/'+new_analysis+'.h', 'Build/Main/main.bak']:226 for onefile in ['Build/SampleAnalyzer/User/Analyzer/'+new_analysis+'.cpp',
227 'Build/SampleAnalyzer/User/Analyzer/'+new_analysis+'.h',
228 'Build/Main/main.bak']:
224 TheCommand = ['rm', '-f', os.path.join(self.installdir,onefile)]229 TheCommand = ['rm', '-f', os.path.join(self.installdir,onefile)]
225 logging.getLogger('MA5').debug(' --> ' + ' '.join(TheCommand))230 logging.getLogger('MA5').debug(' --> ' + ' '.join(TheCommand))
226 ok= ShellCommand.Execute(TheCommand,self.main.archi_info.ma5dir+'/tools')231 ok= ShellCommand.Execute(TheCommand,self.main.archi_info.ma5dir+'/tools')
227232
=== modified file 'madanalysis/interpreter/cmd_install.py'
--- madanalysis/interpreter/cmd_install.py 2021-02-09 23:40:40 +0000
+++ madanalysis/interpreter/cmd_install.py 2021-02-19 16:32:46 +0000
@@ -22,13 +22,11 @@
22################################################################################22################################################################################
2323
2424
25from __future__ import absolute_import25from __future__ import absolute_import
26from madanalysis.interpreter.cmd_base import CmdBase26from madanalysis.interpreter.cmd_base import CmdBase
27from madanalysis.install.install_manager import InstallManager27from madanalysis.install.install_manager import InstallManager
28import logging, os28import logging, os
2929
30import six.moves.urllib.request, six.moves.urllib.parse , six.moves.urllib.error
31
32class CmdInstall(CmdBase):30class CmdInstall(CmdBase):
33 """Command INSTALL"""31 """Command INSTALL"""
3432
@@ -144,14 +142,48 @@
144 if self.main.archi_info.has_fastjet:142 if self.main.archi_info.has_fastjet:
145 padsfs_install_check = installer.Execute('PADForSFS')143 padsfs_install_check = installer.Execute('PADForSFS')
146 else:144 else:
147 self.logger.warning('PADForSFS can not be installed without FastJet.')145 self.logger.warning("PADForSFS requires FastJet to be installed.")
146 self.logger.info("Would you like to install FastJet? [Y/N]")
147 while True:
148 answer = input("Answer : ")
149 if answer.lower() in ['y','n','yes','no']:
150 break
151 if answer.lower() in ['y','yes']:
152 if not installer.Execute('fastjet'):
153 return False
154 if not installer.Execute('fastjet-contrib'):
155 return False
156 if not installer.Execute('PADForSFS'):
157 return False
158 padsfs_install_check = 'restart'
148 if inst_delphes(self.main,installer,'delphes',True):159 if inst_delphes(self.main,installer,'delphes',True):
149 pad_install_check = installer.Execute('PAD')160 pad_install_check = installer.Execute('PAD')
150 else:161 else:
151 self.logger.warning('Delphes is not installed (and will be installed). Then please exit MA5 and re-install the PAD')162 self.logger.warning('Delphes is not installed (and will be installed). '+
163 'Then please exit MA5 and re-install the PAD')
164 if 'restart' in [pad_install_check, padsfs_install_check]:
165 return 'restart'
152 return any([pad_install_check, padsfs_install_check])166 return any([pad_install_check, padsfs_install_check])
153 elif args[0]=='PADForSFS':167 elif args[0]=='PADForSFS':
154 return installer.Execute('PADForSFS')168 padsfs_install_check = False
169 if self.main.archi_info.has_fastjet:
170 padsfs_install_check = installer.Execute('PADForSFS')
171 else:
172 self.logger.warning("PADForSFS requires FastJet to be installed.")
173 self.logger.info("Would you like to install FastJet? [Y/N]")
174 while True:
175 answer = input("Answer : ")
176 if answer.lower() in ['y','n','yes','no']:
177 break
178 if answer.lower() in ['y','yes']:
179 if not installer.Execute('fastjet'):
180 return False
181 if not installer.Execute('fastjet-contrib'):
182 return False
183 if not installer.Execute('PADForSFS'):
184 return False
185 return 'restart'
186 return padsfs_install_check
155 elif args[0]=='pyhf':187 elif args[0]=='pyhf':
156 return installer.Execute('pyhf')188 return installer.Execute('pyhf')
157 else:189 else:
158190
=== modified file 'madanalysis/interpreter/ma5_interpreter.py'
--- madanalysis/interpreter/ma5_interpreter.py 2020-09-29 21:01:19 +0000
+++ madanalysis/interpreter/ma5_interpreter.py 2021-02-19 16:32:46 +0000
@@ -258,7 +258,7 @@
258 # initialization258 # initialization
259 install_delphes = False259 install_delphes = False
260 install_delphesMA5tune = False260 install_delphesMA5tune = False
261 user_info = UserInfo()261 user_info = UserInfo()
262262
263 # A few useful methods263 # A few useful methods
264 def validate_bool_key(key):264 def validate_bool_key(key):
@@ -327,8 +327,10 @@
327 install_delphes = validate_bool_key(key)327 install_delphes = validate_bool_key(key)
328 elif key=='with-delphesMA5tune':328 elif key=='with-delphesMA5tune':
329 install_delphesMA5tune = validate_bool_key(key)329 install_delphesMA5tune = validate_bool_key(key)
330 elif key in ['with-PADForSFS','with-padforsfs','PADForSFS']:
331 install_padforsfs = value
330 else:332 else:
331 raise UNK_OPT('Unknown options for further_install')333 raise UNK_OPT('Unknown options for further_install : '+str(key))
332334
333 # Muting the logger335 # Muting the logger
334 lvl = self.logger.getEffectiveLevel()336 lvl = self.logger.getEffectiveLevel()
@@ -368,6 +370,13 @@
368 self.logger.error('Impossible to install fastjet.')370 self.logger.error('Impossible to install fastjet.')
369 return False371 return False
370372
373 # If FastJet is installed, install PADForSFS
374 if self.main.archi_info.has_fastjet and install_padforsfs:
375 self.logger.info('Installing PAD for SFS')
376 if not installer.Execute('padforsfs'):
377 self.logger.error('Impossible to install PAD For SFS.')
378 return False
379
371 # Delphes installation380 # Delphes installation
372 if self.main.archi_info.has_root and user_info.delphes_veto and install_delphes:381 if self.main.archi_info.has_root and user_info.delphes_veto and install_delphes:
373 self.logger.warning('Delphes has been both vetoed and non-vetoed. Ignoring veto.')382 self.logger.warning('Delphes has been both vetoed and non-vetoed. Ignoring veto.')
374383
=== modified file 'madanalysis/system/detect_pad.py'
--- madanalysis/system/detect_pad.py 2021-02-11 00:05:52 +0000
+++ madanalysis/system/detect_pad.py 2021-02-19 16:32:46 +0000
@@ -22,16 +22,11 @@
22################################################################################22################################################################################
2323
2424
25from __future__ import absolute_import25from __future__ import absolute_import
26import logging26from shell_command import ShellCommand
27import glob
28import os
29import sys
30import re
31import platform
32from shell_command import ShellCommand
33from madanalysis.enumeration.detect_status_type import DetectStatusType27from madanalysis.enumeration.detect_status_type import DetectStatusType
34from madanalysis.system.config_checker import ConfigChecker28from madanalysis.system.config_checker import ConfigChecker
29import logging, os
3530
3631
37class DetectPAD:32class DetectPAD:

Subscribers

People subscribed via source and target branches

to all changes: