Skip to content

Instantly share code, notes, and snippets.

@themperek
themperek / testz.c
Created April 10, 2015 10:01
iverilog: vpi problem
#include <assert.h>
#include "vpi_user.h"
static PLI_INT32
EndOfCompile(s_cb_data *data)
{
s_vpi_time timerec = { vpiSimTime, 0, 0, 0 };
s_vpi_value val;
@themperek
themperek / .travis.yml
Last active August 29, 2015 14:21
How to cache requirements python project on Travis-CI?
cache:
directories:
- $HOME/.pip-cache/
install:
- pip install --upgrade pip
- pip install -r requirements.txt --cache-dir $HOME/.pip-cache

Keybase proof

I hereby claim:

  • I am themperek on github.
  • I am themperek (https://keybase.io/themperek) on keybase.
  • I have a public key whose fingerprint is 37E2 15E4 C9C9 1A8A FF73 0194 95D5 A500 E8F3 3B31

To claim this, I am signing this object:

import time
from array import array
import numpy as np
buff = array('B')
x = np.empty([], dtype=np.uint8)
t0 = time.time()
filter_tables = tables.Filters(complib='blosc', complevel=0)
def hser(data):
h5file = tables.open_file("in-memory", "w", driver="H5FD_CORE", driver_core_backing_store=0)
h5file.create_table(h5file.root, "array", data, filters=filter_tables)
fi = h5file.get_file_image()
h5file.close()
return fi
def hdes(sdata):
yappi.start()
import yappi
# code
f = open('workfile'+str(self.kind), 'w')
yappi.get_func_stats().print_all(out=f)
yappi.get_thread_stats().print_all()
def simple_ser(data, meta = {}):
buffer = array('B', [])
buffer.fromstring(data.data)
meta['data_meta'] = {'dtype': str(data.dtype), 'shape': data.shape}
meta_json = jsonapi.dumps(meta)
meta_json_buffer = array('B', [])
@themperek
themperek / arch_sim.py
Last active October 7, 2017 16:45
Pixel readout architecture simulation
import numpy as np
import random
from numba import jit
@jit
def fei3_sim(PIXEL_AREA = 36.4*36.4, HIT_RATE_CM = 200*(10**6), ):
SIM_TIME = 100000
PIXEL_NO = 512*2
MEAN_TOT = 10
@themperek
themperek / tjmonopix_sim.py
Last active March 7, 2018 22:33
Data flow simulation model for Monopix chip
import numpy as np
import random
import numba
@numba.njit
def monopix_sim(SIM_TIME = 1000000, LATENCY = 400, TRIGGER_RATE = 4.0/40, PIXEL_AREA = 36.0*40.0, READ_COL = 4, LOGIC_COLUMNS = 512/4, PIXEL_NO = 4*512, HIT_RATE_CM = 100*(10**6), MEAN_TOT = 15, READ_TRIGER_MEM = 1, TRIG_MEM_SIZE = 96, READ_OUTPUT_FIFO = 1, OUT_FIFO_SIZE = 128):
# Average hit rate L4: 0.021/mm2/BC
PIXEL_MAX_LATENCY = 63 #6-bit ToT
#LATENCY = 400 10us
#TRIGGER_RATE = 4.0/40 4MHz
import numpy as np
PIXEL_NO = 8*400
PIXEL_AREA = 50*50
HIT_RATE_CM = 0.5*(10**9) # this is hit rate should be region rate for this
TRIGGER_RATE = 4.0/40
pixel_hit_rate_bx = ((float(PIXEL_AREA)/(10000*10000)) * HIT_RATE_CM )/ (40*(10**6))
trig_mem = np.full((100000) ,-1, dtype=np.int)
stat_trig = np.full((10000) ,0, dtype=np.int)