Metadata-Version: 2.1
Name: b22ao
Version: 0.1.0
Summary: API for b22 adaptive optics operations.
Author-email: Douglas Winter <douglas.winter@diamond.ac.uk>
License: MIT License
        
        Copyright (c) 2020 Diamond Light Source Ltd.
        
        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.
        
Project-URL: GitLab, https://gitlab.diamond.ac.uk/daq/tools/b22/b22ao
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: dcor
Requires-Dist: pyepics
Requires-Dist: p4p
Requires-Dist: graypy
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: bump2version; extra == "dev"
Requires-Dist: pipdeptree; extra == "dev"
Requires-Dist: flake8-isort; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pytest-random-order; extra == "dev"
Requires-Dist: types-mock; extra == "dev"
Requires-Dist: types-requests; extra == "dev"

# b22ao: API for B22 adaptive optics operations

This package provides the basic API for Adaptive Optics scripts running at beamline B22 in Diamond Light Source.

Adaptive Optics operations must implement b22ao.base.BaseOperation, which provides methods for deforming mirrors and
capturing images. The implementation is run by the AO manager which will inject any given JSON configuration file.

Example:
```python
from b22ao.base import BaseOperation
import numpy

class MyAO(BaseOperation):
    def start(self):
        max_iter = self.config['max_iter']

        self.select_dm(self.config['mirror'])

        self.stopping = False
        for iter in range(max_iter):
            if self.stopping:
                self.stopping = False
                break
            self.deform(numpy.zeros(97))
            self.capture()
    
        print("Finished!")

    def stop(self):
        self.stopping = True
```
And the configuration file:
```json
{
  "max_iter": 300,
  "mirror": 2
}
```
