Ejemplo n.º 1
0
import torch
from torch.autograd import grad
import pyro
from pyro import poutine
import inspect
import numpy as np

from showerSim.simulator import Simulator
from showerSim.utils import get_logger
import os

logger = get_logger()


class PyroSimulator(Simulator):
    """ Pyro simulator interface """
    def forward(self, inputs):
        raise NotImplementedError

    def trace(self, inputs):
        # self.forward will be implemented when we create a simulator that inherits from PyroSimulator. And PyroSimulator inherits from Simulator where the __call__ method returns self.forwad (as in PyTorch)
        return pyro.poutine.trace(self.forward).get_trace(inputs)

    # -------------------------------
    def augmented_data(self,
                       inputs,
                       inputs_num,
                       inputs_den,
                       exponential=True,
                       uniform=False):
        """
Ejemplo n.º 2
0
import numpy as np
import torch
import pprint
import matplotlib.pyplot as plt
import sys
import pickle
import argparse
import logging
import os

from showerSim import invMass_ginkgo
from showerSim.utils import get_logger

logger = get_logger(level=logging.WARNING)

augmented_data = False

# Nsamples=sys.argv[1]
# start = int(sys.argv[2])
# end = int(sys.argv[3])
#-----------------------
'''
Runs Ginkgo invariant mass toy parton shower
'''
parser = argparse.ArgumentParser(description="Generate synthetic jets")
parser.add_argument("-v",
                    "--verbose",
                    action="store_true",
                    help="Increase output verbosity")

parser.add_argument("--Nsamples",
Ejemplo n.º 3
0
import numpy as np
import torch
import pprint
import matplotlib.pyplot as plt
import sys
import pickle
import argparse
import logging
import os

from showerSim import exp2DShowerTree
from showerSim.utils import get_logger

logger = get_logger(level=logging.INFO)

augmented_data = False

# Nsamples=sys.argv[1]
# start = int(sys.argv[2])
# end = int(sys.argv[3])
#-----------------------
'''
Gaussian distribution shower
'''
parser = argparse.ArgumentParser(description="Generate synthetic jets")
parser.add_argument("-v",
                    "--verbose",
                    action="store_true",
                    help="Increase output verbosity")

parser.add_argument("--Nsamples",