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 / Readme.md
Created April 26, 2025 06:38
John D'Errico's inpaint in 3D with Python counterexample using Scipy and tests. The Matlab function is from pivSuite v0.8.3
test_inpaint_equivalence.py
..
----------------------------------------------------------------------
Ran 2 tests in 1.908s

OK
(.conda) user@user-NUC8i7BEH:~/Documents/repos/OpenOpticalFlow_PIV_v1$ /home/user/Documents/repos/OpenOpticalFlow_PIV_v1/.conda/bin/python /home/user/Documents/repos/OpenOpticalFlow_PIV_v1/test_inpaint_equivalence.py
..
----------------------------------------------------------------------
@alexlib
alexlib / trajectories_to_eulerian_average_field.py
Last active April 12, 2025 18:44
Flowtracks trajectories to Eulerian average field using RBF interpolator
import numpy as np
from scipy.interpolate import RBFInterpolator
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
def process_frames_average(particles, N, corner_m, fps, max_frames=None):
"""
Process multiple frames to create average velocity maps.
Args:
@alexlib
alexlib / trajectories_to_txt_for_Paraview.py
Last active April 12, 2025 18:31
trajectories to vtk
import pandas as pd
from flowtracks.scene import Scene
import numpy as np
h5_name = r'../corner_51.h5'
particles = Scene(h5_name)
ids = particles.trajectory_ids()
dataframes = []
@alexlib
alexlib / bundle_adjustment_scipy.ipynb
Created March 14, 2025 18:01 — forked from nmayorov/bundle_adjustment_scipy.ipynb
Large scale bundle adjustment in scipy
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.
@alexlib
alexlib / simple_idw.ipynb
Created December 24, 2024 20:52 — forked from Majramos/simple_idw.ipynb
Simple inverse distance weighted (IDW) interpolation with python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexlib
alexlib / 00README.rst
Created December 13, 2024 15:53 — forked from GaelVaroquaux/00README.rst
Copy-less bindings of C-generated arrays with Cython

Cython example of exposing C-computed arrays in Python without data copies

The goal of this example is to show how an existing C codebase for numerical computing (here c_code.c) can be wrapped in Cython to be exposed in Python.

The meat of the example is that the data is allocated in C, but exposed in Python without a copy using the PyArray_SimpleNewFromData numpy

@alexlib
alexlib / detect_overlapping_spheres.ipynb
Last active September 13, 2024 12:08
Remove background for shadow 3D-PTV and detecting overlapping spheres
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexlib
alexlib / custom_feature_detection_template_matching.ipynb
Created June 24, 2024 15:40
Customized image segmentation algorithm to find a sphere using cross-correlation and template matching
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alexlib
alexlib / settling_velocity_app.py
Created May 26, 2024 19:38
Streamlit app that estimates settling terminal velocity of a sphere
import streamlit as st
import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import odeint
def drag_coefficient(Re):
"""Calculate the drag coefficient using the empirical correlation."""
if Re < 1:
return 24 / Re
elif Re < 1000: