Particle count in Poisson process


/ Published in: Python
Save to your folder(s)

A simple algorithm for counting particles emitted by radio active matter assumed to be described by a Poisson process


Copy this code and paste it in your HTML
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Sun Aug 10 16:27:16 2014
  4.  
  5. @author: Anish
  6. """
  7. #Spyder Editor
  8.  
  9.  
  10. # Importing libraries
  11. import os
  12. os.system('cls')
  13. import numpy as np
  14. import matplotlib.pyplot as plt
  15.  
  16. #clf()
  17. Nlim = 100
  18.  
  19. a = 1
  20. b = 2
  21. l = 10
  22. x = 0
  23.  
  24. s = np.random.poisson(l, 1)
  25. plt.plot(x,s,'-r')
  26. plt.show() # redraw the canvas
  27. plt.xlabel('Time Lapsed (ms)')
  28. plt.ylabel('Particle Counts')
  29. # for loop for recursive plotting of poisson process
  30. while x < Nlim:
  31. x = x+1
  32. s = np.random.poisson(l, 1)
  33. plt.plot(x,s,'or')
  34. plt.show() # redraw the canvas
  35. pause(.2)

URL: Poisson Process: Counting

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.