Skip to content

Instantly share code, notes, and snippets.

View zonca's full-sized avatar

Andrea Zonca zonca

View GitHub Profile
@zonca
zonca / README.md
Created August 7, 2026 18:16
numpy vs numba performance benchmark

numpy vs numba performance benchmark

A simple benchmark comparing numpy (vectorized) and numba (JIT-compiled parallel loop) for a sum-of-squares computation over a large array.

Performance

On a representative machine the JIT-compiled numba version is roughly 12–15x faster than the vectorized numpy version:

numba vs numpy performance benchmark

A small benchmark that compares the wall-clock performance of equivalent numeric operations written with plain numpy and with numba @njit-compiled code.

What it measures

On a large 1-D float array (10M elements) it compares five operations:

| Operation | Description |

@zonca
zonca / car_output_from_healpix_pysm3.ipynb
Created August 5, 2026 16:35
Producing CAR output from a HEALPix PySM3 sky (executed notebook)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zonca
zonca / compare_flamingo_ksz.executed.ipynb
Last active July 20, 2026 20:15
PySM PR #261: executed FLAMINGO kSZ comparison notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zonca
zonca / low_frequency_synchrotron_model.ipynb
Last active June 25, 2026 23:42
Low frequency synchrotron model (original notebook from PR #258, fixed). Tweaks: ESA PLA free-free URL, ./input_data paths, nside=256 added, exception handler fixed, kernel pysm311. Executed on NERSC Perlmutter job 54963870.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zonca
zonca / low_sync_clean.ipynb
Created June 24, 2026 13:50
Low frequency synchrotron model using pysm3, healpy, pygdsm, cmasher - executed on NERSC Perlmutter compute node (job 54958780). Data files pre-downloaded to input_data/ directory. Fixed: PLA ESA URLs for freefree data (NASA Lambda 404), all paths use ./input_data relative to notebook.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zonca
zonca / test_pr1108_extra.py
Created June 3, 2026 00:38
Extra tests for healpy PR #1108: synalm Cl boundary check fix
import numpy as np
import healpy as hp
import sys
def test_synalm_cl_exactly_lmax_length():
cl = np.ones(33, dtype=np.float64)
lmax = 32
np.random.seed(123)
alm = hp.synalm(cl, lmax=lmax)
assert alm.dtype == np.complex128
@zonca
zonca / healpy_harmonic_ud_grade_comparison.ipynb
Last active May 29, 2026 02:55
healpy harmonic_ud_grade vs ud_grade comparison notebook (executed)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zonca
zonca / comparison_executed.ipynb
Created May 20, 2026 01:28
healpy harmonic_ud_grade vs ud_grade comparison notebook (executed)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
Test script for Issue #268: Do not modify the input astropy table when converting to pandas dataframe.
This script extracts all Python code blocks from episode 03-transform.md and executes them
sequentially to verify the episode content runs correctly end-to-end.
NOTE: The assert statements below (marked with "ASSERT: not part of the lesson") are added
for automated testing purposes only. They are NOT part of the lesson content.
"""