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 cubic spline equation.
- splinart.compute.update_img(img: ndarray[tuple[Any, ...], dtype[floating]], path: ndarray[tuple[Any, ...], dtype[floating]], xs_func: Callable[[], ndarray[tuple[Any, ...], dtype[floating]]], x: ndarray[tuple[Any, ...], dtype[floating]] | None = None, nrep: int = 300, periodic: bool = True, scale_color: float = 0.005, color: Sequence[float] = (0.0, 0.41568627450980394, 0.6196078431372549, 1.0), scale_value: float = 1e-05) None#
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: ndarray[tuple[Any, ...], dtype[floating]], periodic: bool = False, scale_value: float = 1e-05) None#
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: ndarray[tuple[Any, ...], dtype[floating]], xs: ndarray[tuple[Any, ...], dtype[floating]], ys: ndarray[tuple[Any, ...], dtype[floating]], scale_color: float = 0.0005, color: Sequence[float] = (0.0, 0.41568627450980394, 0.6196078431372549, 1.0)) None#
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: ndarray[tuple[Any, ...], dtype[floating]], path: str, filename: str) None#
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: ndarray[tuple[Any, ...], dtype[floating]]) None#
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: List[float] | Tuple[float, float] | ndarray[tuple[Any, ...], dtype[floating]], radius: float, npoints: int = 50) Tuple[ndarray[tuple[Any, ...], dtype[floating]], ndarray[tuple[Any, ...], dtype[floating]]]#
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: float, end: float, ypos: float = 0.5, npoints: int = 50) ndarray[tuple[Any, ...], dtype[floating]]#
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: ndarray[tuple[Any, ...], dtype[floating]], path: str, filename: str) None#
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: ndarray[tuple[Any, ...], dtype[floating]]) None#
Plot the image using matplotlib.
- Parameters:
img (np.ndarray) – The image to save.
- splinart.update_img(img: ndarray[tuple[Any, ...], dtype[floating]], path: ndarray[tuple[Any, ...], dtype[floating]], xs_func: Callable[[], ndarray[tuple[Any, ...], dtype[floating]]], x: ndarray[tuple[Any, ...], dtype[floating]] | None = None, nrep: int = 300, periodic: bool = True, scale_color: float = 0.005, color: Sequence[float] = (0.0, 0.41568627450980394, 0.6196078431372549, 1.0), scale_value: float = 1e-05) None#
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