Skip to content

Instantly share code, notes, and snippets.

View drinkingkazu's full-sized avatar

Drinking Kazu drinkingkazu

View GitHub Profile
drinkingkazu@sakura:~/sw/slac-jupyterlab$ docker build . -f Dockerfile
Sending build context to Docker daemon 105kB
Step 1/7 : FROM rapidsai/rapidsai:21.08-cuda11.2-runtime-ubuntu20.04-py3.8
21.08-cuda11.2-runtime-ubuntu20.04-py3.8: Pulling from rapidsai/rapidsai
16ec32c2132b: Pull complete
d735ef3c6c53: Pull complete
95da9507e914: Pull complete
e8b322aea2b1: Pull complete
be1982caa717: Pull complete
39542a3f5781: Pull complete
@drinkingkazu
drinkingkazu / MultiPartRain_module.cc
Last active June 14, 2021 18:46
Event Generators
////////////////////////////////////////////////////////////////////////
// Class: MultiPartRain
// Module Type: producer
// File: MultiPartRain_module.cc
//
// Generated at Tue Dec 13 15:48:59 2016 by Kazuhiro Terao using artmod
// from cetpkgsupport v1_11_00.
////////////////////////////////////////////////////////////////////////
#include "art/Framework/Core/EDProducer.h"
////////////////////////////////////////////////////////////////////////
// Class: MultiPartVertex
// Module Type: producer
// File: MultiPartVertex_module.cc
//
// Generated at Tue Dec 13 15:48:59 2016 by Kazuhiro Terao using artmod
// from cetpkgsupport v1_11_00.
////////////////////////////////////////////////////////////////////////
#include "art/Framework/Core/EDProducer.h"
[OpDet #0] optical detector C:0 O:0 centered at (-59.36,29.35,872.9) cm, bar size 20.32 x 20.32 x 10.16 cm, theta(z): 1.5708 rad
[OpDet #1] optical detector C:0 O:1 centered at (-381.07,29.35,872.9) cm, bar size 20.32 x 20.32 x 10.16 cm, theta(z): 1.5708 rad
[OpDet #2] optical detector C:0 O:2 centered at (-59.36,-76.25,872.9) cm, bar size 20.32 x 20.32 x 10.16 cm, theta(z): 1.5708 rad
[OpDet #3] optical detector C:0 O:3 centered at (-381.07,-76.25,872.9) cm, bar size 20.32 x 20.32 x 10.16 cm, theta(z): 1.5708 rad
[OpDet #4] optical detector C:0 O:4 centered at (-59.36,82.15,823.02) cm, bar size 20.32 x 20.32 x 10.16 cm, theta(z): 1.5708 rad
[OpDet #5] optical detector C:0 O:5 centered at (-381.07,82.15,823.02) cm, bar size 20.32 x 20.32 x 10.16 cm, theta(z): 1.5708 rad
[OpDet #6] optical detector C:0 O:6 centered at (-59.36,-23.45,823.02) cm, bar size 20.32 x 20.32 x 10.16 cm, theta(z): 1.5708 rad
[OpDet #7] optical detector C:0 O:7 centered at (-381.07,-23.45,823.02) cm, bar
import torch
class SimIonization(torch.nn.Module):
def __init__(self):
super(SimIonization, self).__init__()
self._density = 1.38 # g/cm^3
self._alpha = 0.847
self._beta = 0.2061
iotool:
batch_size: 64
shuffle: False
num_workers: 4
collate_fn: CollateSparse
#sampler:
# name: RandomSequenceSampler
# batch_size: 64
dataset:
name: LArCVDataset
import subprocess as sp
import time,sys,yaml
class mem_record():
def __init__(self,fname):
self._fout=open(fname,'w')
self._fout.write('index,time,memory\n')
self._tstart=time.time()
ProcessDriver: {
Verbosity: 1
EnableFilter: false
RandomAccess: false
ProcessType: ["SuperaMCTruth","SuperaBBoxInteraction","SuperaMCParticle","SuperaSimEnergyDeposit","Tensor3DFromCluster3D","SegLabelFiveTypes","MaskCluster3D","MaskTensor3D","BBoxFromCluster3D","ParticleCorrector","SuperaSpacePoint","SegLabelGhost"]
ProcessName: ["SuperaMCTruth","SuperaBBoxInteraction","SuperaMCParticle","SuperaSimEnergyDeposit","Tensor3DFromCluster3D","SegLabelFiveTypes","MaskCluster3D","MaskTensor3D","BBoxFromCluster3D","ParticleCorrector","SuperaSpacePoint","SegLabelGhost"]
IOManager: {
Verbosity: 2
@drinkingkazu
drinkingkazu / example_update
Created December 4, 2018 15:16
example of matplotlib update, maybe useful
import matplotlib.pyplot as plt
import numpy as np
import time
MIN=0.
MAX=20.
def random_data():
return np.random.randint(MIN*100,MAX*100,size=100).astype(np.float32)/100.
from ROOT import TChain
import sys
ch=TChain("sparse3d_data_tree")
ch.AddFile(sys.argv[1])
ch.GetEntry(0)
event_data = ch.sparse3d_data_branch
vox_array = event_data.as_vector()