"""Module that computes a physical observable.The observable could be structure functions or some linearcombination of them."""importloggingfrom.esfimportexslogger=logging.getLogger(__name__)
[docs]classCrossSection:r"""Represents an abstract structure function. This class acts as an intermediate handler between the :py:class:`Runner` exposed to the outside and the :py:class:`EvaluatedStructureFunction` which compute the actual observable. Parameters ---------- obs_name : ObservableName name runner : yadism.runner.Runner parent reference """def__init__(self,obs_name,runner):# internal managersself.obs_name=obs_nameself.runner=runnerself.exss=[]logger.debug("Init %s",self)
@propertydefelements(self):"""Collect the evaluated observable."""returnself.exss
[docs]defload(self,kinematic_configs):r"""Load all kinematic configurations from the run card. Parameters ---------- kinematic_configs : list(dict) run card input """self.exss=[]forkinematicsinkinematic_configs:self.exss.append(exs.EvaluatedCrossSection(kinematics,self.obs_name,self.runner.configs,self.get_esf))
[docs]defget_esf(self,obs_name,kin):r"""Get the observable in question for given kinematics. Parameters ---------- obs_name: str name of the observable kin: dict contains the kinematic specs Returns ------- get_sf: observable evaluated on some kinematics """returnself.runner.get_sf(obs_name).get_esf(obs_name,kin,use_raw=False)
[docs]defget_result(self):r"""Collect the results from all childrens. Returns ------- output : list(ESFResult) all children outputs """returnlist(elem.get_result()foreleminself.elements)