funcnodes-span 0.2.3__tar.gz → 0.2.5__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.1
2
2
  Name: funcnodes-span
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary:
5
5
  Home-page: https://linkdlab.de/
6
6
  Author: Kourosh Rezaei
@@ -5,7 +5,7 @@ from .smoothing import SMOOTH_NODE_SHELF as SMOOTH
5
5
  from .peak_analysis import PEAKS_NODE_SHELF as PEAK
6
6
  from .baseline import BASELINE_NODE_SHELF as BASELINE
7
7
 
8
- __version__ = "0.2.3"
8
+ __version__ = "0.2.5"
9
9
 
10
10
  NODE_SHELF = fn.Shelf(
11
11
  name="Spectral Analysis",
@@ -659,19 +659,17 @@ def plot_peaks(x: np.array, y: np.array, peaks_dict: List[PeakProperties]) -> go
659
659
 
660
660
  # Add rectangle shapes for each peak
661
661
  for index, peak in enumerate(peaks_dict):
662
- initial_idx = peak.i_index
663
- ending_idx = peak.f_index
664
662
  peak_height = peak.y_at_index
665
- plot_y_min = min(y[initial_idx], y[ending_idx])
663
+ plot_y_min = min(peak.y_at_i_index, peak.y_at_f_index)
666
664
 
667
665
  # Create a scatter trace that simulates a rectangle
668
666
  fig.add_trace(
669
667
  go.Scatter(
670
668
  x=[
671
- x[initial_idx],
672
- x[ending_idx],
673
- x[ending_idx],
674
- x[initial_idx],
669
+ peak.x_at_i_index,
670
+ peak.x_at_f_index,
671
+ peak.x_at_f_index,
672
+ peak.x_at_i_index,
675
673
  ],
676
674
  y=[plot_y_min, plot_y_min, peak_height, peak_height],
677
675
  fill="toself",
@@ -680,6 +678,19 @@ def plot_peaks(x: np.array, y: np.array, peaks_dict: List[PeakProperties]) -> go
680
678
  line=dict(width=0),
681
679
  mode="lines",
682
680
  name=f"Peak {peak.id}",
681
+ legendgroup=f"Peak {peak.id}", # Group by Peak id
682
+ showlegend=True,
683
+ )
684
+ )
685
+ # Add an X marker at the exact peak position
686
+ fig.add_trace(
687
+ go.Scatter(
688
+ x=[peak.x_at_index],
689
+ y=[peak.y_at_index],
690
+ mode="markers",
691
+ marker=dict(symbol="x", size=10, color="black"),
692
+ legendgroup=f"Peak {peak.id}", # Same group as rectangle
693
+ showlegend=False,
683
694
  )
684
695
  )
685
696
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "funcnodes-span"
3
- version = "0.2.3"
3
+ version = "0.2.5"
4
4
  description = ""
5
5
  authors = ["Kourosh Rezaei <kouroshrezaei90@gmail.com>"]
6
6
  readme = "README.md"
@@ -26,6 +26,7 @@ pre-commit = "*"
26
26
  funcnodes-module = "*"
27
27
  pooch = "*"
28
28
 
29
+
29
30
  [build-system]
30
31
  requires = ["poetry-core"]
31
32
  build-backend = "poetry.core.masonry.api"
File without changes