Points.repeat

Points.repeat(totalCopies, copyPointByPoint, *, useLog=None)

Create an object using copies of this object’s points.

Copies of this object will be stacked vertically. The returned object will have the same number of features as this object and the number of points will be equal to the number of points in this object times totalCopies. If this object contains pointNames, each point name will have “_#” appended, where # is the number of the copy made.

Parameters:
  • totalCopies (int) – The number of times a copy of the data in this object will be present in the returned object.

  • copyPointByPoint (bool) – When False, copies are made as if iterating through the points in this object totalCopies times. When True, copies are made as if the object is only iterated once, making totalCopies copies of each point before iterating to the next point.

  • useLog (bool, None) – Local control for whether to send object creation to the logger. If None (default), use the value as specified in the “logger” “enabledByDefault” configuration option. If True, send to the logger regardless of the global option. If False, do NOT send to the logger, regardless of the global option.

Returns:

nimble Base object – Object containing the copied data.

Examples

Single point

>>> X = nimble.data([[1, 2, 3]])
>>> X.points.setNames(['a'])
>>> X.points.repeat(totalCopies=3, copyPointByPoint=False)
<Matrix 3pt x 3ft
       0  1  2
     ┌────────
 a_1 │ 1  2  3
 a_2 │ 1  2  3
 a_3 │ 1  2  3
>

Two-dimensional, copyPointByPoint is False

>>> X = nimble.data([[1, 2, 3], [4, 5, 6]])
>>> X.points.setNames(['a', 'b'])
>>> X.points.repeat(totalCopies=2, copyPointByPoint=False)
<Matrix 4pt x 3ft
       0  1  2
     ┌────────
 a_1 │ 1  2  3
 b_1 │ 4  5  6
 a_2 │ 1  2  3
 b_2 │ 4  5  6
>

Two-dimensional, copyPointByPoint is True

>>> X = nimble.data([[1, 2, 3], [4, 5, 6]])
>>> X.points.setNames(['a', 'b'])
>>> X.points.repeat(totalCopies=2, copyPointByPoint=True)
<Matrix 4pt x 3ft
       0  1  2
     ┌────────
 a_1 │ 1  2  3
 a_2 │ 1  2  3
 b_1 │ 4  5  6
 b_2 │ 4  5  6
>