Commit f47c47b7 authored by andy.disch's avatar andy.disch

initial commit

parent 9a6773a6
......@@ -24,7 +24,12 @@ class UrbanDrainageTS(pandas.DataFrame):
super().__init__(d_f)
def sample_entropy(self, m_m=2):
"""compute sample entropy."""
"""compute sample entropy
negative logarithm of the probability that if two sets of simultaneous data points of
length m have distance < r then two sets of simultaneous data points of length m + 1
m+1 also have distance < r
"""
u_u = self.value
r_r = 0.2 * numpy.std(self.value)
......
......@@ -8,4 +8,4 @@ import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from examplepydebuggingandtesting import exampletesting
from examplepydebuggingandtesting import example
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Example test file."""
import unittest
import datetime
from .context import exampletesting
class TestUrbanDrainageTS(unittest.TestCase):
def setUp(self):
time = [datetime.datetime.strptime('2018-01-01 12:00:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:05:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:10:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:15:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:20:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:25:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:30:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:35:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:40:00', '%Y-%m-%d %H:%M:%S')]
value = [6.789, 4.567, 9.09, 6.70, 8.70, 3.4, 2.3, 4.56, 2.78]
self.test_case = exampletesting.UrbanDrainageTS(time, value)
def tearDown(self):
"""tear down"""
class TestInit(TestUrbanDrainageTS):
def test_initial_length(self):
self.assertIsNotNone(self.test_case.time)
self.assertIsNotNone(self.test_case.value)
class TestSampleEntropy(TestUrbanDrainageTS):
def test_sample_entropy(self):
self.assertIsNotNone(self.test_case)
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Example test file."""
import unittest
import datetime
from .context import example
class TestUrbanDrainageTS(unittest.TestCase):
""" base test class. """
def setUp(self):
"""set up test variables."""
time_time = [datetime.datetime.strptime('2018-01-01 12:00:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:05:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:10:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:15:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:20:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:25:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:30:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:35:00', '%Y-%m-%d %H:%M:%S'),
datetime.datetime.strptime('2018-01-01 12:40:00', '%Y-%m-%d %H:%M:%S')]
value_value = [6.789, 4.567, 9.09, 6.70, 8.70, 3.4, 2.3, 4.56, 2.78]
self.test_case = example.UrbanDrainageTS(time_time, value_value)
# def tearDown(self):
# """tear down"""
class TestInit(TestUrbanDrainageTS):
""" test initialization. """
def test_initial_length(self):
""" method docstring. """
self.assertIsNotNone(self.test_case.time)
self.assertIsNotNone(self.test_case.value)
class TestSampleEntropy(TestUrbanDrainageTS):
""" test sample entropy. """
def test_sample_entropy(self):
""" method docstring. """
def test_max_dist(self):
""" method docstring. """
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