laplace.py 430 B

1234567891011121314151617181920212223
  1. import math
  2. import sys
  3. def laplace_test(ttr, tend):
  4. r = len(ttr)
  5. s = 0
  6. for ti in ttr:
  7. s += ti - (tend/2)
  8. try:
  9. z = (math.sqrt(12*r)*s)/(r*tend)
  10. except ZeroDivisionError:
  11. return(0)
  12. return(z)
  13. def main():
  14. time_end = float(sys.argv[1])
  15. time_list = [float(i) for i in sys.argv[2:]]
  16. print(laplace_test(time_list, time_end))
  17. return
  18. if __name__ == "__main__":
  19. main()