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.1.tar.gz
(8.0 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.1.tar.gz.
File metadata
- Download URL: xrench-0.1.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84c307a0b4e55b4fac13600acdeb66b5d9afb060c0b6ed395aa7747d43afdeec
|
|
| MD5 |
c0740b884aa89afaf12f01e5065cc07d
|
|
| BLAKE2b-256 |
108a46943129d6e70fa4345ac25af8578eeb97820d2d620d9ede0837a7d5b76b
|
File details
Details for the file xrench-0.1.1-py3-none-any.whl.
File metadata
- Download URL: xrench-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efaf0161211578f9b810cfceda4407f2838c6d0bd123f1888397f68cab4425e0
|
|
| MD5 |
7e8a819443086078696926a2dd765f5a
|
|
| BLAKE2b-256 |
8eb88b7f14f971b0cdb0d46fc909c8187d0baa337be31fda1101a661c2b4cbaa
|