<jupyter_start><jupyter_text>Fitting transit data to a modelIn this notebook, we illustrate a method to fit the transit model to the data that we have retrieved. We use `juliet` package to get the transit model -- later, we use the `scipy` package `scipy.optimize.minimize` to fit the computed model to the data.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
import batman
from scipy.optimize import minimize as mz
from scipy.optimize import curve_fit as cft
import juliet as jl
import os
p1 = os.getcwd() + '/'
p2 = os.getcwd() + '/Fitting/'

# Defining data dictionary
tt1, fl1, fle1 = np.loadtxt('normal_flux.dat', usecols=(0,1,2), unpack=True)
tts, fls, fles = {}, {}, {}
tts['EUL'], fls['EUL'], fles['EUL'] = tt1, fl1, fle1


# Defining prior file/dictionary
pri1 = {}
params = ['P_p1','t0_p1','r1_p1','r2_p1','q1_EUL','q2_EUL','ecc_p1','omega_p1','a_p1', 'mdilution_EUL', 'mflux_EUL', 'sigma_w_EUL']
dists = ['fixed','normal','uniform','uniform','uniform','uniform','fixed','fixed','uniform', 'fixed', 'normal', 'loguniform']
hyperps = [1.7497798, [58423.10,0.1], [0.,1], [0.,1.], [0., 1.], [0., 1.], 0.0, 90., [1., 100.], 1.0, [0.,0.1], [0.1, 1000.]]

for param, dist, hyperp in zip(params, dists, hyperps):
    pri1[param] = {}
    pri1[param]['distribution'], pri1[param]['hyperparameters'] = dist, hyperp


dataset = jl.load(priors=pri1, t_lc=tts, y_lc=fls, yerr_lc=fles, out_folder=p2)
rels = dataset.fit()<jupyter_output>analysing data from /home/jayshil/Documents/UNIGE/Data_Analysis/Transits/Fitting/jomnest_.txt
{'fraction_non_alphanumeric': 0.18069948186528498, 'fraction_numerical': 0.04727979274611399, 'mean_word_length': 5.491596638655462, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '551106', 'license': 'MIT', 'n_tokens_mistral': 642, 'n_tokens_neox': 609, 'n_words': 153, 'path': 'Transits/p3.ipynb', 'repo_name': 'Jayshil/Data_analysis', 'size': '1544'}