Пример #1
0
def make_bins():
	"""
	Calls the select_size_bins2 and select_flux_bins2 and produces the .fits files
	Deals with overlap. 
	"""
	dataNN,dataMG = select_all_interesting()
	tdata = vstack([dataNN,dataMG])

	a = select_size_bins2(dataNN,dataMG,Write=True)
	a = select_flux_bins2(tdata,Write=True)

	for i in range(5):
		size_data = Table(fits.open('./size_bins2_'+str(i)+'.fits')[1].data)
		flux_data = Table(fits.open('./flux_bins2_'+str(i)+'.fits')[1].data)

		size_data = deal_with_overlap(size_data)
		flux_data = deal_with_overlap(flux_data)

		size_data.write('./size_bins2_'+str(i)+'.fits',overwrite=True)
		flux_data.write('./flux_bins2_'+str(i)+'.fits',overwrite=True)
Пример #2
0
def fix_data_latest():
	"""
	After initial source filtering, deal with overlap.
	"""


	dataNN_l, dataMG_l = select_all_interesting(iteration=2)
	tdata_latest = vstack([dataNN_l,dataMG_l])
	# Write it so nans appear in the MG columns
	tdata_latest.write('/data1/osinga/value_added_catalog/source_filtering/biggest_selection_latest.fits',overwrite=True)
	# Open it again
	tdata_latest = Table(fits.open('/data1/osinga/value_added_catalog/source_filtering/biggest_selection_latest.fits')[1].data)
	# Deal with the overlapping sources.
	tdata_latest = deal_with_overlap(tdata_latest)
	tdata_latest.write('/data1/osinga/value_added_catalog/source_filtering/biggest_selection_latest.fits',overwrite=True)
Пример #3
0
    plt.ylabel('Mean angular radius (deg)')
    plt.xlabel('n')
    # plt.savefig('/data1/osinga/figures/statistics/show/angular_radius_vs_n_'+filename+'.png',overwrite=True)
    plt.savefig('./angular_radius_vs_n_' + filename + '.pdf', overwrite=True)
    plt.close()

    return median


n = 180

for i in range(5):
    # Open the size data
    filename = 'size_bins2_' + str(i)
    tdata = Table(fits.open('./' + filename + '.fits')[1].data)
    tdata = deal_with_overlap(tdata)
    Sn_mc = Table(fits.open('./Sn_monte_carlo_' + filename + '.fits')[1].data)
    # Calculate the Sn and the plots
    angular_radius = angular_radius_vs_n(tdata, filename, n)
    Sn_data = angular_dispersion_vectorized_n(tdata, n)
    Sn_vs_n(tdata, Sn_mc, Sn_data, filename, angular_radius, n)

    break

    # Open the flux data
    filename = 'flux_bins2_' + str(i)
    tdata = Table(fits.open('./' + filename + '.fits')[1].data)
    tdata = deal_with_overlap(tdata)
    Sn_mc = Table(fits.open('./Sn_monte_carlo_' + filename + '.fits')[1].data)
    # Caluclate the Sn and the plots
    Sn_data = angular_dispersion_vectorized_n(tdata, n)
Пример #4
0
    tdata_BS = vstack([tdataNN, tdataMG])
    print('Length of biggest selection before dealing with overlap:',
          len(tdata_BS))
    # have to write it out and read it again to prevent '--' from showing up in Table instead of NaN
    tdata_BS.write('../biggest_selection_with_overlap.fits', overwrite=True)
    tdata_BS = Table(
        fits.open('../biggest_selection_with_overlap.fits')[1].data)

    # fix the NN sources that are also MG sources and fix the nearest neighbour
    # of NN sources that are also MG sources by visually classifying
    # the results are saved in classtable.
    classtable = '../NN_excluded_by_also_being_MG_classification.fits'
    classtable = Table(fits.open(classtable)[1].data)
    # classified=True makes it so it uses the visual classification to deal with overlap
    tdata_BS = deal_with_overlap(tdata_BS,
                                 classified=True,
                                 classtable=classtable)
    print('Length of biggest selection after dealing with overlap:',
          len(tdata_BS))

    # Then, check if we don't have double sources by imposing a
    # minimum distance between to sources of 0.2 arcmin
    tdata_BS = check_distance(tdata_BS)
    print('Length of biggest selection after distance check:', len(tdata_BS))

    NN_Peak_flux = find_NN_properties(tdata_BS, 'Peak_flux')
    total_flux_NN = find_NN_properties(tdata_BS, 'Total_flux')
    tdata_BS['new_NN_Peak_flux'] = NN_Peak_flux
    tdata_BS['new_NN_Total_flux'] = total_flux_NN

    tdata_BS.write('../biggest_selection.fits', overwrite=True)