Metadata-Version: 2.4
Name: piezod
Version: 0.13.1
Summary: Modeling and optimization of piezoresistive and piezoelectric sensors and actuators
Project-URL: Homepage, https://github.com/MicrosystemsLab/PiezoD
Project-URL: Repository, https://github.com/MicrosystemsLab/PiezoD
Author: Joseph C. Doll
License-Expression: MIT OR Apache-2.0
License-File: LICENSE-APACHE
License-File: LICENSE-MIT
Keywords: MEMS,cantilever,optimization,piezoelectric,piezoresistive,sensor
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.12
Requires-Dist: addcopyfighandler>=2.0.0
Requires-Dist: h5py>=3.0.0
Requires-Dist: matplotlib>=3.4.0
Requires-Dist: numpy>=1.20.0
Requires-Dist: scipy>=1.7.0
Provides-Extra: dev
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Requires-Dist: ty>=0.0.14; extra == 'dev'
Description-Content-Type: text/markdown

# piezod

Modeling and optimization of piezoresistive and piezoelectric sensors and actuators.

## Installation

```bash
pip install piezod
```

For development:

```bash
git clone https://github.com/MicrosystemsLab/PiezoD.git
cd PiezoD/python
uv sync
```

## Usage

```python
from piezod import CantileverEpitaxy

# Create cantilever and set geometry
c = CantileverEpitaxy()
c.l = 300e-6  # length: 300 um
c.w = 44e-6   # width: 44 um
c.t = 89e-9   # thickness: 89 nm
c.fluid = "water"

# Calculate properties
print(f"Stiffness: {c.stiffness() * 1e3:.3f} mN/m")
print(f"Resonant frequency: {c.omega_vacuum_hz() / 1e3:.1f} kHz")
freq_hz, Q = c.omega_damped_hz_and_Q()
print(f"Damped frequency: {freq_hz / 1e3:.1f} kHz, Q = {Q:.1f}")
```

Run the example:

```bash
uv run python examples/quickstart.py
```

## Development

Install dependencies:

```bash
uv sync
```

Run tests:

```bash
uv run pytest
```

Lint and format:

```bash
uvx ruff check . --fix && uvx ruff format .
```

Type check:

```bash
uvx ty check src
```

## Doping profile convention

`doping_profile()` on every cantilever subclass returns
`(z, active_doping, total_doping)`:

- `total_doping`: total concentration `max(dopant_species,
  substrate_background_cm3)` (cm^-3). Floors at the substrate so plotting code
  shows the implant peak rolling down into the substrate floor directly.
- `active_doping`: net active resistor carriers (cm^-3) =
  `max(0, electrically_active_dopant - substrate_background_cm3)`. Goes to zero
  below the junction. Used internally by all carrier integrals
  (`Nz`, `sheet_resistance`, `beta`).

The substrate is always counter-doped to the piezoresistor. Set the substrate
concentration via the `substrate_background_cm3` attribute on `Cantilever` (or
the equivalent kwarg on `PiezoresistorFromProfile`); the default is 1e15 cm^-3.
The TSUPREM-4 lookup table's baked-in 1.36e15 cm^-3 substrate is subtracted at
load time so the `tsuprem4` and `dopedealer` sources share the same underlying
dopant convention.

Use `cantilever.plot_doping_profile()` for a quick total + net active overlay
with the junction marked.

## Documentation

See the main project documentation at [github.com/MicrosystemsLab/PiezoD](https://github.com/MicrosystemsLab/PiezoD).

## Citation

If you use piezod in your research, please cite:

> Joseph C. Doll, Sung-Jin Park and Beth L. Pruitt
> Design optimization of piezoresistive cantilevers for force sensing in air and water
> Journal of Applied Physics 106.6 (2009): 064310-064310.

## License

Licensed under either of

- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
  http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or
  http://opensource.org/licenses/MIT)

at your option.

## Contribution

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.
