Robert D. French
User Support Specialist
Oak Ridge Leadership Computing Facility
Email: frenchrd@ornl.gov
In [100]:
x = linspace(-10, 10., 1000)
plot(x, sin(x))
Out[100]:
In [101]:
bins = [n/10.0 for n in range(0,11)]
hist(rand(100),bins);
In [59]:
import json
notebook = json.load(open("/Users/rf9/Projects/iPython-Molecular-Dynamics/presentation.ipynb"))
notebook["worksheets"][0]["cells"][4]
Out[59]:
In [43]:
x = array([1,2,3])
x
Out[43]:
Vector addition is now supported via the +
operator
In [64]:
y = array([1,0,1])
x + y
Out[64]:
Standard tools from linear algebra such as Euclidean inner products and norms
In [65]:
x.dot(y)
Out[65]:
In [66]:
numpy.linalg.norm(x - y)
Out[66]:
Scipy functions are automatically applied to each element in the list:
In [36]:
sin(x)**2
Out[36]:
This includes any operation of scalar arithmetic, and extends to everyone's favorite trig identity:
In [37]:
sin(x)**2 + cos(x)**2
Out[37]:
In [69]:
input_config = json.load(open("/Users/rf9/Projects/iPython-Molecular-Dynamics/ExampleInput.dragging.json"))
input_config["particles"]
Out[69]:
In [74]:
import pandas
output = pandas.read_csv("/Users/rf9/Projects/iPython-Molecular-Dynamics/dragging_output.csv")
output.head()
Out[74]:
In [90]:
plot(output["time"],output["y1"], label='Particle A')
plot(output["time"],output["y2"], label='Particle B')
legend(loc='upper left')
Out[90]:
In [91]:
input_config = json.load(open("/Users/rf9/Projects/iPython-Molecular-Dynamics/ExampleInput.oscillation.json"))
input_config["particles"]
Out[91]:
In [92]:
output = pandas.read_csv("/Users/rf9/Projects/iPython-Molecular-Dynamics/oscillation_output.csv")
output.head()
Out[92]:
In [93]:
plot(output["time"],output["y1"], label='Particle A')
plot(output["time"],output["y2"], label='Particle B')
legend(loc='upper left')
Out[93]:
In [98]:
mean(output["y1"]) - input_config["particles"][0]["position"][1]
Out[98]:
In [99]:
mean(output["y2"]) - input_config["particles"][1]["position"][1]
Out[99]:
In [ ]: