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
@nepomnyi
nepomnyi / customDeen.py
Last active December 15, 2022 19:06
The custom implementation of the PIV image preprocessing algorithm after N. Deen et al., "On image preprocessing for PIV of single- and two-phase flows over reflecting objects", Exp. Fluids, 49(2):525-530, 2010.
import cv2
import numpy as np
def customDeen(frame0,
frame1,
blockOne,
algorithmType = 'basic',
minMaxKernel = (15,15),
minMaxLowLimit = 10,
cliplimit = 2.0,
@nepomnyi
nepomnyi / MinMaxForPIV.py
Last active December 14, 2022 22:53
A python min-max filter implementation after Adrain & Westerweel, "Particle image velocimetry", 2011, p.250.
import cv2
import numpy as np
def minMaxFilter(img, filterSize, minContrast):
"""
After R.Adrian, J.Westerweel, "Particle image velocimetry", Cambridge
university press, 2011. See ch.6.1.2, p.248-250.
Parameters: img (ndarray) - image to be filtered
filterSize (ndarray) - a 1x2 numpy array of the filter height
and width correspondingly
@FedericoTartarini
FedericoTartarini / embed_video.tex
Last active June 27, 2024 19:16
Embed a video into LaTeX wihout using Flash
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% this code was copied from https://tex.stackexchange.com/a/516102
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[bigfiles]{pdfbase}
\ExplSyntaxOn
\NewDocumentCommand\embedvideo{smm}{
\group_begin:
\leavevmode
\tl_if_exist:cTF{file_\file_mdfive_hash:n{#3}}{
@yangyushi
yangyushi / pdist_pbc.py
Created November 2, 2020 14:36
Different ways to get pairwise distance in cubic box with PBC in Python
"""
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)
"""
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ErichZimmer
ErichZimmer / DifferentPlots2Revised.ipynb
Last active August 24, 2020 10:30
Second version of the OpenPIV analysis code that provides more raw results. Furthermore, this code was written in a different and more simple way compared to the previous version in case if the previous analysis code doesn't execute properly.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@AndreasTsikri
AndreasTsikri / Hardy Cross Method-Changed Github.ipynb
Last active August 28, 2020 15:23 — forked from alexlib/hardy_cross_pipe_network.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.
@IlievskiV
IlievskiV / calculate_circle_area.ipynb
Created June 7, 2020 23:52
How to numerically calculate the area of a circle
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@serazing
serazing / xr_lowess.py
Last active December 27, 2023 11:41
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
@yosefm
yosefm / link_trajectories.py
Created April 2, 2020 22:38
Trajectory linking with Flowtracks