Skip to content

Instantly share code, notes, and snippets.

@nhmc
nhmc / mortgage_repayments.ipynb
Created February 11, 2016 02:22
A mortgage repayment calculator written in Python using a Jupyter notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nhmc
nhmc / Curve of Growth calculation
Last active December 15, 2015 04:39
An IPython notebook generating a curve of growth (rest equivalent width vs column density) for neutral hydrogen.
{
"metadata": {
"name": "Curve of growth"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@nhmc
nhmc / calc_bg.py
Created November 16, 2012 10:43
Calculate the background and RMS of an astronomical image
import numpy as np
def calc_bg(a):
""" Estimate the background level and rms. """
good = ~np.isnan(a)
assert good.sum(), 'no good pixels!'
# poor man's source detection...
vmax = np.percentile(a[good], 80)
c0 = a[good] < vmax
temp = a[good][c0]