semvec/pypi-packages huggingface dataset:
synim 1.0.1
Synthetic interaction matrix generator for adaptive optics systems
Requires Python: >=3.8

# SynIM

**Synthetic Interaction Matrix generator for Adaptive Optics systems**

[![Documentation Status](https://readthedocs.org/projects/synim/badge/?version=latest)](https://synim.readthedocs.io)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Overview

SynIM is a Python package for computing synthetic interaction matrices, projection matrices, and covariance matrices for adaptive optics (AO) systems. It supports both Single Conjugate AO (SCAO), Laser Tomography AO (LTAO), Ground Layer AO (GLAO) and Multi-Conjugate AO (MCAO) configurations with Shack-Hartmann sensors.
It also supports GPU acceleration. Some of its functionalities are provided by [SPECULA](https://github.com/ArcetriAdaptiveOptics/SPECULA).

## Key Features

- 🔧 **Interaction matrices** for DM-WFS combinations (SCAO/MCAO)
- 📊 **Projection matrices** for DM-Layer tomography (MCAO/LTAO)
- 📈 **Covariance matrices** for MMSE reconstructor optimization
- ⚙️ **YAML/PRO configuration** with automatic parameter parsing
- 💾 **SPECULA-compatible** FITS format for data exchange
- 🎯 **Smart caching** to minimize redundant computations
- 🚀 **GPU acceleration** via CuPy for high-performance computation

## Documentation

Full documentation available at: **[synim.readthedocs.io](https://synim.readthedocs.io)**

## Requirements

- Python ≥ 3.8
- numpy, scipy, matplotlib
- [specula](https://github.com/ArcetriAdaptiveOptics/SPECULA) - AO simulation framework
- [cupy](https://cupy.dev/) - GPU acceleration (optional, requires CUDA)

## Contributing to SynIM
To contribute to SynIM, follow these steps:

1. Fork this repository.
2. Create a branch: `git checkout -b <branch_name>`
3. Make your changes and **add tests for the new functionality.**
4. Commit your changes: `git commit -m '<commit_message>'`
5. Push to the branch: `git push`
6. Create the pull request.

We require tests for all new features to ensure the stability of the project.

## Citation

If you use SynIM in your research, please cite:

```bibtex
@software{synim2025,
  author = {Agapito, Guido},
  title = {SynIM: Synthetic Interaction Matrix Generator},
  year = {2025},
  url = {https://github.com/ArcetriAdaptiveOptics/SynIM}
}
```

## License

MIT License - see [LICENSE](LICENSE) file for details.

## Authors

- **Guido Agapito** - INAF - Osservatorio Astrofisico di Arcetri

## Acknowledgments

It was built as part of the [MORFEO project](https://elt.eso.org/instrument/MORFEO/).
usfm3 0.1.5
Error-tolerant USFM 3.x parser
Requires Python: >=3.9

# usfm3

An error-tolerant [USFM 3.x](https://docs.usfm.bible/usfm/3.1.1/index.html) parser for Python. Outputs [USJ](https://docs.usfm.bible/usfm/3.1.1/usj/index.html) (JSON), [USX](https://docs.usfm.bible/usfm/3.1.1/usx/index.html) (XML), normalized USFM, and verse-reference maps.

Built in Rust for speed, with native Python bindings via [PyO3](https://pyo3.rs).

Also available as a [Rust crate](https://crates.io/crates/usfm3) and [npm package](https://www.npmjs.com/package/usfm3) (WebAssembly).

## Installation

```sh
pip install usfm3
```

Requires Python 3.9+.

## Usage

```python
import usfm3

result = usfm3.parse(open("GEN.usfm").read())

# Output formats
usj = result.to_usj()       # dict
usx = result.to_usx()       # XML string
usfm = result.to_usfm()     # USFM string
vref = result.to_vref()     # {"GEN 1:1": "In the beginning...", ...}

# Diagnostics
for d in result.diagnostics:
    print(f"[{d.severity}] {d.message} ({d.start}..{d.end})")

if result.has_errors():
    print("Document has errors")

# Skip semantic validation
result = usfm3.parse(text, validate=False)
```

## API

### `usfm3.parse(usfm: str, validate: bool = True) -> ParseResult`

Parse a USFM string. Returns a `ParseResult` with lazy output methods and diagnostics.

### `ParseResult`

| Method / Property | Returns | Description |
|---|---|---|
| `to_usj()` | `dict` | USJ (Unified Scripture JSON) |
| `to_usx()` | `str` | USX (Unified Scripture XML) |
| `to_usfm()` | `str` | Normalized USFM |
| `to_vref()` | `dict` | Verse reference to plain text map |
| `has_errors()` | `bool` | True if any error-severity diagnostics |
| `diagnostics` | `list[Diagnostic]` | Parser and validation diagnostics |

### `Diagnostic`

| Property | Type | Description |
|---|---|---|
| `severity` | `str` | `"error"`, `"warning"`, or `"info"` |
| `code` | `str` | Machine-readable code (e.g. `"UnknownMarker"`) |
| `message` | `str` | Human-readable message |
| `start` | `int` | Start byte offset in source |
| `end` | `int` | End byte offset in source |

## License

MIT