Metadata-Version: 2.4
Name: bloodmoon
Version: 0.1.0
Summary: A library for analyzing data and simulations from the WFM coded mask instrument.
Project-URL: Homepage, https://github.com/peppedilillo/bloodmoon
Author-email: Giuseppe Dilillo <peppedilillo@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Giuseppe Dilillo
        
        Permission is hereby granted, free of charge, to any person
        obtaining a copy of this software and associated documentation
        files (the "Software"), to deal in the Software without
        restriction, including without limitation the rights to use,
        copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the
        Software is furnished to do so, subject to the following
        conditions:
        
        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
        OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
        NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
        HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
        WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
        FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
        OTHER DEALINGS IN THE SOFTWARE.
License-File: LICENSE.txt
Keywords: astrophysics,coded masks
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.11
Requires-Dist: astropy~=7.0
Requires-Dist: matplotlib~=3.10
Requires-Dist: numpy~=2.2
Requires-Dist: scipy~=1.14
Provides-Extra: dev
Requires-Dist: black~=24.10; extra == 'dev'
Requires-Dist: ipython~=8.31; extra == 'dev'
Requires-Dist: isort~=5.13; extra == 'dev'
Requires-Dist: pyinstrument~=5.0; extra == 'dev'
Description-Content-Type: text/markdown

# Bloodmoon

A Python library for analyzing data from the Wide Field Monitor (WFM) coded mask instrument. Bloodmoon provides tools for:
- Image reconstruction
- Source detection and parameter estimation
- Detector effects modeling (vignetting, PSF)
- Dual-camera source localization

> ⚠️ **Note**: Bloodmoon is under active development. APIs may change between versions.


## Installation

### PyPI

```bash
pip install bloodmoon
```

### From Source

Installing from source is necessary when doing development work. The exact process depends on your platform but will generally require:
- Git
- Python 3.11 or later
- pip
- venv or conda (for environment management)

#### Using venv
```bash
# Clone repository
git clone https://github.com/peppedilillo/bloodmoon.git
cd bloodmoon

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: .\venv\Scripts\activate

# Install package in editable mode with development dependencies
pip install -e ".[dev]"
```

#### Using Conda
```bash
# Clone repository
git clone https://github.com/peppedilillo/bloodmoon.git
cd bloodmoon

# Create and activate conda environment
conda create -n "bloodmoon" python=3.11
conda activate bloodmoon

# Install package in editable mode with development dependencies
pip install -e ".[dev]"
```

## Quick Start

```python
import bloodmoon as bm

# Load camera configuration
wfm = bm.codedmask("wfm_mask.fits")

# Load simulation data
filepaths = bm.simulation_files("simdir/")
sdl1a = bm.simulation(filepaths["cam1a"]["reconstructed"])
sdl1b = bm.simulation(filepaths["cam1b"]["reconstructed"])

# Create detector images
detector, bins = bm.count(wfm, sdl1a.data)

# Reconstruct sky image
sky = bm.decode(wfm, detector)

# Run iterative source detection
for sources, residuals in bm.iros(wfm, sdl1a, sdl1b, max_iterations=10):
    # Process detected sources...
    pass
```

For more take a look at our [demo](demo/demo.ipynb).

## Development

### Running Tests

Assuming you installed from sources, and your source living into `bloodmon` directory.

```bash
cd bloodmoon
python -m unittest
```

## Contributing

Contributions are welcome! Before submitting a pull request:

1. Ensure all tests pass: `python -m unittest`
2. Format code with black: `black -l 120 .`
3. Sort imports with isort: `isort --profile=google .`

For bug reports and feature requests, please open an issue.