<jupyter_start><jupyter_text>AimDo a bit of reverse engineering on the Ballard (2018) data to recover its fit coefficients.<jupyter_code>import numpy as np
from matplotlib import pyplot as plt
from scipy import optimize
%matplotlib inline
comp03m = np.load('Completeness_0.3Msun.npy')
comp04m = np.load('Completeness_0.4Msun.npy')
comp05m = np.load('Completeness_0.5Msun.npy')
comp = np.vstack((comp03m, comp04m, comp05m))
plt.plot(comp04m[:,9,7])
comp03m.shape
radius03 = np.sum(comp03m, axis=(0,2))
period03 = np.sum(comp03m, axis=(0,1))
radius04 = np.sum(comp04m, axis=(0,2))
period04 = np.sum(comp04m, axis=(0,1))
radius05 = np.sum(comp05m, axis=(0,2))
period05 = np.sum(comp05m, axis=(0,1))
period_buckets = np.exp(np.linspace(-0.22, 5.77, 13))
radius_buckets = np.exp(np.linspace(-1.22, 1.33, 17))
def comp_fit(x, a1, a2, a3, a4):
    return a4 + a1 * x + a1 * a2 * x ** 2 + (a1/3) * (a2 ** 2 + a3 ** 2) * x ** 3
for ind, period, radius in [(3, period03, radius03), (4, period04, radius04), (5, period05, radius05)]:
    for fname, field, x in [("period", period, period_buckets), ("radius", radius, radius_buckets)]:
        print(fname, ind)
        print(optimize.curve_fit(comp_fit, x, field, maxfev=int(1e6)))
plt.plot(period_buckets, period03)
plt.plot(period_buckets, comp_fit(period_buckets, *[-5.73618534e+00,  1.46642786e-10, -1.03058829e-05,  1.92823638e+03]))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.17057569296375266, 'fraction_numerical': 0.11300639658848614, 'mean_word_length': 5.3710407239819, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '660473', 'license': 'MIT', 'n_tokens_mistral': 673, 'n_tokens_neox': 598, 'n_words': 129, 'path': 'data/ballard_data/ballard_fitting_1.ipynb', 'repo_name': 'aditya-sengupta/tesscomp-prototyping', 'size': '1407'}