Python display library for engineering calculations - matrices, equations, formatted output
Project description
hekatan
Python display library for engineering calculations — matrices, equations, formatted output
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hekatan-0.2.1.tar.gz.
File metadata
- Download URL: hekatan-0.2.1.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3406868c9f71f5f8a01c68faec1c1a3ddee9dd5a93d064e4e4d3f753a09eb460
|
|
| MD5 |
2a918addc4d289bb098ac2521926fc5a
|
|
| BLAKE2b-256 |
f3acdc2ebbae9e4bf22132beb2560f5d36225fcf2205a13571206895afbef624
|
File details
Details for the file hekatan-0.2.1-py3-none-any.whl.
File metadata
- Download URL: hekatan-0.2.1-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e10a69708e9601cd39279b318d2a06924978c28e091a85f9f6f50aa8961e6ca1
|
|
| MD5 |
1a389959e2a8a420609048c40fcd8e8b
|
|
| BLAKE2b-256 |
c219898b3bf5b9d54925983b8d728b2ab48444d8e883dfa7d5310e982ab8ba1c
|