This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Different functions to get pairwise distance in cubic box with PBC | |
| Args: | |
| positions: the positions of particles, shape (N, dim) | |
| box (int or float): the size of the box | |
| Return: | |
| np.ndarray: the pair-wise distances, shape (N, N) | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import napari | |
| import numpy as np | |
| def _circle(r, theta): | |
| x = r*np.cos(theta) | |
| y = r*np.sin(theta) | |
| return x, y | |
| def _sphere(r, theta, psi): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import numba | |
| import xarray as xr | |
| @numba.jit(nopython=True) | |
| def lowess_1d(y, x, alpha=2. / 3., it=10): | |
| """lowess(x, y, f=2./3., iter=3) -> yest | |
| Lowess smoother: Robust locally weighted regression. | |
| The lowess function fits a nonparametric regression curve to a scatterplot. | |
| The arrays x and y contain an equal number of elements; each pair |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Example animations using matplotlib's FuncAnimation | |
| # Ken Hughes. August 2019 | |
| # For more detail, see | |
| #https://brushingupscience.com/2019/08/01/elaborate-matplotlib-animations/ | |
| # Examples include | |
| # - quiver plot with variable positions and directions | |
| # - 3D contour plot | |
| # - line plot on a polar projection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Example animations using matplotlib's FuncAnimation | |
| # Ken Hughes. 18 June 2016. | |
| # For more detail, see | |
| # https://brushingupscience.wordpress.com/2016/06/21/matplotlib-animations-the-easy-way/ | |
| # Examples include | |
| # - line plot | |
| # - pcolor plot | |
| # - scatter plot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gcsfs | |
| import pyarrow | |
| def read_parquet(gs_directory_path, to_pandas=True): | |
| """ | |
| Reads multiple (partitioned) parquet files from a GS directory | |
| e.g. 'gs://<bucket>/<directory>' (without ending /) | |
| """ | |
| gs = gcsfs.GCSFileSystem() | |
| arrow_df = pyarrow.parquet.ParquetDataset(gs_directory_path, filesystem=gs) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.