Skip to content

Instantly share code, notes, and snippets.

View lgarrison's full-sized avatar

Lehman Garrison lgarrison

View GitHub Profile
@lgarrison
lgarrison / SAO_python_worksheet.ipynb
Created August 14, 2018 15:57
Simple simulations with Python and NumPy
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lgarrison
lgarrison / scale_free_sigma8.ipynb
Last active October 25, 2019 19:18
sigma8 in Scale-Free Cosmologies
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lgarrison
lgarrison / high_performance_python.ipynb
Last active July 23, 2020 14:10
High-Performance Python, or When to Write For Loops in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lgarrison
lgarrison / repeat_histogram.py
Created December 27, 2016 22:25
Fast repeated histogramming in numpy
# Note: this function uses the term 'radius', but the histogramming is completely general
import numpy as np
def RadialBin(radii, values, bin_edges, bin_indices=None):
"""
Radial histogramming that supports fast re-evaluation
for the same `radii` with new `values` by passing back `bin_indices`.
Parameters
@lgarrison
lgarrison / RR_autocorrelations.ipynb
Last active July 24, 2020 12:52
A note on the RR term in autocorrelations
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lgarrison
lgarrison / swot vs corrfunc
Last active February 1, 2017 20:16
swot vs corrfunc: timing & accuracy
swot: https://github.com/jcoupon/swot/
corrfunc: https://github.com/manodeep/Corrfunc
To test the speed and agreement of swot vs corrfuc, we generated random
datasets of increasing size and measured the w(theta) autocorrelation function.
Swot has an approximation parameter 'OA' (opening angle) that critically impacts its runtime.
We tried OA=0.03 and OA='no'. However, even the conservative value of OA=0.03
caused >10% errors in wtheta for this randomized configuration. Thus, it should
be used with caution.