Example #1
0
def log_likelihood_h2o(theta, y, fixed_parameters):
    # retrieve the global variables

    global pixel_bins
    global transit_data
    global err
    # only 'y' changes on the fly
    x = pixel_bins
    yerr = err
    _, model = transit_model_H2O(x, theta, fixed_parameters, p0=p0)

    sigma = yerr**2
    return -0.5 * np.sum((y - model)**2 / sigma + np.log(sigma))
Example #2
0
theta_h2och4 = (rad_planet,
                T,
                log_fh2o,
                log_fch4)

theta_null = (rad_planet,
              T)

fixed_null = (fine_wavelengths,
                    h2_cross_sections,
                    g_planet,
                    rad_star,
                    R)

# generate spectrum
pixel_wavelengths_h2o, pixel_transit_depth_h2o = transit_model_H2O(pixel_bins, theta_h2o, fixed_h2o, p0=p0)

pixel_wavelengths_ch4, pixel_transit_depth_ch4 = transit_model_CH4(pixel_bins, theta_ch4, fixed_ch4, p0=p0)

pixel_wavelengths_null, pixel_transit_depth_null = transit_model_NULL(pixel_bins, theta_null, fixed_null, p0=p0)

if plot:
    # compare the spectrums, to check
    fig, ax = plt.subplots(figsize=(8, 6))
    ax.plot(pixel_wavelengths_h2o, pixel_transit_depth_h2o * 1e6, 'o', label='H2O')
    ax.plot(pixel_wavelengths_ch4, pixel_transit_depth_ch4 * 1e6, 'o', label='CH4')
    ax.plot(pixel_wavelengths_null, pixel_transit_depth_null * 1e6, 'o', label='H2 only')
    ax.set_xlabel('Wavelength (μm)')
    ax.set_ylabel('transit depth (ppm)')
    ax.legend()