Skip to content

Instantly share code, notes, and snippets.

View ivirshup's full-sized avatar
💭
🫠

Isaac Virshup ivirshup

💭
🫠
View GitHub Profile
@ivirshup
ivirshup / scalene-error.txt
Created April 17, 2024 12:23
scalene error
Scalene: An exception of type UnicodeDecodeError occurred. Arguments:
('ascii', b'/* PrismJS 1.26.0\nhttps://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+python&plugins=normalize-whitespace */\n/// <reference lib="WebWorker"/>\n\nvar _self =\n typeof window !== "undefined"\n ? window // if in browser\n : typeof WorkerGlobalScope !== "undefined" &&\n self instanceof WorkerGlobalScope\n ? self // if in worker\n : {}; // if in node js\n\n/**\n * Prism: Lightweight, robust, elegant syntax highlighting\n *\n * @license MIT <https://opensource.org/licenses/MIT>\n * @author Lea Verou <https://lea.verou.me>\n * @namespace\n * @public\n */\nvar Prism = (function (_self) {\n // Private helper vars\n var lang = /(?:^|\\s)lang(?:uage)?-([\\w-]+)(?=\\s|$)/i;\n var uniqueId = 0;\n\n // The grammar object for plaintext\n var plainTextGrammar = {};\n\n var _ = {\n /**\n * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highl
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ivirshup
ivirshup / commands.sh
Created January 30, 2024 15:52
Benchmark highly variable genes w/ dask
git checkout dask-hvg
python run_hvg.py
# 544.9354245662689
git checkout dask-hvg-w-pandas
python run_hvg.py
# 130.07193517684937
@ivirshup
ivirshup / run-min-deps.sh
Last active January 16, 2024 14:24
Local script for testing minimum dependency versions
# conda deactivate
mamba env remove -yn anndata-min-deps-test
mamba create -yn anndata-min-deps-test "python=3.9"
PACKAGES=`python3 ci/scripts/min-deps.py pyproject.toml --extra dev test`
# conda activate anndata-min-deps-test
# conda run -n anndata-min-deps-test pip install cupy-cuda12x
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ivirshup
ivirshup / sparse-dask.ipynb
Last active October 9, 2023 10:42
Using sparse dask chunks inside of anndata
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ivirshup
ivirshup / simple_ooc_concat.py
Created March 9, 2023 15:21
Simple OOC concat for anndata
import zarr
import pandas as pd, numpy as np
from anndata.experimental import read_elem, write_elem
from anndata._core.sparse_dataset import SparseDataset
def _df_index(df: zarr.Group) -> np.ndarray:
index_key = df.attrs["_index"]
return read_elem(df[index_key])
@ivirshup
ivirshup / virtual_concatenate.py
Last active March 2, 2023 18:40
h5py virtual dataset with uneven chunk size
# Docs: https://docs.h5py.org/en/stable/vds.html
import h5py
import numpy as np
def virtual_concatenate(datasets: list[h5py.Dataset]) -> h5py.VirtualLayout:
"""Concatenate datasets along the first axis."""
vds = h5py.VirtualLayout(shape=sum(d.shape[0] for d in datasets), dtype=datasets[0].dtype)
offset = 0
for d in datasets: