Python bindings for libqe — generic QE numerics: adjacency, normalization, statistics, door, and trajectory kernels
Formerly published as pylibqe.
Python >=3.9 · API documentation · Source code · Homepage · Documentation · Bug Tracker
Also available for R: libqe · Julia: libqe · npm: @qe-libs/libqe-wasm · C++ (Conan): libqe
uv
uv add qe-lib --index qe-libs=https://qe-libs.org/py/simple/
pip
pip install --extra-index-url https://qe-libs.org/py/simple/ qe-lib
requirements.txt
--extra-index-url https://qe-libs.org/py/simple/ qe-lib
Latest development build (0.2.1.9001)
pip install --extra-index-url https://qe-libs.org/py/dev/simple/ qe-lib
uv add qe-lib --index qe-libs-dev=https://qe-libs.org/py/dev/simple/
Development builds are built from main and served only by the
development index; the regular index installs releases.
Links in the wheel columns are the Python versions each wheel supports; pip and uv pick the right file automatically.
| Version | Published | Source | Linux x86_64 · glibc 2.27+ | macOS arm64 · macOS 26.0+ | Windows x64 |
|---|---|---|---|---|---|
| 0.2.1.9001 | 2026-10-14 | .tar.gz | 3.11 3.12 3.13 | 3.11 3.12 3.13 | 3.11 3.12 3.13 |
| 0.2.0 | 2026-10-13 | .tar.gz | 3.11 3.12 3.13 | 3.11 3.12 3.13 | 3.11 3.12 3.13 |
| 0.1.9 | 2026-10-09 | .tar.gz | 3.11 3.12 3.13 | 3.11 3.12 3.13 | 3.11 3.12 3.13 |
| 0.1.8 | 2026-10-07 | .tar.gz | 3.11 3.12 3.13 | 3.11 3.12 3.13 | 3.11 3.12 3.13 |
| 0.1.7 | 2026-10-06 | .tar.gz | 3.11 3.12 3.13 | 3.11 3.12 3.13 | — |
For 0.2.0.
numpypytest (extra: dev)numpy (extra: dev)nanobind bindings that expose the libqe modules as the qe Python package
(install qe-lib, import qe),
built with CMake + scikit-build-core.
All matrix arguments are 2-D numpy.ndarray with dtype=float64, C-contiguous.
All vector arguments are 1-D numpy.ndarray with dtype=float64.
Return values are always freshly allocated numpy arrays owned by Python.
The ENA model code (rotations, node positions, ena_correlation, CCD) is in
qe-ena (import ena) and all
accumulation in qe-tma
(import tma); the qe.accumulation, qe.rotation and qe.ccd submodules
were removed in 0.2.0.
qe.adjacency| Function | Returns | Notes |
|---|---|---|
choose_two(n) |
int |
n × (n-1) / 2 |
connection_indices(len, row=-1) |
2 × n_pairs ndarray[int64] |
Upper-tri (i, j) pairs. row=-1 both rows, 0 row-only, 1 col-only |
code_connections(v) |
1-D ndarray |
Pairwise products of a code vector → connection vector |
fold_directed_network(v) |
1-D ndarray |
n² directed vector → upper-tri (symmetric pairs summed) |
network_to_vector(x, full=True) |
1-D ndarray |
Matrix → flat vector. full=True → n², False → upper-tri |
connection_names(names) |
list[str] |
"A & B" pair labels for every upper-tri position |
qe.normalization| Function | Returns | Notes |
|---|---|---|
normalize_networks(m) |
2-D ndarray |
Row-wise L2 normalization. Zero rows left unchanged. |
scale_networks(m) |
2-D ndarray |
Max-norm scaling: divide all rows by the largest row L2 norm. |
qe.modeling| Function | Returns | Notes |
|---|---|---|
center_points(values) |
2-D ndarray |
Subtract column means. |
mean_ci(points, conf_level=0.95) |
n_dims × 3 ndarray |
[mean, ci_lower, ci_upper] — matches rENA t.test exactly. |
outlier_ci(points, iqr_factor=1.5) |
n_dims × 2 ndarray |
[lower, upper] symmetric around 0 — matches rENA IQR formula. |
group_stats(g1, g2) |
GroupStatsResult |
Per-dimension Welch t-test + Wilcoxon rank-sum. See fields below. |
GroupStatsResult fields| Field | Type | Notes |
|---|---|---|
n1, n2 |
int |
Sample sizes |
t |
ndarray (n_dims,) |
Welch t-statistic per dimension |
df |
ndarray (n_dims,) |
Welch–Satterthwaite degrees of freedom |
pvalue_t |
ndarray (n_dims,) |
Two-tailed p-values (t-test) |
cohens_d |
ndarray (n_dims,) |
Cohen's d (pooled SD, group1 − group2) |
means |
2 × n_dims ndarray |
Row 0 = group1, row 1 = group2 |
sds |
2 × n_dims ndarray |
Sample standard deviations |
U |
ndarray (n_dims,) |
Wilcoxon U for group 1 (= R's W) |
pvalue_u |
ndarray (n_dims,) |
Two-tailed p-values (normal approx, tie + continuity correction) |
effect_r |
ndarray (n_dims,) |
Rank-biserial: 1 − 2·U / (n1·n2) |
medians |
2 × n_dims ndarray |
Row 0 = group1, row 1 = group2 |
qe.door| Function | Returns | Notes |
|---|---|---|
lookback_block(block, lookback_size=20, aggregate_mean=False, weighting_linear=False, segment_ids=[]) |
2-D ndarray |
Lookback pooling over one unit block; matches ETM missing-value behavior. |
ema_block(block, alpha=0.1, segment_ids=[]) |
2-D ndarray |
EMA smoothing over one unit block; missing current values carry the prior smoothed value. |
qe.trajectory| Function | Returns | Notes |
|---|---|---|
fit_poly(points, t=None, max_degree=3, fixed_degree=0, criterion="loocv", basis="orthogonal") |
dict |
Fit a 2D polynomial trajectory; default basis matches R stats::poly predictions. |
eval_curve(coeffs_x, coeffs_y, t_eval) |
2-D ndarray |
Evaluate fitted trajectory coordinates. |
eval_derivatives(coeffs_x, coeffs_y, t_eval) |
dict |
Velocity, acceleration, speed, heading rate, and curvature. |
integrated_distance(...) |
float |
Integrated Euclidean distance between curves. |
lagged_distance(...) |
float |
Normalized follower/leader lagged curve distance. |
signed_turn_lag(...) / sweep_signed_turn_lags(...) |
dict |
Discrete signed turn-lag distance metrics. |
dist_dist_correlation(X, Y) |
float |
Correlation between pairwise distance structures. |
pip install nanobind or brew install nanobind)pip install scikit-build-core)cd libqe/python
pip install -e ".[dev]"
Or build a wheel:
pip wheel .
cd libqe/python
pytest tests/
import numpy as np
from qe import adjacency, normalization, modeling
# Pair names for 3 codes
print(adjacency.connection_names(["X", "Y", "Z"]))
# ['X & Y', 'X & Z', 'Y & Z']
# Sphere normalization
lw = np.array([[1,1,0],[1,0,1],[0,1,1]], dtype=float)
normed = normalization.normalize_networks(lw)
# Two-group comparison
g1 = np.random.randn(20, 2)
g2 = np.random.randn(18, 2) + 0.5
r = modeling.group_stats(g1, g2)
print(r.pvalue_t) # per-dimension two-tailed p-values
| File | Size | SHA-256 |
|---|---|---|
| qe_lib-0.2.1.9001.tar.gz | 44.6 KB | 488173b2375d5853dd2d3fa0462e17c640d7c91fb7cca37848e23703736ec4d1 |
| qe_lib-0.2.1.9001-cp313-cp313-win_amd64.whl | 5.6 MB | e36c966090066787e6ffad6a682650a748e6fc567a315882effa80f704ed5c31 |
| qe_lib-0.2.1.9001-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.6 MB | eab9b5eb60dba4728b4358d97614f90e0c821ff599ae0b484b5dd8b3de128e54 |
| qe_lib-0.2.1.9001-cp313-cp313-macosx_26_0_arm64.whl | 141.2 KB | 661eb8226ff5eeb1eaf0ae2c171f060ba82a9fb0e9ca268b2e1a6a504ab25395 |
| qe_lib-0.2.1.9001-cp312-cp312-win_amd64.whl | 5.6 MB | ac7b916585d583aa5068b51a234d484db5b62555dcb8a477d001e0c4fbd91cf6 |
| qe_lib-0.2.1.9001-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.6 MB | 8ccc34b9fab953c21e6eabb37eb59e5d40ea739616f2a842855307ee39162ba4 |
| qe_lib-0.2.1.9001-cp312-cp312-macosx_26_0_arm64.whl | 141.3 KB | 25eab6c3b410878a210896cc2bfad067891c6b6485802713da8f0a64b3df4e57 |
| qe_lib-0.2.1.9001-cp311-cp311-win_amd64.whl | 5.6 MB | 58efd41ccde788a0ea80ce08b913afbd6c6e8f9a6c09b6a2c2c91df1652992e9 |
| qe_lib-0.2.1.9001-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.6 MB | 125f0f62f23d333aa9b4b833bdf8242d9c6e2e4b8b5c0de40c92cc8d0dfebbb4 |
| qe_lib-0.2.1.9001-cp311-cp311-macosx_26_0_arm64.whl | 141.8 KB | 7747d4f18bc9230fa0267233b01af94f4893ba3ff8c1cc6be71fda8b53576f10 |
| qe_lib-0.2.0.tar.gz | 44.3 KB | 8850c08b98220fb62f1b78ff84e347c0aba20958befd3fc29bbd12952424ccb3 |
| qe_lib-0.2.0-cp313-cp313-win_amd64.whl | 5.6 MB | 3da99f50c6a7797099627ecd1399e7caf4cb06d660ce1b578faef6ca148859e9 |
| qe_lib-0.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.6 MB | 602f09c94da9bab2c92d9655323b159d4e9a661bf9449644747984686b738eaa |
| qe_lib-0.2.0-cp313-cp313-macosx_26_0_arm64.whl | 141.2 KB | 8444c40d91515dd664cdd4b2871db7d10cd5e2b8500dc44618150eb004b9526c |
| qe_lib-0.2.0-cp312-cp312-win_amd64.whl | 5.6 MB | 2c908421e5518f9e8594dc6f2e835f1e9f9f9b98b2a0f6061f582c80f4047351 |
| qe_lib-0.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.6 MB | c7888fc90cb9d92390667581bd61974289b0d84412a07010caeccc9fb7f236c9 |
| qe_lib-0.2.0-cp312-cp312-macosx_26_0_arm64.whl | 141.2 KB | 7883ba309e8cd9289bc657dda47ece7eaad3b6833627c090700cfdb3b37bf307 |
| qe_lib-0.2.0-cp311-cp311-win_amd64.whl | 5.6 MB | 611eda7ca4105969522b1cfd5e1c98f654c6c5a8ed5d213bac6abdad152ff00a |
| qe_lib-0.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.6 MB | 2702be9fa4516da91d492e772e7fc709affaf4531158a03f62898d59d7a0a22b |
| qe_lib-0.2.0-cp311-cp311-macosx_26_0_arm64.whl | 141.8 KB | 9b5071d250a9ac77797801015eff8b9bcd0cd0fad87d79a8a6e684f506354fd1 |
| qe_lib-0.1.9.tar.gz | 85.6 KB | 9d62e1226b36ac79f409025213021e3d93270a09d866c97b0967fb6d8ac28f0f |
| qe_lib-0.1.9-cp313-cp313-win_amd64.whl | 5.7 MB | a3bcda5067b07a36c31854649c4b9665a47a8d9983b3ba9f4b68fe71dadd6b26 |
| qe_lib-0.1.9-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | 2750c4ad41e7212962be057661aa8b18c9f5574032a2b3dfd434e6ab4ac69d14 |
| qe_lib-0.1.9-cp313-cp313-macosx_26_0_arm64.whl | 248.8 KB | 307b9529121d554e39e41c946b3a84bc559434848c76cbb871219d09b935f976 |
| qe_lib-0.1.9-cp312-cp312-win_amd64.whl | 5.7 MB | 74f38a91b4a14a22c408630ec080b70d4bb56cc9a79e5601e806a59ab8d5d60c |
| qe_lib-0.1.9-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | 589e593760910471e02c158919c85b67aa0fcf6484f81ba99925ef99a2d1924f |
| qe_lib-0.1.9-cp312-cp312-macosx_26_0_arm64.whl | 248.7 KB | 32c3f9f65379e739bf3810281e243167a8276bd4ee78cd1f0940d8b0afb0b9ce |
| qe_lib-0.1.9-cp311-cp311-win_amd64.whl | 5.7 MB | 231db874139119fb7f79a1e7a2e5b907e41ff795b1ccf072b50502d0d744cfff |
| qe_lib-0.1.9-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | 24742929d9d7ed87bdcf19e35f066d9ea0b7a34082547240f22e2a8a8fa3257a |
| qe_lib-0.1.9-cp311-cp311-macosx_26_0_arm64.whl | 249.8 KB | e8525002b076db4071a5abda5fcd7c60a968d69827e74e8d793947843550d84d |
| qe_lib-0.1.8.tar.gz | 81.8 KB | 3721b1d575bcb487e22756f63be0c9ff7cba4db228ef542c49f82dc7cd269b13 |
| qe_lib-0.1.8-cp313-cp313-win_amd64.whl | 5.7 MB | 3d256bf6fbe29c206c2c833e19b86140bee9e37382c82ef2a1c10e8258747e04 |
| qe_lib-0.1.8-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | 525a8031eb7abf4a773d7ce2a57169b2dd0ad062522a199eb62d3b1ef98506d1 |
| qe_lib-0.1.8-cp313-cp313-macosx_26_0_arm64.whl | 243.4 KB | c36670966c2efa302bc305337274a0e5aa5ac22d9ee4875e83ef9870f7fa9677 |
| qe_lib-0.1.8-cp312-cp312-win_amd64.whl | 5.7 MB | 15d26769f2934792c04224e3a9eb817574e2b3b5aa3b2f94f3f27488fe50327d |
| qe_lib-0.1.8-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | da3c64453fd780d039c3ad9f607c2b42fc9c486a8034d8155f99421cc3660426 |
| qe_lib-0.1.8-cp312-cp312-macosx_26_0_arm64.whl | 243.3 KB | f58d763b7456211509168eaec3fbf869bfcbd346f7c2f718228520b1566341b5 |
| qe_lib-0.1.8-cp311-cp311-win_amd64.whl | 5.7 MB | c6622cbd6bf64cae385a3741dc93cd0d2821faa9fe83579a7433a4ab2b77cea9 |
| qe_lib-0.1.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | 05d4635be208e77f32dff09073cde4093c9594e4911db20381bf8a5d2dc42303 |
| qe_lib-0.1.8-cp311-cp311-macosx_26_0_arm64.whl | 244.1 KB | 1b2781894266e69c80bd23ca0211eaff65ad5c1b42d27df1a6b7feaa057762ac |
| qe_lib-0.1.7.tar.gz | 36.6 KB | 307dd5f128d6387c9faced9609c29431abc327eccca3685f25167ae943be20d5 |
| qe_lib-0.1.7-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | 057e6125e0c8f542038e8507cf6a6cb3a40e34ce00a4fe02f69f251d90bdce2c |
| qe_lib-0.1.7-cp313-cp313-macosx_26_0_arm64.whl | 243.4 KB | 5daa5a2c20c0a0536ee361bfa59ad85bb6e267b70e0922b1e29f57d355bc6a27 |
| qe_lib-0.1.7-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | 69f2cab6ee8e5285973f1733390a6aaa0b2678bf696f04b6c301c069be121a72 |
| qe_lib-0.1.7-cp312-cp312-macosx_26_0_arm64.whl | 243.3 KB | 8114c8e4f9d474c91e32f6f220db04bdb58f0cf2327cbf783f6bc0127b6dfce1 |
| qe_lib-0.1.7-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | b6da3929f998c4e7036be98db93cfd27c3d3eb7164352d78fced7fc98b6aa510 |
| qe_lib-0.1.7-cp311-cp311-macosx_26_0_arm64.whl | 244.1 KB | b73654d8a8ce2eb3adf6045a1904c2557fe63772ae69d5f410c0974c2e2a33fc |