Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / Run_base_simulation.py
Last active August 29, 2015 13:56
Run base SAPPHiRE simulation
import tables
from sapphire.simulations.base import BaseSimulation
from sapphire.clusters import ScienceParkCluster
datafile = tables.openFile('/tmp/test_base_simulation.h5', 'w')
cluster = ScienceParkCluster()
sim = BaseSimulation(cluster, datafile, '/simulations/this_run', 10)
sim.run()
@153957
153957 / Mars.md
Last active October 30, 2016 18:53
Many Names of Mars
Name Language
Al-Qahira Arabic, Indonesian, Malay
Ares Greek
Auqakuh Quechua (Inca)
Bahram Persian
Harmakhis Ancient Egyptian
Her Desher Egyptian
Hrad Armenian
Huo Hsing Chinese
@153957
153957 / coincidences_between_clusters.py
Created March 19, 2014 10:14
Check for coincidences between stations from different clusters.
import tables
data = tables.openFile('2013_8_1.h5', 'r')
c_index = data.root.coincidences.c_index
s_index = data.root.coincidences.s_index
clusters = [s_group.split('/')[2][8:] for s_group in s_index[:]]
stations = [s_group.split('/')[3][8:] for s_group in s_index[:]]
@153957
153957 / esd_update_status.md
Last active August 29, 2015 14:01
ESD Update status
@153957
153957 / scp_with_spaces.md
Last active August 29, 2015 14:03
scp or rsync a remote file or path with spaces

Escape twice, once using quotes and once using backslashes

Use:

scp [user]@[server]:"[filepath]" [destination]

Example:

scp fred@server.me:"/Volumes/disk/file\ with\ space\ (and\ specials)" Here_please/

@153957
153957 / code.js
Last active August 29, 2015 14:16 — forked from davidfokkema/code.js
var station_info;
var coincidences;
var c_idx = 0;
var map = L.map('map');
var svg = d3.select(map.getPanes().overlayPane).append("svg"),
g = svg.append("g").attr("class", "leaflet-zoom-hide");
function x(coord) { return map.latLngToLayerPoint(coord).x };
function y(coord) { return map.latLngToLayerPoint(coord).y };