Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue70 covariance #71

Merged
merged 2 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fitsfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ def get_true_peaks(self, show=False):
y0 = y1-left_range
y2 = y1+right_range

# Ensure that the ranges do not exceed the width and height of the
# image
# Ensure that the ranges do not exceed the width and height of
# the image
if y0 <= 0: y0 = 0
if y2 >= image_height: y2 = image_height
rng = (y0, y2)
Expand Down
12 changes: 6 additions & 6 deletions gaussfit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from astropy import modeling
import matplotlib.pyplot as plt
import math
import warnings

class Peak:
def __init__(self, x, y):
Expand All @@ -13,9 +14,6 @@ def __init__(self, x, y):
self.width = None # the sigma value of the fitted Gaussian


def non_int_to_int(iterable):
return [int(x) for x in iterable]

def gauss(x, amp, cen, wid):
"""
Gauss fitting function. Using the precision (tau) to define the width of the
Expand Down Expand Up @@ -66,9 +64,11 @@ def fit_gaussian(fits_file, rng, peak, show=False):

# To determine the p0 values, we used the information here:
# https://stackoverflow.com/questions/29599227/fitting-a-gaussian-getting-a-straight-line-python-2-7.
popt, pcov = scipy.optimize.curve_fit(gauss, x, y,
p0=[peak_value, mean, sigma],
maxfev=10000)
with warnings.catch_warnings():
warnings.simplefilter("ignore")
popt, pcov = scipy.optimize.curve_fit(gauss, x, y,
p0=[peak_value, mean, sigma],
maxfev=10000)


mean_intensity = popt[0]
Expand Down