kececilayout 0.3.9__tar.gz → 0.4.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kececilayout
3
- Version: 0.3.9
3
+ Version: 0.4.1
4
4
  Summary: Çeşitli graf kütüphaneleri için sıralı-zigzag yerleşimleri sağlayan bir Python paketi.
5
5
  Home-page: https://github.com/WhiteSymmetry/kececilayout
6
6
  Author: Mehmet Keçeci
@@ -10,7 +10,7 @@ import inspect
10
10
  import warnings
11
11
 
12
12
  # Paket sürüm numarası
13
- __version__ = "0.3.9"
13
+ __version__ = "0.4.1"
14
14
 
15
15
  # =============================================================================
16
16
  # OTOMATİK İÇE AKTARMA VE __all__ OLUŞTURMA
@@ -26,7 +26,7 @@ from .kececi_layout import ( # Veya fonksiyonların bulunduğu asıl modül
26
26
  draw_kececi,
27
27
  _draw_internal, # Private fonksiyonu açıkça import edin
28
28
  _kececi_layout_3d_helix,
29
- kececi_layout,
29
+ kececi_layout_3d_helix_parametric,
30
30
  kececi_layout_v4,
31
31
 
32
32
  # Library-specific layout functions
@@ -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,11 +79,17 @@ __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',
80
90
  '_draw_internal', # <- TESTLER İÇİN GEREKLİ
81
91
  '_kececi_layout_3d_helix',
92
+ 'kececi_layout_3d_helix_parametric',
82
93
 
83
94
  # Utility functions
84
95
  'find_max_node_id',
@@ -124,3 +135,7 @@ def old_function_placeholder():
124
135
  # Eğer bu eski fonksiyonu da dışa aktarmak istiyorsanız, __all__ listesine ekleyin
125
136
  # __all__.append('old_function_placeholder')
126
137
 
138
+
139
+
140
+
141
+
@@ -1,6 +1,6 @@
1
1
  # _version.py
2
2
 
3
- __version__ = "0.3.9"
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"
@@ -8,3 +8,5 @@ __url__ = "https://github.com/WhiteSymmetry/kececilayout"
8
8
  __docs__ = "https://github.com/WhiteSymmetry/kececilayout" # Opsiyonel: Dokümantasyon linki
9
9
  __dependencies__ = ["python>=3.10"] # Diğer bağımlılıkları da ekleyebilirsiniz
10
10
 
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
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kececilayout
3
- Version: 0.3.9
3
+ Version: 0.4.1
4
4
  Summary: Çeşitli graf kütüphaneleri için sıralı-zigzag yerleşimleri sağlayan bir Python paketi.
5
5
  Home-page: https://github.com/WhiteSymmetry/kececilayout
6
6
  Author: Mehmet Keçeci
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "kececilayout"
9
- version = "0.3.9"
9
+ version = "0.4.1"
10
10
 
11
11
  # Diğer proje bilgileri (isteğe bağlı ama tavsiye edilir)
12
12
  authors = [
@@ -51,3 +51,5 @@ test = [
51
51
 
52
52
 
53
53
 
54
+
55
+
File without changes
File without changes
File without changes
File without changes
File without changes