Skip to content

Instantly share code, notes, and snippets.

@willettk
willettk / gist:c7c42dd748a3590faafd
Last active December 30, 2015 16:53
mongoexport command for GZ: CANDELS users. Pay attention to the single vs. double quote order.
mongoexport -d galaxy_zoo -c galaxy_zoo_users -f "name" -q '{"projects.502a90cd516bcb060c000001.groups.50251c3b516bcb6ecb000001.classification_count":{$gte:0}}' --type=csv -o gz4.csv
@willettk
willettk / riddler.py
Created December 22, 2015 18:09
Riddler on FiveThirtyEight - Dec 22, 2015
import random
import numpy
N = 2000
Nt = 100000
times = []
nomatch = 0
for i in range(Nt):
my_tasks = []
@willettk
willettk / aggregate.js
Created November 23, 2015 16:49
Aggregate Zooniverse classifications in MongoDB by date
db.radio_classifications.aggregate(
{ $group : {
_id: {
year : { $year : "$created_at" },
month : { $month : "$created_at" },
day : { $dayOfMonth : "$created_at" },
},
count: { $sum: 1 }
}}
)
@willettk
willettk / guilty.json
Last active September 5, 2015 02:36
Zooniverse Spotifriday
{
"name": "guilty_pleasures",
"children": [
{
"name": "zoonistaff",
"children": [
{
"name": "alex",
"children": [
{"selector": "Alex", "name": "I Think We’re Alone Now", "size": 680},
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Bahir Dar University,Ethiopia
Entoto Obervatory and Research Center,Ethiopia
Ethiopian Space Science Society Entoto Observatory and Research Centre,Ethiopia
Abia State University,Nigeria
Centre for High Performance Computing,South Africa
CSIR(CHPC),South Africa
Hartebeesthoek Radio Astronomy Observatory,South Africa
HartRAO,South Africa
IAU Office of Astronomy for Development,South Africa
IAU Office of Astronomy For Development,South Africa
@willettk
willettk / make_color_bviz_jpeg.py
Last active August 29, 2015 14:19
Making Galaxy Zoo: Hubble images for GOODS full-depth imaging (snippet)
def make_jpeg(gal,color_scheme='bviz',field='s',desaturate=False,show_img=True,load_from_mosaic=False,mosaics=None):
ascales,anonlinearity,npix_final,apedestal = get_image_defaults(color_scheme=color_scheme)
input_oid = gal['UID_MOSAIC_Z']
id_str = 'g%s' % input_oid
#print '----------------- %s --------------------' % id_str
# Get the amount by which we need to resize the image
{
"metadata": {
"name": "",
"signature": "sha256:2671bcf8ad936f12851c3856c8114fbd59a36e08903b1337ca903c79059900fd"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
[willettk@zrak Montage_v3.3]$ make
(cd lib/src; make)
(cd cfitsio-3.25; ./configure; make; cp libcfitsio.a ../..; cp *.h ../../include)
checking for uname... 1
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
@willettk
willettk / README.md
Last active August 29, 2015 14:11
Archer chord diagram

Chord diagram from the FX television series Archer. Based on examples from Mike Bostock of chord diagram and directed relationships among groups.

To do:

  1. Figure out how to label items
  2. Change colors for gender
  3. Change widths based on other parameters.