예제 #1
0
def test_daily_max_string():
    """Test for TypeError when passing strings"""
    from inflammation.models import daily_max
    from pytest import raises

    with raises(TypeError):
        daily_max([['Cannot', 'min'], ['string', 'arguments']])
예제 #2
0
def main():
    """The MVC Controller of the patient inflammation data system.

    The Controller is responsible for:
    - selecting the necessary models and views for the current task
    - passing data between models and views
    """
    parser = argparse.ArgumentParser(
        description='A basic patient inflammation data management system')

    parser.add_argument(
        'infiles',
        nargs='+',
        help='Input CSV(s) containing inflammation series for each patient')

    args = parser.parse_args()

    InFiles = args.infiles
    if not isinstance(InFiles, list):
        InFiles = [args.infiles]

    for filename in InFiles:
        inflammation_data = models.load_csv(filename)

        view_data = {
            'average': models.daily_mean(inflammation_data),
            'max': models.daily_max(inflammation_data),
            'min': models.daily_min(inflammation_data)
        }

        views.visualize(view_data)
예제 #3
0
def test_daily_max():
    from inflammation.models import daily_max

    test_array = np.array([[1, 3, 5],
                            [3, 4, 1],
                            [2, 4, 9]])

    npt.assert_array_equal(np.array([3, 4, 9]), daily_max(test_array))
def main(args):
    """The MVC Controller of the patient data system.

    The Controller is responsible for:
    - selecting the necessary models and views for the current task
    - passing data between models and views
    """
    infiles = args.infiles
    if not isinstance(infiles, list):
        infiles = [args.infiles]

    for filename in infiles:
        inflammation_data = models.load_csv(filename)

        view_data = {'average': models.daily_mean(inflammation_data),
                     'max': models.daily_max(inflammation_data),
                     'min': models.daily_min(inflammation_data)}

        views.visualize(view_data)
예제 #5
0
def test_daily_max(test, expected):
    """Test max function works for zeroes, positive integers, mix of positive/negative integers."""
    from inflammation.models import daily_max
    npt.assert_array_equal(np.array(expected), daily_max(np.array(test)))
예제 #6
0
def test_daily_max():
    from inflammation.models import daily_max

    test_array = np.array([[1, 2], [3, 4], [5, 6]])

    npt.assert_array_equal(np.array([5, 6]), daily_max(test_array))
예제 #7
0
def test_daily_max_integers(test, expected):
    """Test that max function works for an array of positive integers."""
    from inflammation.models import daily_max
    # Need to use Numpy testing functions to compare arrays
    npt.assert_array_equal(np.array(expected), daily_max(np.array(test)))
예제 #8
0
def test_daily_max(test, expected):
    npt.assert_equal(np.array(expected), daily_max(np.array(test)))
예제 #9
0
def test_daily_max_zeros():
    """Test that mean function works for an array of zeros."""

    test_array = np.array([[0, 0], [0, 0], [0, 0]])
    # Need to use Numpy testing functions to compare arrays
    npt.assert_array_equal(np.array([0, 0]), daily_max(test_array))
예제 #10
0
def test_daily_max(test, expected):
    """Test mean function works for array of zeroes and positive integers."""
    from inflammation.models import daily_max
    npt.assert_array_equal(np.array(expected), daily_max(np.array(test)))