Skip to content

Commit 81b472b

Browse files
Merge pull request #30 from d-v-b/docs/update-contrib-guide
update dev docs
2 parents bf7dce0 + 3f43f10 commit 81b472b

File tree

3 files changed

+85
-249
lines changed

3 files changed

+85
-249
lines changed

README.md

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[![PyPI version](https://badge.fury.io/py/anscombe-transform.svg)](https://badge.fury.io/py/anscombe-transform) ![tests](https://github.com/datajoint/anscombe-transform/actions/workflows/tests.yaml/badge.svg)
22

3-
# Anscombe numcodecs
3+
# Anscombe transform
44

5-
This codec is designed for compressing movies with Poisson noise, which are produced by photon-limited modalities such multiphoton microscopy, radiography, and astronomy.
5+
This codec is designed for compressing image recordings with Poisson noise, which are produced by photon-limited modalities such multiphoton microscopy, radiography, and astronomy.
66

77
The codec assumes that the video is linearly encoded with a potential offset (`zero_level`) and that the `photon_sensitivity` (the average increase in intensity per photon) is either already known or can be accurately estimated from the data.
88

@@ -23,24 +23,83 @@ Install via `pip`:
2323
pip install anscombe-transform
2424
```
2525

26-
### Developer installation
26+
## Development Setup
2727

28-
```
29-
conda create -n anscombe_transform python=3.xx
30-
conda activate anscombe_transform
31-
git clone https://github.com/datajoint/anscombe-transform.git
28+
### Getting Started
29+
30+
1. **Fork and clone the repository**
31+
32+
```bash
33+
git clone https://github.com/YOUR_USERNAME/anscombe-transform.git
3234
cd anscombe-transform
33-
pip install -r requirements.txt
34-
pip install -e .
3535
```
3636

37-
Make sure everything works:
37+
2. **Install Hatch**
38+
39+
Via pip:
3840

41+
```bash
42+
pip install hatch
3943
```
40-
pip install pytest
41-
pytest tests/
44+
45+
Or [directly](https://hatch.pypa.io/latest/install/#installers).
46+
47+
48+
3. **Create a development environment**
49+
50+
```bash
51+
# See available environments
52+
hatch env show
53+
54+
# Enter a test environment
55+
hatch shell test.py3.11-2.2
56+
```
57+
58+
Install [pre-commit](https://pre-commit.com/#install)
59+
60+
4. **Run tests**
61+
62+
```bash
63+
# Run all tests
64+
hatch run test:pytest tests/
65+
66+
# Run specific test file
67+
hatch run test:pytest tests/test_codec.py
68+
69+
# Run with coverage
70+
hatch run test:pytest tests/ --cov=src/anscombe_transform
4271
```
4372

44-
## Usage
73+
### Testing
74+
75+
The project uses [pytest](https://docs.pytest.org/en/stable/) for testing. Tests are found in the `tests/` directory.
76+
77+
## Building Documentation
78+
79+
### Local Documentation Server
80+
81+
```bash
82+
# Install docs dependencies
83+
hatch run docs:mkdocs serve
84+
85+
# View at http://127.0.0.1:8000
86+
```
87+
88+
### Building Documentation
89+
90+
```bash
91+
# Build static site
92+
hatch run docs:mkdocs build
93+
94+
# Output in site/
95+
```
96+
97+
98+
## Getting Help
99+
100+
- **Questions?** Open a [GitHub Discussion](https://github.com/datajoint/anscombe-transform/discussions)
101+
- **Bug reports?** Open an [Issue](https://github.com/datajoint/anscombe-transform/issues)
102+
103+
## License
45104

46-
An complete example is provided in [examples/workbook.ipynb](examples/workbook.ipynb)
105+
By contributing, you agree that your contributions will be licensed under the [MIT License](https://opensource.org/license/mit).

docs/contributing.md

Lines changed: 7 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
# Contributing
22

3-
Thank you for your interest in contributing to the Anscombe Transform codec! This guide will help you get started.
4-
53
## Development Setup
64

7-
### Prerequisites
8-
9-
- Python >= 3.11
10-
- [Hatch](https://hatch.pypa.io/) for environment management
11-
- Git
12-
135
### Getting Started
146

157
1. **Fork and clone the repository**
@@ -21,10 +13,15 @@ cd anscombe-transform
2113

2214
2. **Install Hatch**
2315

16+
Via pip:
17+
2418
```bash
2519
pip install hatch
2620
```
2721

22+
Or [directly](https://hatch.pypa.io/latest/install/#installers).
23+
24+
2825
3. **Create a development environment**
2926

3027
```bash
@@ -48,161 +45,9 @@ hatch run test:pytest tests/test_codec.py
4845
hatch run test:pytest tests/ --cov=src/anscombe_transform
4946
```
5047

51-
## Development Workflow
52-
53-
### Making Changes
54-
55-
1. Create a new branch for your feature or fix:
56-
```bash
57-
git checkout -b feature/my-new-feature
58-
```
59-
60-
2. Make your changes following the coding standards below
61-
62-
3. Run tests to ensure everything works:
63-
```bash
64-
hatch run test:pytest tests/
65-
```
66-
67-
4. Run linting and formatting:
68-
```bash
69-
hatch run test:ruff check src/ tests/
70-
hatch run test:ruff format src/ tests/
71-
```
72-
7348
### Testing
7449

75-
The project uses pytest for testing. Tests are organized in the `tests/` directory:
76-
77-
- `test_codec.py` - Direct codec encode/decode tests
78-
- `test_zarr.py` - Zarr integration tests for V2 and V3
79-
- `test_notebooks.py` - Notebook execution tests
80-
81-
**Writing Tests**
82-
83-
- Use the `nearly_equal()` fixture for comparing arrays with tolerance
84-
- Test with synthetic Poisson-distributed data
85-
- Cover both Zarr V2 and V3 implementations
86-
- Include edge cases (zero values, large values, etc.)
87-
88-
Example:
89-
```python
90-
def test_my_feature(nearly_equal):
91-
# Create test data
92-
data = np.random.poisson(lam=50, size=(10, 100, 100)).astype('int16')
93-
94-
# Test your feature
95-
result = my_function(data)
96-
97-
# Assert with tolerance
98-
assert nearly_equal(result, expected, conversion_gain=2.5)
99-
```
100-
101-
### Running Tests Across Environments
102-
103-
Test against multiple Python and NumPy versions:
104-
105-
```bash
106-
# Run on all environments
107-
hatch run test:pytest tests/
108-
109-
# Run on specific Python version
110-
hatch run test.py3.12-2.2:pytest tests/
111-
112-
# Test against upstream dependencies
113-
hatch run upstream:pytest tests/
114-
```
115-
116-
## Coding Standards
117-
118-
### Style Guide
119-
120-
- Follow PEP 8
121-
- Use Ruff for linting and formatting
122-
- Maximum line length: 100 characters
123-
- Use type hints for all public functions
124-
125-
### Documentation
126-
127-
- Write docstrings for all public functions and classes
128-
- Use NumPy-style docstrings
129-
- Include examples in docstrings where helpful
130-
- Update relevant documentation in `docs/`
131-
132-
Example docstring:
133-
```python
134-
def my_function(data: np.ndarray, param: float) -> np.ndarray:
135-
"""
136-
Brief description of what this function does.
137-
138-
Parameters
139-
----------
140-
data : np.ndarray
141-
Description of data parameter
142-
param : float
143-
Description of param parameter
144-
145-
Returns
146-
-------
147-
np.ndarray
148-
Description of return value
149-
150-
Examples
151-
--------
152-
>>> data = np.array([1, 2, 3])
153-
>>> result = my_function(data, 2.5)
154-
"""
155-
pass
156-
```
157-
158-
### Type Hints
159-
160-
Use type hints for function signatures:
161-
162-
```python
163-
from typing import Optional, Union
164-
import numpy as np
165-
166-
def process_data(
167-
data: np.ndarray,
168-
conversion_gain: float,
169-
zero_level: Optional[float] = None
170-
) -> tuple[np.ndarray, dict]:
171-
"""Process data with optional parameters."""
172-
pass
173-
```
174-
175-
## Submitting Changes
176-
177-
### Pull Request Process
178-
179-
1. **Update documentation** if you've changed APIs or added features
180-
181-
2. **Add tests** for new functionality
182-
183-
3. **Update CHANGELOG** if significant changes were made
184-
185-
4. **Push your branch** to your fork:
186-
```bash
187-
git push origin feature/my-new-feature
188-
```
189-
190-
5. **Open a Pull Request** on GitHub:
191-
- Provide a clear description of the changes
192-
- Reference any related issues
193-
- Ensure CI tests pass
194-
195-
### Pull Request Checklist
196-
197-
Before submitting, verify:
198-
199-
- [ ] Tests pass locally
200-
- [ ] New tests added for new features
201-
- [ ] Documentation updated
202-
- [ ] Code follows style guidelines
203-
- [ ] Type hints added
204-
- [ ] Docstrings written
205-
- [ ] CHANGELOG updated (if applicable)
50+
The project uses [pytest](https://docs.pytest.org/en/stable/) for testing. Tests are organized in the `tests/` directory.
20651

20752
## Building Documentation
20853

@@ -224,37 +69,12 @@ hatch run docs:mkdocs build
22469
# Output in site/
22570
```
22671

227-
## Project Structure
228-
229-
```
230-
anscombe-transform/
231-
├── src/
232-
│ └── anscombe_transform/
233-
│ ├── __init__.py
234-
│ ├── codec.py # Main codec implementations
235-
│ ├── estimate.py # Parameter estimation
236-
│ └── version.py # Version info (auto-generated)
237-
├── tests/
238-
│ ├── conftest.py # Pytest fixtures
239-
│ ├── test_codec.py # Codec tests
240-
│ ├── test_zarr.py # Zarr integration tests
241-
│ └── test_notebooks.py # Notebook tests
242-
├── docs/ # Documentation source
243-
├── examples/ # Example notebooks
244-
├── pyproject.toml # Project configuration
245-
└── mkdocs.yml # Documentation config
246-
```
24772

24873
## Getting Help
24974

25075
- **Questions?** Open a [GitHub Discussion](https://github.com/datajoint/anscombe-transform/discussions)
25176
- **Bug reports?** Open an [Issue](https://github.com/datajoint/anscombe-transform/issues)
252-
- **Need to chat?** Contact the maintainers
253-
254-
## Code of Conduct
255-
256-
Please be respectful and constructive in all interactions. We aim to foster an inclusive and welcoming community.
25777

25878
## License
25979

260-
By contributing, you agree that your contributions will be licensed under the MIT License.
80+
By contributing, you agree that your contributions will be licensed under the [MIT License](https://opensource.org/license/mit).

0 commit comments

Comments
 (0)