-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add implementation of standard deviation on data #1
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,3 +54,13 @@ def daily_min(data): | |
"""Calculate the daily min of a 2d inflammation data array.""" | ||
return np.min(data, axis=0) | ||
|
||
|
||
def s_dev(data): | ||
"""Computes and returns standard deviation for data.""" | ||
mmm = np.mean(data, axis=0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
devs = [] | ||
for entry in data: | ||
devs.append((entry - mmm) * (entry - mmm)) | ||
|
||
s_dev2 = sum(devs) / len(data) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing a square root? |
||
return {'standard deviation': s_dev2} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
There was a problem hiding this comment.
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!