valyte 0.1.6__py3-none-any.whl → 0.1.8__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.
valyte/dos_plot.py CHANGED
@@ -57,32 +57,53 @@ def gradient_fill(x, y, ax=None, color=None, xlim=None, **kwargs):
57
57
  rgb = mcolors.to_rgb(fill_color)
58
58
  z[:, :, :3] = rgb
59
59
 
60
+ # Gradient Logic based on relative height
61
+ # We want opacity to be proportional to height relative to the max visible value (ymax_ref)
62
+
63
+ # Create normalized alpha gradient (0 to 1)
64
+ # We map y-values to alpha values.
65
+ # Since imshow fills a rectangle, we create a vertical gradient
66
+ # and clip it later.
67
+
68
+ # Opacity range: 0.05 (at axis) to 0.95 (at max visible height)
69
+ # This ensures "Darker colour at the top"
70
+ min_alpha = 0.05
71
+ max_alpha = 0.95
60
72
 
61
- # Gradient: transparent at bottom (y=0), opaque near the curve
62
- # This creates a gradient from bottom to top of the filled area
63
- # Boosted range for better visibility as per user request
64
- alpha_vals = np.linspace(0.3, 0.9, 100)
73
+ # Create the gradient array (vertical)
74
+ # 0 is bottom, 1 is top
75
+ gradient_vector = np.linspace(min_alpha, max_alpha, 100)
65
76
 
66
- # Scale by the line's alpha
67
- alpha_vals *= alpha
77
+ # IMPORTANT: Restore alpha scaling so total DOS (alpha=0.15) stays faint
78
+ gradient_vector *= alpha
68
79
 
69
80
  # If data is negative (Spin Down), we want opaque at bottom (peak) and transparent at top (axis)
70
- # Current extent is [ymin, ymax]. ymin is bottom. ymax is top (0).
71
- # So we want High Alpha at index 0 and Low Alpha at index 100.
72
81
  if np.mean(y) < 0:
73
- alpha_vals = alpha_vals[::-1]
82
+ gradient_vector = gradient_vector[::-1]
74
83
 
75
- z[:, :, -1] = alpha_vals[:, None]
84
+ z[:, :, -1] = gradient_vector[:, None]
76
85
 
77
86
  xmin, xmax = x.min(), x.max()
78
- ymin, ymax = min(y.min(), 0), max(y.max(), 0)
79
87
 
80
- # Handle pure negative or pure positive cases to avoid singular extent
81
- if ymax == ymin:
82
- ymax += 1e-6
83
-
88
+ # Determine extent based on LOCAL curve limits
89
+ # User requested "each curve should have its own gradient"
90
+ # So we scale from 0 to curve.max()
91
+
92
+ local_ymax = max(y.max(), abs(y.min()))
93
+ if local_ymax == 0: local_ymax = 1.0 # Prevent singular extent
94
+
95
+ if np.mean(y) < 0:
96
+ # Spin Down: Extent from -local_ymax to 0
97
+ extent_ymin = -local_ymax
98
+ extent_ymax = 0
99
+ else:
100
+ # Spin Up: Extent from 0 to local_ymax
101
+ extent_ymin = 0
102
+ extent_ymax = local_ymax
103
+
84
104
  # Display the gradient image
85
- im = ax.imshow(z, aspect="auto", extent=[xmin, xmax, ymin, ymax],
105
+ # We use the explicit extent calculated above
106
+ im = ax.imshow(z, aspect="auto", extent=[xmin, xmax, extent_ymin, extent_ymax],
86
107
  origin="lower", zorder=zorder)
87
108
 
88
109
  # Clip the gradient to the area under the curve
@@ -407,6 +428,13 @@ def plot_dos(dos, pdos, out="valyte_dos.png",
407
428
  global_max = max(max_visible_y, abs(min_visible_y))
408
429
  threshold = legend_cutoff * global_max
409
430
 
431
+ # Auto-scale Y-axis calculation (to determine ymax_ref)
432
+ if ylim:
433
+ pass # ymax_ref = ylim[1] (Unused)
434
+ else:
435
+ # Determine likely ymax based on logic later in the function
436
+ pass
437
+
410
438
  # Filter legend items but keep all plot lines
411
439
  final_lines = []
412
440
  final_labels = []
@@ -445,6 +473,9 @@ def plot_dos(dos, pdos, out="valyte_dos.png",
445
473
  y_total_down = -dos.spin_down
446
474
 
447
475
  ax.plot(dos.energies, y_total_up, color="k", lw=1.2, label="Total DOS")
476
+ # Use ymax_ref here too, assuming we want scaling relative to frame too
477
+ # But Total DOS is often much larger. Maybe keep it separate max?
478
+ # User said "Maximum value after scaling". So consistent reference is good.
448
479
  gradient_fill(dos.energies, y_total_up, ax=ax, color="k", alpha=0.15)
449
480
 
450
481
  if is_spin_polarized:
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.1
2
2
  Name: valyte
3
- Version: 0.1.6
3
+ Version: 0.1.8
4
4
  Summary: A comprehensive CLI tool for VASP pre-processing (Supercells, K-points) and post-processing (DOS, Band Structure plotting)
5
5
  Home-page: https://github.com/nikyadav002/Valyte-Project
6
6
  Author: Nikhil
@@ -13,18 +13,12 @@ Description-Content-Type: text/markdown
13
13
  Requires-Dist: numpy
14
14
  Requires-Dist: matplotlib
15
15
  Requires-Dist: pymatgen
16
- Dynamic: author
17
- Dynamic: author-email
18
- Dynamic: classifier
19
- Dynamic: description
20
- Dynamic: description-content-type
21
- Dynamic: home-page
22
- Dynamic: requires-dist
23
- Dynamic: requires-python
24
- Dynamic: summary
16
+ Requires-Dist: scipy
17
+ Requires-Dist: click
18
+ Requires-Dist: seekpath
25
19
 
26
20
  <p align="center">
27
- <img src="https://raw.githubusercontent.com/nikyadav002/Valyte-Project/main/valyte/Logo.png" alt="Valyte Logo" width="100%"/>
21
+ <img src="valyte/Logo.png" alt="Valyte Logo" width="100%"/>
28
22
  </p>
29
23
 
30
24
  # Valyte
@@ -69,8 +63,8 @@ pip install -e .
69
63
  ## Examples
70
64
 
71
65
  <p align="center">
72
- <img src="https://raw.githubusercontent.com/nikyadav002/Valyte-Project/main/valyte/valyte_dos.png" alt="DOS Plot Example" width="47%"/>
73
- <img src="https://raw.githubusercontent.com/nikyadav002/Valyte-Project/main/valyte/valyte_band.png" alt="Band Structure Example" width="38%"/>
66
+ <img src="valyte/valyte_dos.png" alt="DOS Plot Example" width="47%"/>
67
+ <img src="valyte/valyte_band.png" alt="Band Structure Example" width="38%"/>
74
68
  </p>
75
69
 
76
70
  ## Updating Valyte
@@ -0,0 +1,17 @@
1
+ valyte/Logo.png,sha256=HSZQsjsCj4y_8zeXE1kR1W7deb-6gXheEnmcLcSKUxw,4327936
2
+ valyte/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ valyte/band.py,sha256=fRum_BwgSqsN_lJsHFc7AhhVD5y4T5Sq7JJNhvB8J8w,11732
4
+ valyte/band_plot.py,sha256=2jP6fEh8qDYHXxDAs4S69xDcxrzWbYcjOAWiGHwjyF4,4766
5
+ valyte/cli.py,sha256=5lqDQTPMJTS_-u19l7MZG6GYwhFQQ0BgEJ0T13LxCtQ,9153
6
+ valyte/dos_plot.py,sha256=PWlUSlF887-s2SXuHEjMiGLdo4_5419SVwVn1xTYvQQ,18972
7
+ valyte/kpoints.py,sha256=_LISADqe11NBlv8LMjMkF5rWrREHB3aU5-nHvqxj3jk,3055
8
+ valyte/supercell.py,sha256=w6Ik_krXoshgliJDiyjoIZXuifzN0ydi6VSmpzutm9Y,996
9
+ valyte/valyte_band.png,sha256=1Bh-x7qvl1j4D9HGGbQK8OlMUrTU1mhU_kMILUsNiD8,246677
10
+ valyte/valyte_dos.png,sha256=ViE4CycCSqFi_ZtUhA7oGI1nTyt0mHoYI6yg5-Et35k,182523
11
+ valyte/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
12
+ valyte/data/bradcrack.json,sha256=Jpaf7giqp99BAhFdLv9pRFsx_m-ooQaQpOrPDusuZX4,22614
13
+ valyte-0.1.8.dist-info/METADATA,sha256=QpGEeHAEwcOeT7cmW9xv4uvxByeS0jYwJeaCwX5WGlc,5506
14
+ valyte-0.1.8.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
15
+ valyte-0.1.8.dist-info/entry_points.txt,sha256=Ny3Z5rh3Ia7lEKoMDDZOm4_jS-Zde3qFHv8f1GLUdxk,43
16
+ valyte-0.1.8.dist-info/top_level.txt,sha256=72-UqyU15JSWDjtBQf6cY0_UBqz0EU2FoVeXjd1JZ5M,7
17
+ valyte-0.1.8.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.0)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,15 +0,0 @@
1
- valyte/Logo.png,sha256=HSZQsjsCj4y_8zeXE1kR1W7deb-6gXheEnmcLcSKUxw,4327936
2
- valyte/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- valyte/band.py,sha256=qipx3YIlcl2yV-g6nn_YPRJCidvlrxZKEQzSRyBkwac,1917
4
- valyte/band_plot.py,sha256=2jP6fEh8qDYHXxDAs4S69xDcxrzWbYcjOAWiGHwjyF4,4766
5
- valyte/cli.py,sha256=c5At8G4t6IoZEQKEJdBP72TzsKweUX5DIiaaUd9aQXg,8847
6
- valyte/dos_plot.py,sha256=M3Jg1AaS60CIKBv2pfvrtnSEu61EIvA_yqbYtr4A0g8,17792
7
- valyte/kpoints.py,sha256=_LISADqe11NBlv8LMjMkF5rWrREHB3aU5-nHvqxj3jk,3055
8
- valyte/supercell.py,sha256=w6Ik_krXoshgliJDiyjoIZXuifzN0ydi6VSmpzutm9Y,996
9
- valyte/valyte_band.png,sha256=1Bh-x7qvl1j4D9HGGbQK8OlMUrTU1mhU_kMILUsNiD8,246677
10
- valyte/valyte_dos.png,sha256=ViE4CycCSqFi_ZtUhA7oGI1nTyt0mHoYI6yg5-Et35k,182523
11
- valyte-0.1.6.dist-info/METADATA,sha256=e-tZzPBhtukUAa574Zx8ILM3Q2d3pP6x_5lb2pZh7zc,5835
12
- valyte-0.1.6.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
13
- valyte-0.1.6.dist-info/entry_points.txt,sha256=Ny3Z5rh3Ia7lEKoMDDZOm4_jS-Zde3qFHv8f1GLUdxk,43
14
- valyte-0.1.6.dist-info/top_level.txt,sha256=72-UqyU15JSWDjtBQf6cY0_UBqz0EU2FoVeXjd1JZ5M,7
15
- valyte-0.1.6.dist-info/RECORD,,