Git Product home page Git Product logo

activeopticssimulator's Introduction

Build Status codecov

ActiveOpticsSimulator

A framework for simulating and researching the LSST Active Optics system. We hope to document and transfer much of the functionality in bxin/IM (latest fork: davidthomas5412/IM) and bxin/cwfs (latest fork: davidthomas5412/cwfs) into this new framework, as well as make it easy to explore alternative approaches. We will also be introducing the following software practices:

  1. Testing: unit tests, continuous integration, track code coverage.
  2. Documentation: numpy docstrings, no magic interpolations - all hardcoded matrices etc. must be derived or explained in corresponding notebooks.
  3. Modular design: we strive to make it easy and natural for users to try new alternatives and swap out parts of the pipeline.
  4. Switch simulators: zemax+phosim -> batoid+galsim.
  5. Open source: public github repo, issue tracking, pull requests welcome.

Install

This project has two dependencies that must be installed separately. First, you will need to install galsim. Then, you will need to install batoid. batoid must be installed from source because we depend on a functions (batoid.utils.fieldToDirCos and batoid.utils.dirCosToZemax) that have not made it into the PyPI release. Then you should be able to clone this repo and run setup.py:

git clone https://github.com/davidthomas5412/ActiveOpticsSimulator
cd ActiveOpticsSimulator
python setup.py install

Tests

To run the unit tests, from the ActiveOpticsSimulator directory, first install the testing requirements:

pip install -r test_requirements.txt

And then run the tests using setup.py:

python setup.py test

Getting Started with our Minimum Viable Product

We started off with a minimal viable product (MVP) that supports the following workflow:

  1. create nominal telescope
  2. create perturbed optical state and apply it to telescope
  3. simulate wavefront at the field center
  4. estimate wavefront at field center from wavefront image
  5. use wavefront estimate to solve for optical correction by minimizing metric
  6. apply new optical state to telescope
  7. repeat

The snippet below runs two iterations of this primitive version of the active optics system:

from aos.simulator import WavefrontSimulator
from aos.estimator import WavefrontEstimator
from aos.metric import SumOfSquares
from aos.control import GainController
from aos.telescope import BendingTelescope
from aos.state import BendingState
from aos.solver import SensitivitySolver

telescope = BendingTelescope.nominal(band='g')
simulator = WavefrontSimulator()
estimator = WavefrontEstimator()
solver = SensitivitySolver()
metric = SumOfSquares()
controller = GainController(metric, gain=0.3)
fieldx, fieldy = 0, 0


x = BendingState()
# add 1 micron of the third bending mode to M2.
x['m2b3'] = 1e-6
telescope.update(x)
wavefront = simulator.simulateWavefront(telescope.optic, fieldx, fieldy)
yest = estimator.estimate(wavefront)
xest = solver.solve(yest)
xprime, xdelta = controller.nextState(xest)

# start second iteration
telescope.update(xdelta)
wavefront = simulator.simulateWavefront(telescope.optic, fieldx, fieldy)
yest = estimator.estimate(wavefront)
xest = solver.solve(yest)
xprime, xdelta = controller.nextState(xest)

There are a lot of degeneracies in the optical system at the field center, so the convergence is not great ... yet.

activeopticssimulator's People

Contributors

davidthomas5412 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

activeopticssimulator's Issues

Zernike Surface Perturbations

Currently we support applying surface perturbations to the mirrors via bicubics. Given that the current mirror modes are off-center, we would like to add support for representing perturbations through annular zernike polynomials. These polynomials would be better for a toy model and can leverage the existing Zernike surface in batoid.

The current code makes strong assumptions about surface perturbations and will need to be reworked to generalize to new surface perturbation types.

OPDSimulator methods

Add methods to (1) return wavefront image in pixels and (2) return wavefront in terms of low order annular zernike polynomial coefficients.

Focal Plane Geometry

We will be simulating donuts on the LSST wavefront sensors. Thus it would be nice to have some functionality to find the corners of these sensors (in field angle, focal plane distance, and pixel units). We aim to create a lightweight class that will support this and allow us to avoid having to add the LSST stack as a dependency.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.