gismap 0.2.2__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gismap/__init__.py +1 -0
- gismap/gisgraphs/__init__.py +0 -0
- gismap/gisgraphs/builder.py +105 -0
- gismap/{lab → gisgraphs}/graph.py +70 -66
- gismap/gisgraphs/groups.py +70 -0
- gismap/gisgraphs/js.py +190 -0
- gismap/gisgraphs/options.py +37 -0
- gismap/gisgraphs/style.py +119 -0
- gismap/gisgraphs/widget.py +145 -0
- gismap/lab/__init__.py +0 -4
- gismap/lab/egomap.py +6 -7
- gismap/lab/expansion.py +7 -6
- gismap/lab/filters.py +1 -1
- gismap/lab/lab_author.py +51 -4
- gismap/lab/labmap.py +4 -2
- gismap/lab_examples/__init__.py +0 -0
- gismap/lab_examples/cedric.py +46 -0
- gismap/{lab → lab_examples}/lincs.py +2 -2
- gismap/{lab → lab_examples}/toulouse.py +20 -3
- gismap/sources/dblp.py +15 -17
- gismap/sources/hal.py +17 -8
- gismap/sources/models.py +7 -0
- gismap/sources/multi.py +23 -15
- gismap/utils/requests.py +4 -2
- {gismap-0.2.2.dist-info → gismap-0.3.0.dist-info}/METADATA +21 -5
- gismap-0.3.0.dist-info/RECORD +38 -0
- gismap/lab/vis.py +0 -329
- gismap-0.2.2.dist-info/RECORD +0 -30
- /gismap/{lab → lab_examples}/lip6.py +0 -0
- {gismap-0.2.2.dist-info → gismap-0.3.0.dist-info}/WHEEL +0 -0
- {gismap-0.2.2.dist-info → gismap-0.3.0.dist-info}/licenses/AUTHORS.md +0 -0
gismap/sources/models.py
CHANGED
gismap/sources/multi.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from dataclasses import dataclass, field
|
|
2
|
-
from bof.fuzz import
|
|
2
|
+
from bof.fuzz import jit_square_factors
|
|
3
|
+
from bof.feature_extraction import CountVectorizer
|
|
3
4
|
import numpy as np
|
|
4
5
|
|
|
5
6
|
from gismap.sources.models import Publication, Author
|
|
@@ -52,6 +53,8 @@ class SourcedAuthor(Author):
|
|
|
52
53
|
def get_publications(self, clean=True, selector=None):
|
|
53
54
|
if selector is None:
|
|
54
55
|
selector = []
|
|
56
|
+
if not isinstance(selector, list):
|
|
57
|
+
selector = [selector]
|
|
55
58
|
res = {
|
|
56
59
|
p.key: p
|
|
57
60
|
for a in self.sources
|
|
@@ -135,7 +138,9 @@ def regroup_authors(auth_dict, pub_dict):
|
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
for pub in pub_dict.values():
|
|
138
|
-
pub.authors = [
|
|
141
|
+
pub.authors = [
|
|
142
|
+
redirection.get(a.key, redirection.get(a.name, a)) for a in pub.authors
|
|
143
|
+
]
|
|
139
144
|
|
|
140
145
|
|
|
141
146
|
def regroup_publications(pub_dict, threshold=85, length_impact=0.05, n_range=5):
|
|
@@ -156,19 +161,22 @@ def regroup_publications(pub_dict, threshold=85, length_impact=0.05, n_range=5):
|
|
|
156
161
|
:class:`dict`
|
|
157
162
|
Unified publications.
|
|
158
163
|
"""
|
|
164
|
+
if len(pub_dict) == 0:
|
|
165
|
+
return dict()
|
|
159
166
|
pub_list = [p for p in pub_dict.values()]
|
|
160
167
|
res = dict()
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
168
|
+
vectorizer = CountVectorizer(n_range=n_range)
|
|
169
|
+
x = vectorizer.fit_transform([p.title for p in pub_list])
|
|
170
|
+
y = x.T.tocsr()
|
|
171
|
+
jc_matrix = jit_square_factors(
|
|
172
|
+
x.indices, x.indptr, y.indices, y.indptr, len(pub_list), length_impact
|
|
173
|
+
)
|
|
174
|
+
done = np.zeros(len(pub_list), dtype=bool)
|
|
175
|
+
for i, paper in enumerate(pub_list):
|
|
176
|
+
if done[i]:
|
|
177
|
+
continue
|
|
178
|
+
locs = np.where(jc_matrix[i, :] > threshold)[0]
|
|
179
|
+
pub = SourcedPublication.from_sources([pub_list[i] for i in locs])
|
|
180
|
+
res[pub.key] = pub
|
|
181
|
+
done[locs] = True
|
|
174
182
|
return res
|
gismap/utils/requests.py
CHANGED
|
@@ -13,7 +13,7 @@ session.headers.update(
|
|
|
13
13
|
)
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def get(url, params=None, n_trials=10):
|
|
16
|
+
def get(url, params=None, n_trials=10, verify=True):
|
|
17
17
|
"""
|
|
18
18
|
Parameters
|
|
19
19
|
----------
|
|
@@ -21,6 +21,8 @@ def get(url, params=None, n_trials=10):
|
|
|
21
21
|
Entry point to fetch.
|
|
22
22
|
params: :class:`dict`, optional
|
|
23
23
|
Get arguments (appended to URL).
|
|
24
|
+
verify: :class:`bool`, optional
|
|
25
|
+
Verify certificates.
|
|
24
26
|
|
|
25
27
|
Returns
|
|
26
28
|
-------
|
|
@@ -29,7 +31,7 @@ def get(url, params=None, n_trials=10):
|
|
|
29
31
|
"""
|
|
30
32
|
for attempt in range(n_trials):
|
|
31
33
|
try:
|
|
32
|
-
r = session.get(url, params=params)
|
|
34
|
+
r = session.get(url, params=params, verify=verify)
|
|
33
35
|
if r.status_code == 429:
|
|
34
36
|
try:
|
|
35
37
|
t = int(r.headers["Retry-After"])
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gismap
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: GisMap leverages DBLP and HAL databases to provide cartography tools for you and your lab.
|
|
5
5
|
Project-URL: Repository, https://github.com/balouf/gismap
|
|
6
6
|
Project-URL: Documentation, https://balouf.github.io/gismap
|
|
7
7
|
Author-email: Fabien Mathieu <fabien.mathieu@normalesup.org>
|
|
@@ -10,8 +10,11 @@ License-Expression: MIT
|
|
|
10
10
|
License-File: AUTHORS.md
|
|
11
11
|
Requires-Python: >=3.10
|
|
12
12
|
Requires-Dist: bof>=0.3.5
|
|
13
|
+
Requires-Dist: distinctipy>=1.3.4
|
|
14
|
+
Requires-Dist: domonic>=0.9.13
|
|
13
15
|
Requires-Dist: gismo>=0.5.2
|
|
14
16
|
Requires-Dist: ipykernel>=6.30.1
|
|
17
|
+
Requires-Dist: ipywidgets>=8.1.8
|
|
15
18
|
Requires-Dist: tqdm>=4.67.1
|
|
16
19
|
Description-Content-Type: text/markdown
|
|
17
20
|
|
|
@@ -19,12 +22,13 @@ Description-Content-Type: text/markdown
|
|
|
19
22
|
|
|
20
23
|
|
|
21
24
|
[](https://pypi.python.org/pypi/gismap)
|
|
25
|
+
[](https://mybinder.org/v2/gh/balouf/gismap/HEAD?urlpath=%2Fdoc%2Ftree%2Fbinder%2Finteractive.ipynb)
|
|
22
26
|
[](https://github.com/balouf/gismap/actions?query=workflow%3Abuild)
|
|
23
27
|
[](https://github.com/balouf/gismap/actions?query=workflow%3Adocs)
|
|
24
28
|
[](https://opensource.org/licenses/MIT)
|
|
25
29
|
[](https://codecov.io/gh/balouf/gismap/tree/main)
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
GisMap leverages DBLP and HAL databases to provide cartography tools for you and your lab.
|
|
28
32
|
|
|
29
33
|
- Free software: MIT
|
|
30
34
|
- Documentation: <https://balouf.github.io/gismap/>.
|
|
@@ -37,15 +41,27 @@ GISMAP leverages DBLP and HAL databases to provide cartography tools for you and
|
|
|
37
41
|
- Automatically keeps track of a Lab/Department members and publications.
|
|
38
42
|
- Builds interactive collaboration graphs.
|
|
39
43
|
|
|
44
|
+
## Test GisMap online!
|
|
45
|
+
|
|
46
|
+
Don't want to install GisMap on your computer (yet)? No worries, you can play with it using https://mybinder.org/.
|
|
47
|
+
|
|
48
|
+
For example:
|
|
49
|
+
|
|
50
|
+
- [A simple interface to display and save collaboration graphs](https://mybinder.org/v2/gh/balouf/gismap/HEAD?urlpath=%2Fdoc%2Ftree%2Fbinder%2Finteractive.ipynb)
|
|
51
|
+
- [Tutorial: Making LabMaps](https://mybinder.org/v2/gh/balouf/gismap/HEAD?urlpath=%2Fdoc%2Ftree%2Fdocs%2Ftutorials%2Flab_tutorial.ipynb)
|
|
52
|
+
- [Tutorial: Making EgoMaps](https://mybinder.org/v2/gh/balouf/gismap/HEAD?urlpath=%2Fdoc%2Ftree%2Fdocs%2Ftutorials%2Fegomap.ipynb)
|
|
53
|
+
- [Jupyter Lab instance with GisMap installed](https://mybinder.org/v2/gh/balouf/gismap/HEAD)
|
|
54
|
+
|
|
55
|
+
|
|
40
56
|
## Quickstart
|
|
41
57
|
|
|
42
|
-
Install
|
|
58
|
+
Install GisMap:
|
|
43
59
|
|
|
44
60
|
```console
|
|
45
61
|
$ pip install gismap
|
|
46
62
|
```
|
|
47
63
|
|
|
48
|
-
Use
|
|
64
|
+
Use GisMap to produce a collaboration graph (HTML):
|
|
49
65
|
|
|
50
66
|
```pycon
|
|
51
67
|
>>> from gismap.sources.hal import HAL
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
gismap/__init__.py,sha256=Zk5ZXwC-MBREnngJh3V9WUtxLSAUKhkyJhV6kUjtxLE,800
|
|
2
|
+
gismap/author.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
gismap/gismap.py,sha256=h0hwdogXGFqerm-5ZPeT-irPn91pCcQRjiHThXsRzEk,19
|
|
4
|
+
gismap/gismo.py,sha256=oDAryl4XQzHE0tUmOWC-3G1n_zUgTeykPL-JWSDYwe0,6307
|
|
5
|
+
gismap/search.py,sha256=nsUoDsFGeEtvCZ0dB7ooRPC_6qsazkiWx_oM7dHdNV4,4932
|
|
6
|
+
gismap/gisgraphs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
gismap/gisgraphs/builder.py,sha256=La01_OczsSfZ1hu8sq6rdQN_TelBatN8wP3xLF7TwIg,3234
|
|
8
|
+
gismap/gisgraphs/graph.py,sha256=RuUuWdPudrbrDyoGMj2V9SuJGkrsClL_4_4tUMptsjk,7028
|
|
9
|
+
gismap/gisgraphs/groups.py,sha256=1E-7Xrv0uDw2SgqwtdjgeRLVBLaC7agUrrVics4jVLs,2405
|
|
10
|
+
gismap/gisgraphs/js.py,sha256=Gbz5nMWORabZkgIdyZAe1sMlnwJZ9jy7sLrx0vYStzI,6283
|
|
11
|
+
gismap/gisgraphs/options.py,sha256=lmUSnfSwrZQyJpGGs16JUGDIQNcJeX4Y0tA8cyC0nuM,817
|
|
12
|
+
gismap/gisgraphs/style.py,sha256=sXNUnv690kxiJiRQZ7lv4iKKrsxMqAfblheJbqesd48,4653
|
|
13
|
+
gismap/gisgraphs/widget.py,sha256=s7W_8N4f2palM0ChVFYyr9ImcQoMBiEw83MIO4HSm6c,4542
|
|
14
|
+
gismap/lab/__init__.py,sha256=ifyZqI9BpC5NRlMfSmJ671tnKWJDoXbo18iDoE-VR1s,181
|
|
15
|
+
gismap/lab/egomap.py,sha256=RabRJSWJ0xrG67l012En0rbi7ukr4R2lR0hc_K7Xp0o,1211
|
|
16
|
+
gismap/lab/expansion.py,sha256=CMUsXqo-shRyb_MiuPRL5-ZgaitxAxjfbSY_fvzi_1E,6236
|
|
17
|
+
gismap/lab/filters.py,sha256=pG_g2POQXMbyUUw0aXOaeyiGBbiSc7M2NzxLCTQrALk,1875
|
|
18
|
+
gismap/lab/lab_author.py,sha256=XwSXvioHDreZWcaWioGW4rjU2zZN10o89ilyfOsWV90,4497
|
|
19
|
+
gismap/lab/labmap.py,sha256=w3dFCyDHM-hEwHEQzrQA8GEOs8juu8F-f18gbufiOe8,5782
|
|
20
|
+
gismap/lab_examples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
21
|
+
gismap/lab_examples/cedric.py,sha256=AjgYy5dhzqh3vDsr9ia_hbtSc9_2Ic238rmJO198FMM,1764
|
|
22
|
+
gismap/lab_examples/lincs.py,sha256=-mIVMGQMrtCtJ3N-oCU8j4Ko9mDuhEPB_pA0gaIw4QA,1126
|
|
23
|
+
gismap/lab_examples/lip6.py,sha256=K32Jqe3-o99QYI--akmwBDFAWKgq0HFEk_psC4akR60,1740
|
|
24
|
+
gismap/lab_examples/toulouse.py,sha256=OUKrK0uefn4uvW74qMsF792un203z3OUfKTquLPGBH4,2091
|
|
25
|
+
gismap/sources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
26
|
+
gismap/sources/dblp.py,sha256=eVd1u09BH-0TgAD3dXn78zsW5Er69mE_vKxPeGDaBw0,4834
|
|
27
|
+
gismap/sources/hal.py,sha256=tZkeDWob4p5fccBRXC10G3kf2rnVAVzwdkf3swjvl0c,10306
|
|
28
|
+
gismap/sources/models.py,sha256=XlNrQWTF-DQbfIFaSLPsgWPN-c79_0rfr_2jDasgukM,713
|
|
29
|
+
gismap/sources/multi.py,sha256=7aiYuExiCoU_5GCwi_ufhesy44HsAh9lNFx_J444YJs,4690
|
|
30
|
+
gismap/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
|
+
gismap/utils/common.py,sha256=nx1f60yNwFpl1oz08h-R5o0xK9CbJv9tmYLDk61dwYA,2898
|
|
32
|
+
gismap/utils/logger.py,sha256=1YALIaNYKTqeIyyCnYxzvZTK7x4FTSfYYl5CP9IMw8E,86
|
|
33
|
+
gismap/utils/requests.py,sha256=nPnTh-lfo8cXiCeEhzZJ2AMo0odDtx4slPN1rTE4H_E,1384
|
|
34
|
+
gismap/utils/text.py,sha256=1_9DlduAYh7Nz-yAg-MaCTmdKbPPmuIY20bb87t7JAQ,3810
|
|
35
|
+
gismap-0.3.0.dist-info/METADATA,sha256=BWpxgm1dncPB8ISiMH95WY_Dyn_AyerfVrHIR6X1VYA,3469
|
|
36
|
+
gismap-0.3.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
37
|
+
gismap-0.3.0.dist-info/licenses/AUTHORS.md,sha256=oDR4mptVUBMq0WKIpt19Km1Bdfz3cO2NAOVgwVfTO8g,131
|
|
38
|
+
gismap-0.3.0.dist-info/RECORD,,
|
gismap/lab/vis.py
DELETED
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
from string import Template
|
|
2
|
-
import uuid
|
|
3
|
-
import json
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
vis_template = Template("""
|
|
7
|
-
<div class="gismap-content">
|
|
8
|
-
<div id="${container_id}"></div>
|
|
9
|
-
<a
|
|
10
|
-
href="https://balouf.github.io/gismap/"
|
|
11
|
-
target="_blank"
|
|
12
|
-
id="gismap-brand"
|
|
13
|
-
style="position: absolute; left: 10px; bottom: 10px; text-decoration: none; color: #888; font-size: min(2vw, 10px);
|
|
14
|
-
z-index: 10; pointer-events: auto;"
|
|
15
|
-
>
|
|
16
|
-
© Gismap 2025
|
|
17
|
-
</a>
|
|
18
|
-
<div id="${modal_id}" class="modal">
|
|
19
|
-
<div class="modal-content">
|
|
20
|
-
<span class="close" id="${modal_close_id}">×</span>
|
|
21
|
-
<div id="${modal_body_id}"></div>
|
|
22
|
-
</div>
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
<style>
|
|
26
|
-
.gismap-content {
|
|
27
|
-
position: relative;
|
|
28
|
-
width: 100%;
|
|
29
|
-
height: 80vh !important;
|
|
30
|
-
max-width: 100vw;
|
|
31
|
-
max-height: 100vh !important;
|
|
32
|
-
}
|
|
33
|
-
/* Styles adaptatifs pour dark/light */
|
|
34
|
-
/* Default: dark mode styles */
|
|
35
|
-
#${container_id} {
|
|
36
|
-
width: 100%;
|
|
37
|
-
height: 100%;
|
|
38
|
-
box-sizing: border-box;
|
|
39
|
-
border: 1px solid #444;
|
|
40
|
-
background: #181818;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.modal {
|
|
44
|
-
display: none;
|
|
45
|
-
position: fixed;
|
|
46
|
-
z-index: 1000;
|
|
47
|
-
left: 0; top: 0;
|
|
48
|
-
width: 100%; height: 100%;
|
|
49
|
-
overflow: auto;
|
|
50
|
-
background-color: rgba(10,10,10,0.85);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.modal-content {
|
|
54
|
-
background-color: #23272e;
|
|
55
|
-
color: #f0f0f0;
|
|
56
|
-
margin: 10% auto;
|
|
57
|
-
padding: 24px;
|
|
58
|
-
border: 1px solid #888;
|
|
59
|
-
width: 50%;
|
|
60
|
-
border-radius: 8px;
|
|
61
|
-
box-shadow: 0 5px 15px rgba(0,0,0,.6);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.close {
|
|
65
|
-
color: #aaa;
|
|
66
|
-
float: right;
|
|
67
|
-
font-size: 28px;
|
|
68
|
-
font-weight: bold;
|
|
69
|
-
cursor: pointer;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.close:hover, .close:focus {
|
|
73
|
-
color: #fff;
|
|
74
|
-
text-decoration: none;
|
|
75
|
-
cursor: pointer;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/* PyData Sphinx Light Theme */
|
|
79
|
-
html[data-theme="light"] #${container_id},
|
|
80
|
-
body[data-jp-theme-light="true"] #${container_id} {
|
|
81
|
-
background: #fff;
|
|
82
|
-
border: 1px solid #ccc;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
html[data-theme="light"] .modal,
|
|
86
|
-
body[data-jp-theme-light="true"] .modal {
|
|
87
|
-
background-color: rgba(220,220,220,0.85);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
html[data-theme="light"] .modal-content,
|
|
91
|
-
body[data-jp-theme-light="true"] .modal-content {
|
|
92
|
-
background: #fff;
|
|
93
|
-
color: #222;
|
|
94
|
-
border: 1px solid #888;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
html[data-theme="light"] .close,
|
|
98
|
-
body[data-jp-theme-light="true"] .close {
|
|
99
|
-
color: #222;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
html[data-theme="light"] .close:hover, html[data-theme="light"] .close:focus,
|
|
103
|
-
body[data-jp-theme-light="true"] .close:hover, body[data-jp-theme-light="true"] .close:focus {
|
|
104
|
-
color: #555;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/* Fallback: system light mode */
|
|
108
|
-
@media (prefers-color-scheme: light) {
|
|
109
|
-
#${container_id} {
|
|
110
|
-
background: #fff;
|
|
111
|
-
border: 1px solid #ccc;
|
|
112
|
-
}
|
|
113
|
-
.modal {
|
|
114
|
-
background-color: rgba(220,220,220,0.85);
|
|
115
|
-
}
|
|
116
|
-
.modal-content {
|
|
117
|
-
background: #fff;
|
|
118
|
-
color: #222;
|
|
119
|
-
border: 1px solid #888;
|
|
120
|
-
}
|
|
121
|
-
.close {
|
|
122
|
-
color: #222;
|
|
123
|
-
}
|
|
124
|
-
.close:hover, .close:focus {
|
|
125
|
-
color: #555;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
</style>
|
|
129
|
-
<script type="text/javascript">
|
|
130
|
-
(function() {
|
|
131
|
-
// Détection du thème
|
|
132
|
-
function getTheme() {
|
|
133
|
-
// Try PyData Sphinx theme on <html>
|
|
134
|
-
const pydataTheme = document.documentElement.getAttribute("data-theme");
|
|
135
|
-
if (pydataTheme === "dark" || pydataTheme === "light") {
|
|
136
|
-
return pydataTheme;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Try JupyterLab theme on <body>
|
|
140
|
-
const jupyterLabTheme = document.body.getAttribute("data-jp-theme-name");
|
|
141
|
-
if (jupyterLabTheme) {
|
|
142
|
-
// Simplify theme name to 'dark' or 'light'
|
|
143
|
-
const lowerName = jupyterLabTheme.toLowerCase();
|
|
144
|
-
if (lowerName.includes("dark")) {
|
|
145
|
-
return "dark";
|
|
146
|
-
}
|
|
147
|
-
if (lowerName.includes("light")) {
|
|
148
|
-
return "light";
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Fallback to system preference
|
|
153
|
-
return window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? "dark" : "light";
|
|
154
|
-
};
|
|
155
|
-
function getVisOptions(theme) {
|
|
156
|
-
if (theme === 'dark') {
|
|
157
|
-
return {
|
|
158
|
-
nodes: {
|
|
159
|
-
shape: 'circle', size: 20,
|
|
160
|
-
font: { size: 16, color: '#f0f0f0' },
|
|
161
|
-
color: {
|
|
162
|
-
background: '#222e3c',
|
|
163
|
-
border: '#5d90f5',
|
|
164
|
-
highlight: { background: '#2f3d4d', border: '#f5a25d' }
|
|
165
|
-
},
|
|
166
|
-
borderWidth: 2
|
|
167
|
-
},
|
|
168
|
-
edges: {
|
|
169
|
-
width: 2,
|
|
170
|
-
color: { color: '#888', highlight: '#f5a25d' },
|
|
171
|
-
smooth: { type: 'continuous' }
|
|
172
|
-
},
|
|
173
|
-
interaction: { hover: true }
|
|
174
|
-
};
|
|
175
|
-
} else {
|
|
176
|
-
return {
|
|
177
|
-
nodes: {
|
|
178
|
-
shape: 'circle', size: 20,
|
|
179
|
-
font: { size: 16, color: '#222' },
|
|
180
|
-
color: {
|
|
181
|
-
background: '#e3eaff',
|
|
182
|
-
border: '#3d6cf7',
|
|
183
|
-
highlight: { background: '#fffbe6', border: '#f5a25d' }
|
|
184
|
-
},
|
|
185
|
-
borderWidth: 2
|
|
186
|
-
},
|
|
187
|
-
edges: {
|
|
188
|
-
width: 2,
|
|
189
|
-
color: { color: '#848484', highlight: '#f5a25d' },
|
|
190
|
-
smooth: { type: 'continuous' }
|
|
191
|
-
},
|
|
192
|
-
interaction: { hover: true }
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
};
|
|
196
|
-
|
|
197
|
-
var physics = {
|
|
198
|
-
physics: {
|
|
199
|
-
solver: "forceAtlas2Based",
|
|
200
|
-
forceAtlas2Based: {
|
|
201
|
-
gravitationalConstant: -50,
|
|
202
|
-
centralGravity: 0.01,
|
|
203
|
-
springLength: 200,
|
|
204
|
-
springConstant: 0.08,
|
|
205
|
-
damping: 0.98,
|
|
206
|
-
avoidOverlap: 1
|
|
207
|
-
},
|
|
208
|
-
maxVelocity: 10,
|
|
209
|
-
minVelocity: 0.9,
|
|
210
|
-
stabilization: {
|
|
211
|
-
enabled: true,
|
|
212
|
-
iterations: 2000,
|
|
213
|
-
updateInterval: 50,
|
|
214
|
-
onlyDynamicEdges: false,
|
|
215
|
-
fit: true
|
|
216
|
-
},
|
|
217
|
-
timestep: 0.25
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
function renderNetwork() {
|
|
222
|
-
const nodes = new vis.DataSet(${nodes_json});
|
|
223
|
-
const edges = new vis.DataSet(${edges_json});
|
|
224
|
-
const container = document.getElementById('${container_id}');
|
|
225
|
-
let network = null;
|
|
226
|
-
const theme = getTheme();
|
|
227
|
-
const options = getVisOptions(theme);
|
|
228
|
-
network = new vis.Network(container, { nodes: nodes, edges: edges }, options);
|
|
229
|
-
network.setOptions(physics)
|
|
230
|
-
// Tooltip survol
|
|
231
|
-
network.on("hoverNode", function(params) {
|
|
232
|
-
const node = nodes.get(params.node);
|
|
233
|
-
network.body.container.title = node.hover || '';
|
|
234
|
-
});
|
|
235
|
-
network.on("blurNode", function(params) {
|
|
236
|
-
network.body.container.title = '';
|
|
237
|
-
});
|
|
238
|
-
network.on("hoverEdge", function(params) {
|
|
239
|
-
const edge = edges.get(params.edge);
|
|
240
|
-
network.body.container.title = edge.hover || '';
|
|
241
|
-
});
|
|
242
|
-
network.on("blurEdge", function(params) {
|
|
243
|
-
network.body.container.title = '';
|
|
244
|
-
});
|
|
245
|
-
// Modal overlay
|
|
246
|
-
const modal = document.getElementById('${modal_id}');
|
|
247
|
-
const modalBody = document.getElementById('${modal_body_id}');
|
|
248
|
-
const modalClose = document.getElementById('${modal_close_id}');
|
|
249
|
-
network.on("click", function(params) {
|
|
250
|
-
if (params.nodes.length === 1) {
|
|
251
|
-
const node = nodes.get(params.nodes[0]);
|
|
252
|
-
modalBody.innerHTML = node.overlay || '';
|
|
253
|
-
modal.style.display = "block";
|
|
254
|
-
} else if (params.edges.length === 1) {
|
|
255
|
-
const edge = edges.get(params.edges[0]);
|
|
256
|
-
modalBody.innerHTML = edge.overlay || '';
|
|
257
|
-
modal.style.display = "block";
|
|
258
|
-
} else {
|
|
259
|
-
modal.style.display = "none";
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
modalClose.onclick = function() { modal.style.display = "none"; };
|
|
263
|
-
window.onclick = function(event) {
|
|
264
|
-
if (event.target == modal) { modal.style.display = "none"; }
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
function loadVisAndRender() {
|
|
269
|
-
if (typeof vis === 'undefined') {
|
|
270
|
-
var script = document.createElement('script');
|
|
271
|
-
script.src = "https://unpkg.com/vis-network/standalone/umd/vis-network.min.js";
|
|
272
|
-
script.type = "text/javascript";
|
|
273
|
-
script.onload = function() {
|
|
274
|
-
console.log("vis-network loaded dynamically");
|
|
275
|
-
renderNetwork(); // Graph init after vis is loaded
|
|
276
|
-
};
|
|
277
|
-
document.head.appendChild(script);
|
|
278
|
-
} else {
|
|
279
|
-
console.log("vis-network already loaded");
|
|
280
|
-
renderNetwork(); // Graph init immediately
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
loadVisAndRender();
|
|
284
|
-
|
|
285
|
-
// Adapter dynamiquement si le thème change
|
|
286
|
-
window.addEventListener("theme-changed", () => loadVisAndRender());
|
|
287
|
-
const observer = new MutationObserver(mutations => {
|
|
288
|
-
for (const mutation of mutations) {
|
|
289
|
-
if (mutation.type === "attributes" && mutation.attributeName === "data-jp-theme-name") {
|
|
290
|
-
loadVisAndRender();
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
observer.observe(document.body, { attributes: true });
|
|
295
|
-
if (window.matchMedia) {
|
|
296
|
-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => loadVisAndRender());
|
|
297
|
-
};
|
|
298
|
-
})();
|
|
299
|
-
</script>
|
|
300
|
-
""")
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
def generate_html(nodes, edges):
|
|
304
|
-
"""
|
|
305
|
-
Parameters
|
|
306
|
-
----------
|
|
307
|
-
nodes: :class:`list`
|
|
308
|
-
edges: :class:`list`
|
|
309
|
-
|
|
310
|
-
Returns
|
|
311
|
-
-------
|
|
312
|
-
:class:`str`
|
|
313
|
-
"""
|
|
314
|
-
uid = str(uuid.uuid4())[:8] # identifiant unique pour éviter les collisions
|
|
315
|
-
container_id = f"mynetwork_{uid}"
|
|
316
|
-
modal_id = f"modal_{uid}"
|
|
317
|
-
modal_body_id = f"modal_body_{uid}"
|
|
318
|
-
modal_close_id = f"modal_close_{uid}"
|
|
319
|
-
nodes_json = json.dumps(nodes)
|
|
320
|
-
edges_json = json.dumps(edges)
|
|
321
|
-
dico = {
|
|
322
|
-
"container_id": container_id,
|
|
323
|
-
"modal_id": modal_id,
|
|
324
|
-
"modal_body_id": modal_body_id,
|
|
325
|
-
"modal_close_id": modal_close_id,
|
|
326
|
-
"nodes_json": nodes_json,
|
|
327
|
-
"edges_json": edges_json,
|
|
328
|
-
}
|
|
329
|
-
return vis_template.substitute(dico) # html_template
|
gismap-0.2.2.dist-info/RECORD
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
gismap/__init__.py,sha256=wZhnsqnlouh2Ugsb4L36K9QG8IEGrvI7s9biEv6LjRw,735
|
|
2
|
-
gismap/author.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
gismap/gismap.py,sha256=h0hwdogXGFqerm-5ZPeT-irPn91pCcQRjiHThXsRzEk,19
|
|
4
|
-
gismap/gismo.py,sha256=oDAryl4XQzHE0tUmOWC-3G1n_zUgTeykPL-JWSDYwe0,6307
|
|
5
|
-
gismap/search.py,sha256=nsUoDsFGeEtvCZ0dB7ooRPC_6qsazkiWx_oM7dHdNV4,4932
|
|
6
|
-
gismap/lab/__init__.py,sha256=xYLZzcXn9oNbD3nNF3sLGvy_uvRkFnBoOS6fQeB3iZw,426
|
|
7
|
-
gismap/lab/egomap.py,sha256=eH2FOoB7rD4-UA3__nq9gmgNJRB6FcyCKmbgi4CviQA,1348
|
|
8
|
-
gismap/lab/expansion.py,sha256=bolmFhotkjFywUmjaqWqyZGzAmHauM5F4MTcTMeH9gI,6204
|
|
9
|
-
gismap/lab/filters.py,sha256=eNEqg7vChmXE2y-TfWghpIy1fHKUFrJ4NRsSCihFeFs,1852
|
|
10
|
-
gismap/lab/graph.py,sha256=B7S63clj4tEOnuGugDmPahCqkKbuOuuvJEcabHmBDPk,6764
|
|
11
|
-
gismap/lab/lab_author.py,sha256=jQhq1spZP5P-Bpzr5E_OP73gWy3SG6UjiVCGotjm57s,2439
|
|
12
|
-
gismap/lab/labmap.py,sha256=H1ESWeoQdVN9jWaKIzErsFi0DE51BoPiu1Di4VtVnaE,5680
|
|
13
|
-
gismap/lab/lincs.py,sha256=RblzZOkfY99dcMj_NIStFMSwmBTlACgG9LKgs9l1iU0,1103
|
|
14
|
-
gismap/lab/lip6.py,sha256=K32Jqe3-o99QYI--akmwBDFAWKgq0HFEk_psC4akR60,1740
|
|
15
|
-
gismap/lab/toulouse.py,sha256=SsQmjGIaq_ZKOPu4u-bXpehjWsWbdMvsvNlxQLstg4w,1510
|
|
16
|
-
gismap/lab/vis.py,sha256=YwMkoSa3-IsoNooQgZbluvIrQsYRbti1dlVRewypBNY,8734
|
|
17
|
-
gismap/sources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
-
gismap/sources/dblp.py,sha256=_AgPgDbHYYaeJVam43eExv1VsglvAV46eP77RL7o9Fo,5278
|
|
19
|
-
gismap/sources/hal.py,sha256=FZVKB1mjOYZMXk7M5VrpzH_IDPYjW0snFKfa5BT73vI,10021
|
|
20
|
-
gismap/sources/models.py,sha256=yJPBXcJO6MgOrSXgpGPepHDDtniJP1OsK8OSz__VzYc,543
|
|
21
|
-
gismap/sources/multi.py,sha256=UNVFiCgV-2xiEgKix2Ava6260008HmCS664K0EB3LbU,4387
|
|
22
|
-
gismap/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
-
gismap/utils/common.py,sha256=nx1f60yNwFpl1oz08h-R5o0xK9CbJv9tmYLDk61dwYA,2898
|
|
24
|
-
gismap/utils/logger.py,sha256=1YALIaNYKTqeIyyCnYxzvZTK7x4FTSfYYl5CP9IMw8E,86
|
|
25
|
-
gismap/utils/requests.py,sha256=DA-ifVMdcOtipDSqYdVRQi-7CGR5WCTYiGyZ7Xu78q0,1291
|
|
26
|
-
gismap/utils/text.py,sha256=1_9DlduAYh7Nz-yAg-MaCTmdKbPPmuIY20bb87t7JAQ,3810
|
|
27
|
-
gismap-0.2.2.dist-info/METADATA,sha256=vAHxaSUyILKqv9brEdkaxFWA6vRSQTDzOAg2ifZw-44,2542
|
|
28
|
-
gismap-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
-
gismap-0.2.2.dist-info/licenses/AUTHORS.md,sha256=oDR4mptVUBMq0WKIpt19Km1Bdfz3cO2NAOVgwVfTO8g,131
|
|
30
|
-
gismap-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|