Metadata-Version: 2.4
Name: calibration-statistics-tool
Version: 1.0.4
Summary: Statistics and antenna pattern analysis tool for radar systems
License: MIT
Keywords: radar,antenna,statistics,analysis
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PySide6>=6.0.0
Requires-Dist: matplotlib>=3.5.0
Requires-Dist: numpy>=1.21.0
Requires-Dist: PyYAML>=6.0
Requires-Dist: python-pptx>=0.6.21
Requires-Dist: mplcursors>=0.5.0
Requires-Dist: natsort>=8.0.0
Requires-Dist: schedule>=1.0.0
Requires-Dist: python-docx>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Provides-Extra: test-writer
Requires-Dist: mcp>=1.23.0; extra == "test-writer"
Provides-Extra: docs
Requires-Dist: sphinx>=5.0.0; extra == "docs"
Dynamic: license-file

# StatisticToolPython

A comprehensive statistics and antenna pattern analysis tool for radar systems, built with Python and PySide6.

## Features

- **Statistics Analysis**: Process and analyze measurement data with statistical limits
- **Antenna Pattern Processing**: Handle antenna diagrams and patterns for various radar types
- **GUI Interface**: User-friendly Qt-based interface for data visualization
- **Report Generation**: Automated PowerPoint and PDF report creation
- **Data Processing**: Support for multiple data formats (JSON, YAML, protocol files)

## Requirements

- Python 3.8+
- PySide6 for GUI
- matplotlib for plotting
- numpy for numerical operations
- PyYAML for configuration
- python-pptx for PowerPoint generation

## Installation

1. Clone the repository:
```bash
git clone <repository-url>
cd statistictoolpython
```

2. Create virtual environment:
```bash
python -m venv .venv
.venv\Scripts\activate  # Windows
# or
source .venv/bin/activate  # Linux/Mac
```

3. Install dependencies:
```bash
pip install -e .
```

## Usage

Run the main application:
```bash
python main.py
```

Or use the command-line entry point:
```bash
statistictool
```

## Project Structure

The application follows an MVC architecture split across several sub-packages:

```
main.py                         # Thin wiring file -- startup, DI, handler wiring
shared/                         # Domain logic (controllers, parsers, models)
    models.py                   # Data model classes
    parse_controller.py         # ParseController -- protocol/PTU2 business logic
    plot_controller.py          # PlotController -- diagram/plot state management
    calcdiagram_functions.py    # Vectorised diagram calculations (NumPy)
    parsePTU2data.py            # PTU2 file parser and data structures
    parse_helpers.py            # Protocol parsing helpers
    loaddata.py                 # Data loading utilities
ui/
    main_view.py                # MainView -- owns QApplication and all widgets
    pyside_qtgui.py             # Backward-compat shim (delegates to MainView)
    ui_constants.py             # Pure-Python layout/size/style constants
    widgets.py                  # Reusable Qt widget classes (PlotFrame, etc.)
    handlers/                   # Signal handler modules (one per tab)
        app_context.py          # AppContext -- dependency-injection container
        parse_handlers.py       # Parse Protocols tab handlers
        sys_diag_handlers.py    # System Diagrams tab handlers
        tx_ant_diag_handlers.py # Tx-Antenna Diagrams tab handlers
        ant_pat_handlers.py     # Antenna Patterns tab handlers
    tabs/                       # Tab widget declarations (one file per tab)
        parse_prot_tab.py
        sys_diag_tab.py
        tx_ant_diag_tab.py
        ant_pat_tab.py
system_diagrams/                # AntennaSystemDiagrams computation module
antenna_patterns/               # Antenna pattern analysis (antpat_v5)
tx_diagrams/                    # Tx-Antenna Diagrams computation module
config/                         # YAML configuration files
tests/                          # Pytest test suite (613 tests)
    conftest.py                 # Shared fixtures and Qt session setup
    integration/                # Real-Qt integration tests
docs/                           # Architecture documentation
```

## Development

Install development dependencies:
```bash
pip install -e ".[dev]"
```

Run tests:
```bash
pytest
```

Run benchmarks (local only, informational):
```bash
pytest --benchmark-only
```

Lint code:
```bash
ruff check .
```

## Architecture

Detailed architecture documentation is in [docs/](docs/):
- `docs/mvc_architecture.md` — MVC design, dependency injection, layer boundaries

## Test Writer Agent (Jira Zephyr)

The `agents/zephyr` package analyses the Python source tree and generates
**manual test cases** as a CSV file that can be imported directly into
**Jira Zephyr Scale** (*Test Cases → Import → CSV*).

### Quick start

```bash
# Generate Unit + Integration test cases for the shared/ module
python -m agents.zephyr.mcp_server \
    --source shared/ \
    --level Unit \
    --level Integration \
    --output zephyr_tests.csv
```

Or from Python:

```python
from test_writer import TestWriterAgent

agent = TestWriterAgent(
    source_paths=["shared/", "ui/handlers/"],
    levels=["Unit", "Integration", "System"],
    output_csv="zephyr_tests.csv",
)
path = agent.run()
print(f"Generated: {path}")
```

### CLI reference

| Option | Default | Description |
|--------|---------|-------------|
| `--source PATH` | `.` | Directory or `.py` file to scan. Repeatable. |
| `--level LEVEL` | `Unit, Integration` | Testing level: `Unit`, `Integration`, `System`, `Smoke`, `Regression`, `Acceptance`. Repeatable. |
| `--output FILE` | `zephyr_tests.csv` | Output CSV path. |
| `--root DIR` | `cwd` | Repo root for module-name resolution. |
| `--prefix PREFIX` | `Calibration-Statistics-Tool` | Jira component prefix. |
| `--skip-dir NAME` | — | Directory name to skip. Repeatable. |

### CSV format

The generated file follows the **Zephyr Scale CSV import** schema:

| Column | Description |
|--------|-------------|
| Name | Test case name (e.g. `[Unit] shared.models — MyClass`) |
| Status | `Draft` / `Approved` / `Deprecated` |
| Priority | `High` / `Medium` / `Low` |
| Component | Jira component (`<prefix>/<top-level-package>`) |
| Labels | Comma-separated: level, symbol kind, package |
| Precondition | Environment prerequisites |
| Objective | One-sentence description of what is verified |
| Folder | Zephyr folder path (`/<Level>/<module/path>`) |
| Test Script (Step) | Step action text |
| Test Script (Step Data) | Input data for the step |
| Test Script (Expected Result) | Expected outcome |

---

## License

MIT License - see LICENSE file for details.

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request
