am attempting to create 3 individual plots A plot of HARPS-N CCF data. This data is freely available on the DACE website. I have been able to create this plot and it produces a signature "V" shape. A plot of the Mean of the CCF data, same shape. A residuals plot. This is where I am having the difficulty, I have coded as much can. The shape of the plot should be "dumbbell" in shape. At the moment I am getting an empty plot. This is the code that I have so far.. #import libs import matplotlib.pyplot as plt import glob from astropy.io import fits from astropy.wcs import WCS import numpy as np # Initial plot fig, ax = plt.subplots(figsize=(10, 10)) # data from the FITS data_dir = glob.glob('/Users/xxxxx/Desktop/harpn_sun_release_package_ccf_2018/2018-01-18/*.fits') # empty lists for storage lams = [] fluxs = [] # read the the FITS for file_path in data_dir:     hdul = fits.open(file_path)     data = hdul[1].data     h1 = hdul[1].header     flux = data[1]     w = WCS(h1, naxis=1, relax=False, fix=False)     lam = w.wcs_pix2world(np.arange(len(flux)), 0)[0]     lams.append(lam)     fluxs.append(flux)     ax.plot(lam, flux) # Calc mean flux mean_ccf = np.mean(fluxs, axis=0) # New fig for main plot fig_mean, ax_mean = plt.subplots(figsize=(10, 10)) # plot the mean data ax_mean.plot(lams[1], mean_ccf, color='k', linewidth=1) # Mean ax_mean.set_xlabel('RV [km/s]') ax_mean.set_ylabel('Normalized CCF') ax_mean.set_title('Mean CCF') # Residuals residuals = fluxs - mean_ccf fig_res, ax_res = plt.subplots(figsize=(10, 10)) ax_res.plot(lams[1], residuals, color='k', linewidth=1) # Plot residuals ax_res.set_xlabel('RV [km/s]') ax_res.set_ylabel('CCF Residuals') ax_res.set_title('CCF Residuals') plt.show()

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

am attempting to create 3 individual plots

  1. A plot of HARPS-N CCF data. This data is freely available on the DACE website. I have been able to create this plot and it produces a signature "V" shape.

  2. A plot of the Mean of the CCF data, same shape.

  3. A residuals plot. This is where I am having the difficulty, I have coded as much can. The shape of the plot should be "dumbbell" in shape. At the moment I am getting an empty plot.

This is the code that I have so far..

#import libs
import matplotlib.pyplot as plt
import glob
from astropy.io import fits
from astropy.wcs import WCS
import numpy as np

# Initial plot
fig, ax = plt.subplots(figsize=(10, 10))

# data from the FITS
data_dir = glob.glob('/Users/xxxxx/Desktop/harpn_sun_release_package_ccf_2018/2018-01-18/*.fits')

# empty lists for storage
lams = []
fluxs = []

# read the the FITS
for file_path in data_dir:
    hdul = fits.open(file_path)
    data = hdul[1].data
    h1 = hdul[1].header
    flux = data[1]
    w = WCS(h1, naxis=1, relax=False, fix=False)
    lam = w.wcs_pix2world(np.arange(len(flux)), 0)[0]
    lams.append(lam)
    fluxs.append(flux)
    ax.plot(lam, flux)

# Calc mean flux
mean_ccf = np.mean(fluxs, axis=0)

# New fig for main plot
fig_mean, ax_mean = plt.subplots(figsize=(10, 10))

# plot the mean data
ax_mean.plot(lams[1], mean_ccf, color='k', linewidth=1)

# Mean
ax_mean.set_xlabel('RV [km/s]')
ax_mean.set_ylabel('Normalized CCF')
ax_mean.set_title('Mean CCF')

# Residuals
residuals = fluxs - mean_ccf
fig_res, ax_res = plt.subplots(figsize=(10, 10))
ax_res.plot(lams[1], residuals, color='k', linewidth=1)

# Plot residuals
ax_res.set_xlabel('RV [km/s]')
ax_res.set_ylabel('CCF Residuals')
ax_res.set_title('CCF Residuals')

plt.show()

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY