tyrion

modulazione.py

May 27th, 2013
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. from itertools import izip
  2. import math
  3.  
  4. def dati():
  5.     for r, i in izip(open('dati_re.txt'), open('dati_im.txt')):
  6.         yield complex(float(r), float(i))
  7.  
  8. def proc():
  9.     input = dati()
  10.     j = next(input)
  11.     for i in input:
  12.         x = i * j.conjugate()
  13.         yield math.atan2(x.imag, x.real)
  14.         j = i
  15.  
  16. if __name__ == '__main__':
  17.     for x in proc():
  18.         print(x)
Advertisement
Add Comment
Please, Sign In to add comment