#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun  4 14:52:22 2019

@author: aurelien
"""


import numpy as np
import matplotlib.pyplot as plt

import aotools
from aotools.slm.slm import SLM
import sys
sys.path.append("../..")

from constants import FIG_UNIT
plt.close("all")
slm = SLM()

slm.set_hologram_geometry([0,0,400,400])
slm.set_pupil_rho(200)

def set_aberration(ind,val,savename):
    abe = np.zeros(15)
    abe[ind] = val
    slm.set_aberration(abe)
    arr = slm.arr.copy().astype(np.float)
    arr/=arr.max()
    arr[slm.rho>1] = np.nan
    fig = plt.figure(figsize=(FIG_UNIT,FIG_UNIT))
    plt.imshow(arr)
    plt.axis("off")
    fig.savefig(savename+"_mask.svg",dpi = 600,transparent = True)

set_aberration(5,1,"Astigmatism")
set_aberration(7,1,"Coma")
set_aberration(10,1,"Spherical")
set_aberration(1,1,"Tip")