pylibqe has been renamed to qe-lib. The files below are kept so existing installs keep working; new projects should install qe-lib.
Python bindings for libqe — low-level QE math including ENA, accumulation, door, and trajectory kernels
Python >=3.9 · Source code · Homepage · Documentation · Bug Tracker
Also available for R: libqe · Julia: libqe · npm: @qe-libs/libqe-wasm · C++ (Conan): libqe
Install qe-lib instead. Do not pip install pylibqe — that name may resolve to an unrelated project on PyPI.
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+ |
|---|---|---|---|---|
| 0.1.6.9000 | — | .tar.gz | 3.11 3.12 3.13 | — |
| 0.1.6 | — | .tar.gz | 3.11 3.12 3.13 | 3.11 3.12 3.13 |
| 0.1.5 | — | .tar.gz | 3.11 3.12 3.13 | 3.11 3.12 3.13 |
| 0.1.4 | — | .tar.gz | 3.11 3.12 3.13 | 3.11 3.12 3.13 |
For 0.1.6.
numpypytest (extra: dev)numpy (extra: dev)nanobind bindings that expose the libqe modules as a pylibqe Python package,
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.
pylibqe.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 |
pylibqe.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. |
pylibqe.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. |
ena_correlation(points, centroids, conf_level=0.95) |
n_units × 3 ndarray |
Pearson r with CI: [r, ci_lower, ci_upper]. |
node_positions(adj_mats, t, num_dims) |
NodePositions |
Undirected ENA node positions. |
directed_node_positions(line_weights, points, num_dims) |
NodePositions |
Directed ENA node positions. |
directed_node_positions_combine_pairs(line_weights, points, num_dims) |
NodePositions |
Directed positions — paired ground+response rows combined before solve. |
group_stats(g1, g2) |
GroupStatsResult |
Per-dimension Welch t-test + Wilcoxon rank-sum. See fields below. |
NodePositions fields: .nodes, .centroids, .weights, .points (all 2-D ndarray).
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 |
pylibqe.accumulation| Function | Returns | Notes |
|---|---|---|
connection_matrix(ground, response, response_weight=1.0, ordered=True) |
2-D ndarray |
Core adjacency math for one ground+response event pair. |
accumulate_stanza(codes, window_back=1, window_forward=0, binary=True, ordered=False) |
2-D ndarray |
Stanza-window accumulation. ordered=False: undirected upper-tri → n_rows × choose_two(n_codes). ordered=True: directed → n_rows × n_codes². |
row_connections(codes, binary=True) |
2-D ndarray |
Per-row upper-tri co-occurrence without windowing. |
rolling_window_sum(codes, window_size=1) |
2-D ndarray |
Rolling backward sum of raw code values. |
flat_index(indices, dims) |
int |
Column-major linear index. indices and dims are 0-based. |
accumulate_unit(codes, unit_rows, decay_fn, ordered=False) |
UnitNetworks |
tma ground/response accumulation. unit_rows 0-based int list. decay_fn(dists) -> weights. |
accumulate_unit_with_rows(codes, unit_rows, decay_fn, ordered=False) |
UnitNetworks |
Like accumulate_unit + per-response-row networks. |
apply_tensor_unit(tensor, dims, ...) |
TensorNetworks |
Tensor-based multi-modal accumulation (tma). |
UnitNetworks fields: .networks, .row_networks.
TensorNetworks fields: .connection_counts, .row_connection_counts.
pylibqe.rotation| Function | Returns | Notes |
|---|---|---|
ena_svd(points) |
RotationResult |
SVD-based ENA rotation. |
deflate(data, axis) |
2-D ndarray |
Project out a single unit axis from data. |
orthogonal_svd(points, fixed_axes) |
RotationResult |
SVD constrained to be orthogonal to fixed axes. |
complete_rotation(points, axes) |
RotationResult |
Fix named axes first, fill remaining dims with SVD. |
means_rotation(points, groups) |
RotationResult |
Means rotation (MR) — rotate toward group mean difference. |
generalized_means_rotation(V, x_model, x_target, ...) |
RotationResult |
GMR with Lasso covariate adjustment — mirrors rENA's ena.rotate.by.generalized(). |
RotationResult fields: .rotation, .eigenvalues, .column_names.
pylibqe.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. |
pylibqe.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 pylibqe import adjacency, normalization, modeling, accumulation
# Pair names for 3 codes
print(adjacency.connection_names(["X", "Y", "Z"]))
# ['X & Y', 'X & Z', 'Y & Z']
# Stanza-window accumulation
codes = np.array([[1,1,0],[1,0,1],[0,1,1]], dtype=float)
co = accumulation.accumulate_stanza(codes, window_back=2, binary=True)
print(co)
# Sphere normalization
normed = normalization.normalize_networks(codes)
# 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 |
|---|---|---|
| pylibqe-0.1.6.9000.tar.gz | 36.9 KB | 2859b59bb88168737af32f044488a6565d441a2b4b8df07997b2c4135231df4c |
| pylibqe-0.1.6.9000-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | cbabbd1dec5eb08dc656f0c19c7c3db0fbef392f3cf63b7c9033c24cd524ba5b |
| pylibqe-0.1.6.9000-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | cb80b2f871f06cc18092cef7de1a805ebd65f9da2f3e45f0eec816b317e21af6 |
| pylibqe-0.1.6.9000-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 11.7 MB | f6b3ebcf36ab4b74ee1a35cf83d8f69cbde55058e45b4de7936736325c7d5791 |
| pylibqe-0.1.6.tar.gz | 36.4 KB | 2d8c968701e32773cab6078c517824c86eef325671dcfe03038ac9349a20bf0e |
| pylibqe-0.1.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 41.3 MB | 84642614a89c00f250cdbe7debcdd56405a05da66b81f9f9099a79a9870420fe |
| pylibqe-0.1.6-cp313-cp313-macosx_26_0_arm64.whl | 243.5 KB | 6a1e8fd0a3e04096a477f348194f6eccbd348b759129651490836c1287ba0b79 |
| pylibqe-0.1.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 41.3 MB | 54620203b7c6906fb133c1dcd6dc52a0294a3a2ec3abf158ba1ccb6b1b5919b1 |
| pylibqe-0.1.6-cp312-cp312-macosx_26_0_arm64.whl | 243.5 KB | e6df43314cfd9bc137359271a649a3eab11fe7014fb7d9052e48428b5a64d4aa |
| pylibqe-0.1.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 41.3 MB | cfe439ac68f2b83befdbbc9632da8866a758c0f26dd5d8fcf4e1df724f0b547a |
| pylibqe-0.1.6-cp311-cp311-macosx_26_0_arm64.whl | 244.3 KB | 9bb566b44722071cb033cf6b1d5cc5288a60f2527955dc206c5ba8b6a97d3083 |
| pylibqe-0.1.5.tar.gz | 35.9 KB | 893e988cac0592b1b04e507b9b781df8ede062bda62e3591dc303f3546dcc823 |
| pylibqe-0.1.5-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 41.3 MB | 087df64c16e25365185c23537eacf9b19b2584e0eb1239bddb0dfbc7b9986d5d |
| pylibqe-0.1.5-cp313-cp313-macosx_26_0_arm64.whl | 240.0 KB | 24ddf83cb30891a336fcfa1c92bddc6df61dea972991efdd8ff8c46538a8b128 |
| pylibqe-0.1.5-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 41.3 MB | d48a1c9415504add0bdcadd0e0430921c13684f786b172ae948796059b03440b |
| pylibqe-0.1.5-cp312-cp312-macosx_26_0_arm64.whl | 240.0 KB | 71946cd75a313ee7554975d913715f0403b8d158957c5085cbce2da39c1fcb71 |
| pylibqe-0.1.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 41.3 MB | 2ae1cf7b4e1380ce070f7e13401d40cbddcb9446f6075f1606df9f0fcfbe5362 |
| pylibqe-0.1.5-cp311-cp311-macosx_26_0_arm64.whl | 240.7 KB | 9266ca16767d7e01f00e5f2ed7fd0d01760eb11c2a037dde6525fc291203eea1 |
| pylibqe-0.1.4.tar.gz | 34.5 KB | 151e300adebd4af90e09550360519fff71ef61e062e28641e6252006d909d1f1 |
| pylibqe-0.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 41.3 MB | 0eae2a1170cf5ae8aad82308f7241e6db8e84dc3a3020052e84d6db95f2beb93 |
| pylibqe-0.1.4-cp313-cp313-macosx_26_0_arm64.whl | 240.0 KB | 62cfdcc6a49740f5e5c3ddd9cdd4262b23d69518e448f5a773f1f79916d90740 |
| pylibqe-0.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 41.3 MB | d63219653e1eccf5927ff3b2d239d1021497a792cf345b6e9d42fa43bd117c75 |
| pylibqe-0.1.4-cp312-cp312-macosx_26_0_arm64.whl | 240.0 KB | 3b0f96e4b41f25f8c59533640e11564dcd1a28ec4371cc9b9667f3909421dd9e |
| pylibqe-0.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | 41.3 MB | a9469a4a96f194f9197721000646535658080ec0269017a8171b29bef5c65041 |
| pylibqe-0.1.4-cp311-cp311-macosx_26_0_arm64.whl | 240.7 KB | e691c8173113808398d87465b46a30687ccdc42e96bbcad3f4a84b6123e9cacf |