Facebook
From Blush Porcupine, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 285
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Thu Mar  7 11:14:23 2019
  4.  
  5. @author: Student
  6. """
  7.  
  8. #class VectorExample():
  9. #    def __init__(self, input_list):
  10. #        self.vector = input_list
  11. #        
  12. #    def foreach(self, other, input_function):
  13. #        return VectorExample([input_function(self.vector[i], other.vector[i]) for i in range(len(self.vector))])
  14. #        
  15. #    def __add__(self,other):
  16. #        return self.foreach(other, lambda a,b: a+b)
  17. #    
  18. #    def __sub__(self, other):
  19. #        return self.foreach(other, lambda a,b: a-b)
  20. #    
  21. #    def __mul__(self, other):
  22. #        return self.foreach(other, lambda a,b: a*b)
  23. #    
  24. #    def __truediv__(self,other):
  25. #        return self.foreach(other, lambda a,b: a/b)
  26. #    
  27. #    def __str__(self):
  28. #        return str(self.vector)
  29. #
  30. #
  31. #def run():
  32. #    vector_1 = VectorExample([1, 13, 4])
  33. #    vector_2 = VectorExample([3, -2, 2])
  34. #
  35. #    print(vector_1 + vector_2)
  36. #    print(vector_1 - vector_2)
  37. #    print(vector_1 * vector_2)
  38. #    print(vector_1 / vector_2)
  39. #    
  40. #if __name__== "__main__":
  41. #   run()
  42.  
  43. import os
  44. import numpy as np
  45. from matplotlib  import pyplot as plt
  46. from skimage import io
  47.    
  48. def run():
  49.     example_array = np.array([
  50.             [8,1,1,1],
  51.             [9,7,5,3],
  52.             [4,6,8,10],
  53.             [2,3,5,7]
  54.    
  55.     ])
  56.    
  57.     noise_1 = np.random.randn(128,256)
  58.     noise_2 = np.random.randn(128,256)
  59.    
  60.     vmin=-0.5;vmax=0.5
  61.     plt.figure()
  62.     plt.subplot(2,1,1)
  63.     plt.imshow(noise_1,cmap='gray', vmin=vmin, vmax=vmax)
  64.     plt.axis('off')
  65.     plt.subplot(2,1,2)
  66.     plt.imshow(noise_2, cmap='gray', vmin=vmin, vmax=vmax)
  67.     plt.axis('off')
  68.     plt.show()
  69.    
  70.    
  71.  
  72. run()
  73.    
  74.    
  75.    
  76.    
  77.    
  78.    
  79.    
  80.    
  81.    
  82.    
  83.    
  84.    
  85.