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
// Doing the operation: | |
// | |
// | a a a a | | y | | |
// x * A * y = [ x x x x ] | a a a a | | y | | |
// | a a a a | | y | | |
// | a a a a | | y | | |
// | |
// with SIMD intrinics (specifically AVX). | |
// | |
// adapted from https://gist.github.com/rygorous/4172889 |
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
# Split MIRI transmissions into separate files. Original file was | |
# http://ircamera.as.arizona.edu/MIRI/ImPCE_TN-00072-ATC-Iss2.xlsx | |
# saved as CSV. | |
import numpy as np | |
data = np.loadtxt("ImPCE_TN-00072-ATC-Iss2.csv", skiprows=2) | |
bands = ("F560W F770W F1000W F1280W F1130W F1500W F1800W F2100W F2550W" | |
.lower().split()) |
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
"""example of converting a numpy array to a C++ valarray and back in cython | |
using copies. | |
Compile with `python setup.py build_ext --inplace` | |
Example | |
------- | |
>>> import cpptest, numpy as np | |
>>> x = np.array([0., 1., 2.]) |
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
"""A minimal implementation of a dense neural net with an arbitrary | |
number of layers, backpropagation, and a few different activation functions.""" | |
import numpy as np | |
# Activation and cost functions (with gradients) | |
def sigmoid(x): | |
y = 1.0 / (1.0 + np.exp(-x)) | |
return y, y * (1.0 - y) |
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
"""sncosmo Source implementing the "dm15" model from Sako et al (2008). | |
Example:: | |
>>> import sncosmo | |
>>> import dm15source | |
>>> model = sncosmo.Model(source='dm15') | |
>>> model.set(z=0.5, t0=55000., amplitude=1e-10, dm15=0.9) | |
>>> model.bandmag('sdssi', 'ab', 55011.5) | |
24.661108429127694 |
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
# Licensed under a 3-clause BSD style license - see LICENSE.rst | |
"""Animate one or more sncosmo Source spectral time series.""" | |
from __future__ import division | |
import math | |
import numpy as np | |
from astropy.utils.misc import isiterable | |
from astropy.extern import six |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
"""Tools for simulation of transients.""" | |
import sys | |
import math | |
from copy import deepcopy | |
import numpy as np | |
from scipy.interpolate import InterpolatedUnivariateSpline as Spline1d | |
from astropy.table import Table | |
from astropy import cosmology |
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
{ | |
"metadata": { | |
"name": "Introduction" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
NewerOlder