예제 #1
0
def generate_spectrum(planet):
    """
    Function to loop over to generate spectra. 
    """
    #INSERT PLANET SELECTION RULES HERE
    if planet["PlanetMass"] <= 17:  #Planet masses in Earth Masses
        #If Neptune or less, we'll just use the Exosims Flux Ratio for now at all wavelengths.
        #Later this will also use PICASO once we learn how to use it better
        planet_type = "Exosims"
        planet_spectrum = np.repeat(planet['Flux Ratio'], len(model_wvs))

    else:
        planet_type = "Gas"
        time1 = time.time()
        #Generate the spectrum and downsample to intermediate resolution
        atmospheric_parameters = spectrum.generate_picaso_inputs(planet,
                                                                 planet_type,
                                                                 clouds=True)
        planet_spectrum = spectrum.simulate_spectrum(planet, model_wvs,
                                                     intermediate_R,
                                                     atmospheric_parameters)

        time2 = time.time()
        print('Spectrum took {0:.3f} s'.format((time2 - time1)))

    return planet_type, planet_spectrum
model_wvs = np.linspace(model_wv_low, model_wv_high,
                        n_model_wv)  #Choose some wavelengths

print("\n Starting to generate planet spectra")
for planet in planet_table[:n_planets_now]:

    #INSERT PLANET SELECTION RULES HERE
    planet_type = "Jupiter"
    planet_types.append(planet_type)

    #Generate the spectrum and downsample to intermediate resolution
    atmospheric_parameters = spectrum.generate_picaso_inputs(
        planet, planet_type)
    planet_spectrum, polarized_spectrum = spectrum.simulate_spectrum(
        planet,
        model_wvs,
        intermediate_R,
        atmospheric_parameters,
        package="picaso+pol")
    # planet_spectrum = spectrum.simulate_spectrum(planet, model_wvs, intermediate_R, atmospheric_parameters,package="picaso")
    planet_polarized_spectra.append(polarized_spectrum)
    planet_spectra.append(planet_spectrum)

print("Done generating planet spectra")
print("\n Starting to simulate observations")

post_processing_gain = 1000
sim_F_lambda, sim_F_lambda_errs, sim_F_lambda_stellar, noise_components = observation.simulate_observation_set(
    tmt,
    psi_blue,
    planet_table[:n_planets_now],
    planet_spectra,
예제 #3
0
# sim_F_lambda_stellar = tmp[2]
# noise_components = fits.open("noise_components.fits")[0].data
######################## Plot Cloud vs. Clear ######################

# get the best SNR Planet
avg_snrs = np.mean(snrs, axis=1)
print(avg_snrs)
argsort_snrs = np.argsort(np.abs(avg_snrs - 6))
bestsnr = argsort_snrs[0]  #np.argmax(avg_snrs)

# Generate the cloudy spectrum of this planet
planet = planet_table[rand_planets[bestsnr]]
atmospheric_parameters_clear = spectrum.generate_picaso_inputs(planet,
                                                               planet_type,
                                                               clouds=False)
planet_spectrum_clear = spectrum.simulate_spectrum(
    planet, model_wvs, intermediate_R, atmospheric_parameters_clear)

# Generate noisy spectra for cloudy and clear
clear_F_lambda, clear_F_lambda_errs, _ = observation.simulate_observation(
    tmt,
    psi_blue,
    planet_table[rand_planets[bestsnr]],
    planet_spectrum_clear,
    model_wvs,
    intermediate_R,
    inject_noise=True,
    post_processing_gain=post_processing_gain)
cloudy_F_lambda, cloudy_F_lambda_errs, _ = observation.simulate_observation(
    tmt,
    psi_blue,
    planet_table[rand_planets[bestsnr]],
예제 #4
0
#####################################

print("\n Starting to generate planet spectra")
for planet in planet_table[rand_planets]:
    #INSERT PLANET SELECTION RULES HERE

    if planet['PlanetMass'] < 10:
        #If the planet is < 10 M_Earth, we don't trust bex. So we'll be pessimistic and just report its thermal equilibrium.
        planet_type = "blackbody"
        planet_types.append(planet_type)

        #The bond albedo
        atmospheric_parameters = 0.5
        planet_spectrum = spectrum.simulate_spectrum(planet,
                                                     model_wvs,
                                                     intermediate_R,
                                                     atmospheric_parameters,
                                                     package='blackbody')
        planet_spectra.append(planet_spectrum)
        planet_eq_spectra.append(planet_spectrum)

    else:
        planet_type = "Gas"
        planet_types.append(planet_type)

        age = np.random.random() * 5e9  # between 0 and 5 Gyr
        planet_ages.append(age)

        time1 = time.time()

        ### Here we're going to generate the spectrum as the addition of cooling models and a blackbody (i.e. equilibrium Temperature)