Skip to main content

bastools

Personal Python utilities for scientific plotting, formatting and data handling. Mainly LLM-generated with post-correction.

installation

PyPI:

pip install bastools

Or with uv:

uv add bastools

Or from source:

git clone https://github.com/BastienGrvt/bastools
cd bastools
uv sync

Minimal example

import bastools as bst

# Grid of subplots, last row auto-centered
fig, axs = bst.subplots_grid(2, 3, n_plots=5, plot_size=(5, 4))

# Format a measurement with its uncertainty
label = bst.sci_notation(1.234e-3, 5.6e-5, n=2)

axs[0].set_title(label)
fig.savefig("figure.png", dpi=300, bbox_inches="tight")

Available tools

Plots (bastools.plots)

  • subplots_grid(rows, cols, n_plots, plot_size, grid) - matplotlib subplot grid with automatic centering of incomplete rows
  • plot_colormap(...) - plot a family of curves colored by a parameter, with linear or log colorbar

Helpers (bastools.helpers)

  • set_not_none(class_parent, **kwargs) - assign keyword arguments to an object, skipping None values
  • get_not_none(arg, arg_type) - return the argument if set, else a default of the given type
  • sci_notation(mu, sigma, n) - format a value and its uncertainty in scientific notation
  • smart_tqdm(iterable, *args, **kwargs) - tqdm wrapper that auto-detects nesting and sets leave accordingly
  • wsl_show(fig, file_path) - save a matplotlib figure and open it from WSL
  • wsl_open(file_path) - open a file with the Windows default application from WSL

Draw (bastools.draw)

  • svg_draw(x_min, x_max, N, unit_size, foo, file_path) - render a 1D function as an SVG path

Requirements

Python >= 3.13 - numpy, scipy, matplotlib, tqdm, rich, svgwrite

License

Apache-2.0 - see LICENSE.

Metadata

Release files for bastools 0.1.1

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

Source distribution (sdist)

Source distribution for bastools 0.1.1
File Size Uploaded Provenance
bastools-0.1.1.tar.gz 9.8 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 22.5 kB

Release files / bastools-0.1.1.tar.gz

Download URL bastools-0.1.1.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ee7a10013e608a56ca77e6f3b6aec20d2bda7ab79b8cf6705c0a6b85b39bb980
BLAKE2b-256 checksum
How to use checksums
4defef73899ddd5ba2d04724f7ceee28416cf153e3c24e35ca4b625e775a2720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"42","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / bastools-0.1.1-py3-none-any.whl

Download URL bastools-0.1.1-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b5d4430ddac8125db06643c73c8f121c4c2b5e5dabc97dcec476bd494c713e2
BLAKE2b-256 checksum
How to use checksums
945423c436c87f856848c0fc98f83e84e178ee591e0e4426c209095458396f46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"42","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for bastools 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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