Utility functions.
Project description
🔧 xrench
Utility functions for pint and xarray to support RF and microwave design Python tools.
Installation
uv add xrench
Or with pip:
pip install xrench
Features
- Unit-aware arrays — Seamless integration between
pintandxarrayfor physical quantities - Custom RF units — Built-in support for dBK (decibel kelvin) and dBHz (decibel hertz)
- Unit decorator —
wraps_xrdecorator to strip and re-apply units around functions, preserving xarray coordinates and dimensions - Rotation utilities — Apply
scipyrotations to coordinate DataArrays, including polarization rotation - Logging control — Mutable/unmutable logger via
XRENCHLoggerfor clean library logging
Usage
Unit Registry
from xrench.units import ureg
# Use built-in RF units
noise_temp = 290 * ureg.decibelkelvin
bandwidth = 1e6 * ureg.decibelhertz
Convert kwargs to DataArrays
from xrench.xrutils import kw2da
arrays = kw2da(frequency=freq_quantity, angle=angle_array)
Unit-preserving function decorator
from xrench.xrutils import wraps_xr
@wraps_xr(ret_units="meter", arg_units=["meter", "meter"])
def my_func(x, y):
# work with unit-less DataArrays
return x + y
Logging
from xrench.logcontrol import XRENCHLogger
XRENCHLogger.unmute() # enable logs
XRENCHLogger.level = "DEBUG" # change level
XRENCHLogger.mute() # silence logs
License
MIT
Contact
Created by Rob Scheeler
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
xrench-0.1.0.tar.gz
(7.7 kB
view details)
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 xrench-0.1.0.tar.gz.
File metadata
- Download URL: xrench-0.1.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bb16bc64914e5d5d3c1a9fcd0737a167211364ffcf01343a7f1ac129dddd9bf
|
|
| MD5 |
21b1bbc2d6497f3fef92abd6f6392f4f
|
|
| BLAKE2b-256 |
2e4921fc9b45551d84b433008c33f665afe8f3eff7eedf220fbe82ed6c5ba006
|
File details
Details for the file xrench-0.1.0-py3-none-any.whl.
File metadata
- Download URL: xrench-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
523b00d01e27b35e07ad48f306b2969d714849c59a82ec215b99073fbd9d5d20
|
|
| MD5 |
af8bd8736f672907a06187cad2683d21
|
|
| BLAKE2b-256 |
a2d7cae1851c81a523f34936349339899d6ce2c3a2c779eb386354260a78efeb
|