kececilayout 0.4.0__tar.gz → 0.4.2__tar.gz
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.
- {kececilayout-0.4.0/kececilayout.egg-info → kececilayout-0.4.2}/PKG-INFO +1 -1
- {kececilayout-0.4.0 → kececilayout-0.4.2}/kececilayout/__init__.py +12 -1
- {kececilayout-0.4.0 → kececilayout-0.4.2}/kececilayout/_version.py +2 -1
- {kececilayout-0.4.0 → kececilayout-0.4.2}/kececilayout/kececi_layout.py +98 -0
- {kececilayout-0.4.0 → kececilayout-0.4.2/kececilayout.egg-info}/PKG-INFO +1 -1
- {kececilayout-0.4.0 → kececilayout-0.4.2}/pyproject.toml +3 -1
- {kececilayout-0.4.0 → kececilayout-0.4.2}/LICENSE +0 -0
- {kececilayout-0.4.0 → kececilayout-0.4.2}/MANIFEST.in +0 -0
- {kececilayout-0.4.0 → kececilayout-0.4.2}/README.md +0 -0
- {kececilayout-0.4.0 → kececilayout-0.4.2}/kececilayout.egg-info/SOURCES.txt +0 -0
- {kececilayout-0.4.0 → kececilayout-0.4.2}/kececilayout.egg-info/dependency_links.txt +0 -0
- {kececilayout-0.4.0 → kececilayout-0.4.2}/kececilayout.egg-info/requires.txt +0 -0
- {kececilayout-0.4.0 → kececilayout-0.4.2}/kececilayout.egg-info/top_level.txt +0 -0
- {kececilayout-0.4.0 → kececilayout-0.4.2}/setup.cfg +0 -0
- {kececilayout-0.4.0 → kececilayout-0.4.2}/setup.py +0 -0
- {kececilayout-0.4.0 → kececilayout-0.4.2}/tests/test_sample.py +0 -0
|
@@ -10,7 +10,7 @@ import inspect
|
|
|
10
10
|
import warnings
|
|
11
11
|
|
|
12
12
|
# Paket sürüm numarası
|
|
13
|
-
__version__ = "0.4.
|
|
13
|
+
__version__ = "0.4.1"
|
|
14
14
|
|
|
15
15
|
# =============================================================================
|
|
16
16
|
# OTOMATİK İÇE AKTARMA VE __all__ OLUŞTURMA
|
|
@@ -41,6 +41,11 @@ from .kececi_layout import ( # Veya fonksiyonların bulunduğu asıl modül
|
|
|
41
41
|
kececi_layout_rx,
|
|
42
42
|
kececi_layout_rustworkx,
|
|
43
43
|
kececi_layout_pure,
|
|
44
|
+
load_element_data_and_spectral_lines,
|
|
45
|
+
wavelength_to_rgb,
|
|
46
|
+
get_text_color_for_bg,
|
|
47
|
+
generate_soft_random_colors,
|
|
48
|
+
generate_distinct_colors,
|
|
44
49
|
|
|
45
50
|
# Drawing functions
|
|
46
51
|
draw_kececi,
|
|
@@ -74,6 +79,11 @@ __all__ = [
|
|
|
74
79
|
'kececi_layout_rx',
|
|
75
80
|
'kececi_layout_rustworkx',
|
|
76
81
|
'kececi_layout_pure',
|
|
82
|
+
'load_element_data_and_spectral_lines',
|
|
83
|
+
'wavelength_to_rgb',
|
|
84
|
+
'get_text_color_for_bg',
|
|
85
|
+
'generate_soft_random_colors',
|
|
86
|
+
'generate_distinct_colors',
|
|
77
87
|
|
|
78
88
|
# Drawing functions
|
|
79
89
|
'draw_kececi',
|
|
@@ -128,3 +138,4 @@ def old_function_placeholder():
|
|
|
128
138
|
|
|
129
139
|
|
|
130
140
|
|
|
141
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# _version.py
|
|
2
2
|
|
|
3
|
-
__version__ = "0.4.
|
|
3
|
+
__version__ = "0.4.1"
|
|
4
4
|
__license__ = "MIT"
|
|
5
5
|
__description__ = "A deterministic node placement algorithm used in graph visualization. In this layout, nodes are arranged sequentially along a defined primary axis. Each subsequent node is then alternately offset along a secondary, perpendicular axis, typically moving to one side of the primary axis and then the other. Often, the magnitude of this secondary offset increases as nodes progress along the primary axis, creating a characteristic zig-zag or serpentine pattern."
|
|
6
6
|
__author__ = "Mehmet Keçeci"
|
|
@@ -9,3 +9,4 @@ __docs__ = "https://github.com/WhiteSymmetry/kececilayout" # Opsiyonel: Doküma
|
|
|
9
9
|
__dependencies__ = ["python>=3.10"] # Diğer bağımlılıkları da ekleyebilirsiniz
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
|
|
@@ -1169,6 +1169,103 @@ def kececi_layout_3d_helix_parametric(nx_graph, z_spacing=2.0, radius=5.0, turns
|
|
|
1169
1169
|
pos_3d[node_id] = (x, y, z)
|
|
1170
1170
|
return pos_3d
|
|
1171
1171
|
|
|
1172
|
+
def load_element_data_and_spectral_lines(filename):
|
|
1173
|
+
"""Loads element data and spectral lines from a text file."""
|
|
1174
|
+
element_data = {}
|
|
1175
|
+
spectral_lines = {}
|
|
1176
|
+
current_section = None
|
|
1177
|
+
|
|
1178
|
+
with open(filename, 'r', encoding='utf-8') as f:
|
|
1179
|
+
for line in f:
|
|
1180
|
+
line = line.strip()
|
|
1181
|
+
if not line or line.startswith('#'):
|
|
1182
|
+
if "Element Data" in line:
|
|
1183
|
+
current_section = "element"
|
|
1184
|
+
elif "Spectral Lines" in line:
|
|
1185
|
+
current_section = "spectral"
|
|
1186
|
+
continue
|
|
1187
|
+
|
|
1188
|
+
parts = line.split(',')
|
|
1189
|
+
if current_section == "element" and len(parts) >= 2:
|
|
1190
|
+
symbol = parts[0]
|
|
1191
|
+
atomic_number = int(parts[1])
|
|
1192
|
+
element_data[atomic_number] = (symbol, atomic_number)
|
|
1193
|
+
elif current_section == "spectral" and len(parts) >= 2:
|
|
1194
|
+
symbol = parts[0]
|
|
1195
|
+
wavelengths = [float(wl) for wl in parts[1:] if wl]
|
|
1196
|
+
spectral_lines[symbol] = wavelengths
|
|
1197
|
+
|
|
1198
|
+
return element_data, spectral_lines
|
|
1199
|
+
|
|
1200
|
+
def wavelength_to_rgb(wavelength, gamma=0.8):
|
|
1201
|
+
wavelength = float(wavelength)
|
|
1202
|
+
if 380 <= wavelength <= 750:
|
|
1203
|
+
if wavelength < 440:
|
|
1204
|
+
attenuation = 0.3 + 0.7 * (wavelength - 380) / (440 - 380)
|
|
1205
|
+
R = ((-(wavelength - 440) / (440 - 380)) * attenuation) ** gamma
|
|
1206
|
+
G = 0.0
|
|
1207
|
+
B = (1.0 * attenuation) ** gamma
|
|
1208
|
+
elif wavelength < 490:
|
|
1209
|
+
R = 0.0
|
|
1210
|
+
G = ((wavelength - 440) / (490 - 440)) ** gamma
|
|
1211
|
+
B = 1.0
|
|
1212
|
+
elif wavelength < 510:
|
|
1213
|
+
R = 0.0
|
|
1214
|
+
G = 1.0
|
|
1215
|
+
B = (-(wavelength - 510) / (510 - 490)) ** gamma
|
|
1216
|
+
elif wavelength < 580:
|
|
1217
|
+
R = ((wavelength - 510) / (580 - 510)) ** gamma
|
|
1218
|
+
G = 1.0
|
|
1219
|
+
B = 0.0
|
|
1220
|
+
elif wavelength < 645:
|
|
1221
|
+
R = 1.0
|
|
1222
|
+
G = (-(wavelength - 645) / (645 - 580)) ** gamma
|
|
1223
|
+
B = 0.0
|
|
1224
|
+
else:
|
|
1225
|
+
attenuation = 0.3 + 0.7 * (750 - wavelength) / (750 - 645)
|
|
1226
|
+
R = (1.0 * attenuation) ** gamma
|
|
1227
|
+
G = 0.0
|
|
1228
|
+
B = 0.0
|
|
1229
|
+
else:
|
|
1230
|
+
R = G = B = 0.0 # UV veya IR için siyah
|
|
1231
|
+
return (R, G, B)
|
|
1232
|
+
|
|
1233
|
+
def get_text_color_for_bg(bg_color):
|
|
1234
|
+
"""Determines optimal text color (white or black) based on background luminance."""
|
|
1235
|
+
luminance = 0.299 * bg_color[0] + 0.587 * bg_color[1] + 0.114 * bg_color[2]
|
|
1236
|
+
return 'white' if luminance < 0.5 else 'black'
|
|
1237
|
+
|
|
1238
|
+
def generate_soft_random_colors(n):
|
|
1239
|
+
"""
|
|
1240
|
+
Generates n soft, pastel, and completely random colors.
|
|
1241
|
+
Uses high Value and Saturation in HSV space for a soft look.
|
|
1242
|
+
"""
|
|
1243
|
+
colors = []
|
|
1244
|
+
for _ in range(n):
|
|
1245
|
+
# Tamamen rastgele ton (hue)
|
|
1246
|
+
hue = random.random() # 0.0 - 1.0 arası
|
|
1247
|
+
# Soft görünüm için doygunluk (saturation) orta seviyede
|
|
1248
|
+
saturation = 0.4 + (random.random() * 0.4) # 0.4 - 0.8 arası
|
|
1249
|
+
# Soft görünüm için parlaklık (value) yüksek
|
|
1250
|
+
value = 0.7 + (random.random() * 0.3) # 0.7 - 1.0 arası
|
|
1251
|
+
from matplotlib.colors import hsv_to_rgb
|
|
1252
|
+
rgb = hsv_to_rgb([hue, saturation, value])
|
|
1253
|
+
colors.append(rgb)
|
|
1254
|
+
return colors
|
|
1255
|
+
|
|
1256
|
+
def generate_distinct_colors(n):
|
|
1257
|
+
colors = []
|
|
1258
|
+
for i in range(n):
|
|
1259
|
+
hue = i / n
|
|
1260
|
+
saturation = 0.7 + (random.random() * 0.3) # 0.7 - 1.0 arası
|
|
1261
|
+
value = 0.8 + (random.random() * 0.2) # 0.8 - 1.0 arası
|
|
1262
|
+
rgb = plt.cm.hsv(hue)[:3] # HSV'den RGB'ye dönüştür
|
|
1263
|
+
# Parlaklığı ayarla
|
|
1264
|
+
from matplotlib.colors import hsv_to_rgb
|
|
1265
|
+
adjusted_rgb = hsv_to_rgb([hue, saturation, value])
|
|
1266
|
+
colors.append(adjusted_rgb)
|
|
1267
|
+
return colors
|
|
1268
|
+
|
|
1172
1269
|
# =============================================================================
|
|
1173
1270
|
# 3. INTERNAL DRAWING STYLE IMPLEMENTATIONS
|
|
1174
1271
|
# =============================================================================
|
|
@@ -1298,3 +1395,4 @@ if __name__ == '__main__':
|
|
|
1298
1395
|
|
|
1299
1396
|
|
|
1300
1397
|
|
|
1398
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|