Functions | Variables
run_cnn_3class Namespace Reference

Functions

def load_model (name)
 

Variables

 parser = argparse.ArgumentParser(description='Run CNN over a full 2D projection.')
 
 help
 
 default
 
 args = parser.parse_args()
 
 PATCH_SIZE_W = int(args.rows)
 
 PATCH_SIZE_D = int(args.cols)
 
bool crop_event = False
 
 rootModule = args.module
 
 rootFile = TFile(args.input)
 
list keys = [rootModule+'/'+k.GetName()[:-4] for k in rootFile.Get(rootModule).GetListOfKeys() if '_raw' in k.GetName()]
 
 evname = keys[int(args.event)]
 
 raw
 
 deposit
 
 pdg
 
 tracks
 
 showers
 
 full2d = int(args.full)
 
 total_patches
 
 inputs = np.zeros((total_patches, PATCH_SIZE_W, PATCH_SIZE_D), dtype=np.float32)
 
int cnt_ind = 0
 
 model_name = args.net
 
 m = load_model(model_name)
 
 loss
 
 optimizer
 
 pred = m.predict(inputs.reshape(inputs.shape[0], 1, PATCH_SIZE_W, PATCH_SIZE_D))
 
 outputs = np.zeros((pred.shape[1], raw.shape[0], raw.shape[1]), dtype=np.float32)
 
 mask = np.zeros(raw.shape, dtype=np.int32)
 
float mask_thr = 0.67
 
int none_idx = pred.shape[1]-1
 
 pnorm = pred[:, 0]+pred[:, 1]+pred[:, none_idx]
 
float pn = 1.0
 
 fig
 
 ax
 
 figsize
 
 cs = ax[0,0].pcolor(np.transpose(pdg & 0xFF), cmap='gist_ncar')
 

Function Documentation

def run_cnn_3class.load_model (   name)

Definition at line 38 of file run_cnn_3class.py.

38 def load_model(name):
39  with open(name + '_architecture.json') as f:
40  model = model_from_json(f.read())
41  model.load_weights(name + '_weights.h5')
42  return model
43 
44 
def load_model(name)
int open(const char *, int)
Opens a file descriptor.

Variable Documentation

run_cnn_3class.args = parser.parse_args()

Definition at line 11 of file run_cnn_3class.py.

run_cnn_3class.ax

Definition at line 109 of file run_cnn_3class.py.

int run_cnn_3class.cnt_ind = 0

Definition at line 62 of file run_cnn_3class.py.

bool run_cnn_3class.crop_event = False

Definition at line 47 of file run_cnn_3class.py.

run_cnn_3class.cs = ax[0,0].pcolor(np.transpose(pdg & 0xFF), cmap='gist_ncar')

Definition at line 111 of file run_cnn_3class.py.

run_cnn_3class.default

Definition at line 3 of file run_cnn_3class.py.

run_cnn_3class.deposit

Definition at line 54 of file run_cnn_3class.py.

run_cnn_3class.evname = keys[int(args.event)]

Definition at line 52 of file run_cnn_3class.py.

run_cnn_3class.fig

Definition at line 109 of file run_cnn_3class.py.

run_cnn_3class.figsize

Definition at line 109 of file run_cnn_3class.py.

run_cnn_3class.full2d = int(args.full)

Definition at line 55 of file run_cnn_3class.py.

run_cnn_3class.help

Definition at line 3 of file run_cnn_3class.py.

run_cnn_3class.inputs = np.zeros((total_patches, PATCH_SIZE_W, PATCH_SIZE_D), dtype=np.float32)

Definition at line 60 of file run_cnn_3class.py.

list run_cnn_3class.keys = [rootModule+'/'+k.GetName()[:-4] for k in rootFile.Get(rootModule).GetListOfKeys() if '_raw' in k.GetName()]

Definition at line 51 of file run_cnn_3class.py.

run_cnn_3class.loss

Definition at line 76 of file run_cnn_3class.py.

run_cnn_3class.m = load_model(model_name)

Definition at line 75 of file run_cnn_3class.py.

run_cnn_3class.mask = np.zeros(raw.shape, dtype=np.int32)

Definition at line 84 of file run_cnn_3class.py.

float run_cnn_3class.mask_thr = 0.67

Definition at line 85 of file run_cnn_3class.py.

run_cnn_3class.model_name = args.net

Definition at line 74 of file run_cnn_3class.py.

int run_cnn_3class.none_idx = pred.shape[1]-1

Definition at line 87 of file run_cnn_3class.py.

run_cnn_3class.optimizer

Definition at line 76 of file run_cnn_3class.py.

run_cnn_3class.outputs = np.zeros((pred.shape[1], raw.shape[0], raw.shape[1]), dtype=np.float32)

Definition at line 82 of file run_cnn_3class.py.

run_cnn_3class.parser = argparse.ArgumentParser(description='Run CNN over a full 2D projection.')

Definition at line 2 of file run_cnn_3class.py.

run_cnn_3class.PATCH_SIZE_D = int(args.cols)

Definition at line 46 of file run_cnn_3class.py.

run_cnn_3class.PATCH_SIZE_W = int(args.rows)

Definition at line 45 of file run_cnn_3class.py.

run_cnn_3class.pdg

Definition at line 54 of file run_cnn_3class.py.

float run_cnn_3class.pn = 1.0

Definition at line 97 of file run_cnn_3class.py.

run_cnn_3class.pnorm = pred[:, 0]+pred[:, 1]+pred[:, none_idx]

Definition at line 88 of file run_cnn_3class.py.

run_cnn_3class.pred = m.predict(inputs.reshape(inputs.shape[0], 1, PATCH_SIZE_W, PATCH_SIZE_D))

Definition at line 79 of file run_cnn_3class.py.

run_cnn_3class.raw

Definition at line 54 of file run_cnn_3class.py.

run_cnn_3class.rootFile = TFile(args.input)

Definition at line 50 of file run_cnn_3class.py.

run_cnn_3class.rootModule = args.module

Definition at line 49 of file run_cnn_3class.py.

run_cnn_3class.showers

Definition at line 54 of file run_cnn_3class.py.

run_cnn_3class.total_patches

Definition at line 56 of file run_cnn_3class.py.

run_cnn_3class.tracks

Definition at line 54 of file run_cnn_3class.py.