Commit a2127ea6 authored by Maxime Charpentier's avatar Maxime Charpentier

Update astropython.py

parent e07148e8
......@@ -55,38 +55,6 @@ class phot:
def estbg(im, mask=None, bins=None, plotalot=False, rout=(3,200), badval=nan, verbose=False):
"""Estimate the background value of a masked image via histogram fitting.
INPUTS:
im -- numpy array. Input image.
OPTIONAL INPUTS:
mask -- numpy array. logical mask, False/0 in regions to ignore
bins -- sequence. edges of bins to pass to HIST
plotalot -- bool. Plot the histogram and fit.
rout -- 2-tuple of (nsigma, niter) for analysis.removeoutliers.
Set to (Inf, 0) to not cut any outliers.
badval -- value returned when things go wrong.
OUTPUT:
b, s_b -- tuple of (background, error on background) from gaussian fit.
Note that the error is analagous to the standard deviation on the mean
COMMENTS:
The fit parameters appear to be robust across a fairly wide range of bin sizes. """
# 2009-09-02 17:13 IJC: Created!
# 2009-09-04 15:07 IJC: Added RemoveOutliers option. Use only non-empty bins in fit.
# 2009-09-08 15:32 IJC: Error returned is now divided by sqrt(N) for SDOM
# 2009-11-03 00:16 IJC: Improved guess for gaussian dispersion
# 2011-05-18 11:47 IJMC: Moved (e)gaussian imports to analysis.
# 2012-01-01 21:04 IJMC: Added badval option
# 2012-08-15 17:45 IJMC: Numpy's new histogram no longer accepts 'new' keyword
# 2013-03-20 08:22 IJMC: Now works better even for small numbers
# of pixels; thanks to A. Weigel @
# ETH-Zurich for catching this!
# 2014-08-29 10:05 IJMC: Added verbosity flag.
# 2014-09-25 14:29 IJMC: Added check for no usability
from numpy import histogram, mean, median, sqrt, linspace, isfinite, ones,std
from pylab import find
from scipy import optimize
......
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