-
Notifications
You must be signed in to change notification settings - Fork 0
/
CANDELS_Combining_Fields_z.py
26 lines (17 loc) · 1.13 KB
/
CANDELS_Combining_Fields_z.py
1
from astropy.table import vstack, Tablefrom astropy.io import asciifields = ['COSMOS', 'EGS', 'GOODSN', 'GOODSS', 'UDS']z_Combined_Fields = Table()for each_field in fields: catalog = ascii.read('/Users/laurenhiggins/Dropbox/GEG_Research/Key_Parameters_Catalogs_Per_Field/Redshift_Catalogs/zcat_%s_v2.0.cat'%each_field) z_subset = catalog[['ID', 'RA', 'DEC', 'z_best', 'z_best_type']] z_subset['Field_flag'] = each_field z_Combined_Fields = vstack([z_Combined_Fields, z_subset])ascii.write(z_Combined_Fields, '/Users/laurenhiggins/Dropbox/GEG_Research/Key_Parameters_Catalogs_Per_Field/Redshift_Catalogs/zcat_All_Fields_v2.0.cat', names=('ID', 'RA', 'DEC', 'z_best', 'z_best_type', 'Field_Flag'), format='csv', overwrite=True) '''then inside the for loop you can do .. catalog[‘Field_flag’] = each_fieldand then you can create a subset table as subset_table = catalog[[‘ID’, ‘redshift’, … your 7 column names will go here]]and then you can say master_table = vstack(master_table,subset) --> see proper usagethen in the end.. you will say ascii.write(‘path+file_name’, master_table)'''