Functions | Variables
generate_datataset Namespace Reference

Functions

def normalize (value)
 
def normalize2 (value)
 

Variables

string __version__ = '1.0'
 
string __author__ = 'Saul Alonso-Monsalve'
 
string __email__ = "saul.alonso.monsalve@cern.ch"
 
 stream
 
 stdout
 
 level
 
 config = configparser.ConfigParser()
 
 SEED = int(config['random']['seed'])
 
 IMAGES_PATH = config['images']['path']
 
 VIEWS = int(config['images']['views'])
 
 PLANES = int(config['images']['planes'])
 
 CELLS = int(config['images']['cells'])
 
 DATASET_PATH = config['dataset']['path']
 
 PARTITION_PREFIX = config['dataset']['partition_prefix']
 
 LABELS_PREFIX = config['dataset']['labels_prefix']
 
 UNIFORM = ast.literal_eval(config['dataset']['uniform'])
 
 OUTPUTS = int(config['model']['outputs'])
 
 TRAIN_FRACTION = float(config['train']['fraction'])
 
 WEIGHTED_LOSS_FUNCTION = ast.literal_eval(config['train']['weighted_loss_function'])
 
 CLASS_WEIGHTS_PREFIX = config['train']['class_weights_prefix']
 
 VALIDATION_FRACTION = float(config['validation']['fraction'])
 
 TEST_FRACTION = float(config['test']['fraction'])
 
int count_flavour = [0]*4
 
int count_category = [0]*14
 
dictionary partition = {'train' : [], 'validation' : [], 'test' : []}
 
dictionary labels = {}
 
list y_train = []
 
list y1_class_weights = []
 
list y2_class_weights = []
 
list only_train = ['nutau2', 'nutau3']
 
int count_neutrinos = 0
 
int count_antineutrinos = 0
 
int count_empty_views = 0
 
int count_empty_events = 0
 
int count_less_10nonzero_views = 0
 
int count_less_10nonzero_events = 0
 
 count_train
 
 count_val
 
 count_test
 
 files = list(glob.iglob(images_path + "/images/*"))
 
 ID = imagefile.split("/")[-1][:-3]
 
string infofile = images_path+'/info/'
 
 info = open(infofile, 'r').readlines()
 
 fInt = int(info[0].strip())
 
int flavour = fInt//4
 
int interaction = fInt%4
 
 fNuEnergy = float(info[1].strip())
 
 fLepEnergy = float(info[2].strip())
 
 fRecoNueEnergy = float(info[3].strip())
 
 fRecoNumuEnergy = float(info[4].strip())
 
 fEventWeight = float(info[5].strip())
 
 fNuPDG = normalize2(int(info[6].strip()))
 
 fNProton = normalize(int(info[7].strip()))
 
 fNPion = normalize(int(info[8].strip()))
 
 fNPizero = normalize(int(info[9].strip()))
 
 fNNeutron = normalize(int(info[10].strip()))
 
 random_value = np.random.uniform(0,1)
 
 pixels = np.fromstring(zlib.decompress(image_file.read()), dtype=np.uint8, sep='').reshape(VIEWS, PLANES, CELLS)
 
list views = [None]*VIEWS
 
list empty_view = [0,0,0]
 
list non_empty_view = [0,0,0]
 
int count_empty = 0
 
int count_less_10nonzero = 0
 
 maxi = np.max(views[i])
 
 mini = np.min(views[i])
 
 nonzero = np.count_nonzero(views[i])
 
 total = np.sum(views[i])
 
 avg = np.mean(views[i])
 

Detailed Description

This is the dataset generator module.

Function Documentation

def generate_datataset.normalize (   value)

Definition at line 81 of file generate_datataset.py.

81 def normalize(value):
82  if value > 2:
83  return 3
84  return value
85 
86 # Return 1 if N < 0 else 0
def generate_datataset.normalize2 (   value)

Definition at line 87 of file generate_datataset.py.

87 def normalize2(value):
88  if value < 0:
89  return 1
90  return 0
91 

Variable Documentation

string generate_datataset.__author__ = 'Saul Alonso-Monsalve'
private

Definition at line 6 of file generate_datataset.py.

string generate_datataset.__email__ = "saul.alonso.monsalve@cern.ch"
private

Definition at line 7 of file generate_datataset.py.

string generate_datataset.__version__ = '1.0'
private

Definition at line 5 of file generate_datataset.py.

generate_datataset.avg = np.mean(views[i])

Definition at line 209 of file generate_datataset.py.

generate_datataset.CELLS = int(config['images']['cells'])

Definition at line 49 of file generate_datataset.py.

generate_datataset.CLASS_WEIGHTS_PREFIX = config['train']['class_weights_prefix']

Definition at line 66 of file generate_datataset.py.

generate_datataset.config = configparser.ConfigParser()

Definition at line 32 of file generate_datataset.py.

int generate_datataset.count_antineutrinos = 0

Definition at line 117 of file generate_datataset.py.

int generate_datataset.count_category = [0]*14

Definition at line 93 of file generate_datataset.py.

int generate_datataset.count_empty = 0

Definition at line 201 of file generate_datataset.py.

int generate_datataset.count_empty_events = 0

Definition at line 119 of file generate_datataset.py.

int generate_datataset.count_empty_views = 0

Definition at line 118 of file generate_datataset.py.

int generate_datataset.count_flavour = [0]*4

Definition at line 92 of file generate_datataset.py.

int generate_datataset.count_less_10nonzero = 0

Definition at line 202 of file generate_datataset.py.

int generate_datataset.count_less_10nonzero_events = 0

Definition at line 121 of file generate_datataset.py.

int generate_datataset.count_less_10nonzero_views = 0

Definition at line 120 of file generate_datataset.py.

int generate_datataset.count_neutrinos = 0

Definition at line 116 of file generate_datataset.py.

generate_datataset.count_test

Definition at line 125 of file generate_datataset.py.

generate_datataset.count_train

Definition at line 125 of file generate_datataset.py.

generate_datataset.count_val

Definition at line 125 of file generate_datataset.py.

generate_datataset.DATASET_PATH = config['dataset']['path']

Definition at line 53 of file generate_datataset.py.

list generate_datataset.empty_view = [0,0,0]

Definition at line 196 of file generate_datataset.py.

generate_datataset.fEventWeight = float(info[5].strip())

Definition at line 151 of file generate_datataset.py.

generate_datataset.files = list(glob.iglob(images_path + "/images/*"))

Definition at line 132 of file generate_datataset.py.

generate_datataset.fInt = int(info[0].strip())

Definition at line 143 of file generate_datataset.py.

int generate_datataset.flavour = fInt//4

Definition at line 144 of file generate_datataset.py.

generate_datataset.fLepEnergy = float(info[2].strip())

Definition at line 148 of file generate_datataset.py.

generate_datataset.fNNeutron = normalize(int(info[10].strip()))

Definition at line 157 of file generate_datataset.py.

generate_datataset.fNPion = normalize(int(info[8].strip()))

Definition at line 155 of file generate_datataset.py.

generate_datataset.fNPizero = normalize(int(info[9].strip()))

Definition at line 156 of file generate_datataset.py.

generate_datataset.fNProton = normalize(int(info[7].strip()))

Definition at line 154 of file generate_datataset.py.

generate_datataset.fNuEnergy = float(info[1].strip())

Definition at line 147 of file generate_datataset.py.

int generate_datataset.fNuPDG = normalize2(int(info[6].strip()))

Definition at line 153 of file generate_datataset.py.

generate_datataset.fRecoNueEnergy = float(info[3].strip())

Definition at line 149 of file generate_datataset.py.

generate_datataset.fRecoNumuEnergy = float(info[4].strip())

Definition at line 150 of file generate_datataset.py.

generate_datataset.ID = imagefile.split("/")[-1][:-3]

Definition at line 137 of file generate_datataset.py.

generate_datataset.IMAGES_PATH = config['images']['path']

Definition at line 46 of file generate_datataset.py.

generate_datataset.info = open(infofile, 'r').readlines()

Definition at line 142 of file generate_datataset.py.

string generate_datataset.infofile = images_path+'/info/'

Definition at line 138 of file generate_datataset.py.

int generate_datataset.interaction = fInt%4

Definition at line 145 of file generate_datataset.py.

dictionary generate_datataset.labels = {}

Definition at line 102 of file generate_datataset.py.

generate_datataset.LABELS_PREFIX = config['dataset']['labels_prefix']

Definition at line 55 of file generate_datataset.py.

generate_datataset.level

Definition at line 30 of file generate_datataset.py.

generate_datataset.maxi = np.max(views[i])

Definition at line 205 of file generate_datataset.py.

generate_datataset.mini = np.min(views[i])

Definition at line 206 of file generate_datataset.py.

list generate_datataset.non_empty_view = [0,0,0]

Definition at line 197 of file generate_datataset.py.

generate_datataset.nonzero = np.count_nonzero(views[i])

Definition at line 207 of file generate_datataset.py.

list generate_datataset.only_train = ['nutau2', 'nutau3']

Definition at line 107 of file generate_datataset.py.

generate_datataset.OUTPUTS = int(config['model']['outputs'])

Definition at line 60 of file generate_datataset.py.

dictionary generate_datataset.partition = {'train' : [], 'validation' : [], 'test' : []}

Definition at line 101 of file generate_datataset.py.

generate_datataset.PARTITION_PREFIX = config['dataset']['partition_prefix']

Definition at line 54 of file generate_datataset.py.

generate_datataset.pixels = np.fromstring(zlib.decompress(image_file.read()), dtype=np.uint8, sep='').reshape(VIEWS, PLANES, CELLS)

Definition at line 191 of file generate_datataset.py.

generate_datataset.PLANES = int(config['images']['planes'])

Definition at line 48 of file generate_datataset.py.

generate_datataset.random_value = np.random.uniform(0,1)

Definition at line 188 of file generate_datataset.py.

generate_datataset.SEED = int(config['random']['seed'])

Definition at line 37 of file generate_datataset.py.

generate_datataset.stdout

Definition at line 30 of file generate_datataset.py.

generate_datataset.stream

Definition at line 30 of file generate_datataset.py.

generate_datataset.TEST_FRACTION = float(config['test']['fraction'])

Definition at line 74 of file generate_datataset.py.

generate_datataset.total = np.sum(views[i])

Definition at line 208 of file generate_datataset.py.

generate_datataset.TRAIN_FRACTION = float(config['train']['fraction'])

Definition at line 64 of file generate_datataset.py.

generate_datataset.UNIFORM = ast.literal_eval(config['dataset']['uniform'])

Definition at line 56 of file generate_datataset.py.

generate_datataset.VALIDATION_FRACTION = float(config['validation']['fraction'])

Definition at line 70 of file generate_datataset.py.

generate_datataset.VIEWS = int(config['images']['views'])

Definition at line 47 of file generate_datataset.py.

list generate_datataset.views = [None]*VIEWS

Definition at line 195 of file generate_datataset.py.

generate_datataset.WEIGHTED_LOSS_FUNCTION = ast.literal_eval(config['train']['weighted_loss_function'])

Definition at line 65 of file generate_datataset.py.

list generate_datataset.y1_class_weights = []

Definition at line 104 of file generate_datataset.py.

list generate_datataset.y2_class_weights = []

Definition at line 105 of file generate_datataset.py.

list generate_datataset.y_train = []

Definition at line 103 of file generate_datataset.py.