diff --git a/evaluation.py b/evaluation.py index 54fdd49dc73f145ca042f7e3ed06ed508fff1e8e..e0b3eea7ed95c8ca58469c688af3b95a1e07fe2b 100644 --- a/evaluation.py +++ b/evaluation.py @@ -44,10 +44,11 @@ class PCEvaluation: def __init__(self, sources, fake_sources, shape, wcs, flux=None, mapbins=19, threshold_bins=5, threshold_range=(3, 5)): + print('sorting values') idxsort = np.argsort(flux.to_value(u.mJy)) self.flux = flux[idxsort] - self.sources = sources[idxsort] - self.fake_sources = sources[idxsort] + self.sources = [sources[i] for i in idxsort] + self.fake_sources = [fake_sources[i] for i in idxsort] self.completness = None self.purity = None @@ -70,6 +71,7 @@ class PCEvaluation: threshold_range=threshold_range, threshold_bins=threshold_bins) + print('wcs created') # Testing the lower edges wcs_threshold = self.wcs_3D.sub([3]) assert np.all(np.abs(wcs_threshold.all_pix2world( @@ -95,7 +97,7 @@ class PCEvaluation: else: comp, pur, hitm = [], [], [] for i in range(len(sources)): - tmpres = self.completness_purity(sources, fake_sources, + tmpres = self.completness_purity(sources[i], fake_sources[i], wcs, shape) comp.append(tmpres[0]) pur.append(tmpres[1]) @@ -153,7 +155,8 @@ FLUX = [] SOURCE = [] FSOURCE = [] -for isimu in range(nfluxes): +# for isimu in range(nfluxes): +for isimu in range(3): FLUX.append(u.Quantity(hdul[0].header['flux{}'.format(isimu)])) SOURCE.append(Table.read(hdul['DETECTED_SOURCES{}' @@ -161,12 +164,13 @@ for isimu in range(nfluxes): FSOURCE.append(Table.read(hdul['FAKE_SOURCES{}' .format(FLUX[isimu])])) -SOURCE = np.array(SOURCE) -FSOURCE = np.array(FSOURCE) xx = PCEvaluation(SOURCE, FSOURCE, sh, wcs, u.Quantity(FLUX)) +print('done') +# %% testfunctions -sys.exit() +res = xx.GetCP() +# %% # midbin = int(bins / 2)