# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# +
from pathlib import Path
from astropy import units as u
from astropy.table import Table
from astropy.time import Time
from astropy.timeseries import TimeSeries

import re
import matplotlib.pyplot as plt
import numpy as np

# +
# %matplotlib inline

plt.style.use('guide.mplstyle')

plot_kwargs = { 'markersize': 3, 'marker': '^', }
rv_data = Path('/data/PHOEBE1/1SWASP J144508.70+050514.4.rv.csv')
lc_observed_data = Path('/data/PHOEBE1/1SWASP J144508.70+050514.4.lc.observed.csv')
lc_synthetic_data = Path('/data/PHOEBE1/1SWASP J144508.70+050514.4.lc.synthetic.csv')
lc_residuals_data = Path('/data/PHOEBE1/1SWASP J144508.70+050514.4.lc.residuals.csv')
# -

rv = Table.read(rv_data, format='ascii.csv', delimiter=',', fast_reader=False)
lc_observed = Table.read(lc_observed_data, format='ascii.csv', delimiter=',', fast_reader=False)
lc_synthetic = Table.read(lc_synthetic_data, format='ascii.csv', delimiter=',', fast_reader=False)
lc_residuals = Table.read(lc_residuals_data, format='ascii.csv', delimiter=',', fast_reader=False)

# +
fig1 = plt.figure(figsize=(20,20))

ax1 = fig1.add_subplot(111)
ax1.plot(rv['Phase'], rv['Primary'], 'r.', label='Primary', linestyle='-', **plot_kwargs)
ax1.plot(rv['Phase'], rv['Secondary'], 'b.', label='Secondary', linestyle='-', **plot_kwargs)
ax1.set_xlabel('Phase')
ax1.set_ylabel(r'Radial Velocity / $km^{-s}$')
ax1.set_title('CRTS J144508.6+050514')
ax1.legend(loc='best')
ax1.grid()

# +
fig2 = plt.figure(figsize=(20,20))

ax2 = fig2.add_subplot(111)
ax2.plot(lc_observed['Phase'], lc_observed['Magnitude'], 'r.', label='Observed', **plot_kwargs)
ax2.plot(lc_synthetic['Phase'], lc_synthetic['Magnitude'], 'b.', label='Synthetic', linestyle='-', **plot_kwargs)
ax2.set_xlabel('Phase')
ax2.set_ylabel('Magnitude')
ax2.set_title('CRTS J144508.6+050514')
ax2.legend(loc='best')
ax2.invert_yaxis()

# +
fig3 = plt.figure(figsize=(20,10))

ax3 = fig3.add_subplot(111)
ax3.plot(lc_residuals['Phase'], lc_residuals['Observed'], 'r.', label='Observed', **plot_kwargs)
ax3.plot(lc_residuals['Phase'], lc_residuals['Synthetic'], 'b.', label='Synthetic', linestyle='-', **plot_kwargs)
ax3.set_xlabel('Phase')
ax3.set_ylabel('Magnitude')
ax3.set_title('CRTS J144508.6+050514')
ax3.legend(loc='best')
ax3.set_ylim(-0.10, 0.10)
# -

fig1.savefig('/data/PHOEBE1/1SWASP J144508.70+050514.4.rv.png', format='png')
fig2.savefig('/data/PHOEBE1/1SWASP J144508.70+050514.4.lc.png', format='png')
fig3.savefig('/data/PHOEBE1/1SWASP J144508.70+050514.4.residuals.png', format='png')



StarcoderdataJupyterScriptsDedupFiltered