Skip to main content

Parser for Gigahertz-Optik S-BTS2048 and S-BTS256 spectral data files

Project description

sbts-py

PyPI version License Python

Parser for spectral data files exported by Gigahertz-Optik S-BTS2048 and S-BTS256 spectroradiometers (.xls BIFF8 format).

Installation

pip install sbts-py

Usage

from sbts import read

# Single measurement
measurements = read('measurement.xls')
s = measurements[0]

print(s.instrument)               # 'S-BTS2048' or 'S-BTS256'
print(s.wavelengths[0])           # 350.0  (nm)
print(len(s.spd))                 # 701 (S-BTS2048) or 371 (S-BTS256)

print(s.data.get('CCT'))          # 4043.16
print(s.data.get('CRI: Ra'))      # 82.45
print(s.data.get('date'))         # '23.06.2025'

# Multi-measurement file
measurements = read('multi.xls')
for m in measurements:
    print(m.data.get('CCT'), m.data.get('samplenumber'))

# S-BTS256 — diode progression
s = read('S-BTS256.xls')[0]
print(s.diode_time_ms)            # [0.0, 0.02, ...] or None
print(s.data.get('Pst'))          # flicker Pst

Returned object

read() always returns list[Sbts] — a list of one element for a single-measurement file, N elements for a multi-measurement file.

@dataclass
class Sbts:
    wavelengths: list[float]        # wavelengths in nm
    spd: list[float]                # spectral irradiance (W/m²)/nm
    data: dict[str, Any]            # all scalar key/value pairs from the file
    diode_time_ms: list[float] | None
    diode_values: list[float] | None
    instrument: str | None          # 'S-BTS2048' | 'S-BTS256' | None

All missing or unavailable values (-9999.0 convention) are normalized to None.

Compatibility

The sheet name used by the Gigahertz-Optik export software has changed across versions (Sheet3 in older versions, Sheet1 in recent ones). sbts-py automatically tries Sheet3, then Sheet1, then Sheet2.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sbts_py-1.0.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sbts_py-1.0.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file sbts_py-1.0.2.tar.gz.

File metadata

  • Download URL: sbts_py-1.0.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for sbts_py-1.0.2.tar.gz
Algorithm Hash digest
SHA256 97648e67da8613d830e8060124bf4a50338777b1e5ea0f7d436484d58ba9ef88
MD5 dab18b987cb1387e26ef1e0995836f43
BLAKE2b-256 5c5ced89f70b3d51dae7c39a3ecdb549ec8f1f5f62c920e5983bd182b6819085

See more details on using hashes here.

File details

Details for the file sbts_py-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: sbts_py-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for sbts_py-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5f8756f99dc839822c0c3cfb96d4c6aba37e80ff5916aed2ffd968d139b9c382
MD5 0c8f4682a1a1aa63d95561087a32e93e
BLAKE2b-256 2322d404dc49878fe61d7a2a549b7a0c66e9628e90e6d7712ee58813886dc82d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page