Skip to main content

Python display library for engineering calculations - matrices, equations, formatted output

Project description

hekatan

Python display library for engineering calculations — matrices, equations, formatted output

PyPI License

Install

pip install hekatan

Quick Start

from hekatan import matrix, eq, var, fraction, title, text, show

title("Beam Design")
text("Rectangular section properties:")

var("b", 300, "mm", "beam width")
var("h", 500, "mm", "beam height")

eq("A", 300 * 500, "mm²")

title("Stiffness Matrix", level=2)
K = [[12, 6, -12, 6],
     [6, 4, -6, 2],
     [-12, -6, 12, -6],
     [6, 2, -6, 4]]
matrix(K, "K")

title("Design Ratio", level=2)
fraction("M_u", "φ · b · d²", "R_n")

show()  # Opens formatted HTML in your browser

How It Works

Each function (matrix(), eq(), var(), etc.) works in 3 modes:

Mode When Behavior
Hekatan Inside Hekatan Calc (WPF/CLI) Emits @@HEKATAN markers → rendered as formatted HTML
Standalone Regular Python script show() generates HTML, opens in browser
Console Fallback ASCII formatted output

Mode is auto-detected via HEKATAN_RENDER=1 environment variable.

Functions

Function Description Example
matrix(data, name) Display formatted matrix matrix([[1,2],[3,4]], "A")
eq(name, value, unit) Equation: name = value unit eq("F", 25.5, "kN")
var(name, value, unit, desc) Variable with description var("b", 300, "mm", "width")
fraction(num, den, name) Formatted fraction fraction("M", "S", "σ")
title(text, level) Heading (h1-h6) title("Results", 2)
text(content) Paragraph text text("Design is OK.")
show(filename) Generate HTML + open browser show() or show("out.html")
clear() Clear accumulated buffer clear()
set_mode(mode) Force mode set_mode("console")

Integration with Hekatan Calc

When used inside a Hekatan Calc .hcalc document:

# My Calculation

@{python}
from hekatan import matrix, eq

K = [[12, 6], [6, 4]]
matrix(K, "K")
eq("det_K", 12*4 - 6*6)
@{end python}

The output is automatically formatted with Hekatan's CSS (matrices with brackets, equations with proper typography).

License

MIT — Giorgio Burbanelli

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

hekatan-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

hekatan-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hekatan-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for hekatan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1ec8f8a2823a21f961d6e7de6bcb17ff1b36a2c477d43784bf59cfe9eacc4a7c
MD5 21c6a7e0dab1064805657ee91349863d
BLAKE2b-256 58900626654cc8b0ad0bbd197578422e66d41a1a62a15b050d02108c96fb209c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hekatan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd39552a093d6350f5a9ac91ef14e82184434abd6bd3a65bea735028a0af032f
MD5 4411c1394c782abfc4e9aba9e4fa84f9
BLAKE2b-256 d9c525ac16547408ff49767f6c6ab8b1f5fd26af28e856002bb4b8122ac7523f

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