# Load data from input table SCAO_system = convert_lib.set_SCAO() inp_table = np.loadtxt(inp_table_name, dtype=str) JUmag = np.array(np.transpose([inp_table[:, 4], inp_table[:, 5]]), dtype=float) HUmag = np.array(np.transpose([inp_table[:, 6], inp_table[:, 7]]), dtype=float) KUmag = np.array(np.transpose([inp_table[:, 8], inp_table[:, 9]]), dtype=float) IR1mag = np.array(inp_table[:, 10], dtype=float) IR2mag = np.array(inp_table[:, 11], dtype=float) IR3mag = np.array(inp_table[:, 12], dtype=float) IR4mag = np.array(inp_table[:, 13], dtype=float) MP1mag = np.array(inp_table[:, 14], dtype=float) #----------------------------------- JUflux = convert_lib.ensemble_mag_to_mjy(JUmag, 'J', SCAO_system) HUflux = convert_lib.ensemble_mag_to_mjy(HUmag, 'H', SCAO_system) KUflux = convert_lib.ensemble_mag_to_mjy(KUmag, 'K', SCAO_system) IR1flux = convert_lib.mag_to_mJy_noerr(SCAO_system['IR1'][2], IR1mag) IR1err = IR1flux * 0.047 IR2flux = convert_lib.mag_to_mJy_noerr(SCAO_system['IR2'][2], IR2mag) IR2err = IR2flux * 0.047 IR3flux = convert_lib.mag_to_mJy_noerr(SCAO_system['IR3'][2], IR3mag) IR3err = IR3flux * 0.047 IR4flux = convert_lib.mag_to_mJy_noerr(SCAO_system['IR4'][2], IR4mag) IR4err = IR4flux * 0.047 MP1flux = convert_lib.mag_to_mJy_noerr(SCAO_system['MP1'][2], MP1mag) MP1err = MP1flux * 0.095 flux_sed = np.array( np.transpose([ JUflux[:, 0],
exit() ukidss_table_name = argv[1] #----------------------------------- # Print the test text ukidss_table = np.loadtxt( ukidss_table_name, dtype = str, delimiter = ',',) # Take the AperMag3 as the magnitude. distance = np.array(ukidss_table[:, 3], dtype = float) Jmag = np.array(ukidss_table[:, 48:50] , dtype = float) Hmag = np.array(ukidss_table[:, 73:75] , dtype = float) Kmag = np.array(ukidss_table[:, 98:100], dtype = float) # Load UKIDSS bands system ukidss_system = convert_lib.set_ukirt() # Convert mag to flux. Jflux = convert_lib.ensemble_mag_to_mjy(Jmag, 'J', ukidss_system) Hflux = convert_lib.ensemble_mag_to_mjy(Hmag, 'H', ukidss_system) Kflux = convert_lib.ensemble_mag_to_mjy(Kmag, 'K', ukidss_system) sed_table = np.array(np.transpose([ Jflux[:,0], Hflux[:,0], Kflux[:,0], Jflux[:,1], Hflux[:,1], Kflux[:,1] ])) coord_table = np.array(ukidss_table[:,8:10], dtype = str) dist_table = np.array(ukidss_table[:,3], dtype = str) saturation_table = np.array(ukidss_table[:,35], dtype = str) # Save the data np.savetxt( '{0}_sed.txt'.format(ukidss_table_name[:-4]),
MP1mag = np.array(np.transpose([inp_table[:, 28], inp_table[:, 29]]), dtype=float) #----------------------------------- # Convert 2MASSflux to UKIDSSflux print('Convert 2MASSmag to UKIDSSflux') ukirt_system = convert_lib.set_ukirt() spitzer_system = convert_lib.set_spitzer() JUmag, HUmag, KUmag = convert_lib.ensemble_two2u(J2mag, H2mag, K2mag) JUflux, eJUflux = convert_lib.ensemble_mag_to_mjy_ufloat( JUmag, 'J', ukirt_system) HUflux, eHUflux = convert_lib.ensemble_mag_to_mjy_ufloat( HUmag, 'H', ukirt_system) KUflux, eKUflux = convert_lib.ensemble_mag_to_mjy_ufloat( KUmag, 'K', ukirt_system) # Convert Spitzermag to Spitzerflux IR1flux = convert_lib.ensemble_mag_to_mjy(IR1mag, 'IR1', spitzer_system) IR2flux = convert_lib.ensemble_mag_to_mjy(IR2mag, 'IR2', spitzer_system) IR3flux = convert_lib.ensemble_mag_to_mjy(IR3mag, 'IR3', spitzer_system) IR4flux = convert_lib.ensemble_mag_to_mjy(IR4mag, 'IR4', spitzer_system) MP1flux = convert_lib.ensemble_mag_to_mjy(MP1mag, 'MP1', spitzer_system) # Form the sed table print('Form the tables') flux_sed = np.array( np.transpose([ JUflux, HUflux, KUflux, IR1flux[:, 0], IR2flux[:, 0], IR3flux[:, 0], IR4flux[:, 0],
''' #----------------------------------- # Set the 1/100 of the smallest detectable flux and the corresponding error proper_flux_error = np.array( [[ 0.00149784692033, 0.00307373858059], [ 0.00227441747763, 0.00362321269368], [ 0.00225503537577, 0.00601552926042], [ 0.000373 , 0.0158 ], [ 0.000315 , 0.0119 ], [ 0.000107 , 0.0257 ], [ 0.000216 , 0.0257 ], [ 0.000898 , 0.02905 ]]) ''' #----------------------------------- # Convert mag to flux and artifical data Jflux = convert_lib.ensemble_mag_to_mjy(Jmag, 'J', SCAO_system) Hflux = convert_lib.ensemble_mag_to_mjy(Hmag, 'H', SCAO_system) Kflux = convert_lib.ensemble_mag_to_mjy(Kmag, 'K', SCAO_system) IR1flux = convert_lib.ensemble_mag_to_mjy(IR1mag, 'IR1', SCAO_system) IR2flux = convert_lib.ensemble_mag_to_mjy(IR2mag, 'IR2', SCAO_system) IR3flux = convert_lib.ensemble_mag_to_mjy(IR3mag, 'IR3', SCAO_system) IR4flux = convert_lib.ensemble_mag_to_mjy(IR4mag, 'IR4', SCAO_system) MP1flux = convert_lib.ensemble_mag_to_mjy(MP1mag, 'MP1', SCAO_system) flux_sed = np.array( np.transpose([ Jflux[:, 0], Hflux[:, 0], Kflux[:, 0], IR1flux[:, 0], IR2flux[:, 0], IR3flux[:, 0],