Skip to content

Instantly share code, notes, and snippets.

View tomkooij's full-sized avatar

Tom Kooij tomkooij

View GitHub Profile
@tomkooij
tomkooij / montecarlo.ipynb
Created March 15, 2015 18:44
Monte carlo Pi ipython notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tomkooij
tomkooij / index.html
Last active August 29, 2015 14:17
Muonlifetime histogram simulation
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<script src='http://d3js.org/d3.v3.min.js'></script>
</head>
<style>
.ditwaseerst_dotbar {
@tomkooij
tomkooij / N = 10000
Last active August 29, 2015 14:19
Pytables / sapphire.GroundParticlesSimulation() testscript
*** testcase: 1e16 eV 88Mb unsorted
N = 10000
old code pytables_readwhere:
Time: 4:36:13|############################################################################################################################################|100%
number of coincidences: 5055
new code: pytbales_readwhere on x. compress on y and particle_id
Time: 5:35:23|############################################################################################################################################|100%
number of coincidences: 5055
results:
# coding: utf-8
from sapphire import CorsikaQuery
cq = CorsikaQuery('/data/hisparc/corsika/corsika_overview.h5')
cq.available_parameters('energy')
cq.simulations(energy=16.5)
# coding: utf-8
import tables
print "tables version: ", tables.__version__
import numexpr
print "numexpr version: ", numexpr.__version__
FILENAME = '/data/hisparc/corsika/corsika_overview.h5'
data = tables.open_file(FILENAME, 'r')
a = data.root.simulations.read_where('log10(energy) > 14.')
print len(a)
# coding: utf-8
import numpy
from hashlib import md5
from tables.utilsExtension import get_nested_field
import numexpr
from numexpr.necompiler import NumExpr, stringToExpression
import tables
FILENAME = '/data/hisparc/corsika/corsika_overview.h5'
"""
Simulate a read_where() query on a pytables table
Issue: Using MKL 11.3 the numexpr NumExpr query is wrong
works with without MKL.
works with and without MKL using a single column.
It seems the VML log10 function is not correctly called.
The table has different memory mapping as a single column.
It seems the VML call does not account for this correctly.
import tables
import numexpr
FILENAME = 'test.h5'
class Test(tables.IsDescription):
a = tables.Float32Col(dflt=1, pos = 2) # single-precision
b = tables.Float32Col(dflt=1, pos = 2) # single-precision
c = tables.Float32Col(dflt=1, pos = 2) # single-precision
@tomkooij
tomkooij / out.txt
Created April 4, 2016 05:01
output of --heavy test on current master (pytables 3.2.2)
$ python -m tables.tests.test_all --heavy
*Warning*: NumPy version is lower than recommended: 1.10.4 < 1.7.1
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
PyTables version: 3.2.2
HDF5 version: 1.8.16
NumPy version: 1.10.4
Numexpr version: 2.5.2.dev0 (using VML/MKL 11.3.1)
Zlib version: 1.2.8 (in Python interpreter)
BZIP2 version: 1.0.5 (10-Dec-2007)
Blosc version: 1.4.4 (2015-05-05)
@tomkooij
tomkooij / profile.txt
Created April 12, 2016 09:14
cProfile (cumulative) of DAT000000 to HDF5 conversion
convert to hdf5
Converting CORSIKA data (DAT000000) to HDF5 format
100%|##################################################################################################################################################|Time: 0:02:40
create index
Ensuring the x column for table groundparticles is indexed.
106369062 function calls (106367147 primitive calls) in 180.480 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)