Ejemplo n.º 1
0
Object = cfp.Object(sys.argv[1])
Object.InitiateCase('MINUIT.FIRSTTRY')

DataPrepPath = cfp.DataPrepPath
FigurePath = cfp.FigurePath

exec("from tmcmc.myfunc import %s as ModelFunc" % (Object.FuncName))
ModelParams = tmcmc.iomcmc.ReadStartParams(DataPrepPath+'GUESS.'+Object.name+'.par')

APList = []
TTList = []

for fileName in os.listdir(DataPrepPath):
    if fileName.startswith(Object.name) and fileName.endswith('.data'):
        AP = dfp.getAP(fileName)
        APList.append(AP)
        TT = dfp.getTT(fileName,Object.name)
        TTList.append(TT)

TTList = list(set(TTList))
APList = list(set(APList))
APList2 = APList

rms = {}
goodid_db = {}
bad_err = {}
Completeness = {}

print 'Outlier rejection '
for AP in APList:
Ejemplo n.º 2
0
import numpy as np

Object = cfp.Object(sys.argv[1])
Object.InitiateCase('MINUIT.FIRSTTRY')

DataPrepPath = cfp.DataPrepPath

exec("from tmcmc.myfunc import %s as ModelFunc" % (Object.FuncName))
ModelParams = tmcmc.iomcmc.ReadStartParams(DataPrepPath+'GUESS.'+Object.name+'.par')

APList = []
TTList = []

for fileName in os.listdir(DataPrepPath):
    if fileName.startswith(Object.name) and fileName.endswith('.data'):
        AP = dfp.getAP(fileName)
        APList.append(AP)
        TT = dfp.getTT(fileName,Object.name)
        TTList.append(TT)

TTList = list(set(TTList))
APList = list(set(APList))

#FracRej = pickle.load(open(cfp.PicklePath+Object.name+'.FracRej.pickle','rb'))

if Object.name == 'WASP2' or Object.name == 'XO2':
    bcase = float(sys.argv[2])
    APList = []
    if Object.name == 'WASP2':
        SplitNum = 7e0
    else:
Ejemplo n.º 3
0
import os
import sys
import cPickle as pickle
from tmcmc import DataFuncPrep as dfp
from tmcmc import class_fitprep as cfp

Object = cfp.Object(sys.argv[1])
DataPrepPath = cfp.DataPrepPath

APList = []
TTList = []

for fileName in os.listdir(DataPrepPath):
    if fileName.startswith(Object.name) and fileName.endswith(".data"):
        AP = dfp.getAP(fileName)
        APList.append(AP)
        TT = dfp.getTT(fileName, Object.name)
        TTList.append(TT)

TTList = list(set(TTList))
APList = list(set(APList))

for AP in APList:
    LCListName = DataPrepPath + Object.name + ".LC.AP" + AP + ".list"
    NListName = DataPrepPath + Object.name + ".NUS.AP" + AP + ".onoff"
    LCListObject = open(LCListName, "w")
    NListObject = open(NListName, "w")
    print >> LCListObject, "# FileName | TTag "
    print >> NListObject, "# NUISANCE Data | TTag | " + dfp.detrendHeader.strip("#")
    for TT in TTList:
        print >> LCListObject, DataPrepPath + Object.name + ".AP" + AP + "." + TT + ".lc" + "|" + TT
Ejemplo n.º 4
0
import os
import sys
import tmcmc
import cPickle as pickle
from tmcmc import DataFuncPrep as dfp
from tmcmc import class_fitprep as cfp

Object = cfp.Object(sys.argv[1])
DataPrepPath = cfp.DataPrepPath

APList = []
TTList = []

for fileName in os.listdir(DataPrepPath):
    if fileName.startswith(Object.name) and fileName.endswith('.data'):
        AP = dfp.getAP(fileName)
        TT = dfp.getTT(fileName,Object.name)
        APList.append(AP)
        TTList.append(TT)
        
APPs = list(set(APList))
TTs = list(set(TTList))
FluxNorm = {}

for AP in APPs:
    FluxNorm[AP] = {}
    for TT in TTs:
        FluxNorm[AP][TT] = 0

for fileName in os.listdir(DataPrepPath):
    if fileName.startswith(Object.name) and fileName.endswith('.data'):
Ejemplo n.º 5
0
exec("from tmcmc.myfunc import %s as ModelFunc" % (Object.FuncName))
ModelParams = tmcmc.iomcmc.ReadStartParams(DataPrepPath+'GUESS.'+Object.name+'.par')

for fileName in os.listdir(DataPrepPath):
    if fileName.startswith(Object.name) and \
       fileName.endswith('.nus'):
        name_split = map(str, fileName.split('.'))
        AP = name_split[1].strip('AP')
        TT = name_split[2]
        if TT in ['T8','T9','T10']:
            lcfile = Object.name+'.AP'+AP+'.'+TT+'.lc'
            nusfile = Object.name+'.AP'+AP+'.'+TT+'.nus'
            #os.system('wc %s' % DataPrepPath+nusfile )
            #os.system('wc %s' % DataPrepPath+lcfile )
            dt_data = dfp.readNusFile(DataPrepPath+nusfile)
            lc_data = tmcmc.iomcmc.ReadSingleDataFile(DataPrepPath+lcfile)
            time = np.array(lc_data['all']['x'])
            diffT = 45e0/86400e0
            if len(time) > 0:
                #print dt_data.keys()
                T0 = time[0]
                new_index = (time-T0)//diffT
                dt_data['index'] = new_index
                dfp.writeUpdatedNuisance(DataPrepPath+nusfile, dt_data)

#sys.exit()
## OPT AP X
#LCListName = DataPrepPath+Object.name+'.LC.listx'
#NListName = DataPrepPath+Object.name+'.NUS.onoffx'
#ObservedData = tmcmc.iomcmc.ReadMultiList(LCListName)
Ejemplo n.º 6
0
LCListName = DataPrepPath+Object.name+'.LC.listx'
NListName = DataPrepPath+Object.name+'.NUS.onoffx'
ObservedData = tmcmc.iomcmc.ReadMultiList(LCListName)
NuisanceData = tmcmc.iomcmc.ReadDetrendFile(NListName)
ModelData = ModelFunc(ModelParams,ObservedData)
HiResData = dfp.HiRes(ObservedData,5000)
HiResModel = ModelFunc(ModelParams,HiResData)
DetrendedData = tmcmc.mcmc.DetrendData(ObservedData,ModelData,NuisanceData,'',False)

#for TT in DetrendedData.keys():
    #print TT, DetrendedData[TT]['x']

#sys.exit()

ChiSQ, DetrendedData = dfp.chisq(DetrendedData,ModelData)
#print DetrendedData['T1']['x']
DOF = len(DetrendedData['all']['y'])-dfp.NOpen(ModelParams)
print ChiSQ, DOF, ChiSQ/DOF
OtherInfo = {}

ScaleTT = {}
#scaling individual nights
for TT in ObservedData.keys():
    if TT.startswith('T'):
        med_err = np.median(DetrendedData[TT]['yerr'])
        scale = OptAp[TT]['min_rms']/med_err
        DetrendedData[TT]['yerr'] = np.array(DetrendedData[TT]['yerr'])*scale
        ObservedData[TT]['yerr'] = np.array(ObservedData[TT]['yerr'])*scale
        ScaleTT[TT] = scale
Ejemplo n.º 7
0
import os
import sys
import cPickle as pickle
from tmcmc import DataFuncPrep as dfp
from tmcmc import class_fitprep as cfp

Object = cfp.Object(sys.argv[1])
DataPrepPath = cfp.DataPrepPath

APList = []
TTList = []
for fileName in os.listdir(DataPrepPath):
    if fileName.startswith(Object.name) and fileName.endswith('.data'):
        AP = dfp.getAP(fileName)
        APList.append(AP)
        TT = dfp.getTT(fileName,Object.name)
        TTList.append(TT)

TTList = list(set(TTList))
APList = list(set(APList))

for AP in APList:
    LCListName = DataPrepPath+Object.name+'.LC.AP'+AP+'.list0'
    NListName = DataPrepPath+Object.name+'.NUS.AP'+AP+'.onoff0'
    LCListObject = open(LCListName,'w')
    NListObject = open(NListName,'w')
    print >> LCListObject, '# FileName | TTag '
    print >> NListObject, '# NUISANCE Data | TTag | '+dfp.detrendHeader.strip('#')
    for TT in TTList:
        print >> LCListObject, DataPrepPath+Object.name+'.AP'+AP+'.'+TT+'.lc0'+'|'+TT
        SwitchLine = dfp.getSwitchLine(Object.name,TT,supress=True)