Skip to content

Instantly share code, notes, and snippets.

View alexlib's full-sized avatar
:octocat:
Working

Alex Liberzon alexlib

:octocat:
Working
View GitHub Profile
@alexlib
alexlib / napari-track-tests.py
Created September 5, 2021 19:26 — forked from quantumjot/napari-track-tests.py
Tests for napari track layer
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):
@alexlib
alexlib / xr_lowess.py
Created August 11, 2021 07:32 — forked from serazing/xr_lowess.py
Lowess for xarray
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.
@alexlib
alexlib / elaborate_matplotlib_animations.py
Created June 13, 2021 18:15 — forked from hugke729/elaborate_matplotlib_animations.py
Quiver, 3D contour, polar, scatter, and fill animations with Matplotlib
# 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
# 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
@alexlib
alexlib / read_parquet.py
Created April 3, 2021 21:54 — forked from lpillmann/read_parquet.py
Read partitioned parquet files into pandas DataFrame from Google Cloud Storage using PyArrow
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)
@alexlib
alexlib / matlab_notebook.ipynb
Created February 20, 2021 08:26 — forked from phaustin/matlab_notebook.ipynb
Chapter 1 A Brief Tutorial. A direct translation of Chapter 1 of D.J. Higham and N.J. Higham, MATLAB Guide (2005)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexlib
alexlib / mask_creator.ipynb
Last active January 6, 2021 23:25 — forked from arwoll/mask_creator.py
Tool to create polygon mask in Matplotlib
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexlib
alexlib / Hardy Cross Method-Changed Github.ipynb
Created August 28, 2020 15:22 — forked from AndreasTsikri/Hardy Cross Method-Changed Github.ipynb
Hardy cross method of solution for the pipeline network problem
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexlib
alexlib / README.md
Created August 27, 2020 13:58 — forked from amroamroamro/README.md
[Python] Fitting plane/surface to a set of data points

Python version of the MATLAB code in this Stack Overflow post: http://stackoverflow.com/a/18648210/97160

The example shows how to determine the best-fit plane/surface (1st or higher order polynomial) over a set of three-dimensional points.

Implemented in Python + NumPy + SciPy + matplotlib.

quadratic_surface