modusa 0.3.29__tar.gz → 0.3.30__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.
Files changed (90) hide show
  1. {modusa-0.3.29 → modusa-0.3.30}/PKG-INFO +1 -1
  2. {modusa-0.3.29 → modusa-0.3.30}/pyproject.toml +1 -1
  3. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/tools/plotter.py +55 -33
  4. {modusa-0.3.29 → modusa-0.3.30}/LICENSE.md +0 -0
  5. {modusa-0.3.29 → modusa-0.3.30}/README.md +0 -0
  6. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/.DS_Store +0 -0
  7. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/__init__.py +0 -0
  8. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/config.py +0 -0
  9. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/decorators.py +0 -0
  10. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/generate_docs_source.py +0 -0
  11. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/generate_template.py +0 -0
  12. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/list_authors.py +0 -0
  13. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/list_plugins.py +0 -0
  14. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/main.py +0 -0
  15. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/templates/generator.py +0 -0
  16. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/templates/io.py +0 -0
  17. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/templates/model.py +0 -0
  18. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/templates/plugin.py +0 -0
  19. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/templates/test.py +0 -0
  20. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/devtools/templates/tool.py +0 -0
  21. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/generators/__init__.py +0 -0
  22. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/generators/audio.py +0 -0
  23. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/generators/audio_waveforms.py +0 -0
  24. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/generators/base.py +0 -0
  25. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/generators/ftds.py +0 -0
  26. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/generators/s1d.py +0 -0
  27. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/generators/s2d.py +0 -0
  28. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/generators/s_ax.py +0 -0
  29. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/generators/t_ax.py +0 -0
  30. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/generators/tds.py +0 -0
  31. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/__init__.py +0 -0
  32. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/__pycache__/signal1D.cpython-312.pyc.4443461152 +0 -0
  33. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/audio.py +0 -0
  34. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/base.py +0 -0
  35. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/data.py +0 -0
  36. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/ftds.py +0 -0
  37. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/s1d.py +0 -0
  38. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/s2d.py +0 -0
  39. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/s_ax.py +0 -0
  40. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/t_ax.py +0 -0
  41. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/models/tds.py +0 -0
  42. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/plugins/__init__.py +0 -0
  43. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/plugins/base.py +0 -0
  44. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/tools/__init__.py +0 -0
  45. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/tools/ann_loader.py +0 -0
  46. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/tools/audio_converter.py +0 -0
  47. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/tools/audio_loader.py +0 -0
  48. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/tools/audio_player.py +0 -0
  49. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/tools/base.py +0 -0
  50. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/tools/math_ops.py +0 -0
  51. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/tools/youtube_downloader.py +0 -0
  52. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/utils/.DS_Store +0 -0
  53. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/utils/__init__.py +0 -0
  54. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/utils/config.py +0 -0
  55. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/utils/excp.py +0 -0
  56. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/utils/logger.py +0 -0
  57. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/utils/np_func_cat.py +0 -0
  58. {modusa-0.3.29 → modusa-0.3.30}/src/modusa/utils/plot.py +0 -0
  59. {modusa-0.3.29 → modusa-0.3.30}/tests/__init__.py +0 -0
  60. {modusa-0.3.29 → modusa-0.3.30}/tests/data/song1.mp3 +0 -0
  61. {modusa-0.3.29 → modusa-0.3.30}/tests/data/song1.wav +0 -0
  62. {modusa-0.3.29 → modusa-0.3.30}/tests/test_generators/audio_waveform.py +0 -0
  63. {modusa-0.3.29 → modusa-0.3.30}/tests/test_generators/test_audio.py +0 -0
  64. {modusa-0.3.29 → modusa-0.3.30}/tests/test_generators/test_ftds.py +0 -0
  65. {modusa-0.3.29 → modusa-0.3.30}/tests/test_generators/test_s1d.py +0 -0
  66. {modusa-0.3.29 → modusa-0.3.30}/tests/test_generators/test_s2d.py +0 -0
  67. {modusa-0.3.29 → modusa-0.3.30}/tests/test_generators/test_s_ax.py +0 -0
  68. {modusa-0.3.29 → modusa-0.3.30}/tests/test_generators/test_signal.py +0 -0
  69. {modusa-0.3.29 → modusa-0.3.30}/tests/test_generators/test_signal_generator.py +0 -0
  70. {modusa-0.3.29 → modusa-0.3.30}/tests/test_generators/test_t_ax.py +0 -0
  71. {modusa-0.3.29 → modusa-0.3.30}/tests/test_generators/test_tds.py +0 -0
  72. {modusa-0.3.29 → modusa-0.3.30}/tests/test_io/audio_player.py +0 -0
  73. {modusa-0.3.29 → modusa-0.3.30}/tests/test_io/plotter.py +0 -0
  74. {modusa-0.3.29 → modusa-0.3.30}/tests/test_models/test_data.py +0 -0
  75. {modusa-0.3.29 → modusa-0.3.30}/tests/test_models/test_t_ax.py +0 -0
  76. {modusa-0.3.29 → modusa-0.3.30}/tests/test_plugins/youtube_audio_loader.py +0 -0
  77. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/frequency_domain_signal.py +0 -0
  78. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/spectrogram.py +0 -0
  79. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/test_axis.py +0 -0
  80. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/test_feature_time_domain_signal.py +0 -0
  81. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/test_frequency_time_domain_signal.py +0 -0
  82. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/test_signal1D.py +0 -0
  83. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/test_signal2D.py +0 -0
  84. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/test_time_domain_signal.py +0 -0
  85. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/test_u_ax.py +0 -0
  86. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/test_window_signal.py +0 -0
  87. {modusa-0.3.29 → modusa-0.3.30}/tests/test_signals/time_domain_signal.py +0 -0
  88. {modusa-0.3.29 → modusa-0.3.30}/tests/test_tools/test_audio_converter.py +0 -0
  89. {modusa-0.3.29 → modusa-0.3.30}/tests/test_tools/test_fourier_tranform.py +0 -0
  90. {modusa-0.3.29 → modusa-0.3.30}/tests/test_tools/test_math_ops.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: modusa
3
- Version: 0.3.29
3
+ Version: 0.3.30
4
4
  Summary: A modular signal analysis python library.
5
5
  Author-Email: Ankit Anand <ankit0.anand0@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "modusa"
3
- version = "0.3.29"
3
+ version = "0.3.30"
4
4
  description = "A modular signal analysis python library."
5
5
  authors = [
6
6
  { name = "Ankit Anand", email = "ankit0.anand0@gmail.com" },
@@ -27,7 +27,7 @@ def _calculate_extent(x, y):
27
27
  ]
28
28
 
29
29
  #======== 1D ===========
30
- def plot1d(*args, ann=None, events=None, xlim=None, ylim=None, xlabel=None, ylabel=None, title=None, legend=None, show_grid=False):
30
+ def plot1d(*args, ann=None, events=None, xlim=None, ylim=None, xlabel=None, ylabel=None, title=None, legend=None, show_grid=False, show_stem=False):
31
31
  """
32
32
  Plots a 1D signal using matplotlib.
33
33
 
@@ -75,6 +75,9 @@ def plot1d(*args, ann=None, events=None, xlim=None, ylim=None, xlabel=None, ylab
75
75
  show_grid: bool
76
76
  - If you want to show the grid.
77
77
  - Default: False
78
+ show_stem: bool:
79
+ - If you want stem plot.
80
+ - Default: False
78
81
 
79
82
  Returns
80
83
  -------
@@ -114,15 +117,34 @@ def plot1d(*args, ann=None, events=None, xlim=None, ylim=None, xlabel=None, ylab
114
117
  y = signal[0]
115
118
  x = np.arange(y.size)
116
119
  if legend is not None:
117
- signal_ax.plot(x, y, label=legend[i])
120
+ if show_stem is True:
121
+ markerline, stemlines, baseline = signal_ax.stem(x, y, label=legend[i])
122
+ markerline.set_color(colors[i])
123
+ stemlines.set_color(colors[i])
124
+ baseline.set_color("k")
125
+ else:
126
+ signal_ax.plot(x, y, color=colors[i], label=legend[i])
118
127
  else:
119
- signal_ax.plot(x, y)
128
+ if show_stem is True:
129
+ markerline, stemlines, baseline = signal_ax.stem(x, y)
130
+ markerline.set_color(colors[i])
131
+ stemlines.set_color(colors[i])
132
+ baseline.set_color("k")
133
+ else:
134
+ signal_ax.plot(x, y, color=colors[i])
135
+
120
136
  elif len(signal) == 2:
121
137
  y, x = signal[0], signal[1]
122
138
  if legend is not None:
123
- signal_ax.plot(x, y, label=legend[i])
139
+ if show_stem is True:
140
+ signal_ax.stem(x, y, linefmt=f"{colors[i]}-", markerfmt=f"{colors[i]}o", basefmt="k-", label=legend[i])
141
+ else:
142
+ signal_ax.plot(x, y, color=colors[i], label=legend[i])
124
143
  else:
125
- signal_ax.plot(x, y)
144
+ if show_stem is True:
145
+ signal_ax.stem(x, y, linefmt=f"{colors[i]}-", markerfmt=f"{colors[i]}o", basefmt="k-")
146
+ else:
147
+ signal_ax.plot(x, y, color=colors[i])
126
148
 
127
149
  # Add annotations
128
150
  if ann is not None:
@@ -166,7 +188,7 @@ def plot1d(*args, ann=None, events=None, xlim=None, ylim=None, xlabel=None, ylab
166
188
  # Add legend
167
189
  if legend is not None:
168
190
  handles, labels = signal_ax.get_legend_handles_labels()
169
- fig.legend(handles, labels, loc='upper right', bbox_to_anchor=(0.9, 1.2), ncol=len(legend), frameon=False)
191
+ fig.legend(handles, labels, loc='upper right', bbox_to_anchor=(0.9, 1.2), ncol=len(legend), frameon=True)
170
192
 
171
193
  # Set title, labels
172
194
  if title is not None:
@@ -463,11 +485,11 @@ def plot_dist(*args, ann=None, xlim=None, ylim=None, ylabel=None, xlabel=None, t
463
485
  from scipy.stats import gaussian_kde
464
486
 
465
487
  if isinstance(legend, str):
466
- legend = (legend, )
488
+ legend = (legend, )
467
489
 
468
490
  if legend is not None:
469
- if len(legend) < len(args):
470
- raise ValueError(f"Legend should be provided for each signal.")
491
+ if len(legend) < len(args):
492
+ raise ValueError(f"Legend should be provided for each signal.")
471
493
 
472
494
  # Create figure
473
495
  fig = plt.figure(figsize=(16, 4))
@@ -480,28 +502,28 @@ def plot_dist(*args, ann=None, xlim=None, ylim=None, ylabel=None, xlabel=None, t
480
502
 
481
503
  # Set limits
482
504
  if xlim is not None:
483
- dist_ax.set_xlim(xlim)
505
+ dist_ax.set_xlim(xlim)
484
506
 
485
507
  if ylim is not None:
486
- dist_ax.set_ylim(ylim)
508
+ dist_ax.set_ylim(ylim)
487
509
 
488
510
  # Add plot
489
511
  for i, data in enumerate(args):
490
- # Fit gaussian to the data
491
- kde = gaussian_kde(data)
492
-
493
- # Create points to evaluate KDE
494
- x = np.linspace(min(data), max(data), npoints)
495
- y = kde(x)
496
-
497
- if legend is not None:
498
- dist_ax.plot(x, y, color=colors[i], label=legend[i])
499
- if show_hist is True:
500
- dist_ax.hist(data, bins=bins, density=True, alpha=0.3, facecolor=colors[i], edgecolor='black', label=legend[i])
501
- else:
502
- dist_ax.plot(x, y, color=colors[i])
503
- if show_hist is True:
504
- dist_ax.hist(data, bins=bins, density=True, alpha=0.3, facecolor=colors[i], edgecolor='black')
512
+ # Fit gaussian to the data
513
+ kde = gaussian_kde(data)
514
+
515
+ # Create points to evaluate KDE
516
+ x = np.linspace(np.min(data), np.max(data), npoints)
517
+ y = kde(x)
518
+
519
+ if legend is not None:
520
+ dist_ax.plot(x, y, color=colors[i], label=legend[i])
521
+ if show_hist is True:
522
+ dist_ax.hist(data, bins=bins, density=True, alpha=0.3, facecolor=colors[i], edgecolor='black', label=legend[i])
523
+ else:
524
+ dist_ax.plot(x, y, color=colors[i])
525
+ if show_hist is True:
526
+ dist_ax.hist(data, bins=bins, density=True, alpha=0.3, facecolor=colors[i], edgecolor='black')
505
527
 
506
528
  # Add annotations
507
529
  if ann is not None:
@@ -528,22 +550,22 @@ def plot_dist(*args, ann=None, xlim=None, ylim=None, ylabel=None, xlabel=None, t
528
550
 
529
551
  # Add legend
530
552
  if legend is not None:
531
- handles, labels = dist_ax.get_legend_handles_labels()
532
- fig.legend(handles, labels, loc='upper right', bbox_to_anchor=(0.9, 1.1), ncol=len(legend), frameon=True)
553
+ handles, labels = dist_ax.get_legend_handles_labels()
554
+ fig.legend(handles, labels, loc='upper right', bbox_to_anchor=(0.9, 1.1), ncol=len(legend), frameon=True)
533
555
 
534
556
  # Set title, labels
535
557
  if title is not None:
536
- annotation_ax.set_title(title, pad=10, size=11)
558
+ annotation_ax.set_title(title, pad=10, size=11)
537
559
  if xlabel is not None:
538
- dist_ax.set_xlabel(xlabel)
560
+ dist_ax.set_xlabel(xlabel)
539
561
  if ylabel is not None:
540
- dist_ax.set_ylabel(ylabel)
562
+ dist_ax.set_ylabel(ylabel)
541
563
 
542
564
  # Remove the boundaries and ticks from annotation axis
543
565
  if ann is not None:
544
- annotation_ax.tick_params(left=False, bottom=False, labelleft=False, labelbottom=False)
566
+ annotation_ax.tick_params(left=False, bottom=False, labelleft=False, labelbottom=False)
545
567
  else:
546
- annotation_ax.axis("off")
568
+ annotation_ax.axis("off")
547
569
 
548
570
  fig.subplots_adjust(hspace=0.01, wspace=0.05)
549
571
  plt.close()
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes