Skip to main content

pybif6

PyPI - Version

This tiny project rewrites the BIF6 file parsing part of the R package tofsims in Python.

Usage

import pybif6

with pybif6.parse_bif6("path/to/bif6/file") as bif6_file:
    for interval_image in bif6_file:
        print(
            f'id: {interval_image.id}, '
            f'mz_center: {interval_image.mz_center}, '
            f'mz_interval_lower: {interval_image.mz_interval_lower}, '
            f'mz_interval_upper: {interval_image.mz_interval_upper}, '
            f'image: {interval_image.image.shape}'
        )
        # The image data is stored in `interval_image.image`, a 2D numpy array.

m/z fields

Each interval stores three floats. Upstream names them lower, middle, upper, but that labelling is wrong: across real acquisitions the first value lies between the other two for 100 % of intervals and is above the second for 100 % of them. A real triple, from the PC 2:3 standard spot:

125.5632    125.2045    125.8703
 center      lower       upper

The two bounds describe the software's integration window, which is ~0.7-0.8 Da wide. The centre sits within roughly 0.03 Da of the midpoint of those bounds. pybif6 therefore exposes them as mz_center, mz_interval_lower and mz_interval_upper.

The mislabelling is inherited, not introduced here — note also that upstream tofsims sets its canonical massValues to middle (the lower bound), so upstream and pybif6 consumers do not pick the same value out of a bin.

The TIC image (interval 0) has NaN for all three.

Orientation

parse_bif6 accepts keyword-only options that orient every image:

Option Meaning
flip_x mirror along x (reverse the columns)
flip_y mirror along y (reverse the rows)
transpose swap the two spatial axes
rotate rotate counter-clockwise by 0, 90, 180 or 270 degrees

They are applied in a fixed order — flips, then transpose, then rotation — and image_size follows, so image.shape == image_size always holds. These exist because the correct orientation depends on the instrument and on the sample mount, which the file header does not record; the header is only a magic string plus three unsigned integers.

Metadata

Release files for pybif6 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pybif6 0.2.0
File Size Uploaded Provenance
pybif6-0.2.0.tar.gz 16.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pybif6 0.2.0
File Interpreter ABI Platform
pybif6-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 34.3 kB

Release files / pybif6-0.2.0.tar.gz

Download URL pybif6-0.2.0.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9af0c797186d404b373191794fe1fac388d1acc08422a295370c7b2f0b948db9
BLAKE2b-256 checksum
How to use checksums
10459d989cc1738029dd38d39c08f9ab433d70bc7c366d8f28c99295eb39ee6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.28.2 CPython/3.14.7 Linux/7.2.0-1-cachyos

Release files / pybif6-0.2.0-py3-none-any.whl

Download URL pybif6-0.2.0-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5303fe4a1a6d95813517312a3de1ecf8baa66fe5367341f2e03922eb09533fd
BLAKE2b-256 checksum
How to use checksums
75eac880e57703c25421f4464cb4a5a91abe07146db4a10d32c831e2c07d90f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via pdm/2.28.2 CPython/3.14.7 Linux/7.2.0-1-cachyos

Security for pybif6 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page