Skip to content

Commit

Permalink
balmer.HbHgHd_fits: Add fitspath input, fix out_pdf prefix, use colum…
Browse files Browse the repository at this point in the history
…n_names for filename convention (iss #10)
  • Loading branch information
astrochun committed Jun 5, 2020
1 parent 7ed3945 commit 5021fb7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Metallicity_Stack_Commons/plotting/balmer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
https://github.com/astrochun/Zcalbase_gal/blob/master/Analysis/DEEP2_R23_O32/balmer_plots.py
"""

from os.path import join
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
Expand All @@ -18,6 +19,7 @@
from ..analysis.attenuation import compute_EBV

from .. import scalefact, wavelength_dict
from ..column_names import filename_dict

n_rows = 3
n_cols = 3
Expand Down Expand Up @@ -96,20 +98,29 @@ def fitting_result(wave, y_norm, lambda_cen, balmer_fit, balmer_fit_neg):


# noinspection PyUnboundLocalVariable
def HbHgHd_fits(stack_name, astropy_table_file, out_pdf):
def HbHgHd_fits(fitspath, stack_name, out_pdf_prefix='HbHgHd_fits',
use_revised=False):
"""
Purpose:
Generate PDF plots that illustrate H-delta, H-gamma, and H-beta line
profiles and best fit
:param fitspath: full path (str)
:param stack_name: filename of the stack spectra (str)
:param astropy_table_file: astropy table containing ID
:param out_pdf: Name of output file (str)
:param out_pdf_prefix: Prefix for outpute PDF file (str)
:param use_revised: Indicate whether to use regular or revised tables (bool)
"""

stack2D, header = fits.getdata(stack_name, header=True)
wave = header['CRVAL1'] + header['CDELT1']*np.arange(header['NAXIS1'])

if not use_revised:
astropy_table_file = join(fitspath, filename_dict['bin_fit'])
out_pdf = join(fitspath, out_pdf_prefix+'.pdf')
else:
astropy_table_file = join(fitspath, filename_dict['bin_fit_rev'])
out_pdf = join(fitspath, out_pdf_prefix+'.revised.pdf')

astropy_table = asc.read(astropy_table_file)

ID = astropy_table['bin_ID'].data
Expand Down

0 comments on commit 5021fb7

Please sign in to comment.