-
Notifications
You must be signed in to change notification settings - Fork 188
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
Issue tracker for Tutorial 01 #3934
Comments
Also, the tutorial implements the cyclic autocorrelation function: import numpy as np
import tidynamics
import matplotlib.pyplot as plt
def autocor(x):
x = np.asarray(x)
mean = x.mean()
var = np.var(x)
xp = x-mean
corr = np.correlate(xp, xp, 'full')[len(x)-1:]/var/len(x)
return corr
x = np.arange(256)
y = np.sin(x * np.pi/16) / (x+1)**2
acf_td = tidynamics.acf(y) / np.var(y)
acf_tut = autocor(y) * len(x) / (len(x) - np.arange(len(x)))
print(np.sum(np.abs(acf_td - acf_tut)))
plt.plot(acf_td, label='tidynamics')
plt.plot(acf_tut, label='tutorial')
plt.legend()
plt.show() |
Adding round brackets can lead to subtle bugs: delete_precious_data = False
assert(delete_precious_data == True, "I can't delete data") # tuple evaluates to true
cleanup_data() # goodbye precious data In python 3.6+ this construction prints |
Description of changes: - remove crystallization tutorial (partial fix for #3955, closes #3820) - remove tutorial numbers and indicate difficulty level (fixes #3959) - resolve issues in tutorial LJ (fixes #3934) - create a tool to simplify editing exercise2 notebooks by temporarily converting solution markdown cells to executable code cells (fixes #3930) and apply pep8 formatting ```sh # convert solution cells to code cells ./pypresso doc/tutorials/convert.py exercise2 --to-py doc/tutorials/lennard_jones/lennard_jones.ipynb # edit the notebook ./ipypresso notebook # convert solution cells back to markdown cells ./pypresso doc/tutorials/convert.py exercise2 --to-md doc/tutorials/lennard_jones/lennard_jones.ipynb # apply autopep formatting rules ./pypresso doc/tutorials/convert.py exercise2 --pep8 doc/tutorials/lennard_jones/lennard_jones.ipynb ``` - implement an autocorrelation function `espressomd.analyze.autocorrelation()` to calculate the ACF of 1-dimensional and 2-dimensional data
List of things to fix based on feedback from the summer school.
matplotlib
plotsfig = plt.figure(figsize=(10, 8))
instead offig = plt.figure()
to be more readable by taking the entire width of the HTML divplt.show()
to avoid printing the return value of the last matplotlib methodscipy
import scipy.optimize
in the cell where it is used for the first time, i.e. thedef autocor()
cellCorrelator
accumulator, because the normalization doesn't consider that for larger tau values, the sample size is smaller and the variance highernumpy
andscipy
are known to be tricky to use for scripting autocorrelation (de Buyl 2018, DOI:10.21105/joss.00877)tidynamics
in the docker imageassert
don't need round bracketsThe text was updated successfully, but these errors were encountered: