π° Source for reproducing the pub frontend
This repository contains the code and analysis for the OpenAstrocytes pub, demonstrating how off-the-shelf vision transformer embeddings (DINOv3) capture rich structure in astrocyte calcium dynamics.
The analysis demonstrates that DINOv3 patch embeddings applied to astrocyte calcium imaging data can:
- Reflect astrocyte network anatomy
- Capture evoked dynamics in response to compound applications
- Generalize across distinct experimental sessions and subjects
- Enable accurate decoding of applied compounds from single patches
ββ€οΈβπ₯ Forecast
This project combines:
- A Python package (
oa_pub) with analysis utilities for working with astrocyte calcium imaging and embeddings - A Quarto document that generates the full pub static site with embedded analysis, figures, and narrative
pub-open-astrocytes/
βββ src/oa_pub/ # Python analysis package
β βββ analysis/ # Data loading and statistical utilities
β β βββ _common.py # Helper functions (e.g., is_between)
β β βββ _constants.py # Constants (patch grid dimensions, compound aliases)
β β βββ _extraction.py # Data loading (get_movie, get_movie_traces)
β β βββ _stats.py # Statistics (baseline_normalize, bootstrap)
β βββ figures/ # Plotting utilities
β βββ __init__.py # Visualization functions
βββ quarto/ # Publication source
β βββ index.qmd # Main Quarto document with analysis
β βββ _quarto.yml # Quarto configuration
β βββ _brand.yml # Forecast branding
β βββ img/ # Images and assets
β βββ csl/ # Citation styles
βββ _public/ # Generated publication output
βββ pyproject.toml # Python package configuration
βββ README.md # This file
- Python 3.12 or later
- uv package manager (installation instructions)
- Quarto (installation instructions)
git clone https://github.com/forecast-bio/pub-open-astrocytes.git
cd pub-open-astrocytes# Install dependencies with uv
uv sync
# This creates a virtual environment in .venv/ and installs all dependencies# Test that the package is importable
uv run python -c "import oa_pub; print('Success!')"cd quarto
uv run quarto renderThis will:
- Execute all Python code blocks in
index.qmd - Load data from the OpenAstrocytes dataset
- Generate all figures and analyses
- Output the complete pub to
_public/index.html
Note: The first render will take significant time as it streams data from the cloud and computes embeddings. Subsequent renders use Quarto's caching system for faster execution.
cd quarto
uv run quarto previewThis opens a browser with the pub and automatically reloads when you make changes to index.qmd.
import oa_pub.analysis as analysis
# Load a recording by UUID
movie_uuid = "your-movie-uuid-here"
frames = analysis.get_movie(movie_uuid, verbose=True)
# Get patch embedding traces (14Γ14 grid)
traces = analysis.get_movie_traces(movie_uuid, verbose=True)
# Extract time information
times, dt = analysis.movie_times(frames)
# Apply baseline normalization
normalized, mean, std = analysis.baseline_normalize(
times, signal, window=(-10, 0)
)
# Bootstrap statistics
boot_results = analysis.boot_stat(
data,
lambda x: np.mean(x, axis=0),
n=200
)from oa_pub.figures import plot_micrograph, plot_trace_grid
from forecast_style import HouseStyle
# Plot a micrograph with scale bar
with HouseStyle() as s:
plot_micrograph(s, image, scale_bar=100.)
# Plot a grid of traces
with HouseStyle() as s:
fig, axs = plt.subplots(14, 14, figsize=(12, 12))
plot_trace_grid(axs, times, traces, color='b')This project uses the OpenAstrocytes dataset, which is publicly available and streamed on-demand:
# Install the astrocytes package
pip install astrocytes
# Or with uv
uv add astrocytesThe oa_pub.analysis module handles data streaming automatically when you call functions like get_movie() and get_movie_traces().
Use verbose parameters for progress output during data loading.
If you use this code or the OpenAstrocytes dataset in your research, please cite:
@article{levesque2025openastrocytes,
author = {Maxine Levesque and Kira Poskanzer},
title = {OpenAstrocytes},
journal = {Forecast Research},
year = {2025},
note = {https://forecast.bio/research/open-astrocytes/},
}- OpenAstrocytes data hive: Available via the
astrocytespackage - Forecast: https://forecast.bio
- OpenAstrocytes pub: View the rendered pub
Copyright Β© 2025 Forecast Bio, Inc.
The narrative contents of this article are licensed under the Creative Commons CC-BY 4.0 license.
Code contributions in this repo are licensed under the Mozilla Public License 2.0; see the LICENSE.md file for details.
Developed by the Open Science team at Forecast.
Docs and README largely by Claude. If they hallucinated, let us know in the issues!
Support for the production of OpenAstrocytes and this pub at Forecast was generously provided by the Special Initiatives division of the Astera Institute.