#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 28 09:15:52 2016

@author: andreaskuk
"""


import numpy as np
import matplotlib.pyplot as plt
"""
function: Y=Y_0(cos(\theta)^(-f)*exp(b(1-1/cos(\theta))))
mit Y_0= 0.11, f=1.9, b=0.19 von 0°-90°
"""
y0, f ,b,  = 0.11, 1.9,0.19
x= np.linspace(0,90,10000)
#y = y0*np.power(np.cos(x),-f)*np.exp(b*(1-1/np.cos(x)))
y = y0*np.cos(np.radians(x))**(-f)*np.exp(b*(1-1/np.cos(np.radians(x))))




plt.title('Plot Sputter Yield')
plt.xlabel('0°-90°')
plt.ylabel('y')

plt.grid(True)
plt.plot(x,y, label='$Y=$Y_0*(cos(\Theta))^(-f)*exp(b(1-(1/ cos(\Theta))))')
plt.legend(loc='upper left')
plt.show()



class Kukplot:
    def __init__(self,y0,f,b):
        #self.x=np.linespace(0,90,101)
        self.y0=y0
        self.f=f
        self.b=b
   #     self.y=y0*np.cos(np.radians(x))**(-f)*np.exp(b*(1-1/np.cos(np.radians(x))))
        
    def __call__(self,x):
        self.x=x
        y = self.y0*np.cos(np.radians(self.x))**(-self.f)*np.exp(self.b*(1-1/np.cos(np.radians(self.x))))

        return y
x=np.linspace(0,90,101)
sjsj = Kukplot(0.11,1.9,0.19)
y= sjsj(np.linspace(0,90,101))
plt.title('Plot Sputter Yield')
plt.xlabel('0°-90°')
plt.ylabel('y')

plt.grid(True)
plt.plot(x,y, label='$Y=$Y_0*(cos(\Theta))^(-f)*exp(b(1-(1/ cos(\Theta))))')
plt.legend(loc='upper left')
plt.show()
