Skip to content

Commit

Permalink
analysis.composite_indv_detect.main: Re-organize code for simplicity …
Browse files Browse the repository at this point in the history
…(iss #21)
  • Loading branch information
astrochun committed Feb 9, 2020
1 parent 5a7597d commit 5e90c5d
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions Metallicity_Stack_Commons/analysis/composite_indv_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,27 @@ def main(fitspath, dataset, composite_file):
# Read in tables containing line ratios, bins, etc.
det3_table = asc.read(join(fitspath, 'get_det3_table2.tbl'))
bin_table = asc.read(join(fitspath, dataset+'_2d_binning_datadet3.tbl'))
# Not used for now
# average_table = asc.read(join(fitspath, dataset+'_Average_R23_O32_Values.tbl'))

# Populate composite temperature for individual galaxies
adopted_temp = np.zeros(len(det3_table))
for comp_bin, comp_temp in zip(bin_id, bin_temp):
bin_idx = np.where(bin_table['Bin_number'].data == comp_bin)[0]
adopted_temp[bin_idx] = comp_temp

# Update [bin_table] to include two new columns
col_temp = Column(adopted_temp, name='Temperature')
col_metal = Column(np.zeros(len(det3_table)), name='com_O_log',
dtype=np.float32)
det3_table.add_columns([col_temp, col_metal]) # Add at the end of table

# Not used for now
# average_table = asc.read(join(fitspath, dataset+'_Average_R23_O32_Values.tbl'))

bin_no = bin_table['Bin_number'].data
O2 = det3_table['O2'].data # [OII]3726,3728 fluxes
O3 = det3_table['O3'].data # [OIII]4959,5007 fluxes (Assume 3.1:1 ratio)
Hb = det3_table['Hb'].data
Hb = det3_table['Hb'].data # H-beta fluxes

com_O_log, metal_dict = metallicity_calculation(adopted_temp, O2/Hb, O3/Hb)

# Update [det3_table] to include two new columns
col_temp = Column(adopted_temp, name='Temperature')
col_metal = Column(com_O_log, name='com_O_log')
det3_table.add_columns([col_temp, col_metal]) # Add at the end (default)


com_O_log, metal_dict = metallicity_calculation(temp_bin, O2/Hb, O3/Hb)


def run_ind_detection(fitspath, dataset, average_value_ascii):
Expand Down

0 comments on commit 5e90c5d

Please sign in to comment.