splinart package#
Subpackages#
Submodules#
splinart.color module#
Define the default color of the output.
splinart.compute module#
Material to update the output image using a cunbic spline equation.
- splinart.compute.update_img(img, path, xs_func, x=None, nrep=300, periodic=True, scale_color=0.005, color=(0.0, 0.41568627450980394, 0.6196078431372549, 1.0), scale_value=1e-05)#
Update the image using a cubic spline on a shape.
- Parameters:
img (np.ndarray) – The output image.
path (np.ndarray) – The y coordinate of the cubic spline if x is not None, the coordinates of the cubic spline if x is None.
x (np.ndarray) – The x coordinates of the cubic spline if given. (the default value is None)
xs_func (function) – The function that return the x coordinate of the sampling points where to compute the y coordinates given the spline equation.
nrep (int) – Number of iteration (default is 300).
periodic (bool) – Define if the first and last points of the path must be equal (default is True).
scale_color (float) – Scale the given color (default is 0.005).
color (list(4)) – Define the RGBA color to plot the spline.
scale_value (float) – Rescale the random radius (default value is 0.00001).
See also
- splinart.compute.update_path(path, periodic=False, scale_value=1e-05)#
Update the path of the spline.
We move each point of the path by a random vector defined inside a circle where
the center is the point of the path
the radius is a random number between [-1, 1]
- Parameters:
path (np.ndarray) – The y coordinate of the cubic spline.
periodic (bool) – If True, the first and the last points of the path are the same (the default value is False).
scale_value (float) – Rescale the random radius (default value is 0.00001).
splinart.draw module#
Material to update the image with given points and save or plot this image.
- splinart.draw.draw_pixel(img, xs, ys, scale_color=0.0005, color=(0.0, 0.41568627450980394, 0.6196078431372549, 1.0))#
Add pixels on the image.
- Parameters:
img (np.ndarray) – The image where we add pixels.
xs (np.ndarray) – The x coordinate of the pixels to add.
ys (np.ndarray) – The y coordinate of the pixels to add.
scale_color (float) – Scale the given color (default is 0.0005).
color (list(4)) – Define the RGBA color of the pixels.
- splinart.draw.save_img(img, path, filename)#
Save the image in a png file.
- Parameters:
img (np.ndarray) – The image to save.
path (str) – The save directory.
filename (str) – The file name with the png extension.
- splinart.draw.show_img(img)#
Plot the image using matplotlib.
- Parameters:
img (np.ndarray) – The image to save.
splinart.version module#
Splinart version.
Module contents#
Splinart package.
- splinart.circle(center, radius, npoints=50)#
Discretization of a circle.
- Parameters:
center (list(2)) – 2d coordinates of the center.
radius (float) – Radius of the circle.
npoints (int) – Number of discretization points (the default value is 50).
- Returns:
np.ndarray – The theta angle.
np.ndarray – The 2d coordinates of the circle.
- splinart.line(begin, end, ypos=0.5, npoints=50)#
Discretization of a horizontal line.
- Parameters:
begin (float) – The left point of the line.
end (float) – The right point of the line.
ypos (float) – The position of the y coordinate (the default value is 0.5).
npoints (int) – Number of discretization points (the default value is 50).
- Returns:
The 2d coordinates of the line.
- Return type:
np.ndarray
- splinart.save_img(img, path, filename)#
Save the image in a png file.
- Parameters:
img (np.ndarray) – The image to save.
path (str) – The save directory.
filename (str) – The file name with the png extension.
- splinart.show_img(img)#
Plot the image using matplotlib.
- Parameters:
img (np.ndarray) – The image to save.
- splinart.update_img(img, path, xs_func, x=None, nrep=300, periodic=True, scale_color=0.005, color=(0.0, 0.41568627450980394, 0.6196078431372549, 1.0), scale_value=1e-05)#
Update the image using a cubic spline on a shape.
- Parameters:
img (np.ndarray) – The output image.
path (np.ndarray) – The y coordinate of the cubic spline if x is not None, the coordinates of the cubic spline if x is None.
x (np.ndarray) – The x coordinates of the cubic spline if given. (the default value is None)
xs_func (function) – The function that return the x coordinate of the sampling points where to compute the y coordinates given the spline equation.
nrep (int) – Number of iteration (default is 300).
periodic (bool) – Define if the first and last points of the path must be equal (default is True).
scale_color (float) – Scale the given color (default is 0.005).
color (list(4)) – Define the RGBA color to plot the spline.
scale_value (float) – Rescale the random radius (default value is 0.00001).
See also
update_path