Call Object


SUBMITTED BY: bitcoinsachen

DATE: Oct. 28, 2016, 8:25 a.m.

FORMAT: Python 3

SIZE: 1.4 kB

HITS: 578

  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Created on Fri Oct 28 09:15:52 2016
  5. @author: andreaskuk
  6. """
  7. import numpy as np
  8. import matplotlib.pyplot as plt
  9. """
  10. function: Y=Y_0(cos(\theta)^(-f)*exp(b(1-1/cos(\theta))))
  11. mit Y_0= 0.11, f=1.9, b=0.19 von 0°-90°
  12. """
  13. y0, f ,b, = 0.11, 1.9,0.19
  14. x= np.linspace(0,90,10000)
  15. #y = y0*np.power(np.cos(x),-f)*np.exp(b*(1-1/np.cos(x)))
  16. y = y0*np.cos(np.radians(x))**(-f)*np.exp(b*(1-1/np.cos(np.radians(x))))
  17. plt.title('Plot Sputter Yield')
  18. plt.xlabel('0°-90°')
  19. plt.ylabel('y')
  20. plt.grid(True)
  21. plt.plot(x,y, label='$Y=$Y_0*(cos(\Theta))^(-f)*exp(b(1-(1/ cos(\Theta))))')
  22. plt.legend(loc='upper left')
  23. plt.show()
  24. class Kukplot:
  25. def __init__(self,y0,f,b):
  26. #self.x=np.linespace(0,90,101)
  27. self.y0=y0
  28. self.f=f
  29. self.b=b
  30. # self.y=y0*np.cos(np.radians(x))**(-f)*np.exp(b*(1-1/np.cos(np.radians(x))))
  31. def __call__(self,x):
  32. self.x=x
  33. y = self.y0*np.cos(np.radians(self.x))**(-self.f)*np.exp(self.b*(1-1/np.cos(np.radians(self.x))))
  34. return y
  35. x=np.linspace(0,90,101)
  36. sjsj = Kukplot(0.11,1.9,0.19)
  37. y= sjsj(np.linspace(0,90,101))
  38. plt.title('Plot Sputter Yield')
  39. plt.xlabel('0°-90°')
  40. plt.ylabel('y')
  41. plt.grid(True)
  42. plt.plot(x,y, label='$Y=$Y_0*(cos(\Theta))^(-f)*exp(b(1-(1/ cos(\Theta))))')
  43. plt.legend(loc='upper left')
  44. plt.show()

comments powered by Disqus