示例#1
0
def search_mocs(mocname, mocfile):
    conn = get_conn()
    cur = conn.cursor()
    moc = MOCFinder(mocfile)
    conn.execute("""insert into mocs (moc_name, moc_file)
                    values ('%s', '%s')""" % (mocname, mocfile))
    for uid, ra, dec in cur.execute("""
        select uid, ra, dec from clusters order by uid""").fetchall():
        if moc.is_in(ra, dec):
            conn.execute("""insert into cluster_in_moc (uid, moc_name)
                            values (%s, '%s')""" % (uid, mocname))
        print mocname, uid
    conn.commit()
    cur.close()
# -*- coding: utf-8 -*-
"""
Created on Mon Dec  7 12:04:55 2015

@author: mints
"""
import numpy as np
import sys
from mocfinder import MOCFinder
from esutil.coords import gal2eq
import matplotlib.pyplot as plt
import matplotlib.cm as cm

moc = MOCFinder(sys.argv[1])
R0 = 8.

Rsize = 40
Zsize = 60
PhiSize = 180
incmap = np.zeros((Rsize, Zsize))

phirange = np.linspace(0., 2.*np.pi, num=PhiSize)
cosphi = np.cos(phirange)
sinphi = np.sin(phirange)

zrange = np.linspace(-20., 20., num=Zsize)

for ir, r in enumerate(np.linspace(0.1, 20., num=Rsize)):
    x0 = r*cosphi - R0
    y0 = r*sinphi
    r0 = np.sqrt(r**2 + R0**2 - 2*r*R0*cosphi)