Import:
import numpy as np
arrays:
variable = np.linspace(value_start,value_end,value_amount)
array = np.array([v1,v2,v3,v4,v5,v6,etc..])
calculations:
np.sqrt() #square root
np.pi #pi
np.e #e
#array calculations
np.mean(array) #calculates mean
np.std(array) #calculates standard deviation of the set
Read/write:
read = np.genfromtxt("file.csv(or.txt)",dtype='float',delimiter=',',skip_header=1)
np.savetxt('test.txt', array, delimiter=',')
Import:
import matplotlib.pyplot as plt
draw:
plt.xlabel('x_name') # creates a label for the x-axis
plt.ylabel('y_name') # creates a label for the y-axis
plt.title('title') # gives the plot a title
plt.savefig('file_name.png', dpi=resolution(600)) # save a copy of the plot
plt.show()
values:
plt.hist(values,bins=10,density=1)
plt.plot(x,y,'color',label="name")
plt.errorbar(x,y,y_errors,fmt='color',label="name")
legend:
plt.legend()