Advertisement
Stex6299

Untitled

Nov 12th, 2020
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. #%%
  2.  
  3. lista = []
  4.    
  5. f = open("./FPA.txt", "r")
  6.  
  7. for x in f:
  8.    
  9.     #print(x)
  10.     a=x.split('\t')
  11.     #print(a)
  12.    
  13.     b = a[1].split(',')
  14.     c = a[2].split(',')
  15.    
  16.     #print(b)
  17.     #print(c)
  18.    
  19.     tmp = [a[0]]+b+c
  20.     #print("\n\n")
  21.     #print(tmp)
  22.     try:
  23.         tmp[4]=tmp[4].replace('\n','')
  24.     except:
  25.         pass
  26.    
  27.     #print("\n\n")
  28.     #print(tmp)
  29.    
  30.     lista.append(tmp)
  31.  
  32. f.close()
  33.  
  34. lista.pop(0)
  35.  
  36.  
  37. matrice=np.array(lista, dtype = np.float32)
  38. #mm=matrice.astype(float)
  39.    
  40.  
  41. plt.plot(matrice[:,0] , matrice[:,1])
  42. plt.plot(matrice[:,0] , np.sqrt(matrice[:,3]**2 + matrice[:,4]**2) )
  43.  
  44. #plt.yscale('log')
  45. plt.xscale('log')
  46.  
  47. plt.show()
  48.  
  49.  
  50.  
  51. #Esporto i dati..
  52. f=matrice[:,0]
  53. v1=matrice[:,1]
  54. v2=np.sqrt(matrice[:,3]**2 + matrice[:,4]**2)
  55. dp=np.angle( np.vectorize(complex)(matrice[:,3], matrice[:,4]) , deg=True )
  56.  
  57.  
  58.  
  59. v2 = np.abs( np.vectorize(complex)(matrice[:,3], matrice[:,4]) )
  60.  
  61. plt.plot(f,v1)
  62. plt.plot(f,v2)
  63. plt.xscale('log')
  64. plt.show()
  65.  
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement