Ejemplo n.º 1
0
import sys
from pylab import *
import os.path

sys.path.insert(0, os.path.join(os.path.expanduser("~"), 'build/Python/modules'))
from jg.ctx import wd2jd

wasp12 = {'e': 2454508.97605,
        'p': 1.0914222}

wasp11 = {'e': 2454729.90631,
        'p': 3.722469}

wd, orig, sub, add = loadtxt("Debug.dat", unpack=True)
jd = wd2jd(wd)

goodind = orig==orig
jd = jd[goodind]
orig = orig[goodind]
sub = sub[goodind]
add = add[goodind]

avflux = average(orig)

wasp12phase = ((jd - wasp12['e']) / wasp12['p']) % 1
wasp12phase[wasp12phase>0.5] -= 1.0

wasp11phase = ((jd - wasp11['e']) / wasp11['p']) % 1
wasp11phase[wasp11phase>0.5] -= 1.0
Ejemplo n.º 2
0
def main(args):
    f  = pyfits.open(args.file)

    Catalogue = f['catalogue'].data
    #Flux = f['flux'].data
    #HJD = f['hjd'].data

    ## get the objects where the width is not 0
    Widths = Catalogue.field("TRANS_WIDTH")
    Epochs = wd2jd(Catalogue.field("TRANS_EPOCH"))
    Periods = Catalogue.field("TRANS_PERIOD")
    Depths = Catalogue.field("TRANS_DEPTH")
    RPlanets = Catalogue.field('TRANS_RP')
    RStars = Catalogue.field('TRANS_RS')
    Inclinations = Catalogue.field("TRANS_I")
    Separations = Catalogue.field("TRANS_A")
    Names = Catalogue.field('OBJ_ID')
    #Index, = where(Widths!=0)

    Index = []
    for i in range(Names.size):
        if "SYNTH" in Names[i]:
            Index.append(i)



    Index = array(Index)

    pp = PdfPages("output.pdf")
    pp2 = PdfPages('wasp12phase.pdf')

    ##ion()
    Reversed = Index[::-1]

    nObjects = 20
    skipStep = 100
    for i in Reversed[:nObjects*skipStep:skipStep]:

        CurrentModel = {'epoch': Epochs[i],
                'period': Periods[i],
                'rp': RPlanets[i],
                'rs': RStars[i],
                'i': Inclinations[i],
                'a': Separations[i],
                }

        print i, CurrentModel

        cla()
        Time = wd2jd(f['hjd'].section[i])
        Lightcurve = f['flux'].section[i]
        Errors = f['fluxerr'].section[i]


        # remove nans
        GoodIndex = (Lightcurve==Lightcurve) & (Time==Time) & (Errors==Errors)
        Lightcurve = Lightcurve[GoodIndex]
        Time = Time[GoodIndex]
        Errors = Errors[GoodIndex]

        Phase = ((Time - CurrentModel['epoch']) / (CurrentModel['period'] / secondsInDay)) % 1.0
        Phase[Phase>0.5] -= 1.0

        MedVal = median(Lightcurve)
        Lightcurve /= MedVal
        Errors /= MedVal

        errorbar(Phase, Lightcurve, Errors, ls="None", color="#AAAAAA")
        plot(Phase, Lightcurve, 'k,')
        title("Depth: %f" % (Depths[i],))

        #axhline(1. - Depths[i])
        #axvline(-Widths[i]/2. / CurrentModel['period'], color='k')
        #axvline(Widths[i]/2. / CurrentModel['period'], color='k', label='Original')


        xlim(-0.3, 0.3)
        ylim(0.5, 1.5)

        BoxX, BoxY = BoxCoords(Widths[i] / CurrentModel['period'], Depths[i], xlim())
        plot(BoxX, BoxY, 'r-')

        pp.savefig()

        cla()
        Phase = ((Time - wasp12['e']) / wasp12['p']) % 1.0
        Phase[Phase>0.5] -= 1.0

        errorbar(Phase, Lightcurve, Errors, ls="None", color="#AAAAAA")
        plot(Phase, Lightcurve, 'k,')
        title("WASP-12b phase")
        xlim(-0.3, 0.3)
        pp2.savefig()

    pp.close()
    pp2.close()