<jupyter_start><jupyter_text>IdentificationGiven an input light curve segment, the task is to classify it as signal or non-signal.<jupyter_code># dontshow=["cnn", "mlp", "gru1", "bigru2", "bilstm1", "rnn_naive", "bigru1_w12.6"]
dontshow=[]
plt.figure(figsize=(10,4))
plt.subplot(1,2,1)
for mname in [m for m in mnames if m not in dontshow]:
    plot_results(results[1500][mname], "acc_seg", split="valid", lbl=mname, fill=0)
plt.legend(fontsize=12, bbox_to_anchor=(1,1))

plt.subplot(1,2,2)
for mname in [m for m in mnames if m not in dontshow]:
    try:
        plot_results(results[500][mname], "acc_seg", split="valid", lbl=mname, fill=0)
    except:
        pass
plt.legend(fontsize=12)
plt.tight_layout()
plt.show()<jupyter_output><empty_output><jupyter_text>DetectionGiven an input light curve (segment), the task is to locate signals in time.  Application to full-length light curves<jupyter_code>def detect(model, flux):
    flux_tens = torch.tensor(flux.reshape(1,-1)).type(torch.FloatTensor)
    with torch.no_grad():
        sigm, _ = model(flux_tens)
    return sigm.squeeze()
rnn = torch.load("models/bigru1_sim.pt")
np.random.seed(42)
lc = lcsim.get_lightcurve(num_planets=2, min_transits=2, period_range=(2,100), t_max=27.4, 
                          max_attempts=4, max_snr_attempts=10, snr_range=(3,80), 
                          rdepth_range=(.5,5.), dur_range=(0,utils.hour2day(14)))
time, flux, pl_masks, params = lc
pl1, pl2 = pl_masks[0], pl_masks[1]
nontr = ~np.any(pl_masks, 0)
flux_ = (flux-1) / params["sigma"] / 2
sigm = detect(rnn, flux_)
plt.figure(figsize=(15,3))
plt.subplot(2,1,1)
vis.plot(time[nontr], flux[nontr], c="black", a=0.1)
for msk in pl_masks:
    vis.plot(time[msk], flux[msk], c=plt.plot([])[0].get_color(), a=1)
plt.xlim(0,time[-1])

plt.subplot(2,1,2)
vis.plot(time, sigm, scatter=0)
plt.xlim(0,time[-1])<jupyter_output><empty_output><jupyter_text>Training different network architectures<jupyter_code>plt.figure(figsize=(10,4))
plt.subplot(1,2,1)
for mname in ["bigru1"]:
    c = plot_results(results[1500][mname], "tpr", split="valid", lbl=mname, fill=0, return_c=1)
    for rng in list(results[1500][mname]["mean"]["metrics"]["valid"].keys())[1:]:
         plot_results(results[1500][mname], "tpr", split="valid", lbl=rng, fill=0, c=c, rng=rng)
plt.legend()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17571611799914494, 'fraction_numerical': 0.04489097905087644, 'mean_word_length': 5.376021798365122, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '248787', 'license': 'MIT', 'n_tokens_mistral': 1008, 'n_tokens_neox': 954, 'n_words': 178, 'path': 'experiments/identification_detection.ipynb', 'repo_name': 'ykerus/transit-detection-rnn', 'size': '2339'}