Пример #1
0
def estimate_teff_logg(file_path,file_name,candidate,hsmso_connect,hscand_connect,default_teff,default_logg):
    found_properties = False

    if hsmso_connect == "true":
        print "Query HSMSO"
        query_entry = "select SPECteff, SPEClogg, SPECsn from SPEC where SPECtype=\"ST\" and SPECobject=\"%s\" " % candidate
        hsmso_result = mysql_query.query_hsmso(query_entry)

        if len(hsmso_result) > 0:
            found_properties = True
            hsmso_result = transpose(hsmso_result)
            for i in range(len(hsmso_result[0])):
                if hsmso_result[2][i] == max(hsmso_result[2]):
                    teff = int(round_value(hsmso_result[0][i],250))
                    logg = round_value(hsmso_result[1][i],0.5)
                    break
        else:
            print "ERROR: cannot find an entry for " + candidate + " in HSMSO"

    if not found_properties and hscand_connect == "true":
        print "Query HSCAND"
        teff = teff_from_colour(candidate)
        if not teff == "INDEF":
            found_properties = True
            teff = int(round_value(teff,250))
            logg = round_value(default_logg,0.5)
            if teff < 3500:
                found_properties = False

    if not found_properties:
        import twomass_colour
        teff = twomass_colour.teff_from_2mass(file_path,file_name)
        if not teff == "INDEF":
            found_properties = True
            teff = int(round_value(teff,250))
            logg = round_value(default_logg,0.5)
            if teff < 3500:
                found_properties = False

    if not found_properties:
        print "Using default teff logg values"
        teff = int(round_value(default_teff,250))
        logg = round_value(default_logg,0.5)

    if logg > 5.0:
        logg = 5.0
    if logg < 0.0:
        logg = 0.0
    
    return teff,logg
Пример #2
0
import functions
import os
import sys
import mysql_query
import datetime
import string

#find all hot stars
query_entry = "select SPECobject,SPECimgname,SPECutdate from SPEC where SPECtype=\"ST\" and SPECteff <= 4250"
query_result = mysql_query.query_hsmso(query_entry)

month_list = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]

count = 1
for i in query_result:
    candidate_name = i[0]
    file_name = i[1]
    thedate = str(i[2])
    year = string.split(thedate,"-")[0]
    month = int(string.split(thedate,"-")[1])
    month = month_list[month-1]
    date = string.split(thedate,"-")[2]
    file_path = "/mimsy/george/wifes/" + date + month + year +"/spectype/blue/"
    
    print "****************"
    print candidate_name
    print "Task " + str(count) + " out of " + str(len(query_result))
    print file_path,file_name
    os.system("python deredden.py " + file_path + " " + file_name)
    os.system("python spectype_main.py " + file_path + " " + file_name)
    os.system("python update_spectype.py " + file_path + " " + file_name)
Пример #3
0
import functions
import os
import sys
import string

date = "2015-02-28"
# CAMERA red ### WiFeS camera (red/blue)
# GRATING B3000 ### WiFeS grating (B3000/R3000/R7000/I7000)

query_entry = (
    'select SPECobject,SPECtelescope,SPECinstrum,SPECresolution,SPECtype,SPECutdate from SPEC where SPECutdate>"'
    + date
    + '" and SPECobject like "HATS%" and SPECtelescope = "ANU23"'
)

query_output = mysql_query.query_hsmso(query_entry)

for entry in query_output:
    object_name = entry[0]
    telescope = entry[1]
    instrument = entry[2]
    grating = entry[3]
    obstype = entry[4]
    date = entry[5]
    if instrument == "echelle" and telescope == "ANU23" and obstype == "RV":
        obstype = "RV"
    if instrument == "WiFeS" and obstype == "RV" and telescope == "ANU23":
        obstype = "RECON_RV"
    if obstype == "ST" and telescope == "ANU23":
        obstype = "RECON_SPECTYPE"
Пример #4
0
query_entry = "select distinct SPECobject"
query_entry = query_entry + " from SPEC where SPECutdate >= \""+start_date+"\" and SPECutdate <=\""+end_date+"\" and SPECtelescope=\"ANU23\""
query_entry = query_entry + " and SPECobject like \"HATS%\""
#query_entry = query_entry + " and SPECobject like \"KJ%\""
#query_entry = query_entry + " and SPECobject like \"asud%\""
#query_entry = query_entry + " and (SPECobject like \"KJ%\" or SPECobject like \"KS%\")"
#query_entry = query_entry + " and SPECobject like \"EP20%\""


query_entry = query_entry + " ORDER BY SPECobject"

print query_entry


candidate_list = mysql_query.query_hsmso(query_entry)

for entry in candidate_list:
    candidate = entry[0]
    
    query_entry = "select SPECteff,SPEClogg,SPECfeh"
    query_entry = query_entry + " from SPEC where SPECobject = \""+candidate+"\""
    query_entry = query_entry + " and SPECtype = \"ST\""
    ST = mysql_query.query_hsmso(query_entry)

    if len(ST) == 0:
        ST_report = "No ST Obs"

    if len(ST) == 1:
        ST_report = "Teff="
        ST_report += str(round(float(ST[0][0])))
Пример #5
0
import os
import sys
import functions
import mysql_query
from numpy import *
import string
from pyraf import iraf
import pyfits
import matplotlib.pyplot as plt

iraf.onedspec()

object_name = sys.argv[1]

query_command = "select SPECimgname,SPECutdate,SPECobject,SPECrv from SPEC where SPECinstrum = \"WiFeS\" and SPECutdate >= \"2012-01-01\" and SPECutdate <= \"2012-12-31\" and SPECobject = \"" + object_name + "\" and SPECtype=\"RV\""
query_result = mysql_query.query_hsmso(query_command)
outdir = "high_sn/"
master_dir = "/mimsy/george/wifes/"

os.system("mkdir "+outdir)
os.system("mkdir "+outdir+"temp/")
os.system("rm "+outdir+"temp/*")

months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]

count = 1
for entry in query_result:

    object_name = entry[2]
    file_name = entry[0]
    utdate = str(entry[1])
Пример #6
0
### Update hatsouth.intersigma

########################
### Start of program ###
########################


start_date = "2015-03-28"
end_date = "2015-04-31"

query_entry = "select SPECtype,SPECobject,SPECmjd,SPEChjd,SPECrv,SPECrv_err,SPECtelescope,SPECresolution,SPECteff,SPECteff_err,SPEClogg,SPEClogg_err,SPECfeh,SPECfeh_err,SPECccfheight,SPECexptime,SPECsn"
query_entry = query_entry + " from SPEC where SPECutdate >= \""+start_date+"\" and SPECutdate <=\""+end_date+"\" and SPECobject like \"HATS%\" and SPECtelescope=\"ANU23\""
#query_entry = query_entry + " from SPEC where SPECobject = \"HATS778-008\" "

exposure_info = mysql_query.query_hsmso(query_entry)
#print exposure_info

if len(exposure_info) > 0:
    
    for entry in exposure_info:
        output = ""

        if entry[7] == 23000:
            inst = "ANU23"
        else:
            inst = "WiFeS"

        if entry[0] == "RV":
            #output = output + entry[1] + " " #name
            output = output + str(2400000 + entry[3]) + " " #hjd
Пример #7
0
import os,sys,functions,string,mysql_query


RV_cmd =  "select distinct SPECobject from SPEC where SPECtype = \"RV\" and not (SPECcomment = \"SpecPhot\" or SPECcomment = \"RV Standard\")" 
output = mysql_query.query_hsmso(RV_cmd)

RV_list = []
for cand in output:
    cand = cand[0]
    print cand
    cand_cmd =  "select SPEChjd from SPEC where SPECobject = \""+cand+"\" and SPECtype = \"RV\"" 
    cand_rv = mysql_query.query_hsmso(cand_cmd)

    if len(cand_rv) > 2:
        RV_list.append(cand)

print "RV",len(RV_list)



spectype_cmd = "select distinct SPECobject from SPEC where SPECtype = \"ST\" and not (SPECcomment = \"SpecPhot\" or SPECcomment = \"RV Standard\")" 

output = mysql_query.query_hsmso(spectype_cmd)
print "Spectral typing ",len(output)
Пример #8
0
    i = i + 0.5

###############################
### Plot Flat HS candidates ###
###############################

hscand_q = "select HATSname from HATS where HATSclass NOT LIKE '%EB%' and HATSclass NOT LIKE '%TR%'"
print hscand_q
good_candidates = mysql_query.query_hscand(hscand_q)
good_candidates = good_candidates[1:]

candidates_RMS = []
for candidate in good_candidates:
    candidate_name = candidate[0]
    hsmso_q = "select SPECrv from SPEC where SPECobject=\"" + candidate_name +"\" and SPECtype=\"RV\""
    candidate_RV = mysql_query.query_hsmso(hsmso_q)

    if len(candidate_RV) > 2:
        candidates_RMS.append(rms(candidate_RV))
        if rms(candidate_RV) > 5.0:
            print candidate_name

plt.hist(candidates_RMS,bins=rms_ax,histtype="step",hatch="/",color="b")
print max(candidates_RMS),median(candidates_RMS),min(candidates_RMS)

rms_out = open("candidate_rms.txt","w")
functions.write_table([candidates_RMS],rms_out)
rms_out.close()

#########################
### Plot RV Standards ###
Пример #9
0
#     object_name_query = object_name[:11]
# else:
#     object_name_query = object_name

if ord(object_name[-1])-ord("A")>0 and ord(object_name[-1])-ord("A")<10:
    object_name_query = object_name[:-1]
else:
    object_name_query = object_name

print object_name_query

plots_folder = functions.read_param_file("RV_PLOTS_FOLDER")

### Extract rv points from HSMSO
query_entry = "select SPEChjd, SPECrv, SPECrv_err from SPEC where SPECtype=\"RV\" and SPECobject=\"%s\" " % object_name
RV_points = mysql_query.query_hsmso(query_entry)

print RV_points

if len(RV_points) > 0:
    cand_txt = open(plots_folder + object_name + ".txt","w")
    functions.write_table(RV_points,cand_txt)
    cand_txt.close()
else:
    print "ERROR entries not found for " + object_name

if len(RV_points) > 1:
    print "Calculating orbital solution"
    ### Extract candidate phase information from HSCAND
    if object_name[:4]=="HATS":
        print "Using HSCAND for candidate parameters"
Пример #10
0
import string
from numpy import *
import pyfits
import matplotlib.pyplot as plt

###################
### Description ###
###################

### Plots the object RV vs BIS
### Points are taken from the HSMSO database

### usage: python plot_candidate_bis.py object_name [oname.pdf]


object_name = sys.argv[1]
query_entry = "select SPECbis, SPECrv, SPECrv_err from SPEC where SPECtype=\"RV\" and SPECobject=\"%s\" " % object_name
data = mysql_query.query_hsmso(query_entry)
data = array(data)
print data

plt.errorbar(data[:,1],data[:,0],xerr=data[:,2],linestyle="none",marker="o")
plt.xlabel("RV (km/s)")
plt.ylabel("BIS (km/s)")
plt.title(object_name+" BIS")

if len(sys.argv) == 3:
    plt.savefig(sys.argv[2])

plt.show()