Skip to content

Add implementation of standard deviation on data#1

Open
JHeathUKAEA wants to merge 1 commit intomainfrom
feature-std-dev
Open

Add implementation of standard deviation on data#1
JHeathUKAEA wants to merge 1 commit intomainfrom
feature-std-dev

Conversation

@JHeathUKAEA
Copy link
Copy Markdown
Owner

Extend to show the graph of standard deviation.

Comment thread inflammation-analysis.py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enable the function to read JSON files also.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside the scope of the pull request, but useful functionality. Will add as issue for future work.

Comment thread tests/test_models.py
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard deviation should raise an error if an empty array is passed.
Make sure the functions performs accurately for negative values .

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will implement.

Comment thread inflammation/models.py
Copy link
Copy Markdown
Collaborator

@sl6391 sl6391 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add test for daily mean that has mix of both zeros and integers

Comment thread tests/test_models.py
Comment on lines +40 to +50


@pytest.mark.parametrize('data, expected_standard_deviation', [
([0, 0, 0], 0.0),
([1.0, 1.0, 1.0], 0),
([0.0, 2.0], 1.0)
])
def test_daily_standard_deviation(data, expected_standard_deviation):
from inflammation.models import s_dev
result_data = s_dev(data)['standard deviation']
npt.assert_approx_equal(result_data, expected_standard_deviation)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these tests cover enough possibilities?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will implement tests to make sure the functions performs accurately for negative values.

Comment thread inflammation/models.py
return np.min(data, axis=0)


def s_dev(data):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could s_dev be rewritten to standard_deviation to avoid confusion?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

Comment thread inflammation-analysis.py
Comment on lines 32 to 34

views.visualize(view_data)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could graph section be taken out of this part of code and have it's own section? Have the code return data instead

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

Copy link
Copy Markdown
Collaborator

@RoeBuckRoe RoeBuckRoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants