Skip to content

Instantly share code, notes, and snippets.

@adammcmaster
adammcmaster / rekognise.py
Created June 22, 2017 14:45
Run AWS Rekognition against a project, coping results into new subject sets
import boto3
import requests
from panoptes_client import Panoptes, Project, SubjectSet, Subject
Panoptes.connect(
username='',
password='',
)
@adammcmaster
adammcmaster / transform-shax-classifications.py
Last active May 4, 2017 15:00
transform-shax-classifications.py
import csv
import json
import sys
EXPERT_USERS = (
'mutabilitie',
'parsfan',
'jules',
'hwolfe',
@adammcmaster
adammcmaster / fix_metadata_for_subject_ids.py
Created April 5, 2017 13:16
Updating Backyard Worlds subjects
import csv
import json
import os
import sys
import time
from panoptes_client import Panoptes, Subject
# Remove admin=True if you're a project collaborator/owner
Panoptes.connect(
@adammcmaster
adammcmaster / gz-activate.rb
Last active February 24, 2017 12:21
Checking and activating Galaxy Zoo subjects
require 'json'
checked_subjects = []
all_valid = true
File.open('illustrisSubjectsForActivation.json').read.each_line do |line|
h = JSON.parse(line)
s = GalaxyZooSubject.find(BSON::ObjectId(h['_id']))
if not s
all_valid = false
@adammcmaster
adammcmaster / lookup.rb
Last active February 21, 2017 15:53
Look up current Ouroboros ID from previous ID
def lookup(old_user_id, project)
p = Project.find(BSON::ObjectId(project))
c = p.classifications.where("user_id" => BSON::ObjectId(old_user_id)).first
u = User.where(name: c.attributes['user_name']).first
if u
[ c.attributes['user_id'], u.id ]
end
end
users_and_projects = [
@adammcmaster
adammcmaster / parse-classifications.py
Created January 31, 2017 11:42
Parsing zooniverse classifications CSV file
import csv
import json
import sys
csv.field_size_limit(sys.maxsize)
with open('classifications.csv') as f:
r = csv.DictReader(f)
for row in r:
NoMethodError: undefined method `type' for main:Object
(root) at /rails_app/app/schemas/subject_set_create_schema.rb:1
require at org/jruby/RubyKernel.java:1065
require at /usr/local/lib/ruby/gems/shared/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247
load_dependency at /usr/local/lib/ruby/gems/shared/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:232
require at /usr/local/lib/ruby/gems/shared/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:247
require_or_load at /usr/local/lib/ruby/gems/shared/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:348
depend_on at /usr/local/lib/ruby/gems/shared/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:307
require_dependency at /usr/local/lib/ruby/gems/shared/gems/activesupport-4

Keybase proof

I hereby claim:

  • I am astopy on github.
  • I am astopy (https://keybase.io/astopy) on keybase.
  • I have a public key whose fingerprint is CFA3 8B0E 8701 160B 96B2 5723 F592 0D1A 64A0 1E73

To claim this, I am signing this object: