File: summarize-jobs.py

package info (click to toggle)
astrometry.net 0.93%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 19,372 kB
  • sloc: ansic: 163,192; python: 18,357; makefile: 1,522; sh: 138; cpp: 78; pascal: 67; awk: 56; perl: 9
file content (57 lines) | stat: -rw-r--r-- 1,589 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# This file is part of the Astrometry.net suite.
# Licensed under a 3-clause BSD style license - see LICENSE

#import sqlite3
#import commands
from __future__ import print_function
import os
import sys

def backtick(cmd):
    (childin, childout) = os.popen2(cmd)
    childin.close()
    out = childout.read()
    return out

def getval(fn, key):
    cmd = "sqlite " + fn + " \"select val from jobdata where key like '" + key + "'\""
    out = backtick(cmd)
    return out

#fn = '/home/gmaps/ontheweb-data/alpha/200705/00001872/jobdata.db'
#email = getval(fn, 'email');
#status = getval(fn, 'checked-done')
#print email, status

outdir = "/data2/apod-solves/"

for month in sys.argv[1:]:
    #print month
    jobs = os.listdir(month)
    for job in jobs:
        path = month + '/' + job + '/'
        fn = path + "jobdata.db"
        #print fn
        email = getval(fn, 'email').strip()
        #print email
        if email != 'ckochanek@astronomy.ohio-state.edu':
            continue
        solvedfn = path + 'solved'
        if not os.path.exists(solvedfn):
            continue
        #status = getval(fn, 'checked-done')
        #print job, status
        #wcsfn = path + "wcs.fits"
        #print wcsfn
        #print job
        print(path)
        cmd = "pngtopnm " + path + "fullsize.png | pnmtojpeg > " + outdir + "csk-" + job + ".jpg"
        backtick(cmd)
        cmd = "cp " + path + "wcs.fits " + outdir + "csk-" + job + ".wcs"
        backtick(cmd)


#conn = sqlite3.connect(fn)
#cur = conn.cursor()
#cur.execute("select val from jobdata where key like 'user-email'")