Commit 70724fe5 authored by LUSTIG Peter's avatar LUSTIG Peter

Added Interpolation for completness threshold evaluation

parent 3950e2b6
......@@ -181,13 +181,6 @@ class PCEvaluation:
return completness, purity, norm_comp, norm_pur
def InterpolateCompletnessThreshold(self, threshold, completness=None):
if completness is None:
completness = self.completness
nextidx = np.argsort(np.absolute(completness - threshold))[:2]
nextidx = np.sort(nextidx)
## np.interp(???) maybe even sorting not necessary
def PlotBin(self, data, title='', flux=None, thresh=None,
nfluxlabels=None, nthreshlabels=None, **kwargs):
......@@ -392,6 +385,18 @@ class PCAreaEvaluation:
else:
return None
def InterpolateCompletnessThreshold(self, threshold, completness=None,
detection_thresholds=None):
if completness is None:
completness = self.completness
if detection_thresholds is None:
detection_thresholds = self.thresholds
thresh = np.interp(threshold, completness[::-1],
detection_thresholds[::-1])
return thresh
def PlotMask(self, mask=None, sources=False, sourcecat=None,
realsources=False, realsourcecat=None, **kwargs):
if mask is None:
......@@ -554,7 +559,6 @@ if __name__ == '__main__':
addmaskname = ('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/'
'Completness/hlsmask.fits')
hdul = fits.open(fname)
sources = Table.read(hdul['DETECTED_SOURCES'])
realsources = Table.read(rsfname, 'DETECTED_SOURCES')
......@@ -574,7 +578,7 @@ if __name__ == '__main__':
if(1): # plot mask
fig = plt.figure()
ax, img = aa.PlotMask(sources=True, realsources=False)
#plt.show()
# plt.show()
if(1):
plt.figure()
......
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