I would like to just plot the data, that is the result from the mean (see code in bold). import numpy as np import matplotlib.pyplot as plt import glob from astropy.io import fits from astropy.wcs import WCS %matplotlib inline %matplotlib widget fig, ax = plt.subplots(figsize = (10,10)) # figsize changes the size of the plot) data_dir = glob.glob('/Users/xxxxxxxxx/Desktop/harpn_sun_release_package_ccf_2018/2018-01-18/*.fits') lams = [] fluxs = [] 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) mean_flux = np.mean(fluxs, axis = 0) ax.plot(lams[0], mean_flux, color = 'k', linewidth = 2) max_rv = lams[0][np.argmin(mean_flux)] ax.vlines(max_rv, np.min(fluxs), np.max(fluxs), color = 'r', linestyle='--') ax.set_xlabel('RV [km/s]') ax.set_ylabel('Normalized CCF') plt.title('CCF') plt.show() print(mean_flux)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I would like to just plot the data, that is the result from the mean (see code in bold).

import numpy as np
import matplotlib.pyplot as plt
import glob
from astropy.io import fits
from astropy.wcs import WCS
%matplotlib inline
%matplotlib widget


fig, ax = plt.subplots(figsize = (10,10)) # figsize changes the size of the plot)

data_dir = glob.glob('/Users/xxxxxxxxx/Desktop/harpn_sun_release_package_ccf_2018/2018-01-18/*.fits')

lams = []
fluxs = []

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)

mean_flux = np.mean(fluxs, axis = 0)
ax.plot(lams[0], mean_flux, color = 'k', linewidth = 2)

max_rv = lams[0][np.argmin(mean_flux)]
ax.vlines(max_rv, np.min(fluxs), np.max(fluxs), color = 'r', linestyle='--')


ax.set_xlabel('RV [km/s]')
ax.set_ylabel('Normalized CCF')

plt.title('CCF')
plt.show()

print(mean_flux)

 

 

 

40000
30000
0
10
20
RV [km/s]
30
40
93492.52
[104930.09 103464.03 101587.89 99710.74 98333.64
97645.76 98206.375 99064.03 100027.09 100870.03
101821.414 101427.24 100071.93 97552.41
79864.69 70415.9 60115.39 50119.555
34768.734 37060.95 43239.555 52353.89
81910.02
41815.21
36503.027
62804.
73144.07
95144.336 96109.86
96252.39
96249.18
97033.84
98058.13
99442.02
88459.586 92786.42
96053.164 96014.38
101030.03 102540.664 103737.98 104716.67 105623.34 106510.61
107199.984]
97626.96
101466.84
87540.8
50
Transcribed Image Text:40000 30000 0 10 20 RV [km/s] 30 40 93492.52 [104930.09 103464.03 101587.89 99710.74 98333.64 97645.76 98206.375 99064.03 100027.09 100870.03 101821.414 101427.24 100071.93 97552.41 79864.69 70415.9 60115.39 50119.555 34768.734 37060.95 43239.555 52353.89 81910.02 41815.21 36503.027 62804. 73144.07 95144.336 96109.86 96252.39 96249.18 97033.84 98058.13 99442.02 88459.586 92786.42 96053.164 96014.38 101030.03 102540.664 103737.98 104716.67 105623.34 106510.61 107199.984] 97626.96 101466.84 87540.8 50
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Concept of Threads
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education