valyte 0.1.5__py3-none-any.whl → 0.1.7__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,28 +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
72
+
73
+ # Create the gradient array (vertical)
74
+ # 0 is bottom, 1 is top
75
+ gradient_vector = np.linspace(min_alpha, max_alpha, 100)
60
76
 
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
- alpha_gradient = np.linspace(0.05, 0.75, 100)
77
+ # IMPORTANT: Restore alpha scaling so total DOS (alpha=0.15) stays faint
78
+ gradient_vector *= alpha
64
79
 
65
80
  # If data is negative (Spin Down), we want opaque at bottom (peak) and transparent at top (axis)
66
- # Current extent is [ymin, ymax]. ymin is bottom. ymax is top (0).
67
- # So we want High Alpha at index 0 and Low Alpha at index 100.
68
81
  if np.mean(y) < 0:
69
- alpha_gradient = alpha_gradient[::-1]
82
+ gradient_vector = gradient_vector[::-1]
70
83
 
71
- z[:, :, -1] = alpha_gradient[:, None]
84
+ z[:, :, -1] = gradient_vector[:, None]
72
85
 
73
86
  xmin, xmax = x.min(), x.max()
74
- ymin, ymax = min(y.min(), 0), max(y.max(), 0)
75
87
 
76
- # Handle pure negative or pure positive cases to avoid singular extent
77
- if ymax == ymin:
78
- ymax += 1e-6
79
-
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
+
80
104
  # Display the gradient image
81
- 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],
82
107
  origin="lower", zorder=zorder)
83
108
 
84
109
  # Clip the gradient to the area under the curve
@@ -403,6 +428,13 @@ def plot_dos(dos, pdos, out="valyte_dos.png",
403
428
  global_max = max(max_visible_y, abs(min_visible_y))
404
429
  threshold = legend_cutoff * global_max
405
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
+
406
438
  # Filter legend items but keep all plot lines
407
439
  final_lines = []
408
440
  final_labels = []
@@ -441,6 +473,9 @@ def plot_dos(dos, pdos, out="valyte_dos.png",
441
473
  y_total_down = -dos.spin_down
442
474
 
443
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.
444
479
  gradient_fill(dos.energies, y_total_up, ax=ax, color="k", alpha=0.15)
445
480
 
446
481
  if is_spin_polarized:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: valyte
3
- Version: 0.1.5
3
+ Version: 0.1.7
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
@@ -24,7 +24,7 @@ Dynamic: requires-python
24
24
  Dynamic: summary
25
25
 
26
26
  <p align="center">
27
- <img src="https://raw.githubusercontent.com/nikyadav002/Valyte-Project/main/valyte/Logo.png" alt="Valyte Logo" width="100%"/>
27
+ <img src="valyte/Logo.png" alt="Valyte Logo" width="100%"/>
28
28
  </p>
29
29
 
30
30
  # Valyte
@@ -69,8 +69,8 @@ pip install -e .
69
69
  ## Examples
70
70
 
71
71
  <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%"/>
72
+ <img src="valyte/valyte_dos.png" alt="DOS Plot Example" width="47%"/>
73
+ <img src="valyte/valyte_band.png" alt="Band Structure Example" width="38%"/>
74
74
  </p>
75
75
 
76
76
  ## Updating Valyte
@@ -3,13 +3,13 @@ valyte/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  valyte/band.py,sha256=qipx3YIlcl2yV-g6nn_YPRJCidvlrxZKEQzSRyBkwac,1917
4
4
  valyte/band_plot.py,sha256=2jP6fEh8qDYHXxDAs4S69xDcxrzWbYcjOAWiGHwjyF4,4766
5
5
  valyte/cli.py,sha256=c5At8G4t6IoZEQKEJdBP72TzsKweUX5DIiaaUd9aQXg,8847
6
- valyte/dos_plot.py,sha256=lmrVu2yu6Fyj0IzRH-CMaIfZaqXNDpj8zQ78yoHyciY,17687
6
+ valyte/dos_plot.py,sha256=PWlUSlF887-s2SXuHEjMiGLdo4_5419SVwVn1xTYvQQ,18972
7
7
  valyte/kpoints.py,sha256=_LISADqe11NBlv8LMjMkF5rWrREHB3aU5-nHvqxj3jk,3055
8
8
  valyte/supercell.py,sha256=w6Ik_krXoshgliJDiyjoIZXuifzN0ydi6VSmpzutm9Y,996
9
9
  valyte/valyte_band.png,sha256=1Bh-x7qvl1j4D9HGGbQK8OlMUrTU1mhU_kMILUsNiD8,246677
10
10
  valyte/valyte_dos.png,sha256=ViE4CycCSqFi_ZtUhA7oGI1nTyt0mHoYI6yg5-Et35k,182523
11
- valyte-0.1.5.dist-info/METADATA,sha256=cHO5vB8M07lYjS3jqwPZRTOxwjaOBjY4G67HAipKN08,5835
12
- valyte-0.1.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
13
- valyte-0.1.5.dist-info/entry_points.txt,sha256=Ny3Z5rh3Ia7lEKoMDDZOm4_jS-Zde3qFHv8f1GLUdxk,43
14
- valyte-0.1.5.dist-info/top_level.txt,sha256=72-UqyU15JSWDjtBQf6cY0_UBqz0EU2FoVeXjd1JZ5M,7
15
- valyte-0.1.5.dist-info/RECORD,,
11
+ valyte-0.1.7.dist-info/METADATA,sha256=9-nvh96xooqlK8HuM5aOo3N_pYw-EbHAva6lkkg0pKY,5637
12
+ valyte-0.1.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
13
+ valyte-0.1.7.dist-info/entry_points.txt,sha256=Ny3Z5rh3Ia7lEKoMDDZOm4_jS-Zde3qFHv8f1GLUdxk,43
14
+ valyte-0.1.7.dist-info/top_level.txt,sha256=72-UqyU15JSWDjtBQf6cY0_UBqz0EU2FoVeXjd1JZ5M,7
15
+ valyte-0.1.7.dist-info/RECORD,,
File without changes