rconan / CEO

Cuda-Engined Adaptive Optics
zlib License
24 stars 18 forks source link

GMT_MX documentation update? #58

Closed Teusia closed 3 years ago

Teusia commented 3 years ago

Hello, I found the following lines of documentation in the code while looking for a way to do a minimal working example.

"""
... line 38
    Examples
    --------
    >>> import ceo

    The mandatory parameters are the size of the pupil plane in meter or in pixel

    >>> gmt = ceo.GMT_MX(25.5,256)
...
"""

While the prototype of the __init__ and the list of parameters does not mention either the telescope diameter in meters nor the diameter in pixels, @rconan gave a recent presentation where the minimal working command for this class is gmt = ceo.GMT_MX(). Using gmt = ceo.GMT_MX(25.5,256) also interestingly produces the following output:

>>> gmt = ceo.GMT_MX(25,256)
Computing Zernike derivative coefficients! ....
Computing Zernike derivative coefficients! ....

Maybe doing this has other undocumented functionalities? Could it be that this class header documentation needs updating?

Best Regards, Anne-laure Cheffot

rconan commented 3 years ago

Thanks @Teusia for pointing out the outdated documentation of GMT_MX, I fixed it and push the changes to the devel branch, here is the updated doc:

>>> ceo.GMT_MX?                                                                                                                                                                                                                                                                       
Init signature:
ceo.GMT_MX(
    M1_radial_order=0,
    M2_radial_order=0,
    M1_mirror_modes='zernike',
    M2_mirror_modes='zernike',
    M1_N_MODE=0,
    M2_N_MODE=0,
    M1_mirror_modes_data=None,
    M2_mirror_modes_data=None,
    M1_clear_aperture_diameter=8.365,
)
Docstring:     
A class container from GMT_M1 and GMT_M2 classes

Parameters
----------
M1_radial_order : int, optional
    The largest radial order of the Zernike polynomials on M1 segments, default to 0
M2_radial_order : int, optional
    The largest radial order of the Zernike polynomials on M2 segments, default to 0
M1_mirror_modes : unicode, optional
    The modal basis on the M1 segments either ""zernike"" or ""bending modes"", default: ""zernike""
M1_N_MODE : int, optional
    The number of modes, default: 0
M2_mirror_modes : unicode, optional
    The modal basis on the M2 segments either ""zernike"" or "Karhunen-Loeve" (https://s3-us-west-1.amazonaws.com/gmto.rconan/KarhunenLoeveModes.bin), default: ""zernike""
M2_N_MODE : int, optional
    The number of modes, default: 0
M1_clear_aperture_diameter: float, optional
    M1 clear aperture diameter, default: 8.365m

Attributes
----------
M1 : GMT_M1
    The GMT M1 CEO class
M2 : GMT_M2
    The GMT M2 CEO class
sphere_radius : float
    The curvature radius of the ray tracing reference sphere

See also
--------
GMT_M1 : the class for GMT M1 model
GMT_M2 : the class for GMT M2 model
Source : a class for astronomical sources
cuFloatArray : an interface class between GPU host and device data for floats

Examples
--------
>>> import ceo

A GMT object is created simply with

>>> gmt = ceo.GMT_MX()

A combination of Zernike polynomials can be applied to M1 and M2 segments by specifying the largest radial order on each mirror

>>> gmt = ceo.GMT_MX(M1_radial_order=8, M2_radial_order=14)

A source is propagated (geometrically) through the telescope with the following procedure:

>>> src = ceo.Source("R",rays_box_size=25.5,rays_box_sampling=256,rays_origin=[0.0,0.0,25])
>>> gmt.propagate(src)

and the wavefront phase is retrieved either as a 2D map cuFloatArray object with

>>> gpu_ps2d = src.phase()

or as a 1D vector with

>>> gpu_ps1d = src.wavefront.phase()
File:           ~/Dropbox/AWS/CEO/python/ceo/GMTLIB.py
Type:           type
Subclasses:     JGMT_MX
Teusia commented 3 years ago

Thanks :)