Skip to content

Instantly share code, notes, and snippets.

@kogens
kogens / rippletank_grating.py
Created September 22, 2023 12:02
Grating for Falstad Rippletank
# Creates a diffraction grating for the Falstad ripple tank simulator
# http://www.falstad.com/ripple/
# Basic parameters
brightness = 480
scale = 1.5625e-8
resolution = 1020
print('$ 3 {} 64 0 1 {} {}'.format(resolution, brightness, scale))
@kogens
kogens / spmloader.md
Last active November 23, 2023 07:28
Loading .spm files (Bruker AFM)

Load SPM files from Bruker AFM Microscopes

Moved to separate repository

The code below is now maintained as a Python package, see https://github.com/kogens/spmpy for a more up to date version.


Setup

Requires Python >= 3.9 with numpy and pint for units, optionally matplotlib for plotting examples below

"""
Extract images from PDF files and decode any QR codes found.
Requirements:
> sudo apt install zbar-tools
> pip install pandas[xlsxwriter] opencv-python pymupdf qrdet qreader tqdm
See also the docs for the QR part
https://github.com/Eric-Canas/qrdet
https://github.com/Eric-Canas/qreader
@kogens
kogens / qr_from_pdf.py
Last active April 28, 2025 18:07
Extract QR codes from PDF files
"""
Extract images from PDF files and decode any QR codes found.
Requirements:
> pip install pandas opencv-python pymupdf qrdet==1.10 qreader==2.11 tqdm xlsxwriter
See also the docs for the QR part
https://github.com/Eric-Canas/qrdet
https://github.com/Eric-Canas/qreader
"""
@kogens
kogens / multithread_fileload.py
Last active April 28, 2023 07:32
Multithreaded file loading example
# See also https://superfastpython.com/threadpoolexecutor-in-python/
import pathlib
from concurrent.futures import ThreadPoolExecutor, as_completed
# Make a list of all excel files in a directory
path = pathlib.Path('path/to/excel/files')
file_list = path.glob('*.xls*')