Skip to main content

Text processing utilities for scientific workflows — LaTeX formatting, colored output, string parsing, and plot text helpers

Project description

SciTeX Str (scitex-str)

Text processing utilities for scientific workflows

PyPI version Tests License: AGPL-3.0

pip install scitex-str


Problem

Scientific Python code frequently needs LaTeX-style formatting for axis labels, colored terminal output for debugging, and structured string parsing for file paths and templates. These are scattered across ad-hoc helper functions in every project.

Solution

scitex-str provides a single package for text utilities commonly needed in scientific workflows:

  • LaTeX formatting -- convert variable names to LaTeX style, with automatic fallback when LaTeX is unavailable
  • Colored terminal output -- printc and color_text for styled console messages
  • String parsing -- bidirectional parse() to extract variables from path patterns
  • Plot text helpers -- format axis labels, titles, and tick labels for publication figures
  • Numeric formatting -- factor out common digits, human-readable byte sizes

Installation

Requires Python >= 3.10.

pip install scitex-str

SciTeX users: pip install scitex already includes this. Use import scitex then scitex.str.

Quick Start

import scitex_str as ss

# LaTeX-style formatting
ss.to_latex_style("theta")        # r"$\theta$"
ss.safe_to_latex_style("unknown") # "unknown" (no error)

# Colored terminal output
ss.printc("Success!", color="green")
ss.ct("Warning", color="yellow")  # returns colored string

# Parse structured paths
result = ss.parse("./data/Patient_23/Hour_12", "./data/Patient_{id}/Hour_{hour}")
# {'id': 23, 'hour': 12}

# Format plot text
ss.format_plot_text("amplitude_mv")  # "Amplitude [mV]"

# Human-readable bytes
ss.readable_bytes(1_500_000)  # "1.43 MB"

Part of SciTeX

scitex-str is part of SciTeX, a Python framework for scientific research automation.

Module Package Role
scitex.str scitex-str Text processing utilities
scitex.stats scitex-stats Statistical testing
scitex.io scitex-io Universal file I/O
scitex.plt figrecipe Publication-ready figures

scitex.ai

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

scitex_str-0.1.0.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

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

scitex_str-0.1.0-py3-none-any.whl (41.8 kB view details)

Uploaded Python 3

File details

Details for the file scitex_str-0.1.0.tar.gz.

File metadata

  • Download URL: scitex_str-0.1.0.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for scitex_str-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fdaf6b9366d55e0bcab0b28fdcb215763bcc67b0728692d83185e41804ea8aba
MD5 396de4d4c314a034072aed7c0756a70f
BLAKE2b-256 bcf6e12df4a5fc5c27d429ecec53cd313e14d23da9feb1377826bc69d5d7f73c

See more details on using hashes here.

File details

Details for the file scitex_str-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: scitex_str-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for scitex_str-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c70677b4a38d24d03336e033c5cd435c09b611253721671dd53a0f6d3a857cbf
MD5 b3a9b09f5f3281b5ac22926aa04ad7a9
BLAKE2b-256 c20f076d5568748c9d3389917d4a2bf0666eb0233d3a6742c2196c6329268678

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