Commit 7fb74184 authored by ljbing's avatar ljbing
Browse files

small changes, use peak flux

parent bae2a2d0
...@@ -5,7 +5,7 @@ import astropy.units as u ...@@ -5,7 +5,7 @@ import astropy.units as u
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
from astropy.wcs import WCS from astropy.wcs import WCS
import warnings import warnings
import sys import sys,pdb
sys.path.append('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness') sys.path.append('/home/peter/Dokumente/Uni/Paris/Stage/FirstSteps/Completness')
from fitmodels import ModifiedErrorFunction, FluxRelativeBoosting, FluxBoosting from fitmodels import ModifiedErrorFunction, FluxRelativeBoosting, FluxBoosting
from astropy.modeling.fitting import LevMarLSQFitter from astropy.modeling.fitting import LevMarLSQFitter
...@@ -337,7 +337,8 @@ class CompletenessArea(BasicEvaluation): ...@@ -337,7 +337,8 @@ class CompletenessArea(BasicEvaluation):
ax2.set_xlabel('Flux [mJy]', fontsize=20) ax2.set_xlabel('Flux [mJy]', fontsize=20)
ax2.set_xscale('log') ax2.set_xscale('log')
return (res, fitter), [ax1, ax2] # modified Jul 19 2020, return fig rather than list of axes
return (res, fitter), fig#[ax1, ax2]
def PlotCompleteness1D(self, idx, constant='flux', linestyles=None, def PlotCompleteness1D(self, idx, constant='flux', linestyles=None,
ax=None, **kwargs): ax=None, **kwargs):
...@@ -523,7 +524,7 @@ class FluxArea(CompletenessArea): ...@@ -523,7 +524,7 @@ class FluxArea(CompletenessArea):
# xval[xval > bins[-1]] = bins[-1] # xval[xval > bins[-1]] = bins[-1]
binidx = np.digitize(xval, bins, right=True) binidx = np.digitize(xval, bins, right=True)
outflux = u.Quantity(sources[fake_sources['find_peak'].filled(0)] outflux = u.Quantity(sources[fake_sources['find_peak'].filled(0)]
['flux_psf']).to_value(u.mJy) ['flux_peak']).to_value(u.mJy) # change to flux_peak from flux_psf
influx = u.Quantity(fake_sources['amplitude']).to_value(u.mJy) influx = u.Quantity(fake_sources['amplitude']).to_value(u.mJy)
fake_sources['fluxgroup'] = - np.ones(len(fake_sources), dtype=int) fake_sources['fluxgroup'] = - np.ones(len(fake_sources), dtype=int)
...@@ -662,7 +663,8 @@ class FluxArea(CompletenessArea): ...@@ -662,7 +663,8 @@ class FluxArea(CompletenessArea):
ax2.set_ylabel('Residuals', fontsize=20) ax2.set_ylabel('Residuals', fontsize=20)
ax2.set_xscale('log') ax2.set_xscale('log')
return (res, fitter), [ax1, ax2] # modified Jul 19 2020, return fig rather than list of axes
return (res, fitter), fig#[ax1, ax2]
def PlotPercentiles(self, exact=True, ax=None, mean=False, **kwargs): def PlotPercentiles(self, exact=True, ax=None, mean=False, **kwargs):
percentiles = np.copy(self.fluxpercentiles).T percentiles = np.copy(self.fluxpercentiles).T
...@@ -732,6 +734,8 @@ def Completeness2D(sources, fake_sources, thresholdbins, fluxbins, ...@@ -732,6 +734,8 @@ def Completeness2D(sources, fake_sources, thresholdbins, fluxbins,
fakesourceslocmask = np.zeros(len(fake_sources), dtype=bool) fakesourceslocmask = np.zeros(len(fake_sources), dtype=bool)
# get SNR for each fake source # get SNR for each fake source
#import pdb
#pdb.set_trace()
fake_snr = np.ma.array(sources[fake_sources['find_peak'] fake_snr = np.ma.array(sources[fake_sources['find_peak']
.filled(0)]['SNR'], .filled(0)]['SNR'],
mask=fake_sources['find_peak'].mask) mask=fake_sources['find_peak'].mask)
......
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