Skip to content

Instantly share code, notes, and snippets.

View jasonmhite's full-sized avatar

Jason Hite jasonmhite

View GitHub Profile
@jasonmhite
jasonmhite / tm1638.py
Last active November 15, 2021 15:07
TM1638 example for FT232H
# See https://blog.3d-logic.com/2015/01/10/using-a-tm1638-based-board-with-arduino/
import atexit
from pyftdi.spi import SpiController
from time import sleep
SPI_FREQ = 10000
SPI_MODE = 0
# Initialize the controller
### Time ###
All of this needs to be done as root.
This assumes the GPS module is connected to the 4th channel of the
FT4232H. If it isn't, you need to edit the DEVICES variable below to
point to the correct one. The connections you need to make are:
GPS Pin <--> FT4232 Pin
----------------------------
@jasonmhite
jasonmhite / write_spe.py
Created July 18, 2019 14:25
A quick and dirty prototype for writing SPE files in becquerel
# Based off the implementation that is already in becquerel.parsers.SpeFile,
# but adapted to read *some* of the info from a Spectrum instance.
# I'm a little fuzzy on the details of the SPE format (e.g. what is the difference
# between $ENER_CAL and $MCA_CAL) but this produces files that load without
# issue in Sandia's InterSpec tool.
# This is a rough implementation as a prototype, it needs a lot of work.
def write_spe(
spec,
@jasonmhite
jasonmhite / gmd.py
Last active November 19, 2019 18:25
Simple implementation for a Gaussian mixture distribution
import numpy as np
import scipy.stats as st
class GaussianMixture(object):
def __init__(self, mu, sigma, w):
self.mu = np.asarray(mu)
self.sigma = np.asarray(sigma)
self.w = np.asarray(w)
self.w /= self.w.sum()
@jasonmhite
jasonmhite / src-my_project-pipelines-do_stuff-__init__.py
Created April 27, 2023 13:22
Convention for kedro pipelines; pretend dashes are / in the file names for folder structure
"""
This is the pipeline `do_stuff`
generated using kedro <blah>
"""
from .pipeline_do_stuff import create_pipeline
__all__ = ["create_pipeline"]
__version__ = "0.1"