Skip to content

Conversation

@clmould
Copy link
Owner

@clmould clmould commented Nov 23, 2023

No description provided.


def s_dev(data):
"""Computes and returns standard deviation for data."""
mmm = np.mean(data, axis=0)
Copy link

Choose a reason for hiding this comment

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

mmm is not a descriptive variable name. Perhaps consider renaming it to mean_data



def s_dev(data):
"""Computes and returns standard deviation for data."""
Copy link

Choose a reason for hiding this comment

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

This function description can be made longer with more detail. For instance, in what format is the data outputted? Unless we look at the code itself, there is no way of knowing it outputs a dictionary object -- a behaviour different from the other functions in the code -- so I would recommend saying this in the docstring!

devs.append((entry - mmm) * (entry - mmm))

s_dev2 = sum(devs) / len(data)
return {'standard deviation': s_dev2}
Copy link

Choose a reason for hiding this comment

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

To allow this function to be more general (i.e., so it can be easily used elsewhere in the code), consider making it return s_dev simply as a list, rather than a dictionary object. Then you can turn it into a dictionary in the inflammation_analysis.py file

for entry in data:
devs.append((entry - mmm) * (entry - mmm))

s_dev2 = sum(devs) / len(data)
Copy link

Choose a reason for hiding this comment

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

Missing a square root?

Copy link

@ltaling ltaling left a comment

Choose a reason for hiding this comment

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

Expected Tests:

  • Test the s_dev function works as expected. I.e., it correctly calculates the standard deviation (done with test_daily_standard_deviation function)

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