Skip to content

Instantly share code, notes, and snippets.

@153957
153957 / chrome_with_disabled_web_security.sh
Created September 19, 2013 11:24
Open Chrome for local (e.g. 'file://[..].csv') $.get testing
open -a Google\ Chrome --args --disable-web-security
@153957
153957 / PyTables_openFile_Speed.py
Created February 14, 2013 13:34
In the early version of Gist 4731132 I tested the speed of some retrieving some information from a h5 file. I thought a difference was found when certain steps where skipped. When testing my code in that gist today I found that the various methods gave the same results. Apparently the part that caused the speed difference was the one thing that …
import timeit
r_relative = timeit.Timer(stmt="read = tables.openFile('[path relative to cwd].h5', 'r'); read.close()", setup='import tables')
min(r_relative(2000, 100))
# 0.04840588569641113
r_absolute = timeit.Timer(stmt="read = tables.openFile('[path starting with /].h5', 'r'); read.close()", setup='import tables')
min(r_absolute.repeat(2000, 100))
# 0.00023484230041503906
@153957
153957 / PyTables_speed_test.py
Last active December 12, 2015 06:38
Test speed of data retrieval from HDF5 file. UPDATED with absolute/relative path comparison.
# It seems slightly faster to skip getting the groups/tables
import timeit
r = timeit.Timer(stmt="read = tables.openFile('Angle_120301_120314.h5', 'r');"
"group = read.root.s503;"
"blobs = group.blobs;"
"events = group.events;"
"event = events[-1];"
"trace_id = event['traces'];"
@153957
153957 / coincidence_data.json
Last active October 10, 2015 19:28
jSparc coincidence with 2-detector stations
{"timestamp": 1342017484, "nanoseconds": 724389247, "events": [{"status": "on", "timestamp": 1342017484, "nanoseconds": 724389232, "lon": 4.8131896836700001, "detectors": 4, "number": 105, "integrals": [24921.539999999997, 11109.869999999999, -0.56999999999999995, -0.56999999999999995], "mips": [5.070149999999999, 3.3544499999999999, -0.0028499999999999997, -0.0028499999999999997], "lat": 52.448649414999998, "pulseheights": [1014.0299999999999, 670.88999999999999, -0.56999999999999995, -0.56999999999999995], "alt": 60.003253926500001, "traces": [[-1.71, -1.71, -1.71, -1.71, -1.71, -1.71, -2.2799999999999998, -49.019999999999996, -173.27999999999997, -406.97999999999996, -642.38999999999999, -833.33999999999992, -943.91999999999996, -1006.6199999999999, -1015.7399999999999, -992.36999999999989, -961.58999999999992, -948.4799999999999, -946.76999999999987, -939.3599999999999, -910.8599999999999, -860.69999999999993, -817.94999999999993, -788.30999999999995, -742.13999999999999, -694.82999999999993, -669.1799999