Skip to content

Commit

Permalink
added and updated Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpaulreeves committed Apr 15, 2015
1 parent 106f8c2 commit 7419e22
Show file tree
Hide file tree
Showing 9 changed files with 265 additions and 146 deletions.
23 changes: 15 additions & 8 deletions doc/source/atmos.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
**********
Atmosphere
==========
**********
.. automodule:: pyAOS.atmosphere

Class to simulate atmosphere above an AO system
Atmosphere Class
================
.. autoclass:: pyAOS.atmosphere.atmos
:members:

Phase Screen Creation and Saving
================================
.. autofunction:: pyAOS.atmosphere.makePhaseScreens

.. autofunction:: pyAOS.atmosphere.ft_phase_screen

.. autofunction:: pyAOS.atmosphere.ft_sh_phase_screen

pyAOS.atmosphere module
-----------------------

.. automodule:: pyAOS.atmosphere
:members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __getattr__(cls, name):
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
#'sphinx.ext.napoleon'
'sphinxcontrib.napoleon'
]

Expand Down
30 changes: 23 additions & 7 deletions doc/source/dms.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
******************
Deformable Mirrors
==================
******************

Classes simulating different types of deformable mirror. The `DM` class provides a base class for other types of DM.
.. automodule:: pyAOS.DM

Base DM Class
-------------
.. autoclass:: pyAOS.DM.DM
:members:

pyAOS.DM module
Real DM Classes
---------------
.. autoclass:: pyAOS.DM.TT
:members:
:show-inheritance:

.. autoclass:: pyAOS.DM.Zernike
:members:
:show-inheritance:

.. automodule:: pyAOS.DM
:members:
:undoc-members:
:show-inheritance:
.. autoclass:: pyAOS.DM.Piezo
:members:
:show-inheritance:

.. autoclass:: pyAOS.DM.GaussStack
:members:
:show-inheritance:
2 changes: 1 addition & 1 deletion doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Contents:
sim.rst
atmos.rst
wfs.rst
lgs.rst
dms.rst
lgs.rst
recon.rst
sci.rst
utils.rst
Expand Down
4 changes: 3 additions & 1 deletion doc/source/intro.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Introduction
************

pyAOS is a Montecarlo Adaptive Optics (AO) simulation written exclusively in the Python programming language. It is aimed at rapidly developing new AO concepts and being a learning tool for those new to the field of AO.
PyAOS is a Montecarlo Adaptive Optics (AO) simulation written exclusively in the Python programming language. It is aimed at rapidly developing new AO concepts and being a learning tool for those new to the field of AO.

The code can be used as an end to end simulation, where the entire system parameters are controlled by a configuration file. This can be used from the Python command line, python scripts or a GUI which is included.

Expand All @@ -25,3 +25,5 @@ Data will now be saved in the directory specified as `filePrefix` in the configu
Alternatively, the GUI can be started with::

pyAOS -g <configFilename>

The use the buttons to initialise the simulation, make interaction matrices and run the AO loop. The interactive python console can be used to view data or change parameters
13 changes: 9 additions & 4 deletions doc/source/wfs.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
******************
Wave-front Sensors
==================

Classes simulating AO WFSs
******************

==========
WFS Module
==========
.. automodule:: pyAOS.WFS

Base WFS Class
==============

.. autoclass:: pyAOS.WFS.WFS
:members:

.. autoclass:: pyAOS.WFS.ShackHartmann
:members:

.. autoclass:: pyAOS.WFS.Pyramid
:members:
:members:
89 changes: 85 additions & 4 deletions pyAOS/DM.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,32 @@
# You should have received a copy of the GNU General Public License
# along with pyAOS. If not, see <http://www.gnu.org/licenses/>.
"""
The module simulating Deformable Mirrors in pyAOS
The module simulating Deformable Mirrors in PyAOS
DMs in PyAOS
============
DMs are represented in PyAOS by python objects which are initialised at startup
with some configuration parameters given, as well as a list of one or more
WFS objects which can be used to measure an interaction matrix.
Upon creation of an interaction matrix, the object first generations all the
possible independant shapes which the DM may form, known as "influence functions".
Then each influence function is passed to the specified WFS(s) and the response
noted to form an interaction matrix. The interaction matrix may then be used
to forma reconstructor.
During the AO loop, commands corresponding to the required amplitude of each
DM influence function are sent to the :py:meth:`DM.dmFrame` method, which
returns an array representing the DMs shape.
Adding New DMs
==============
New DMs are easy to add into the simulation. At its simplest, the :py:class:`DM`
class is inherited by the new DM class. Only a ``makeIMatShapes` method need be provided, which creates the independent influence function the DM can make. The
base class deals with the rest, including making interaction matrices and loop
operation.
"""
import numpy
from scipy.ndimage.interpolation import rotate
Expand All @@ -30,6 +55,14 @@
xrange = range

class DM:
"""
The base DM class
This class is intended to be inherited by other DM classes which describe
real DMs. It provides methods to create
"""

def __init__ (self, simConfig, dmConfig, wfss, mask):

self.simConfig = simConfig
Expand Down Expand Up @@ -169,11 +202,14 @@ def dmFrame ( self, dmCommands, closed=False):


class Zernike(DM):
"""
A DM which corrects using a provided number of Zernike Polynomials
"""

def makeIMatShapes(self):
'''
Creates all the DM shapes which are required for creating the
interaction Matrix
interaction Matrix. In this case, this is a number of Zernike Polynomials
'''

shapes = aoSimLib.zernikeArray(
Expand All @@ -186,8 +222,25 @@ def makeIMatShapes(self):
).astype("float32")

class Piezo(DM):
"""
A DM emulating a Piezo actuator style stack-array DM.
This class represents a standard stack-array style DM with push-pull actuators
behind a continuous phase sheet. The number of actuators is given in the
configuration file.
Each influence function is created by started with an N x N grid of zeros,
where N is the number of actuators in one direction, and setting a single
value to ``1``, which corresponds with a "pushed" actuator. This grid is then
interpolated up to the ``pupilSize``, to form the shape of the DM when that
actuator is activated. This is repeated for all actuators.
"""

def getActiveActs(self):
"""
Finds the actuators which will affect phase whithin the pupil to avoid
reconstructing for redundant actuators.
"""
activeActs = []
xActs = int(numpy.round(numpy.sqrt(self.dmConfig.dmActs)))
self.spcing = self.simConfig.pupilSize/float(xActs)
Expand All @@ -214,7 +267,7 @@ def makeIMatShapes(self):
on the size of the number of actuators, with only the 'poked'
actuator set to 1 and all others set to zero, up to the required
simulation size. This grid is actually padded with 1 extra actuator
spacing to avoid strange edge effects
spacing to avoid strange edge effects.
"""

#Create a "dmSize" - the pupilSize but with 1 extr a actuator on each
Expand Down Expand Up @@ -252,8 +305,24 @@ def makeIMatShapes(self):


class GaussStack(Piezo):
"""
A Stack Array DM where each influence function is a 2-D Gaussian shape.
This class represents a Stack-Array DM, similar to the :py:class:`Piezo` DM,
where each influence function is a 2-dimensional Gaussian function. Though
not realistic, it provides a known influence function which can be useful
for some analysis.
"""


def makeIMatShapes(self):
"""
Generates the influence functions for the GaussStack DM.
Creates a number of Guassian distributions which are centred at points
across the pupil to act as DM influence functions. The width of the
guassian is determined from the configuration file.
"""
shapes = numpy.zeros((
self.acts, self.simConfig.pupilSize, self.simConfig.pupilSize))

Expand All @@ -273,13 +342,25 @@ def makeIMatShapes(self):


class TT(DM):
"""
A class representing a tip-tilt mirror.
This can be used as a tip-tilt mirror, it features two actuators, where each
influence function is simply a tip and a tilt.
"""

def getActiveActs(self):
"""
Returns the number of active actuators on the DM. Always 2 for a TT.
"""
return 2


def makeIMatShapes(self):

"""
Forms the DM influence functions, in this case just a tip and a tilt.
"""
#Make the TT across the entire sim shape, but want it 1 to -1 across
#pupil
padMax = float(self.simConfig.simSize)/self.simConfig.pupilSize
Expand Down
12 changes: 3 additions & 9 deletions pyAOS/WFS.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@
# along with pyAOS. If not, see <http://www.gnu.org/licenses/>.

"""
The pyAOS Wavefront Sensor module.
The PyAOS WFS module.
^^^^^^^^^
WFS Class
^^^^^^^^^
WFS in PyAOS are represented by
This module contains a number of classes which simulate different adaptive optics wavefront sensor (WFS) types. All wavefront sensor classes can inherit from the base ``WFS`` class. The class provides the methods required to calculate phase over a WFS pointing in a given WFS direction and accounts for Laser Guide Star (LGS) geometry such as cone effect and elongation. This is If only pupil images (or complex amplitudes) are required, then this class can be used stand-alone.
Expand All @@ -40,7 +38,7 @@
wfs = WFS.WFS(config.sim, config.wfs[0], config.atmos, config.lgs[0], mask)
Set the WFS scrns (these should be made in advance, perhaps by the atmosphere module). Then run the WFS::
Set the WFS scrns (these should be made in advance, perhaps by the :py:mod:`pyAOS.atmosphere` module). Then run the WFS::
wfs.scrns = phaseScrnList
wfs.makePhase()
Expand All @@ -49,9 +47,6 @@
frameEField = wfs.EField
^^^^^^^^^^^^^^^^^^
Shack-Hartmann WFS
^^^^^^^^^^^^^^^^^^
A Shack-Hartmann WFS is also included in the module, this contains further methods to make the focal plane, then calculate the slopes to send to the reconstructor.
Expand All @@ -70,7 +65,6 @@
wfsDetector = shWfs.wfsDetectorPlane
^^^^^^^^^^^^^^^
Adding new WFSs
^^^^^^^^^^^^^^^
Expand Down
Loading

0 comments on commit 7419e22

Please sign in to comment.