Skip to content

Commit

Permalink
analysis.composite_indv_detect.main: Define new astropy Table with ju…
Browse files Browse the repository at this point in the history
…st the content that is needed (iss #21)
  • Loading branch information
astrochun committed Mar 15, 2020
1 parent 9d79dbc commit dfdab4a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Metallicity_Stack_Commons/analysis/composite_indv_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import numpy as np
from astropy.io import ascii as asc
from astropy.table import Column
from astropy.table import Table

from ..temp_metallicity_calc import metallicity_calculation
from .. import OIII_r
Expand Down Expand Up @@ -60,7 +60,6 @@ def main(fitspath, dataset, composite_file, indv_em_line_file, indv_bin_file, ou
O3 = indv_em_line_table['OIII_5007_Flux_Gaussian'].data * OIII_r # [OIII]4959,5007 fluxes (Assume 3.1:1 ratio)
Hb = indv_em_line_table['HBETA_Flux_Gaussian'].data # H-beta fluxes


if det3:
com_O_log, metal_dict = metallicity_calculation(adopted_temp, O2/Hb, O3/Hb)
else:
Expand All @@ -72,15 +71,14 @@ def main(fitspath, dataset, composite_file, indv_em_line_file, indv_bin_file, ou
com_O_log[det3] = temp_com_O_log

# Update [indv_em_line_table] to include three new columns
col_bin_id = Column(bin_id_indv, name='bin_ID')
col_temp = Column(adopted_temp, name='T_e')
col_metal = Column(com_O_log, name='12+log(O/H)')
indv_em_line_table.add_columns([col_temp, col_metal, col_bin_id]) # Add at the end (default)
arr0 = [indv_em_line_table['ID'], bin_id_indv, adopted_temp, com_O_log]
names0 = ['ID', 'bin_ID', 'T_e', '12+log(O/H)']
indv_derived_prop_table = Table(arr0, names=names0)

# Write Astropy ASCII table containing composite T_e and derived metallicity

if exists(outfile):
print("File exists! Overwriting : ", outfile)
else:
print("Writing : ", outfile)
indv_em_line_table.write(outfile, overwrite=True, format='ascii.fixed_width_two_line')
indv_derived_prop_table.write(outfile, overwrite=True, format='ascii.fixed_width_two_line')

0 comments on commit dfdab4a

Please sign in to comment.