import pynsn as nsn
from pynsn import distributions as distr
PyNSN 0.13.0
To generate a random nsn stimulus, you have to define
factory = nsn.NSNFactory(target_area_radius=150)
factory.set_appearance_dot(diameter=distr.Normal(mu=13, sigma=4, min_max=(10,25)))
# Generate random nsn stimulus with 15 dots
stimulus = factory.create_random_array(n_objects=15)
Make picture of the stimulus
from pynsn.image import pil_image
pil_image.create(stimulus)
# example: to plot field area and center of mass, just define the repective colours and plot
my_colours = nsn.ImageColours(target_area="yellow",
field_area_positions="red",
field_area="green",
center_of_mass="lightblue",
center_of_field_area="blue",
background="gray",
default_object_colour="darkmagenta")
pil_image.create(stimulus, colours=my_colours)
factory.target_area_radius=75
stim_iterator = factory.create_incremental_random_array(n_objects=20)
for stim in stim_iterator:
img = pil_image.create(stim)
display(img)