Skip to content

Instantly share code, notes, and snippets.

View tunnell's full-sized avatar

Chris Tunnell tunnell

View GitHub Profile
import numpy as np
# Here, `filenames` is list of path to the images
# and `labels` are the associated labels.
class S2Sequence(tf.keras.utils.Sequence):
def __init__(self, filenames, batch_size):
self.filenames = list(glob.glob(filenames))
self.batch_size = batch_size
@tunnell
tunnell / windchime.ipynb
Last active July 1, 2021 20:04
Simulate Windchime optomechanical sensors
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
__version__ = '1.3.0'
__nest_version__ = '2.1.0'
from .nestpy import *
# blah blah
NESTcalc._GetYields = NESTcalc.GetYields
def myfunction(**kwargs):
"""alskdfjaklfd
import strax
from straxen.contexts import xenon1t_dali
def xenon1t_fried(output_folder='./strax_data', build_lowlevel=False):
st = xenon1t_dali(output_folder, build_lowlevel)
st.storage=[
strax.DataDirectory(
'/data/xenon1t/strax_data_raw',
take_only='raw_records',
provide_run_metadata=True,
import inspect
from straxen import contexts
def get_context(name, processing_version):
"""Contact the RunDB to see grab context associated with some
processing version
"""
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tunnell
tunnell / passport.py
Created December 17, 2019 14:22
Compute which passport complements your current passport the most
import pandas as pd
my_countries = ('United Kingdom', 'Rwanda',) # Change me
url = 'https://raw.githubusercontent.com/ilyankou/passport-index-dataset/master/passport-index-matrix.csv'
df = pd.read_csv(url).set_index('Passport') != 0
selection = df.loc[my_countries, :]
visa_countries = (selection.sum(axis=0) == 0)
print('Top 10 Complementary', df.loc[:, visa_countries].sum(axis=1).sort_values(ascending=False).head(10))
@tunnell
tunnell / gchq.ipynb
Created May 26, 2019 17:41
Solution to question 1 in Financial Times GCHQ example questions using numpy. https://www.ft.com/GCHQ-quiz
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tunnell
tunnell / latex_prl.mpl
Created April 15, 2019 15:57
XENON style extracts
backend: pgf
pgf.texsystem: pdflatex # change this if using xetex or lautex
text.usetex: True # use LaTeX to write all text
font.family: serif
font.serif: [] # blank entries should cause plots to inherit fonts from the document
font.sans-serif: []
font.monospace: []
axes.labelsize: 10
@tunnell
tunnell / collab_counts.ipynb
Last active March 18, 2019 00:53
Community sizes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.