num = 37
if num > 100:
    print('greater')
else:
    print('not greater')
print('done')

"""
Explanation: Introduction to Python part IX (And a discussion of stochastic processes)
Activity 1: Discussion of stochastic processes

How does a stochastic process extend the idea of a random vector?  What are two additional considerations we have to make in this extension?
What is a Gaussian process?  What are two well-known examples of Gaussian processes?
What properties define a Wiener process?  How is this related to well-known physical models?

Activity 2: Conditionals in Python
In our last lesson, we discovered something suspicious was going on in our inflammation data by drawing some plots. How can we use Python to automatically recognize the different features we saw, and take a different action for each? In this lesson, we’ll learn how to write code that runs only when certain conditions are true.
End of explanation
"""


num = -3

if num > 0:
    print(num, 'is positive')
elif num == 0:
    print(num, 'is zero')
else:
    print(num, 'is negative')

"""
Explanation: The second line of this code uses the keyword if to tell Python that we want to make a choice. If the test that follows the if statement is true, the body of the if (i.e., the set of lines indented underneath it) is executed, and “greater” is printed. If the test is false, the body of the else is executed instead, and “not greater” is printed. Only one or the other is ever executed before continuing on with program execution to print “done”:

We can also chain several tests together using elif, which is short for “else if”. The following Python code uses elif to print the sign of a number.
End of explanation
"""


if (1 > 0) and (-1 >= 0):
    print('both parts are true')
else:
    print('at least one part is false')

"""
Explanation: Note that to test for equality we use a double equals sign == rather than a single equals sign = which is used to assign values.
Along with the > and == operators we have already used for comparing values in our conditionals, there are a few more options to know about:

&gt;: greater than
&lt;: less than
==: equal to
!=: does not equal
&gt;=: greater than or equal to
&lt;=: less than or equal to

We can also combine tests using and and or. and is only true if both parts are true:
End of explanation
"""


if (1 < 0) or (1 >= 0):
    print('at least one test is true')

"""
Explanation: while or is true if at least one part is true:
End of explanation
"""


import numpy as np
data = np.loadtxt("./swc-python/data/inflammation-01.csv", delimiter=",")

"""
Explanation: Activity 3: Checking our Data
Now that we’ve seen how conditionals work, we can use them to check for the suspicious features we saw in our inflammation data. We are about to use functions provided by the numpy module again.
End of explanation
"""


max_inflammation_0 = np.max(data, axis=0)[0]
max_inflammation_20 = np.max(data, axis=0)[20]

if max_inflammation_0 == 0 and max_inflammation_20 == 20:
    print('Suspicious looking maxima!')

"""
Explanation: From the first couple of plots, we saw that maximum daily inflammation exhibits a strange behavior and raises one unit a day. Wouldn’t it be a good idea to detect such behavior and report it as suspicious? Let’s do that! However, instead of checking every single day of the study, let’s merely check if maximum inflammation in the beginning (day 0) and in the middle (day 20) of the study are equal to the corresponding day numbers.
End of explanation
"""


if max_inflammation_0 == 0 and max_inflammation_20 == 20:
    print('Suspicious looking maxima!')
elif np.sum(np.min(data, axis=0)) == 0:
    print('Minima add up to zero!')

"""
Explanation: We also saw a different problem in the third dataset; the minima per day were all zero (looks like a healthy person snuck into our study). We can also check for this with an elif condition:
End of explanation
"""


if max_inflammation_0 == 0 and max_inflammation_20 == 20:
    print('Suspicious looking maxima!')
elif np.sum(np.min(data, axis=0)) == 0:
    print('Minima add up to zero!')
else:
    print('Seems OK!')

"""
Explanation: And if neither of these conditions are true, we can use else to give the all-clear:
End of explanation
"""


