# Lecture 2: Different types of point processes and transformations                 

## 1. Binomial Point Process

- Fixed number of points
- Independent and identically distributed points over a given region
- How to simulate a BPP?


```python
#Numpy library
import numpy as np
#Number of points: N
x_realization_BPP = 50

#Square side: L
L = 10

#Random points in axis x
position_x_realization_BPP = np.random.uniform(0,L,x_realization_BPP)

#Random points in axis y
position_y_realization_BPP = np.random.uniform(0,L,x_realization_BPP)

#Manipulating arrays
position_x_realization_BPP_t=np.transpose(position_x_realization_BPP)
position_y_realization_BPP_t=np.transpose(position_y_realization_BPP)
#position_final_BPP = []
#position_final_BPP = [[position_x_realization_BPP_t[ix], position_y_realization_BPP_t[ix]] for ix in range(0, x_realization_BPP)]
```


```python
#Ploting libraries
import matplotlib.pyplot as plt
#Plot commands
plt.figure(figsize=(8,8), dpi=1200)
plt.plot(position_x_realization_BPP, position_y_realization_BPP, marker='.', color='g',linestyle = '')
plt.xlabel('x')
plt.ylabel('y')
plt.title('BPP')
plt.show()
```

What can you say about this process?

## 2. Poisson Point Process

- Random number of points: Poisson distribution
- Independent and identically distributed point over a given region
- How to simulate a PPP?


```python
#Square side: L
L = 10

#Average number of points (Poisson)
x_average_PPP = 50

#Number of points N that is a Poisson random variable 
x_realization_PPP = np.random.poisson(x_average_PPP,1)

#Random points in axis x
position_x_realization_PPP = np.random.uniform(0,L,x_realization_PPP)

#Random points in axis y
position_y_realization_PPP = np.random.uniform(0,L,x_realization_PPP)

#Manipulating arrays
position_x_realization_PPP_t=np.transpose(position_x_realization_PPP)
position_y_realization_PPP_t=np.transpose(position_y_realization_PPP)
#position_final = []
#position_final = [[position_x_realization_PPP_t[ix], position_y_realization_PPP_t[ix]] for ix in range(0, x_realization_PPP)]
```


```python
#Number of points in this realization
print 'Number of points:', x_realization_PPP

#Ploting libraries
import numpy as np
import matplotlib.pyplot as plt
#Plot commands
plt.figure(figsize=(8,8), dpi=1200)
plt.plot(position_x_realization_PPP, position_y_realization_PPP, marker='.', color='r',linestyle = '')
plt.xlabel('x')
plt.ylabel('y')
plt.title('PPP')
plt.axis([0, L, 0, L])
plt.show()
```

How about the statistics?
- Let's compare the average number of points based on the simulation and the analytic formula of Poisson distribution.


```python
#Sympy library
from sympy import Symbol, symbols, init_printing, oo
from sympy import exp, gamma

# Setting things up
init_printing()

#Symbols
x,k = symbols('x k', real = True, positive = True)
#Defining Poisson distribution
f_Poisson = ((x)**k/gamma(k)) * exp(-x)
f_Poisson
```


```python
#Simulating Poisson distribution
s = np.random.poisson(x_realization_PPP, 100000)

#Analytic distribution
from scipy.stats import poisson
#
plt.figure(figsize=(10,8), dpi=1200)
plt.hist(s,normed=True, color="#6495ED")
k = np.arange(100)
plt.plot(k, poisson.pmf(k, x_realization_PPP), '-o')
plt.xlabel('$k$')
plt.ylabel('Probability that $n = k$')
plt.title('Poisson distribution')
plt.show()
```

## 3. Superposition transformation

What is a superposition transformation?


```python
import matplotlib.pyplot as plt
#Plot commands
plt.figure(figsize=(8,8), dpi=100)
plt.plot(position_x_realization_BPP, position_y_realization_BPP, marker='.', color='b',linestyle = '')
plt.plot(position_x_realization_PPP, position_y_realization_PPP, marker='.', color='b',linestyle = '')
plt.xlabel('x')
plt.ylabel('y')
plt.title('Superposition: BPP and PPP')
plt.show()
```

By looking this plot, can you say which point process is which?

Marking the process


```python
import matplotlib.pyplot as plt
#Plot commands
plt.figure(figsize=(8,8), dpi=1200)
plt.plot(position_x_realization_BPP, position_y_realization_BPP, marker='x', color='g',linestyle = '')
plt.plot(position_x_realization_PPP, position_y_realization_PPP, marker='o', color='r',linestyle = '')
plt.xlabel('x')
plt.ylabel('y')
plt.title('Superposition: BPP and PPP')
plt.show()
```

## 4. Mapping transformation

What is a  mapping transformation?


```python
#Square side: L
L = 10

#Average number of points (Poisson)
x_average_PPP = 50

#Number of points N that is a Poisson random variable 
x_realization_PPP = np.random.poisson(x_average_PPP,1)

#Scaling transformation
s = 2

#Random points in axis x
position_x_realization_PPP = s * np.random.uniform(0,L,x_realization_PPP)

#Random points in axis y
position_y_realization_PPP = s * np.random.uniform(0,L,x_realization_PPP)                   
```


```python
#Number of points in this realization
print 'Number of points:', x_realization_PPP

#Ploting libraries
import numpy as np
import matplotlib.pyplot as plt
#Plot commands
plt.figure(figsize=(8,8), dpi=1200)
plt.plot(position_x_realization_PPP, position_y_realization_PPP, marker='.', color='g',linestyle = '')
plt.xlabel('x')
plt.ylabel('y')
plt.title('PPP with scaling')
plt.show()
```

## 5. Thinning transformation

What is a thinning transformation?

Delete points

- Independent: e.g. erase with a given probability
- Dependent: e.g. erase the points within a given range

You can try to implentent this at home

## 6. Cluster formation

How to form clusters?

- Think about if every point in the original point process can be the parent of other point process around it
- Try also to implement this at home

<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/">Creative Commons Attribution-NonCommercial 4.0 International License</a>.


```python

```

378c7c48cb27c29d7e088753287c5db868bf6f08
ipynb
Jupyter Notebook
lecture2.ipynb
pedrohjn/Stochastic-Geometry
d9c57169989219e4ff38577130096054a51a78e3
CC-BY-4.0
2019-03-11T10:52:51.000Z
2021-12-24T02:55:49.000Z
lecture2.ipynb
pedrohjn/Stochastic-Geometry
d9c57169989219e4ff38577130096054a51a78e3
CC-BY-4.0
lecture2.ipynb
pedrohjn/Stochastic-Geometry
d9c57169989219e4ff38577130096054a51a78e3
CC-BY-4.0
2017-12-19T12:08:24.000Z
2022-01-30T10:57:52.000Z
Qwen/Qwen-72B
1. YES
2. YES