Load necessary package


In [1]:
import  matplotlib.pyplot as plt
import numpy as np
plt.rcParams.update({'figure.max_open_warning': 0})
plt.rcParams.update({ 'image.origin': 'lower'   })
plt.rcParams.update({ 'image.interpolation': 'none'   })
from skbeam.core import roi

In [2]:
#%matplotlib inline
%matplotlib notebook

define objects


In [3]:
ed = 0.1 #edge fraction, in this case [40, 360]
bx = 2000   #box size, namely each frame size
by=  2000
le = bx*ed  #edge size in pixel
size= 10 # each particle size, radius 
center=[ bx//2,by//2]
num =  32  #particle number = num *num
print(center)



#from pixel to q, q= pixel/54.6


[1000, 1000]

Initilize the oject center positions


In [4]:
px = np.random.uniform( ed, 1-ed, (num , num ) ) * bx
py = np.random.uniform( ed, 1-ed, (num , num ) ) * by

In [5]:
%run -i Generate_2D_Pattern.py

Apply a random motion to get non-overlap distribution


In [6]:
px,py = get_random_motion_2D_points( px, py, amp = 10, rmin= 40, try_max=10000, )


100%|██████████| 1024/1024 [00:13<00:00, 73.98it/s]

Place the shape on the spot


In [7]:
img =  place_shape_on_pxy( px,py, size= size,  bx= bx, by=by, shape='c' )

Show the generate image


In [8]:
plt.imshow(img)


Out[8]:
<matplotlib.image.AxesImage at 0x7fbd92d71748>

In [ ]: