Skip to content

Commit 3d12c52

Browse files
committed
major docs update. version bump
1 parent e64698d commit 3d12c52

35 files changed

Lines changed: 1095 additions & 1168 deletions

CONTRIBUTING.md

Lines changed: 14 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -1,208 +1,24 @@
11
# Contributing to Photoelastimetry
22

3-
Thank you for your interest in contributing to photoelastimetry! This document provides guidelines for contributing to the project.
3+
Canonical contributor documentation lives in the developer docs:
44

5-
## Development Setup
5+
- Setup: `docs/developer/setup.md`
6+
- Testing: `docs/developer/testing.md`
7+
- Contributing workflow: `docs/developer/contributing.md`
8+
- Architecture context: `docs/developer/architecture.md`
9+
- Docs/release maintenance: `docs/developer/release-and-docs.md`
610

7-
1. Fork and clone the repository:
8-
```bash
9-
git clone https://github.com/YOUR_USERNAME/photoelastimetry.git
10-
cd photoelastimetry
11-
```
12-
13-
2. Create a virtual environment and install development dependencies:
14-
```bash
15-
python -m venv venv
16-
source venv/bin/activate # On Windows: venv\Scripts\activate
17-
pip install -e ".[dev]"
18-
```
19-
20-
## Testing
21-
22-
### Running Tests
23-
24-
We use `pytest` for testing. Tests are located in the `tests/` directory and organized by module:
25-
26-
- `tests/test_stokes_solver_pytest.py` - Tests for Stokes-based stress recovery
27-
- `tests/test_intensity_solver.py` - Tests for intensity-based stress recovery
28-
- `tests/test_equilibrium_solver.py` - Tests for equilibrium-constrained recovery
29-
- `tests/test_disk.py` - Tests for disk simulations
30-
- `tests/test_image_io.py` - Tests for image processing and I/O
31-
32-
Run all tests:
33-
```bash
34-
pytest
35-
```
36-
37-
Run tests with verbose output:
38-
```bash
39-
pytest -v
40-
```
41-
42-
Run a specific test file:
43-
```bash
44-
pytest tests/test_stokes_solver_pytest.py
45-
```
46-
47-
Run a specific test function:
48-
```bash
49-
pytest tests/test_stokes_solver_pytest.py::TestStokesComponents::test_compute_stokes_components
50-
```
51-
52-
### Code Coverage
53-
54-
We aim for >70% test coverage. Check coverage with:
55-
56-
```bash
57-
pytest --cov=photoelastimetry --cov-report=html
58-
```
59-
60-
View the detailed coverage report:
61-
```bash
62-
open htmlcov/index.html # On macOS
63-
xdg-open htmlcov/index.html # On Linux
64-
start htmlcov/index.html # On Windows
65-
```
66-
67-
### Writing Tests
68-
69-
When adding new features, please include tests:
11+
## Quick Local Validation
7012

71-
1. **Unit tests**: Test individual functions in isolation
72-
2. **Integration tests**: Test how components work together
73-
3. **Edge cases**: Test boundary conditions and error handling
74-
75-
Example test structure:
76-
```python
77-
import pytest
78-
import numpy as np
79-
from photoelastimetry.solver.stokes_solver import function_to_test
80-
81-
@pytest.fixture
82-
def sample_data():
83-
"""Fixture providing test data."""
84-
return {
85-
'param1': value1,
86-
'param2': value2,
87-
}
88-
89-
class TestFeature:
90-
"""Test class for a specific feature."""
91-
92-
def test_basic_functionality(self, sample_data):
93-
"""Test basic use case."""
94-
result = function_to_test(**sample_data)
95-
assert result is not None
96-
assert np.isfinite(result)
97-
98-
def test_edge_case(self):
99-
"""Test edge case or error handling."""
100-
with pytest.raises(ValueError):
101-
function_to_test(invalid_input)
102-
```
103-
104-
## Code Style
105-
106-
We follow PEP 8 style guidelines with some modifications:
107-
108-
- Line length: 110 characters (configured in `pyproject.toml`)
109-
- Use `black` for automatic formatting
110-
- Use `flake8` for linting
111-
112-
Format your code:
11313
```bash
14+
pip install -e ".[dev,docs]"
11415
black photoelastimetry tests
16+
pytest
17+
mkdocs build --strict
11518
```
11619

117-
Check code style:
118-
```bash
119-
flake8 photoelastimetry --max-line-length=110
120-
```
121-
122-
## Pull Request Process
123-
124-
1. **Create a feature branch:**
125-
```bash
126-
git checkout -b feature/your-feature-name
127-
```
128-
129-
2. **Make your changes and add tests:**
130-
- Write clear, documented code
131-
- Add tests for new functionality
132-
- Update documentation if needed
133-
134-
3. **Ensure all tests pass:**
135-
```bash
136-
pytest
137-
black photoelastimetry tests
138-
flake8 photoelastimetry
139-
```
140-
141-
4. **Commit your changes:**
142-
```bash
143-
git add .
144-
git commit -m "Add feature: brief description"
145-
```
146-
147-
5. **Push to your fork and create a pull request:**
148-
```bash
149-
git push origin feature/your-feature-name
150-
```
151-
152-
6. **In your PR description, include:**
153-
- What changes you made and why
154-
- Any relevant issue numbers (#123)
155-
- Screenshots if applicable
156-
- Confirmation that tests pass
157-
158-
## Continuous Integration
159-
160-
Our GitHub Actions workflow automatically:
161-
- Runs tests on Python 3.9, 3.10, 3.11, and 3.12
162-
- Checks code formatting with `black`
163-
- Runs linting with `flake8`
164-
- Uploads coverage reports to Codecov
165-
166-
Your PR must pass all CI checks before it can be merged.
167-
168-
## Documentation
169-
170-
When adding new features:
171-
172-
1. **Add docstrings** following NumPy style:
173-
```python
174-
def my_function(param1, param2):
175-
"""
176-
Brief description of the function.
177-
178-
Parameters
179-
----------
180-
param1 : type
181-
Description of param1.
182-
param2 : type
183-
Description of param2.
184-
185-
Returns
186-
-------
187-
return_type
188-
Description of return value.
189-
190-
Examples
191-
--------
192-
>>> result = my_function(1, 2)
193-
>>> print(result)
194-
3
195-
"""
196-
return param1 + param2
197-
```
198-
199-
2. **Update docs/** if adding major features
200-
3. **Add examples** to `docs/examples.md` if relevant
201-
202-
## Questions?
203-
204-
If you have questions or need help:
205-
- Open an issue on GitHub
206-
- Email the maintainers (see README.md)
20+
## Pull Requests
20721

208-
Thank you for contributing!
22+
- Keep PR scope focused.
23+
- Include tests for behavior changes.
24+
- Update docs when interfaces, workflows, or config keys change.

DEVELOPERS.md

Lines changed: 9 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,12 @@
1-
# Development
1+
# Developer Notes
22

3-
To set up the development environment, clone the repository and install the package in editable mode with development dependencies:
3+
This file is intentionally slim.
44

5-
```bash
6-
git clone https://github.com/benjym/photoelastimetry.git
7-
cd photoelastimetry
8-
pip install -e ".[dev]"
9-
# Set up pre-commit hooks
10-
pre-commit install
11-
```
5+
Use canonical developer docs under `docs/developer/`:
126

13-
## Running Tests
14-
15-
The project uses `pytest` for testing with comprehensive coverage analysis:
16-
17-
```bash
18-
# Run all tests
19-
pytest
20-
21-
# Run tests with coverage report
22-
pytest --cov=photoelastimetry --cov-report=html
23-
24-
# Run specific test file
25-
pytest tests/test_stokes_solver_pytest.py -v
26-
27-
# Run tests in parallel (faster)
28-
pytest -n auto
29-
```
30-
31-
## Code Coverage
32-
33-
View the coverage report by opening `htmlcov/index.html` in your browser after running tests with coverage enabled.
34-
35-
Current test coverage includes:
36-
- Stokes solver: photoelastic stress recovery using normalised Stokes parameters
37-
- Intensity solver: raw intensity-based stress recovery with noise modelling
38-
- Equilibrium solver: global stress field recovery enforcing mechanical equilibrium
39-
- Disk simulations: synthetic photoelastic data generation
40-
- Image processing: retardance, principal angle, and Mueller matrix calculations
41-
42-
## Code Quality
43-
44-
The project uses `black` for code formatting and `flake8` for linting:
45-
46-
```bash
47-
# Format code
48-
black photoelastimetry tests
49-
50-
# Check code style
51-
flake8 photoelastimetry
52-
```
53-
54-
## Continuous Integration
55-
56-
GitHub Actions automatically runs tests on:
57-
- Python 3.9, 3.10, 3.11, and 3.12
58-
- Multiple operating systems (Ubuntu)
59-
- Every push and pull request
60-
61-
Test coverage is automatically uploaded to Codecov for tracking.
7+
- `docs/developer/setup.md`
8+
- `docs/developer/testing.md`
9+
- `docs/developer/architecture.md`
10+
- `docs/developer/module-map.md`
11+
- `docs/developer/contributing.md`
12+
- `docs/developer/release-and-docs.md`

0 commit comments

Comments
 (0)