Skip to content
Snippets Groups Projects
Commit a5d7eef7 authored by Heneka, Dr. Caroline's avatar Heneka, Dr. Caroline
Browse files

Upload New File

parent 0bb817d9
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id:b1144fb9 tags:
``` python
import numpy as np
from astropy.io import fits
import matplotlib.pyplot as plt
from astropy.wcs import WCS
import os
import csv
########## Input ##########
fits_path = 'F:\\data\\spectral_fits\\'
samples_per_class = 1000
search_number = 454
```
%% Cell type:code id:3917f5ac tags:
``` python
########## Program ##########
number = 0
filenames = np.load(fits_path + 'filenames.npy')
directories = ['AGN', 'galaxy', 'QSO', 'star']
directory = directories[int(search_number/1000)]
for filename in os.listdir(fits_path + directory + '\\'):
path = fits_path + '\\' + directory + '\\' + filename
if filename == filenames[search_number]:
hdul = fits.open(path)
data = hdul[1].data
flux = data['flux']
wavelength = 10**data['loglam']
plt.plot(wavelength, flux)
plt.xlabel('wavelength(Å)')
plt.ylabel('flux (10-17 ergs/s/cm2/Å)')
plt.grid(True)
plt.title(str(search_number)+": "+filename)
plt.show()
number += 1
```
%% Output
%% Cell type:code id:43d7a808 tags:
``` python
int(0.934)
```
%% Output
0
%% Cell type:code id:bfee957d tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment