Skip to content

Commit

Permalink
Change-Id: I89fcb2feccb0641910050fcbc76a33ecd9b60412
Browse files Browse the repository at this point in the history
Signed-off-by: Inon Sharony <[email protected]>
  • Loading branch information
Inon Sharony authored and Inon Sharony committed Aug 8, 2015
1 parent 5487752 commit 5b28890
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/FitDissipationOrdinaryLeastSquares.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class FitDissipationOrdinaryLeastSquares():
def exponentialDecay(cls, t, Amp, gamma):
return Amp * exp(-gamma * t)

def __init__(self, x=None, y=None, Amp0=1.0, gamma0=10.0, SNR=25):
def __init__(self, x=None, y=None, Amp0=1.0, gamma0=1.0, SNR=10.0):

basicConfig(level="DEBUG")

Expand Down Expand Up @@ -82,6 +82,8 @@ def generateNoisySignal(self, SNR):
fx = [exponentialDecay(t, self._A_, self._g_) for t in self.x]
rx = fx + gauss(0, self._A_ / SNR)
"""
info(
"generating noisy signal from {} * exp (-{} * t) + N(0, {})".format(self._A_, self._g_, self._A_ * SNR))
return [(FitDissipationOrdinaryLeastSquares.exponentialDecay(t, self._A_, self._g_) +
gauss(0, self._A_ / SNR)) for t in self.x]

Expand Down
21 changes: 11 additions & 10 deletions src/FitDissipationOrdinaryLeastSquaresTest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
'''
Created on Aug 5, 2015
@author: administrator
@author: Inon Sharony
@contact: www.tau.ac.il/~inonshar
@organization: Tel Aviv University Department of Chemical Physics
@since: Aug 5, 2015
'''
from numpy import exp
from random import gauss
Expand All @@ -12,13 +13,13 @@

class FitDissipationOrdinaryLeastSquaresTest(unittest.TestCase):
"""
Web resources:
https://docs.python.org/3/library/unittest.html#classes-and-functions
http://pymotw.com/2/unittest/
http://docs.python-guide.org/en/latest/writing/tests/
http://www.openp2p.com/pub/a/python/2004/12/02/tdd_pyunit.html
http://www.drdobbs.com/testing/unit-testing-with-python/240165163
http://www.diveintopython3.net/unit-testing.html
@see: Web resources:
https://docs.python.org/3/library/unittest.html#classes-and-functions
http://pymotw.com/2/unittest/
http://docs.python-guide.org/en/latest/writing/tests/
http://www.openp2p.com/pub/a/python/2004/12/02/tdd_pyunit.html
http://www.drdobbs.com/testing/unit-testing-with-python/240165163
http://www.diveintopython3.net/unit-testing.html
"""

def setUp(self):
Expand Down

0 comments on commit 5b28890

Please sign in to comment.