<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import (division, print_function, absolute_import,
                        unicode_literals)

import time as timer

import numpy as np
import matplotlib.pyplot as pl

import kplr
from turnstile import _turnstile

if __name__ == "__main__":
    client = kplr.API()
    planet = client.planet("62e").koi
    period = planet.koi_period
    t0 = planet.koi_time0bk % period

    data = []
    time = []
    flux = []
    ivar = []
    for d in planet.data:
        if "slc" in d.filename:
            continue
        ds = kplr.Dataset(d.fetch().filename, untrend=True)
        data.append(ds)
        time.append(ds.time[ds.mask])
        flux.append(ds.flux[ds.mask])
        ivar.append(ds.ivar[ds.mask])

    time = np.concatenate(time)
    flux = np.concatenate(flux)
    ivar = np.concatenate(ivar)

    strt = timer.time()
    periods, depths = _turnstile.find_periods(time, flux, ivar, 100, 600,
                                              0.1, 0.3)
    print("Took {0} minutes.".format((timer.time() - strt) / 60.))

    pl.plot(periods, depths, "k")
    pl.gca().axvline(122.3874, alpha=0.3)
    pl.gca().axvline(267.291, alpha=0.3)
    pl.xlabel("Period [days]")
    pl.ylabel("Transit Depth")

    # pl.gca().axvline(267.291, alpha=0.3)
    # pl.plot(time % (periods[np.argmax(depths)]), flux, ".k", alpha=0.3)
    # pl.plot(time % 267.291, flux, ".k", alpha=0.3)
    # pl.ylim(0.998, 1.002)
    # pl.xlim(40, 45)
    # pl.xlim(t0 - 1, t0 + 1)

    pl.savefig("blah.png")
<commit_msg>masking artifact<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from __future__ import (division, print_function, absolute_import,
                        unicode_literals)

import time as timer

import numpy as np
import matplotlib.pyplot as pl

import kplr
from turnstile import _turnstile

if __name__ == "__main__":
    client = kplr.API()
    planet = client.planet("62e").koi
    period = planet.koi_period
    t0 = planet.koi_time0bk % period

    data = []
    time = []
    flux = []
    ivar = []
    for d in planet.data:
        if "slc" in d.filename:
            continue
        ds = kplr.Dataset(d.fetch().filename, untrend=True)
        data.append(ds)
        time.append(ds.time[ds.mask])
        flux.append(ds.flux[ds.mask])
        ivar.append(ds.ivar[ds.mask])

    time = np.concatenate(time)
    flux = np.concatenate(flux)
    ivar = np.concatenate(ivar)

    inds = (time < 1185) + (time > 1188)
    time = time[inds]
    flux = flux[inds]
    ivar = ivar[inds]

    pl.plot(time, flux, ".k")
    pl.savefig("sup.png")
    # assert 0

    strt = timer.time()
    periods, depths = _turnstile.find_periods(time, flux, ivar, 100, 1.5 * 365,
                                              0.1, 0.3)
    print("Took {0} minutes.".format((timer.time() - strt) / 60.))

    pl.clf()
    pl.plot(periods, depths, "k")
    pl.gca().axvline(122.3874, alpha=0.3)
    pl.gca().axvline(267.291, alpha=0.3)
    pl.xlabel("Period [days]")
    pl.ylabel("Transit Depth")

    # pl.gca().axvline(267.291, alpha=0.3)
    # pl.plot(time % (periods[np.argmax(depths)]), flux, ".k", alpha=0.3)
    # pl.plot(time % 267.291, flux, ".k", alpha=0.3)
    # pl.ylim(0.998, 1.002)
    # pl.xlim(40, 45)
    # pl.xlim(t0 - 1, t0 + 1)

    pl.savefig("blah.png")

{'fraction_non_alphanumeric': 0.16168559473998806, 'fraction_numerical': 0.04453078302450687, 'mean_word_length': 2.3007889546351086, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4052216', 'n_tokens_mistral': 1395, 'n_tokens_neox': 1285, 'n_words': 250}