def WeightedSumSq(weights, inputs=None, *args, **kwargs): weights = stdvector(weights) if inputs is None: inputs = weights elif isinstance(inputs[0], str): inputs = stdvector(inputs) else: inputs = OutputDescriptors(inputs) return R.GNA.GNAObjectTemplates.WeightedSumSqT( context.current_precision())(weights, inputs, *args, **kwargs)
def Dummy(shape, name, varnames=None, *args, **kwargs): if varnames: return R.GNA.GNAObjectTemplates.DummyT(context.current_precision())( shape, name, stdvector(varnames), *args, **kwargs) return R.GNA.GNAObjectTemplates.DummyT(context.current_precision())( shape, name, *args, **kwargs)
def OscProb3(*args, **kwargs): """OscProb3 wrapper Aguments: Neutrino from, Neutrino to, std::string l_name="L", bool modecos=true, std::vector<std::string> dmnames={} """ if len(args) >= 5: args = list(args) args[4] = stdvector(args[4]) return R.GNA.GNAObjectTemplates.OscProb3T(context.current_precision())( *args, **kwargs)
def OutputDescriptors(outputs): descriptors = [] odescr = R.OutputDescriptorT(context.current_precision(), context.current_precision()) ohandle = R.TransformationTypes.OutputHandleT(context.current_precision()) singleoutput = R.SingleOutputT(context.current_precision()) for output in outputs: if isinstance(output, odescr): append = output elif isinstance(output, ohandle): append = odescr(output) elif isinstance(output, singleoutput): append = odescr(output.single()) else: raise Exception('Expect OutputHandle or SingleOutput object') descriptors.append(append) return stdvector( descriptors, 'OutputDescriptorT<%s,%s>' % (context.current_precision(), context.current_precision()))
def VarProduct(varnames, *args, **kwargs): return R.GNA.GNAObjectTemplates.VarProductT(context.current_precision())( stdvector(varnames), *args, **kwargs)
def VarArrayPreallocated(vars, *args, **kwargs): cls = R.GNA.GNAObjectTemplates.VarArrayPreallocatedT( context.current_precision()) ret = cls(stdvector(vars), *args, **kwargs) return ret
def VarArray(vars, *args, **kwargs): cls = R.GNA.GNAObjectTemplates.VarArrayT(context.current_precision()) ret = cls(stdvector(vars), *args, **kwargs) ret.transformations.front().updateTypes() return ret
def EnergyResolution(weights, *args, **kwargs): return R.EnergyResolution(stdvector(weights), *args, **kwargs)
def PolyRatio(nominator=[], denominator=[], *args, **kwargs): nominator = stdvector(nominator, 'string') denominator = stdvector(denominator, 'string') return R.GNA.GNAObjectTemplates.PolyRatioT(context.current_precision())( nominator, denominator, *args, **kwargs)