currentscape.mapper¶
Mappers.
Functions
|
Find a number n that will be useful to find pairs (color, pattern). |
|
Return True if n has a common divisor with either n1 or n2. |
|
Get color index(es) s.t. |
|
Get pattern index(es) s.t. |
- currentscape.mapper.create_mapper(n_colors, n_patterns)[source]¶
Find a number n that will be useful to find pairs (color, pattern).
Those pairs should not have the same color in a row and the same pattern in a row. n should work as in the following example.
Example
- for i in range(n_currents):
color = (n*i) % n_colors pattern = ( (n*i) // n_colors) % n_patterns
- Constraints:
For two patterns to be different in a row: n>=n_patterns
n should not have a common divisor with either n_colors or n_patterns.
- currentscape.mapper.has_common_divisor(n1, n2, n)[source]¶
Return True if n has a common divisor with either n1 or n2.
- currentscape.mapper.map_colors(curr_idxs, n_colors, mapper)[source]¶
Get color index(es) s.t. a color / pattern index pair cannot be produced twice.
- Parameters:
curr_idxs (int or ndarray of ints) – index(es) of the current(s). should be smaller than number of currents
n_colors (int) – total number of colors
mapper (int) – number used to mix colors and patterns
- currentscape.mapper.map_patterns(curr_idxs, n_colors, n_patterns, mapper)[source]¶
Get pattern index(es) s.t. a color / pattern index pair cannot be produced twice.
- Parameters:
curr_idxs (int or ndarray of ints) – index(es) of the current(s). should be smaller than number of currents
n_colors (int) – total number of colors
n_patterns (int) – total number of patterns
mapper (int) – number used to mix colors and patterns