General utilities (caching, env detection, normalization, mat→npy, xml→dict, TimeStamper, …) — standalone module from the SciTeX ecosystem
Project description
SciTeX Gen (scitex-gen)
General-purpose Python utilities for scientific workflows
Full Documentation · uv pip install scitex-gen[all]
scitex-gen collects miscellaneous helpers that have been useful across many
SciTeX projects: caching, normalization, environment detection, mat→npy
conversion, xml→dict parsing, a TimeStamper, dimension wranglers, and more.
Problem and Solution
| # | Problem | Solution |
|---|---|---|
| 1 | One-off utilities scatter across scripts -- every research repo grows its own to_even, xml2dict, TimeStamper, NaN-aware z-score |
Curated misc bag -- scitex_gen.cache / to_z / to_nanz / xml2dict / TimeStamper / transpose / to_even / to_odd collected in one importable place |
| 2 | Environment detection ad-hoc -- "am I in a notebook? a script? interactive?" answered three different ways across projects | scitex_gen.detect_environment / is_notebook / is_script -- single canonical detector used across SciTeX peers |
| 3 | Legacy scitex.gen surface unstable -- helpers migrated to canonical peers (scitex_stats, scitex_os, scitex_str, ...) but old import paths still in use |
Backward-compatible re-exports + DeprecationWarning -- scitex_gen.check_host etc. still work, point to the new home, and warn at import time |
Installation
Requires Python >= 3.10.
pip install scitex-gen
Configuration
Copy .env.example to .env (or source it from your
shell) to override defaults such as SCITEX_DIR.
Architecture
scitex_gen/
├── _cache.py ← disk-backed @cache decorator
├── _norm.py ← to_z, to_nanz (NaN-aware z-score)
├── _norm_cache.py ← cached normalization variants
├── _to_even.py ← to_even / to_odd integer rounding
├── _transpose.py ← named-axis tensor transpose
├── _TimeStamper.py ← elapsed-time logger
├── _xml2dict.py ← XML → nested dict parser
├── _detect_environment.py← interactive / notebook / script detection
├── _SigMacro_*.py ← legacy sigmaplot helpers (deprecated)
└── _skills/ ← agent-facing skill pages
Tiny single-purpose modules. Most are pure Python; to_z and the
geometric-median variants opt into torch when available.
1 Interfaces
Python API
import scitex_gen
scitex_gen.cache(...)
scitex_gen.TimeStamper()
scitex_gen.detect_environment()
scitex_gen.xml2dict(...)
scitex_gen.to_z(...)
scitex_gen.to_even(7) # 6
scitex_gen.to_odd(8) # 7
scitex_gen.transpose(...)
scitex_gen.list_packages()
Demo
flowchart LR
A["raw tensor / array"] --> B["scitex_gen.to_z"]
B --> C["NaN-aware z-scored output"]
D["xml string"] --> E["scitex_gen.xml2dict"]
E --> F["nested dict"]
G["expensive func"] --> H["@scitex_gen.cache"]
H --> I["disk-backed result"]
>>> import scitex_gen as gen
>>> gen.to_even(7)
6
>>> gen.to_odd(8)
7
>>> ts = gen.TimeStamper(); ts("step1") # logs elapsed
Quick Start
import scitex_gen as gen
gen.cache(...)
gen.TimeStamper()
gen.xml2dict(...)
gen.to_z(tensor) # requires torch
gen.to_even(n)
gen.to_odd(n)
gen.transpose(...)
Status
Standalone fork of scitex.gen. The umbrella package's scitex.gen import
path is preserved via a sys.modules-alias bridge.
Decoupling notes:
scitex.{decorators,str,os,introspect,session,context,sh,dict}→scitex_*direct imports (peer packages).scitex.torch.nanstd→ optional viatry/exceptwith a torch-only fallback (only matters for_norm.to_z / to_nanz).import scitexremoved from_less.py(was unused in module body).- self-references in
_norm_cache.pyrewritten toscitex_gen.*.
Part of SciTeX
scitex-gen is part of SciTeX. Install via the
umbrella with pip install scitex[gen] to use as scitex.gen (Python).
The SciTeX system follows the Four Freedoms for Research below, inspired by the Free Software Definition:
Four Freedoms for Research
- The freedom to run your research anywhere — your machine, your terms.
- The freedom to study how every step works — from raw data to final manuscript.
- The freedom to redistribute your workflows, not just your papers.
- The freedom to modify any module and share improvements with the community.
AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.
License
AGPL-3.0-only (see LICENSE).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scitex_gen-0.1.10.tar.gz.
File metadata
- Download URL: scitex_gen-0.1.10.tar.gz
- Upload date:
- Size: 48.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2e276eb1d56464813a94fb17d713a0b27363d3b4decf16a9bee75abd23c0944
|
|
| MD5 |
fdb524ce7b7275176239ca8aa141a008
|
|
| BLAKE2b-256 |
dd1335fa006e396b3219a6a4895ec0e69d182eb14c55fac99c332178013f6102
|
Provenance
The following attestation bundles were made for scitex_gen-0.1.10.tar.gz:
Publisher:
pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-gen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scitex_gen-0.1.10.tar.gz -
Subject digest:
e2e276eb1d56464813a94fb17d713a0b27363d3b4decf16a9bee75abd23c0944 - Sigstore transparency entry: 1637976384
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-gen@426a6bf7bc75ee44eab71e557aa397824494c0da -
Branch / Tag:
refs/tags/v0.1.10 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish-and-github-release-on-tag.yml@426a6bf7bc75ee44eab71e557aa397824494c0da -
Trigger Event:
push
-
Statement type:
File details
Details for the file scitex_gen-0.1.10-py3-none-any.whl.
File metadata
- Download URL: scitex_gen-0.1.10-py3-none-any.whl
- Upload date:
- Size: 58.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36a5f8f461828324a85ac4865cf2bfba36cf177154b6d2ee6c9580d76fcbe8cc
|
|
| MD5 |
90165301a8e4699768c4cd0435794c52
|
|
| BLAKE2b-256 |
bd083a4cf7e70112627f9b7b987cf0f66fe6ab614c2a7d1382a7aa54c5caad79
|
Provenance
The following attestation bundles were made for scitex_gen-0.1.10-py3-none-any.whl:
Publisher:
pypi-publish-and-github-release-on-tag.yml on ywatanabe1989/scitex-gen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
scitex_gen-0.1.10-py3-none-any.whl -
Subject digest:
36a5f8f461828324a85ac4865cf2bfba36cf177154b6d2ee6c9580d76fcbe8cc - Sigstore transparency entry: 1637976544
- Sigstore integration time:
-
Permalink:
ywatanabe1989/scitex-gen@426a6bf7bc75ee44eab71e557aa397824494c0da -
Branch / Tag:
refs/tags/v0.1.10 - Owner: https://github.com/ywatanabe1989
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish-and-github-release-on-tag.yml@426a6bf7bc75ee44eab71e557aa397824494c0da -
Trigger Event:
push
-
Statement type: