<jupyter_start><jupyter_text>I = 14.0, J = 11.4,Answer should be I-J = 2.6<jupyter_code>from astropy.utils.console import ProgressBar

i_minus_j = np.zeros((len(spotted_areas), len(spot_temperatures)))

with ProgressBar(len(spotted_areas) * len(spot_temperatures), ipython_widget=True) as bar:
    for i, area in enumerate(spotted_areas): 
        for j, temp in enumerate(spot_temperatures): 
            hot_spot_flux = model_fluxes[np.argmin(np.abs(temperatures - temp)), :]
            bs = binned_statistic(phoenix_wavelengths, hot_spot_flux, bins=wavelength_bins.value, statistic='mean')
            binned_phoenix = bs.statistic
            binned_phoenix[np.isnan(binned_phoenix)] = 0
            binned_phoenix *= scale_factor.value
            
            total_flux = binned_phoenix * area + (1 - area) * flux.value

            sp = SourceSpectrum(Empirical1D, points=wavelength.to(u.Angstrom), lookup_table=total_flux * flux.unit)
            force = 'taper'
            obs_i = Observation(sp, bp_i, force=force)
            obs_j = Observation(sp, bp_j, force=force)
            
            grid_vegamag = obs_i.effstim('vegamag', vegaspec=v) - obs_j.effstim('vegamag', vegaspec=v)

            i_minus_j[i, j] = grid_vegamag.value
            
            bar.update()
#             plt.plot(wavelength, flux)
#             plt.plot(wavelength, total_flux, ls='--')
#             plt.show()
img = plt.imshow(i_minus_j, extent=extent, aspect=1e-5, origin='lower', vmax=trappist_1_i_minus_j.value, 
                 cmap=plt.cm.viridis_r)
print(trappist_1_i_minus_j)
plt.title("TRAPPIST-1: I-J = {0:.3f}".format(trappist_1_i_minus_j.value))
plt.colorbar(img, label='I-J color')
plt.xscale('log')
plt.xlabel('Spotted area')
plt.ylabel('Spot temperature [k]')
plt.savefig('color_error.pdf', bbox_inches='tight')
i_minus_j.shape, spotted_areas.shape, spot_temperatures.shape
np.savez('color_grid.npz', i_minus_j, spotted_areas, spot_temperatures)
from scipy.interpolate import interp2d
f = interp2d(spot_temperatures, spotted_areas, fractional_err)
f(3500, 0.001)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12440645773979107, 'fraction_numerical': 0.013770180436847104, 'mean_word_length': 3.4734607218683653, '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': '588165', 'license': 'MIT', 'n_tokens_mistral': 824, 'n_tokens_neox': 779, 'n_words': 119, 'path': 'notebooks/synthetic_photometry_grid.ipynb', 'repo_name': 'jlustigy/libra', 'size': '2106'}