Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
// #include <sys/stat.h>
#include <time.h>
#define TIMESTAMP_BYTE_COUNT 4
#define INITIALIZATION_OFFSET 40
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
// #include <time.h>
#define TIMESTAMP_BYTE_COUNT 4
#define INITIALIZATION_OFFSET 40
typedef struct
#!/usr/bin/python3
import struct
import os
import time
start_time = time.time()
# ============ CONSTANTS TO (OPTIONALLY) SET =============
WINDOW_SIZE = 100
INPUT_FILE_NAME = 'timetags5byte.bin'
# OUTPUT_FILE_NAME = 'output.txt'
@glS512
glS512 / findCoincidences_5byte_numpy.py
Last active January 20, 2016 14:22
Inefficient way to process binary data, posted on codereview.SE: http://codereview.stackexchange.com/q/117080/61165
#!/usr/bin/python3
import os
import numpy as np
# ============ CONSTANTS TO (OPTIONALLY) SET =============
WINDOW_SIZE = 100
INPUT_FILE_NAME = 'timetags5byte.bin'
# ======== CODE TO READ AND PARSE 5 BYTE BINARY FILE =========================
# process data in INPUT_FILE_NAME and print results in OUTPUT_FILE_NAME
vp = {1.50335, -2.8497, 1.03397};
vv = {0.209212, -0.331088, 1.84023};
dataSuppOld = <|8 -> <|2 -> 0.00041, 4 -> 0.00062, 6 -> 0.00061|>,
16 -> <|2 -> 0.00069, 4 -> 0.00099, 6 -> 0.0011, 8 -> 0.0013,
10 -> 0.0014, 12 -> 0.0017, 14 -> 0.0017|>,
32 -> <|2 -> 0.0014, 4 -> 0.0020, 6 -> 0.0024, 8 -> 0.0028,
10 -> 0.0030, 12 -> 0.0033, 14 -> 0.0036, 16 -> 0.0040,
18 -> 0.0045, 20 -> 0.0049, 22 -> 0.0050, 24 -> 0.0058,
26 -> 0.0065, 28 -> 0.0074, 30 -> 0.007|>,
64 -> <|2 -> 0.003, 4 -> 0.0036, 6 -> 0.0043, 8 -> 0.0047,