Skip to content

Instantly share code, notes, and snippets.

View aphearin's full-sized avatar

Andrew Hearin aphearin

  • Argonne National Lab
View GitHub Profile
@aphearin
aphearin / binned_elements_finder.py
Created June 1, 2015 13:24
Method to retrieve the array elements that fall within a bin.
def binned_elements_finder(x, bin_limits):
""" Given an array x, and a set of bin limits on x,
return an indexer and a set of slices for retrieiving the set of points
in x that lie in the i^th bin.
Parameters
----------
x : array
bin_limits : array
@aphearin
aphearin / numpy_table_agg.py
Created January 20, 2016 21:02
Demonstration of a group aggregation calculation using Numpy and Astropy Tables
import numpy as np
from astropy.table import Table
############################################
# First we create some fake data
# We'll make a galaxy group catalog
# using a million galaxies so that the calculation
# would be very expensive to do naively
Ngals = 1e6
Ngroups = 3e5
@aphearin
aphearin / random_subvol_mockpop.ipynb
Created February 5, 2016 20:30
Demonstration of generating Halotools predictions from randomly selected subvolumes
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aphearin
aphearin / omp_testing.pyx
Created December 22, 2016 21:31
Minimal example of cython usage of prange and associated setup.py setup
from cython.parallel import prange
def c_array_f_multi(double[:] X):
cdef int N = X.shape[0]
cdef double[:] Y = np.zeros(N)
cdef int i
for i in prange(N, nogil=True):
if X[i] > 0.5:
@aphearin
aphearin / SublimeLinter.sublime-settings
Created March 3, 2018 18:05
User settings file for SublimeLinter: stopped working upon v4 upgrade
{
"user": {
"@python": 2,
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "background",
"linters": {
@aphearin
aphearin / gist:1597c42811aa152f51ba94b28eeb0bf6
Created March 3, 2018 18:19
Attempt to adapt user settings file for SublimeLinter v4: linter behavior does not respond to modifications to ignored error codes
// SublimeLinter Settings - User
{
"paths": {
"linux": [],
"osx": [
"/Users/aphearin/anaconda/bin/"
],
"windows": []
},
@aphearin
aphearin / protodc2_v4_demo.ipynb
Created April 1, 2018 21:24
Demo cosmoDC2 extragalactic catalog for LSST-DESC
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aphearin
aphearin / isocens.ipynb
Created April 7, 2018 04:37
Clustering and lensing of isolated vs. non-isolated centrals
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aphearin
aphearin / ip_clustering_lensing.ipynb
Created April 7, 2018 17:11
Influence of isolation criteria on central galaxy clustering and lensing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aphearin
aphearin / develop_ellipticity_model.ipynb
Created May 19, 2018 16:43
Notebook experimenting with scipy.stats models for COSMOS ellipticity distributions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.