Python client SDK for the RoboAI Stark-width API (MSE electron-impact Stark broadening with full calculation trace).
Project description
RoboAI Stark Client
Lightweight Python client SDK and command-line helper for the RoboAI Stark-width API: electron-impact Stark broadening of isolated ion lines, computed with the modified semi-empirical method (Dimitrijević & Konjević 1980) on a NIST-ASD-backed engine — returning not just the width, but the full calculation trace (every perturbing line with its oscillator-strength provenance) and a validated reliability assessment for each result.
Contents
- Install
- Quick Start
- Authentication
- Usage Examples
- What You Get Back
- Reliability
- Scientific Scope
- Support
- License
Install
Prerequisite: Python 3.10 or newer.
From PyPI:
pip install --upgrade roboai-stark-client
From GitHub, if you need the latest repository version:
pip install git+https://github.com/RoboAI-Green/roboai-stark-client.git
Quick Start
Authenticate once:
roboai-stark auth login
Compute a first width from Python:
from roboai_stark_client import RoboAIStarkClient
client = RoboAIStarkClient()
result = client.compute_width(
element="S", # element symbol
charge=2, # spectroscopic charge: 2 = singly ionised (S II)
wavelength_a=5606.151, # transition wavelength in Å (nearest ASD line)
temperature_ev=1.0, # electron temperature in eV (≈ 11 605 K)
ne_cm3=1e17, # electron density in cm⁻³
)
print(result.fwhm_nm) # 0.07986 (nm, FWHM)
print(result.reliability.confidence) # "high"
print(result.summary())
Or from the command line:
roboai-stark width --element S --charge 2 --wavelength-a 5606.151 \
--temperature-ev 1.0 --ne 1e17
roboai-stark width --element S --charge 2 --wavelength-a 5606.151 \
--temperature-ev 1.0 --ne 1e17 --json # full calculation trace
Authentication
The token store is shared with
roboai-libs-client —
both clients talk to the same platform, so one login serves both:
roboai-stark auth login(orroboai-libs auth login) requests an email verification link and stores the token in~/.config/roboai-libs/auth.json.- Alternatively set
ROBOAI_LIBS_API_KEYin the environment. roboai-stark auth status/auth logout/doctormanage and check it.
Usage Examples
Runnable scripts live in examples/:
single_line.py— one width, the reliability block, and the strongest perturbing-line contributions.batch_lines.py— a line list with reliability screening (note the flagged Na I resonance line).level_search.py— pick a transition by fuzzy level labels ("3s2 3p2 3d 4F"matches3s2.3p2.(3P).3d 4F) instead of wavelength:
lower = client.search_levels(element="S", charge=2, query="3s2 3p2 3d 4F J=9/2")
upper = client.search_levels(element="S", charge=2, query="3s2 3p2 4p 4D J=7/2")
result = client.compute_width(
element="S", charge=2,
low_level_id=lower[0].level_id, upp_level_id=upper[0].level_id,
temperature_k=11600.0, ne_cm3=1e17,
)
What You Get Back
compute_width returns a StarkWidthResult carrying the complete trace:
| Field | Meaning |
|---|---|
fwhm_nm, fwhm_low_nm, fwhm_high_nm |
Stark FWHM in nm with the f-provenance uncertainty band |
hwhm_nm |
half width |
target |
the resolved ASD line: ion, wavelength, both level identifications (configuration/term/J/energy) |
plasma |
temperature (K and eV), electron density, kT in cm⁻¹ |
low_side / upp_side |
per-level term sums: explicit Δn=0 (with bounds), lumped Δn≠0 (R², x, Gaunt), effective quantum number n* |
s_total, c_front |
the two factors of W = Nₑ·C·S·10⁷ |
perturbing_lines |
every explicit Δn=0 perturbing line: ΔE, Gaunt, f with source/provider/method/details, R², contribution |
reliability |
see below |
The width is linear in Nₑ, so one result rescales to any density for free.
Reliability
Every result carries a method-domain reliability block, backed by a 758-transition benchmark against the STARK-B SCP database:
confidence—high/medium/lowfrom the emitter charge and the lumped share of the width.benchmark— the accuracy numbers for this charge class (e.g. singly ionised: median W_MSE/W_SCP = 1.16, 72 % within a factor of 2).lumped_share— the fraction of the width resting on the lumped Δn≠0 approximation; ≥ 50 % flagslumped_dominated(such widths underestimate).flags/notes— machine-readable warnings:neutral_out_of_domain,high_charge_underestimate,lumped_dominated,unvalidated_charge.
Scientific Scope
- Electron-impact broadening of isolated lines of ionized, non-hydrogenic emitters — the stated domain of the MSE method (class accuracy ±50 %).
- Neutral emitters are computed but flagged out-of-domain (resonance lines overestimate); hydrogen lines need dedicated hydrogenic tables and are not meaningful here.
- Quasi-static ion broadening and ion dynamics are not included.
- Gaunt treatment follows Dimitrijević & Konjević (1980), JQSRT 24, 451 (canonical g(x) table and the Δn=0 ion correction g̃ = 0.7 − 1.1/Z + g(x)).
Support
- Issues and feature requests: GitHub issues
- Platform and web UI: libs.roboai.fi
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 roboai_stark_client-0.1.0.tar.gz.
File metadata
- Download URL: roboai_stark_client-0.1.0.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00ccba4bc09c0354441a72e2bdd884d25bacc85447e016454c21a6229ed04506
|
|
| MD5 |
c17363fb47120db0ead1ba556b489f24
|
|
| BLAKE2b-256 |
7e388d3fb3e8424abb8cf5974d599d5d471dfe69afaefacaee83e638c9bb73e6
|
Provenance
The following attestation bundles were made for roboai_stark_client-0.1.0.tar.gz:
Publisher:
publish.yml on RoboAI-Green/roboai-stark-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
roboai_stark_client-0.1.0.tar.gz -
Subject digest:
00ccba4bc09c0354441a72e2bdd884d25bacc85447e016454c21a6229ed04506 - Sigstore transparency entry: 2099361681
- Sigstore integration time:
-
Permalink:
RoboAI-Green/roboai-stark-client@d24d521795a817c4a5f7cd9d7356d638a7abefd0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/RoboAI-Green
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d24d521795a817c4a5f7cd9d7356d638a7abefd0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file roboai_stark_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: roboai_stark_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.7 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 |
2165013d54b77945ba933bd8d4040da47e772276c75a90965f497d5ed6c1d354
|
|
| MD5 |
de1e32f85763e90764587cdd53668d40
|
|
| BLAKE2b-256 |
55fa8227b53415f497d1d8c989e3453b470f47df3d6db65ad4e8b20bf6447290
|
Provenance
The following attestation bundles were made for roboai_stark_client-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on RoboAI-Green/roboai-stark-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
roboai_stark_client-0.1.0-py3-none-any.whl -
Subject digest:
2165013d54b77945ba933bd8d4040da47e772276c75a90965f497d5ed6c1d354 - Sigstore transparency entry: 2099361906
- Sigstore integration time:
-
Permalink:
RoboAI-Green/roboai-stark-client@d24d521795a817c4a5f7cd9d7356d638a7abefd0 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/RoboAI-Green
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d24d521795a817c4a5f7cd9d7356d638a7abefd0 -
Trigger Event:
release
-
Statement type: