hepi.run¶
Subpackages¶
Submodules¶
Package Contents¶
Classes¶
Input for computation and scans. |
|
Computation orders. |
|
General result class. All uncertainties are of numerical origin. |
|
Abstract class that is similar to a dictionary but with fixed keys. |
|
Functions¶
Get the input directory. |
|
Get the input directory. |
|
|
Gets the command prefix. |
|
Convert a dict of list`s to a `pandas.DataFrame. |
|
Convert a list of objects into a dictionary of lists. |
|
Creates a sha256 hash from the objects string representation. |
- class hepi.run.Input(order, energy, particle1, particle2, slha, pdf_lo, pdf_nlo, mu_f=1.0, mu_r=1.0, pdfset_lo=0, pdfset_nlo=0, precision=0.001, max_iters=50, invariant_mass='auto', result='total', pt='auto', id='', model='', update=True)¶
Bases:
hepi.util.DictDataInput for computation and scans.
- Variables:
order (
Order) – LO, NLO or NLO+NLL computation.energy (int) – CMS energy in GeV.
energyhalf (int) – Halfed energy.
particle1 (int) – PDG identifier of the first final state particle.
particle2 (int) – PDG identifier of the second final state particle.
slha (str) – File path of for the base slha. Modified slha files will be used if a scan requires a change of the input.
pdf_lo (str) – LO PDF name.
pdf_nlo (str) – NLO PDF name.
pdfset_lo (int) – LO PDF member/set id.
pdfset_nlo (int) – NLO PDF member/set id.
pdf_lo_id (int) – LO PDF first member/set id.
pdf_nlo_id (int) – NLO PDF first member/set id.
mu (double) – central scale factor.
mu_f (double) – Factorization scale factor.
mu_r (double) – Renormalization scale factor.
precision (double) – Desired numerical relative precision.
max_iters (int) – Upper limit on integration iterations.
invariant_mass (str) – Invariant mass mode ‘auto = sqrt((p1+p2)^2)’ else value.
pt (str) – Transverse Momentum mode ‘auto’ or value.
result (str) – Result type ‘total’/’pt’/’ptj’/’m’.
id (str) – Set an id of this run.
model (str) – Path for MadGraph model.
update (bool) – Update dependent mu else set to zero.
- Parameters:
order (hepi.order.Order) –
energy (float) –
particle1 (int) –
particle2 (int) –
slha (str) –
pdf_lo (str) –
pdf_nlo (str) –
- has_gluino()¶
- Return type:
bool
- has_neutralino()¶
- Return type:
bool
- has_charginos()¶
- Return type:
bool
- has_weakino()¶
- Return type:
bool
- has_squark()¶
- Return type:
bool
- has_slepton()¶
- Return type:
bool
- class hepi.run.Order¶
Bases:
enum.IntEnumComputation orders.
Initialize self. See help(type(self)) for accurate signature.
- LO = 0¶
Leading Order
- NLO = 1¶
Next-to-Leading Order
- NLO_PLUS_NLL = 2¶
Next-to-Leading Order plus Next-to-Leading Logarithms
- aNNLO_PLUS_NNLL = 3¶
Approximate Next-to-next-to-Leading Order plus Next-to-next-to-Leading Logarithms
- hepi.run.get_input_dir()¶
Get the input directory.
- Returns:
in_dir- Return type:
str
- hepi.run.get_output_dir()¶
Get the input directory.
- Returns:
out_dir- Return type:
str
- hepi.run.get_pre()¶
Gets the command prefix.
- Returns:
pre- Return type:
str
- class hepi.run.Result(lo=None, nlo=None, nlo_plus_nll=None, annlo_plus_nnll=None)¶
Bases:
hepi.util.DictDataGeneral result class. All uncertainties are of numerical origin.
- Variables:
LO (
double) – Leading Order result. Defaults to None.NLO (
double) – Next-to-Leading Order result. Defaults to None.NLO_PLUS_NLL (
double) – Next-to-Leading Order plus Next-to-Leading Logarithm result. Defaults to None.K_LO (
double) – LO divided by LO.K_NLO (
double) – NLO divided by LO result.K_NLO_PLUS_NLL (
double) – NLO+NLL divided by LO.K_aNNLO_PLUS_NNLL (
double) – aNNLO+NNLL divided by LO.NLO_PLUS_NLL_OVER_NLO (
double) – NLO+NLL divided by NLO.aNNLO_PLUS_NNLL_OVER_NLO (
double) – aNNLO+NNLL divided by NLO.
Sets given and computes dependent
Attributes.- Parameters:
lo (
double) – corresponds toLO.nlo (
double) – corresponds toNLO.nlo_plus_nll (
double) – corresponds toNLO_PLUS_NLL.annlo_plus_nnll (
double) – corresponds toaNNLO_PLUS_NNLL.
- hepi.run.DL2DF(ld)¶
Convert a dict of list`s to a `pandas.DataFrame.
- Parameters:
ld (dict) –
- Return type:
pandas.DataFrame
- hepi.run.LD2DL(l, actual_dict=False)¶
Convert a list of objects into a dictionary of lists.
The values of each object are first converted to a dict through the __dict__ attribute.
- Parameters:
l (List) – list of objects.
actual_dict (bool) – objects are already dicts
- Returns:
dictionary of numpy arrays.
- Return type:
dict
Examples
>>> class Param: ... def __init__(self,a,b,c): ... self.a = a ... self.b = b ... self.c = c >>> LD2DL([ Param(1,2,3), Param(4,5,6) , Param(7,8,9) ]) {'a': array([1, 4, 7]), 'b': array([2, 5, 8]), 'c': array([3, 6, 9])}
- hepi.run.namehash(n)¶
Creates a sha256 hash from the objects string representation.
- Parameters:
n (any) – object.
- Returns:
sha256 of object.
- Return type:
str
Examples
>>> p = {'a':1,'b':2} >>> str(p) "{'a': 1, 'b': 2}" >>> namehash(str(p)) '3dffaea891e5dbadb390da33bad65f509dd667779330e2720df8165a253462b8' >>> namehash(p) '3dffaea891e5dbadb390da33bad65f509dd667779330e2720df8165a253462b8'
- class hepi.run.RunParam(skip=False, in_file=None, out_file=None, execute=None, name=None)[source]¶
Bases:
hepi.util.DictDataAbstract class that is similar to a dictionary but with fixed keys.
- Parameters:
skip (bool) –
in_file (str) –
out_file (str) –
execute (str) –
name (str) –
- class hepi.run.Runner(path, in_dir=None, out_dir=None, pre=None)[source]¶
- Parameters:
path (str) –
in_dir (str) –
out_dir (str) –
- orders()¶
List of supported Orders in this runner.
- Return type:
List[hepi.input.Order]
- get_name()¶
Returns the name of the runner.
- Return type:
str
- get_version()¶
- Return type:
str
- _sub_run(coms)¶
- Parameters:
coms (List[str]) –
- Return type:
str
- _check_path()¶
Checks if the passed path is valid.
- Return type:
bool
- _prepare(p, skip=False, assume_valid=False, **kwargs)¶
- Parameters:
p (hepi.input.Input) –
- Return type:
- _check_input(param, **kwargs)¶
- Parameters:
param (hepi.input.Input) –
- Return type:
bool
- _prepare_all(params, skip=True, n_jobs=None, **kwargs)¶
Prepares all parameters for execution.
- Parameters:
params (List[
hepi.Input]) – List of input parameters.skip (bool, optional) – If True, the runner will check if the output file already exists and skip the execution if it does. Defaults to True.
n_jobs (int) – Number of parallel jobs. If None, use all available cores.
- Return type:
List[RunParam]
- run(params, skip=True, parse=True, parallel=True, sleep=0, run=True, ignore_error=False, n_jobs=None, **kwargs)¶
Run the passed list of parameters.
- Args:
params (
listofhepi.Input): All parameters that should be executed/queued. skip (bool): True means stored runs will be skipped. Else the are overwritten. parse (bool): Parse the results.This is not the prefered cluster/parallel mode, as there the function only queues the job.
parallel (bool): Run jobs in parallel. sleep (int): Sleep seconds after starting job.
run (bool): Actually start/queue runner. ignore_error (bool): Continue instead of raising Exceptions. Also ignores hash collisions. n_jobs (int): Number of parallel jobs. If None, use all available cores.
- Returns:
pd.DataFrame: combined dataframe of results and parameters. The dataframe is empty if parse is set to False.
- Parameters:
params (List[hepi.input.Input]) –
- _run(rps, wait=True, parallel=True, sleep=0, n_jobs=None, **kwargs)¶
Runs Runner per
RunParams.- Args:
rps (
listofRunParams): Extended run parameters. bar (bool): Enable info bar. wait (bool): Wait for parallel runs to finish. sleep (int): Sleep seconds after starting subprocess. parallel (bool): Run jobs in parallel.
n_jobs (int): Number of parallel jobs. If None, use all available cores.
- Returns:
listof int: return codes from jobs if no_parse is False.
- Parameters:
rps (List[RunParam]) –
- _is_valid(file, p, d, **kwargs)¶
Verifies that a file is a complete output.
- Parameters:
file (str) – File path to be parsed.
p (
hepi.Input) – Onput parameters.d (
dict) – Param dictionary.
- Returns:
True if file could be parsed.
- Return type:
bool
- parse(outputs, n_jobs=None)¶
Parses Resummino output files and returns List of Results.
- Args:
outputs (
listof str): List of the filenames to be parsed.
n_jobs (int): Number of parallel jobs. If None, use all available cores.
- Returns:
listofhepi.resummino.result.ResumminoResult
- Parameters:
outputs (List[str]) –
- Return type:
List[hepi.results.Result]
- _parse_file(file)¶
Extracts results from an output file.
- Parameters:
file (str) – File path to be parsed.
- Returns:
If a value is not found in the file None is used.
- Return type:
- get_path()¶
Get the Runner path.
- Returns:
current Runner path.
- Return type:
str
- get_input_dir()¶
Get the input directory.
- Returns:
in_dir- Return type:
str
- get_output_dir()¶
Get the input directory.
- Returns:
out_dir- Return type:
str
- get_pre()¶
Gets the command prefix.
- Returns:
pre- Return type:
str
- set_path(p)¶
Set the path to the Runner folder containing the binary in ‘./bin’ or ‘./build/bin’.
- Parameters:
p (str) – new path.
- set_input_dir(indir)¶
Sets the input directory.
- Parameters:
indir (str) – new input directory.
- set_output_dir(outdir, create=True)¶
Sets the output directory.
- Parameters:
outdir (str) – new output directory. create (bool): create directory if not existing.
create (bool) –
- set_pre(ppre)¶
Sets the command prefix.
- Parameters:
ppre (str) – new command prefix.