Metadata-Version: 2.4
Name: nanoBragg_noise
Version: 1.8
Summary: A command-line tool to add noise to simulated H5 data.
Author-email: Derek 'Braggling' Mendez <dermen@slac.stanford.edu>
License: MIT License
        
        Copyright (c) [2025] [Derek Mendez]
        
        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.
        
        
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy
Requires-Dist: h5py
Requires-Dist: joblib
Dynamic: license-file

# nanoBragg_noise

This tool allows synthetic diffraction data to be stored on disk as Bragg peaks alone, with individual background files for maximum compression. It is meant to facilitate the sharing of synthetic diffraction data to drive development of novel data reduction algorithms. It adds noise and background to simulated diffraction data, specifically designed for data generated using the `datsimx.sim` script with the `--noNoise` option (see [mx_simulate.py](https://github.com/pixel-modelers/datsimx/blob/main/datsimx/mx_simulate.py)), which is a thin wrapper to a nanoBragg-style forward model.

## Usage Example

To add noise to a noiseless dataset, use the `braggaddnoise` command with the following options:

```bash
braggaddnoise --dirname simulated_scan --run 3 --nj 20

--dirname: The path to the folder containing the simulated data (e.g., simulated_scan).

--run: The run number used in the datsimx simulation (e.g., 3).

--nj: The number of parallel processes to use for faster processing.
```

The above command will find all HDF5 files matching `shots_3_*h5` in the `simulated_scan` folder, add the background to them that's stored in the file `background_3.h5`, and add noise to the result, finally overwriting the existing `sim_image` datasets.

