Skip to content

Instantly share code, notes, and snippets.

import numpy as np
import tifffile
def make_cylinder_profile(x, radius):
valid = np.where(x ** 2 <= radius ** 2)
profile = np.zeros(m)
profile[valid] = 2 * np.sqrt(radius ** 2 - x[valid] ** 2)
return profile
@tfarago
tfarago / resources_leak.py
Created April 11, 2023 10:47
GPU memory leak with UFO when resources are not re-used
import argparse
import gi
import numpy as np
gi.require_version("Ufo", "0.0")
from gi.repository import Ufo
N = 8192
RESOURCES = Ufo.Resources()
PLUGIN_MANAGER = Ufo.PluginManager()
@tfarago
tfarago / break_asyncio_finally.py
Created September 20, 2022 15:03
asyncio coroutines not running through
import asyncio
RUNNING = set([])
async def coro(name, howlong=5, raise_exc=None):
print('start', name)
if raise_exc:
raise raise_exc