Skip to content

Instantly share code, notes, and snippets.

View dannygoldstein's full-sized avatar

Danny Goldstein dannygoldstein

  • Weights & Biases
  • Los Angeles, CA
View GitHub Profile
@dannygoldstein
dannygoldstein / makepicture.py
Last active August 29, 2015 14:04
KBO triplet picture
import cx_Oracle
import pickle
import numpy as np
from itertools import chain
from PIL import Image, ImageDraw, ImageFont
from exceptions import IOError
import shutil
import os
@dannygoldstein
dannygoldstein / find_high_det_count.py
Last active August 29, 2015 14:05
failed subtraction search with ML
# Query to find the subtractions with more than 5x the
# median number of detections per subtraction passing an ML cut of 0.5
query = 'SELECT DISTINCT test.IMAGE_NAME_DIFF, SNOBS.nite, passing_det_count FROM '\
'(SELECT IMAGE_NAME_DIFF, COUNT(CASE WHEN a.ml_score >= 0.5 THEN 1 END) passing_det_count '\
'FROM SNOBS o JOIN SNAUTOSCAN a ON o.snobjid = a.snobjid '\
'WHERE a.ml_version = 2 GROUP BY '\
'IMAGE_NAME_DIFF) test JOIN SNOBS ON '\
'test.IMAGE_NAME_DIFF = SNOBS.IMAGE_NAME_DIFF where passing_det_count >= 55'
@dannygoldstein
dannygoldstein / fake_query.py
Last active August 29, 2015 14:05
query to get fakes from a subtraction
import cx_Oracle
username = 'your_username'
password = 'your_password'
dsn = 'leovip148.ncsa.uiuc.edu/destest'
db = cx_Oracle.connect(username, password, dsn)
cursor = db.cursor()
cursor.execute('begin fixSynonyms(\'\',\'SNY1REPROC\'); end;') # this points you to the right
# tablespace
@dannygoldstein
dannygoldstein / gist:e1b3276b778fdb48f905
Created August 11, 2014 04:37
candidate_efficiency
[('http://dessne.cosmology.illinois.edu/SNWG/web/display/examineCand.php?SNId=1098152',
'z=0.129',
'numepochs=17',
'numepochs_ml=0'),
('http://dessne.cosmology.illinois.edu/SNWG/web/display/examineCand.php?SNId=1098305',
'z=0.129',
'numepochs=17',
'numepochs_ml=0'),
('http://dessne.cosmology.illinois.edu/SNWG/web/display/examineCand.php?SNId=1052550',
'z=0.216',
[('http://dessne.cosmology.illinois.edu/SNWG/web/display/examineCand.php?SNId=1098152',
'z=0.129',
'numepochs=17',
'numepochs_ml=0'),
('http://dessne.cosmology.illinois.edu/SNWG/web/display/examineCand.php?SNId=1098305',
'z=0.129',
'numepochs=17',
'numepochs_ml=0'),
('http://dessne.cosmology.illinois.edu/SNWG/web/display/examineCand.php?SNId=1052550',
'z=0.216',
# Z, Eff
[(0.014285714285714285, 1.0),
(0.042857142857142858, nan),
(0.071428571428571425, nan),
(0.10000000000000001, 0.86082474226804129),
(0.12857142857142856, 0.93023255813953487),
(0.15714285714285714, 0.95454545454545459),
(0.18571428571428572, 0.95608108108108103),
(0.21428571428571427, 0.96601941747572817),
{
"cells": [
{
"cell_type": "code",
"execution_count": 321,
"metadata": {
"collapsed": false
},
"outputs": [
{
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### CS70 Worksheet 4A Problem 2.4"
]
},
{
@dannygoldstein
dannygoldstein / sol.ipynb
Created July 28, 2016 03:56
cs70 worksheet 4a 2.4 solution
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Starting python tests...
============================================================================================================= test session starts =============================================================================================================
platform linux2 -- Python 2.7.14, pytest-3.4.0, py-1.5.2, pluggy-0.6.0
rootdir: /global/scratch/dagoldst/GalSim-1.5.1/tests, inifile:
plugins: xdist-1.22.1, timeout-1.2.1, forked-0.2
timeout: 60.0s method: signal
gw0 I / gw1 I / gw2 I / gw3 I / gw4 I / gw5 I / gw6 I / gw7 I / gw8 I / gw9 I / gw10 I / gw11 I / gw12 I / gw13 I / gw14 I / gw15 I / gw16 I / gw17 I / gw18 I / gw19 I
gw0 [527] / gw1 [527] / gw2 [527] / gw3 [527] / gw4 [527] / gw5 [527] / gw6 [527] / gw7 [527] / gw8 [527] / gw9 [527] / gw10 [527] / gw11 [527] / gw12 [527] / gw13 [527] / gw14 [527] / gw15 [527] / gw16 [527] / gw17 [527] / gw18 [527] / gw19 [527]
scheduling tests via LoadScheduling