diff --git a/pymule/__init__.py b/pymule/__init__.py index dcd57ecae579a2cbedf8ed723bdee82769aa9534..01195ed400f3159af180d900407131ae4e4100d8 100644 --- a/pymule/__init__.py +++ b/pymule/__init__.py @@ -10,3 +10,5 @@ from loader import importreg, pattern, setup, sigma, \ addsets, scaleset from plot import errorband + +from constants import pi, alpha, GF, conv, Mmu, Mel, Mtau diff --git a/pymule/constants.py b/pymule/constants.py new file mode 100644 index 0000000000000000000000000000000000000000..d0d1aad4bd604338620c5347421f7275f0038d30 --- /dev/null +++ b/pymule/constants.py @@ -0,0 +1,35 @@ +import numpy as np +import os + + +def read_globaldef(globaldef=""): + if len(globaldef) == 0: + dir_path = os.path.dirname(os.path.realpath(__file__)) + globaldef = os.path.abspath(os.path.join( + dir_path, os.pardir, os.pardir, 'global_def.f95' + )) + + if not os.path.exists(globaldef): + raise IOError("No such file or directory %s" % globaldef) + + with open(globaldef) as fp: + return [ + (n,eval(v)) + for n,v in re.findall( + "parameter *:: *([A-Z][A-Z\d]*) = ([\dE\.+/-]+)", + fp.read(), + re.IGNORECASE + ) + ] + + +pi = np.pi + +Mmu = 105.6583715 # MeV +Mel = 0.510998928 # MeV +Mtau = 1776.82 # MeV + +alpha = 1./137.0359997 +GF = 1.16637E-11 # MeV^-2 + +conv = 3.893793655569159807686738742e8 # MeV^2 mu barn