From 65d27dd7887f5d5a294ba18670bb310ab5e578dd Mon Sep 17 00:00:00 2001 From: Loic Coyle Date: Mon, 24 Jun 2024 18:42:41 +0200 Subject: [PATCH] fix(mosaic): update docstrings --- phomo/mosaic.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/phomo/mosaic.py b/phomo/mosaic.py index baad44e..73de983 100644 --- a/phomo/mosaic.py +++ b/phomo/mosaic.py @@ -38,7 +38,8 @@ def __init__( >>> pool = Pool.from_dir("tiles") >>> master = Master.from_file("master.png") - >>> Mosaic(master, pool, n_appearances=1).build() + >>> mosaic = Mosaic(master, pool, n_appearances=1) + >>> mosaic.build(mosaic.d_matrix()) """ self._log = logging.getLogger(__name__) self.master = master @@ -275,16 +276,19 @@ def build(self, d_matrix: np.ndarray) -> Image.Image: See: https://en.wikipedia.org/wiki/Assignment_problem Args: - workers: The number of workers to use when computing the - distance matrix. - metric: The distance metric used for the distance matrix. Either - provide a string, for implemented metrics see ``phomo.metrics.METRICS``. - Or a callable, which should take two ``np.ndarray``s and return a float. - d_matrix: Use a pre-computed distance matrix. - **kwargs: Passed to the `metric` function. + d_matrix: The distanace matrix to use to build the mosaic. Returns: The PIL.Image instance of the mosaic. + + Examples: + Building a mosaic. + + >>> mosaic.build(mosaic.d_matrix()) + + On a GPU. + + >>> mosaic.build(mosaic.d_matrix_cuda()) """ mosaic = np.zeros((self.size[1], self.size[0], 3))