Commit 93e671ef authored by LUSTIG Peter's avatar LUSTIG Peter

error corrections...

parent 8838ef68
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment