Skip to content

Commit d338612

Browse files
committed
update glasbey license
1 parent e7c25c0 commit d338612

File tree

5 files changed

+56
-78
lines changed

5 files changed

+56
-78
lines changed

LICENSE/LICENSE_GLASBEY

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Leland McInnes and 2014 Sergey Alexandrov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/cmap/data/glasbey/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""glasbey vendored from https://github.com/lmcinnes/glasbey.
2+
3+
(Vendored to remove dependency on matplotlib and scikit-learn, and make numba optional.)
4+
5+
MIT License
6+
7+
Copyright (c) 2022 Leland McInnes and 2014 Sergey Alexandrov
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy
10+
of this software and associated documentation files (the "Software"), to deal
11+
in the Software without restriction, including without limitation the rights
12+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
copies of the Software, and to permit persons to whom the Software is
14+
furnished to do so, subject to the following conditions:
15+
16+
The above copyright notice and this permission notice shall be included in all
17+
copies or substantial portions of the Software.
18+
19+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25+
SOFTWARE.
26+
"""

src/cmap/data/glasbey/_glasbey.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# glasbey vendored from https://github.com/lmcinnes/glasbey.
2+
# see __init__ and LICENSE_GLASBEY
13
from __future__ import annotations
24

35
from typing import Literal

src/cmap/data/glasbey/_grids.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# MIT License
2-
# Leland McInnes
1+
# glasbey vendored from https://github.com/lmcinnes/glasbey.
2+
# see __init__ and LICENSE_GLASBEY
33
from __future__ import annotations
44

55
from typing import Sized

src/cmap/data/glasbey/_internals.py

Lines changed: 5 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# MIT License
2-
# Leland McInnes, Sergey Alexandrov
3-
1+
# glasbey vendored from https://github.com/lmcinnes/glasbey.
2+
# see __init__ and LICENSE_GLASBEY
43
import numpy as np
54

5+
# "numbafication" is done at the bottom of the module
66

77
def get_next_color(distances, colors, new_color):
88
argmax = -1
@@ -104,42 +104,6 @@ def generate_palette_cam02ucs_and_other(
104104
return result
105105

106106

107-
# def generate_next_color_cam02ucs(colors, current_distances, new_palette_block):
108-
# for i in range(new_palette_block.shape[0]):
109-
# _ = get_next_color(current_distances, colors, new_palette_block[i])
110-
# return get_next_color(current_distances, colors, new_palette_block[0])
111-
112-
113-
# def generate_next_color_cam02ucs_and_other(
114-
# colors1,
115-
# colors2,
116-
# current_distances,
117-
# new_palette_block1,
118-
# new_palette_block2,
119-
# alpha=0.0,
120-
# ):
121-
# for i in range(new_palette_block1.shape[0]):
122-
# _ = two_space_get_next_color(
123-
# current_distances,
124-
# colors1,
125-
# colors2,
126-
# new_palette_block1[i],
127-
# new_palette_block2[i],
128-
# alpha=alpha,
129-
# )
130-
131-
# result, _ = two_space_get_next_color(
132-
# current_distances,
133-
# colors1,
134-
# colors2,
135-
# new_palette_block1[0],
136-
# new_palette_block2[0],
137-
# alpha=alpha,
138-
# )
139-
140-
# return result
141-
142-
143107
try:
144108
import numba
145109
except ImportError:
@@ -168,6 +132,7 @@ def generate_palette_cam02ucs_and_other(
168132
cache=True,
169133
)
170134

135+
# get_next_color(distances, colors, new_color)
171136
get_next_color = jit1(get_next_color)
172137

173138
jit2 = numba.njit(
@@ -187,25 +152,9 @@ def generate_palette_cam02ucs_and_other(
187152
cache=True,
188153
)
189154

155+
# generate_palette_cam02ucs(colors, initial_palette, size)
190156
generate_palette_cam02ucs = jit2(generate_palette_cam02ucs)
191157

192-
# jit3 = numba.njit(
193-
# [
194-
# # 'f4[::1](f4[:,::1], f4[::1], f4[:,::1])',
195-
# numba.types.Array(numba.float32, 1, "C", readonly=True)(
196-
# numba.types.Array(numba.float32, 2, "C", readonly=True),
197-
# numba.types.Array(numba.float32, 1, "C"),
198-
# numba.types.Array(numba.float32, 2, "C", readonly=True),
199-
# )
200-
# ],
201-
# locals={
202-
# "i": numba.uint16,
203-
# },
204-
# cache=True,
205-
# )
206-
207-
# generate_next_color_cam02ucs = jit3(generate_next_color_cam02ucs)
208-
209158
jit4 = numba.njit(
210159
[
211160
"UniTuple(f4[::1], 2)(f4[::1], f4[:, ::1], f4[:, ::1], f4[::1], f4[::1], f4)",
@@ -257,23 +206,3 @@ def generate_palette_cam02ucs_and_other(
257206
)
258207

259208
generate_palette_cam02ucs_and_other = jit5(generate_palette_cam02ucs_and_other)
260-
261-
# jit6 = numba.njit(
262-
# [
263-
# numba.types.Array(numba.float32, 1, "C", readonly=True)(
264-
# numba.types.Array(numba.float32, 2, "C", readonly=True),
265-
# numba.types.Array(numba.float32, 2, "C", readonly=True),
266-
# numba.types.Array(numba.float32, 1, "C"),
267-
# numba.types.Array(numba.float32, 2, "C", readonly=True),
268-
# numba.types.Array(numba.float32, 2, "C", readonly=True),
269-
# numba.float32,
270-
# )
271-
# ],
272-
# locals={
273-
# "i": numba.uint16,
274-
# },
275-
# cache=True,
276-
# )
277-
# generate_next_color_cam02ucs_and_other = jit6(
278-
# generate_next_color_cam02ucs_and_other
279-
# )

0 commit comments

Comments
 (0)