Skip to content

Instantly share code, notes, and snippets.

View davipatti's full-sized avatar

David Pattinson davipatti

  • UW-Madison
  • New York, USA
View GitHub Profile
@davipatti
davipatti / pytest-log.txt
Created January 16, 2026 20:26
limix-legacy pytest log
============================= test session starts ==============================
platform darwin -- Python 3.11.11, pytest-9.0.2, pluggy-1.6.0
rootdir: /Users/pattinson/myrepos/mapdeduce
configfile: pyproject.toml
collected 81 items / 2 errors
==================================== ERRORS ====================================
______________________ ERROR collecting test/test_blup.py ______________________
ImportError while importing test module '/Users/pattinson/myrepos/mapdeduce/test/test_blup.py'.
Hint: make sure your test modules/packages have valid Python names.
@davipatti
davipatti / build-log.txt
Created January 16, 2026 20:20
limix-legacy build log
Resolved 68 packages in 2ms
Building limix-legacy @ git+https://github.com/davipatti/limix-legacy@3636e3d420750a8af5fad27e849122d3068ef459
× Failed to build `limix-legacy @ git+https://github.com/davipatti/limix-legacy@3636e3d420750a8af5fad27e849122d3068ef459`
├─▶ The build backend returned an error
╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)
[stdout]
running bdist_wheel
running build
running build_py
@davipatti
davipatti / gist:1610f5b921794c9c4fc9e43127144559
Created January 16, 2026 20:04
limix legacy uv build failure
❯ uv sync
Using CPython 3.11.11 interpreter at: /opt/homebrew/opt/[email protected]/bin/python3.11
Creating virtual environment at: .venv
Resolved 68 packages in 387ms
Built mapdeduce @ file:///Users/pattinson/myrepos/mapdeduce
Updated https://github.com/davipatti/limix-legacy (3636e3d420750a8af5fad27e849122d3068ef459)
× Failed to build `limix-legacy @ git+https://github.com/davipatti/limix-legacy@3636e3d420750a8af5fad27e849122d3068ef459`
├─▶ The build backend returned an error
╰─▶ Call to `setuptools.build_meta.build_wheel` failed (exit status: 1)
@davipatti
davipatti / packer.py
Created December 18, 2025 20:04
Polyomino packer using ILP written by gemini.
import numpy as np
from scipy.optimize import milp, LinearConstraint, Bounds
class PolyominoPacker:
def __init__(self, grid_rows, grid_cols):
self.R = grid_rows
self.C = grid_cols
self.pieces = [] # List of shapes (each shape is list of coords)
@davipatti
davipatti / palindromes.py
Last active October 29, 2025 17:25
Finding palindromes, solution to Terry's little puzzle.
"""
# palindromes
See https://github.com/terrycojones/palindromes
"""
def substrings(s, l):
"""
generate length `l` substrings of `s`
@davipatti
davipatti / set.py
Created July 21, 2025 12:57
Faffing around with the game 'set'.
#!/usr/bin/env python3
from typing import Generator, Union, Iterable
import random
from itertools import repeat, product
class Set(frozenset):
"""
A 'Set' of cards from the game set. This class is to avoid confusion with the
@davipatti
davipatti / pymc_multilevel_hierarchical_model.py
Created July 11, 2025 16:27
PyMC multilevel hierarchical model #pymc #hierarchical #censored
def titer_hierarchy_model(
df: pd.DataFrame,
l1_name: str = "day",
l2_name: str = "day_size",
transform: Callable = day_size_to_day,
) -> pm.Model:
"""
Args:
df: DataFrame
l1_name: Column that contains the first level.
@davipatti
davipatti / immich.py
Created May 8, 2025 20:47
Fetch a random image from an immich server that contains particular people, resize and pad that image, and return it in a fastapi response. Used for fetching and resizing images to display on a raspberry pi pico which an inky 7.3 e-ink screen.
#!/usr/bin/env python3
from typing import Annotated, Union
import io
import json
import requests
from fastapi import FastAPI, Query
from fastapi.responses import Response
from PIL import Image, ImageOps
@davipatti
davipatti / back-forth.py
Created March 27, 2025 23:55
Increment a counter up and down in marimo.
import marimo
__generated_with = "0.11.30"
app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
return (mo,)
~/g/grounding-dino-tiny-ONNX[1]►imxconv-pt -i grounding-dino-tiny-ONNX/onnx/model.onnx -o imx500-conversion ghog-env 1.002s 08:22
2025-03-14 08:22:54,326 INFO : Running version 1.10.0 [~/.virtualenvs/ghog-env/lib/python3.10/site-packages/uni/common/logger.py:148]
2025-03-14 08:22:54,326 INFO : Converting grounding-dino-tiny-ONNX/onnx/model.onnx [~/.virtualenvs/ghog-env/lib/python3.10/site-packages/uni/common/logger.py:148]
2025-03-14 08:22:57,705 ERROR : CODE: [EXEC] 'NoneType' object cannot be interpreted as an integer [~/.virtualenvs/ghog-env/lib/python3.10/site-packages/uni/common/logger.py:160]
Traceback (most recent call last):
File "~/.virtualenvs/ghog-env/lib/python3.10/site-packages/uni/common/main.py", line 143, in execute
g, metadata = self.convert_model(args.input_path, vis_dir)
File "~/.virtualenvs/ghog-env/lib/python3.10/site-packages/uni/common/main.py", line 61, in convert_model
parser = self.get_parser(model_path, vis_dir)