Note
Go to the end to download the full example code.
Plot the spectrum of a transiting planet#
This example runs VSPEC with a transiting planet scenario.
Saved settings to /home/runner/.libpypsg/settings.json
Reloading settings...
Initialize the VSPEC run#
We read in the config file and run the model.
model = ObservationModel.from_yaml(CFG_PATH)
model.build_planet()
model.build_spectra()
Starting at phase 178.8 deg, observe for 1.5 h in 18 steps
Phases = [178.8 178.92 179.05 179.18 179.3 179.42 179.55 179.68 179.8 179.92
180.05 180.17 180.3 180.42 180.55 180.67 180.8 180.92 181.05] deg
Build Planet: 0%| | 0/19 [00:00<?, ?it/s]
Build Planet: 5%|▌ | 1/19 [00:01<00:25, 1.43s/it]
Build Planet: 11%|█ | 2/19 [00:02<00:23, 1.41s/it]
Build Planet: 16%|█▌ | 3/19 [00:04<00:22, 1.38s/it]
Build Planet: 21%|██ | 4/19 [00:05<00:23, 1.53s/it]
Build Planet: 26%|██▋ | 5/19 [00:07<00:22, 1.63s/it]
Build Planet: 32%|███▏ | 6/19 [00:09<00:21, 1.68s/it]
Build Planet: 37%|███▋ | 7/19 [00:11<00:20, 1.70s/it]
Build Planet: 42%|████▏ | 8/19 [00:13<00:18, 1.71s/it]
Build Planet: 47%|████▋ | 9/19 [00:14<00:17, 1.73s/it]
Build Planet: 53%|█████▎ | 10/19 [00:16<00:15, 1.75s/it]
Build Planet: 58%|█████▊ | 11/19 [00:18<00:13, 1.75s/it]
Build Planet: 63%|██████▎ | 12/19 [00:20<00:12, 1.77s/it]
Build Planet: 68%|██████▊ | 13/19 [00:22<00:11, 1.85s/it]
Build Planet: 74%|███████▎ | 14/19 [00:23<00:09, 1.82s/it]
Build Planet: 79%|███████▉ | 15/19 [00:25<00:07, 1.80s/it]
Build Planet: 84%|████████▍ | 16/19 [00:27<00:05, 1.78s/it]
Build Planet: 89%|████████▉ | 17/19 [00:29<00:03, 1.79s/it]
Build Planet: 95%|█████████▍| 18/19 [00:30<00:01, 1.67s/it]
Build Planet: 100%|██████████| 19/19 [00:31<00:00, 1.57s/it]
Build Planet: 100%|██████████| 19/19 [00:31<00:00, 1.68s/it]
Creating interpolators:
thermal
thermal, combined
thermal, combined, stellar
thermal, combined, stellar, photon noise
thermal, combined, stellar, photon noise, detector noise
thermal, combined, stellar, photon noise, detector noise, telescope noise
thermal, combined, stellar, photon noise, detector noise, telescope noise, background noise
thermal, combined, stellar, photon noise, detector noise, telescope noise, background noise, transit
Finished!
Build Spectra: 0%| | 0/18 [00:00<?, ?it/s]
Loading Spectra: 0%| | 0/17 [00:00<?, ?it/s]
Loading Spectra: 6%|▌ | 1/17 [00:00<00:04, 3.32it/s]
Loading Spectra: 12%|█▏ | 2/17 [00:00<00:04, 3.35it/s]
Loading Spectra: 18%|█▊ | 3/17 [00:00<00:04, 3.36it/s]
Loading Spectra: 24%|██▎ | 4/17 [00:01<00:03, 3.35it/s]
Loading Spectra: 29%|██▉ | 5/17 [00:01<00:03, 3.35it/s]
Loading Spectra: 35%|███▌ | 6/17 [00:01<00:03, 3.36it/s]
Loading Spectra: 41%|████ | 7/17 [00:02<00:02, 3.37it/s]
Loading Spectra: 47%|████▋ | 8/17 [00:02<00:02, 3.37it/s]
Loading Spectra: 53%|█████▎ | 9/17 [00:02<00:02, 3.37it/s]
Loading Spectra: 59%|█████▉ | 10/17 [00:02<00:02, 3.37it/s]
Loading Spectra: 65%|██████▍ | 11/17 [00:03<00:01, 3.37it/s]
Loading Spectra: 71%|███████ | 12/17 [00:03<00:01, 3.37it/s]
Loading Spectra: 76%|███████▋ | 13/17 [00:03<00:01, 3.37it/s]
Loading Spectra: 82%|████████▏ | 14/17 [00:04<00:00, 3.37it/s]
Loading Spectra: 88%|████████▊ | 15/17 [00:04<00:00, 3.38it/s]
Loading Spectra: 94%|█████████▍| 16/17 [00:04<00:00, 3.39it/s]
Loading Spectra: 100%|██████████| 17/17 [00:05<00:00, 3.40it/s]
Loading Spectra: 100%|██████████| 17/17 [00:05<00:00, 3.37it/s]
Build Spectra: 6%|▌ | 1/18 [00:05<01:38, 5.78s/it]
Build Spectra: 11%|█ | 2/18 [00:06<00:45, 2.82s/it]
Build Spectra: 17%|█▋ | 3/18 [00:07<00:28, 1.87s/it]
Build Spectra: 22%|██▏ | 4/18 [00:08<00:20, 1.48s/it]
Build Spectra: 28%|██▊ | 5/18 [00:09<00:16, 1.27s/it]
Build Spectra: 33%|███▎ | 6/18 [00:09<00:13, 1.15s/it]
Build Spectra: 39%|███▉ | 7/18 [00:10<00:11, 1.07s/it]
Build Spectra: 44%|████▍ | 8/18 [00:11<00:10, 1.02s/it]
Build Spectra: 50%|█████ | 9/18 [00:12<00:08, 1.02it/s]
Build Spectra: 56%|█████▌ | 10/18 [00:13<00:07, 1.05it/s]
Build Spectra: 61%|██████ | 11/18 [00:14<00:06, 1.06it/s]
Build Spectra: 67%|██████▋ | 12/18 [00:15<00:05, 1.07it/s]
Build Spectra: 72%|███████▏ | 13/18 [00:16<00:04, 1.07it/s]
Build Spectra: 78%|███████▊ | 14/18 [00:17<00:03, 1.08it/s]
Build Spectra: 83%|████████▎ | 15/18 [00:18<00:02, 1.09it/s]
Build Spectra: 89%|████████▉ | 16/18 [00:19<00:01, 1.09it/s]
Build Spectra: 94%|█████████▍| 17/18 [00:19<00:00, 1.10it/s]
Build Spectra: 100%|██████████| 18/18 [00:20<00:00, 1.17it/s]
Build Spectra: 100%|██████████| 18/18 [00:20<00:00, 1.15s/it]
Load in the data#
We can use VSPEC to read in the synthetic data we just created.
data = PhaseAnalyzer(model.directories['all_model'])
Calculate the transit depth#
Since this star model has no limb darkeing, no spots, and no noise, we don’t need to fit a model to our data to extract the transit depth.
cmb_data = data.total
continuum = cmb_data[:,0] # the first epoch
data_min = np.min(cmb_data,axis=1)
transit_depth = (continuum-data_min)/continuum
rp_rs = np.sqrt(transit_depth)
wavelength = data.wavelength
plt.plot(wavelength,rp_rs*100)
plt.xlabel(f'Wavelength {wavelength.unit}')
plt.ylabel(r'$\frac{R_p}{R_*}$ (%)')

Text(16.222222222222214, 0.5, '$\\frac{R_p}{R_*}$ (%)')
Total running time of the script: (1 minutes 4.903 seconds)