.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "gallery/data_generation.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_gallery_data_generation.py: Generating and Visualizing Signal Data ====================================== This example demonstrates how to: 1. Generate synthetic signals with up to 3 Gaussian pulses. 2. Compute a Region of Interest (ROI) mask based on pulse positions. 3. Visualize signals with peak positions, amplitudes, and the ROI mask. We use: - ``generate_signal_dataset`` to create the signals. - ``compute_rois_from_signals`` to generate the ROI mask. - ``SignalPlotter`` to visualize the results. .. GENERATED FROM PYTHON SOURCE LINES 18-20 Imports ------- .. GENERATED FROM PYTHON SOURCE LINES 20-22 .. code-block:: Python from DeepPeak.signals import Kernel, SignalDatasetGenerator .. GENERATED FROM PYTHON SOURCE LINES 23-29 Generate Synthetic Signal Dataset --------------------------------- We generate a dataset with `NUM_PEAKS` Gaussian pulses per signal. The peak amplitudes, positions, and widths are randomly chosen within specified ranges. .. GENERATED FROM PYTHON SOURCE LINES 29-48 .. code-block:: Python NUM_PEAKS = 3 SEQUENCE_LENGTH = 200 sample_count = 3 generator = SignalDatasetGenerator(n_samples=sample_count, sequence_length=SEQUENCE_LENGTH) dataset = generator.generate( signal_type=Kernel.GAUSSIAN, n_peaks=(1, NUM_PEAKS), amplitude=(1, 100), # Amplitude range position=(0.1, 0.9), # Peak position range width=(0.03, 0.05), # Width range noise_std=0.1, # Add some noise categorical_peak_count=False, compute_region_of_interest=True, ) dataset.plot() .. image-sg:: /gallery/images/sphx_glr_data_generation_001.png :alt: data generation :srcset: /gallery/images/sphx_glr_data_generation_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.492 seconds) .. _sphx_glr_download_gallery_data_generation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: data_generation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: data_generation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: data_generation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_