This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
This is the pipeline `do_stuff` | |
generated using kedro <blah> | |
""" | |
from .pipeline_do_stuff import create_pipeline | |
__all__ = ["create_pipeline"] | |
__version__ = "0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### 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 | |
---------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyftdi as F | |
from pyftdi import i2c | |
from ctypes import c_short | |
from time import sleep | |
import atexit | |
### Some utility functions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################## | |
# Copyright (c) 2018, Jason M. Hite | |
# All rights reserved. | |
# | |
# Redistribution and use in source and binary forms, with or without | |
# modification, are permitted provided that the following conditions are met: | |
# | |
# 1. Redistributions of source code must retain the above copyright notice, this | |
# list of conditions and the following disclaimer. | |
# 2. Redistributions in binary form must reproduce the above copyright notice, |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from scipy.optimize import minimize | |
def least_squares(A, b, x0): # Least-squares solution for Ax=b, initial guess of x0 | |
return minimize( | |
lambda x: np.linalg.norm(A.dot(x) - b), | |
x0, | |
) | |
def least_squares_tikhonov(A, b, alpha, x0): # Least squares for Ax=b with simple Tikhonov regularization |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder