{"id":15444323,"url":"https://github.com/qbarthelemy/pyspectrum","last_synced_at":"2025-06-13T14:04:51.669Z","repository":{"id":106947146,"uuid":"526343835","full_name":"qbarthelemy/PySpectrum","owner":"qbarthelemy","description":"Python package for spectral analyses, looking at sampling rate conversion, spectral rescaling and peak detection.","archived":false,"fork":false,"pushed_at":"2023-04-01T09:16:27.000Z","size":411,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-07T19:49:53.046Z","etag":null,"topics":["aliasing","python","sample-rate-conversion","scientific-computing","signal-processing","spectral-analysis","spectral-normalization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qbarthelemy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-18T19:15:07.000Z","updated_at":"2024-03-05T13:08:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"644da23d-2b7a-49b7-aefd-73f14d44aa23","html_url":"https://github.com/qbarthelemy/PySpectrum","commit_stats":{"total_commits":16,"total_committers":1,"mean_commits":16.0,"dds":0.0,"last_synced_commit":"6834097dc3bba85e31bfba43cb187edae6aefe90"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbarthelemy%2FPySpectrum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbarthelemy%2FPySpectrum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbarthelemy%2FPySpectrum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qbarthelemy%2FPySpectrum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qbarthelemy","download_url":"https://codeload.github.com/qbarthelemy/PySpectrum/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991585,"owners_count":20706129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliasing","python","sample-rate-conversion","scientific-computing","signal-processing","spectral-analysis","spectral-normalization"],"created_at":"2024-10-01T19:40:18.094Z","updated_at":"2025-03-28T08:13:26.594Z","avatar_url":"https://github.com/qbarthelemy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PySpectrum\n\n[![Code PythonVersion](https://img.shields.io/badge/python-3.8+-blue)](https://img.shields.io/badge/python-3.8+-blue)\n[![License](https://img.shields.io/badge/licence-BSD--3--Clause-green)](https://img.shields.io/badge/license-BSD--3--Clause-green)\n\nPySpectrum is a Python package for spectral analyses:\n- sampling rate conversion and its potential aliasing artifacts;\n- spectral rescaling and spectral peak detection by robust log-log linear regression.\n\nPySpectrum is distributed under the open source 3-clause BSD license.\n\n## Description\n\n### Sample-rate conversion (SRC)\n\nIn signal processing,\n[sample-rate conversion](https://en.wikipedia.org/wiki/Sample-rate_conversion)\n(SRC) (also called resampling) is the process of changing the sampling rate of a discrete signal: \n[downsampling](https://en.wikipedia.org/wiki/Downsampling_(signal_processing))\nor [upsampling](https://en.wikipedia.org/wiki/Upsampling).\nSRC can generate\n[aliasing artifacts](https://en.wikipedia.org/wiki/Aliasing) when\n[Nyquist–Shannon sampling theorem](https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem)\nis not respected.\n\nThis module implements several functions to complete the\n[Signal processing module of SciPy](https://docs.scipy.org/doc/scipy/reference/signal.html#filtering):\n- `downsample` and `upsample` for multidimensional arrays,\n- `upiirdn` the [scipy.signal.upfirdn](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.upfirdn.html)\ncounterpart for IIR filtering, allowing **fractional** downsampling in sample domain contrary to\n[scipy.signal.decimate](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.decimate.html).\n\n#### 2D image\n\nImage downsampled without anti-aliasing filter shows\n[aliasing artifacts](https://en.wikipedia.org/wiki/Aliasing).\nThis kind of downsampling is present in max-pooling, strided-convolution\nand more generally in strided-layers.\nThese architectural components are widely used in convolutional neural networks\nlike [ResNets](https://openaccess.thecvf.com/content_cvpr_2016/papers/He_Deep_Residual_Learning_CVPR_2016_paper.pdf),\n[DenseNets](https://openaccess.thecvf.com/content_cvpr_2017/papers/Huang_Densely_Connected_Convolutional_CVPR_2017_paper.pdf),\n[MobileNets](https://openaccess.thecvf.com/content_cvpr_2018/papers/Sandler_MobileNetV2_Inverted_Residuals_CVPR_2018_paper.pdf),\ndegrading performances in terms of\n[shift-invariance and classification accuracy](http://proceedings.mlr.press/v97/zhang19a/zhang19a.pdf).\n\n![](/doc/fig_downsample_img.png)\n\nSee `examples\\downsample_img.py` for the complete analysis.\n\n#### Time series\n\nTime series of this example is an electrocardiogram (ECG) signal,\ndownsampled from 360 Hz to 180 Hz.\nSignal downsampled without anti-aliasing filter shows aliasing artifacts,\nie. a huge artifact peak at 80 Hz.\nThis kind of downsampling can be present in quickly coded drivers.\n\n![](/doc/fig_downsample_ecg.png)\n\nSee `examples\\downsample_ecg.py` for the complete analysis.\n\n### Spectral processing\n\nThis module implements several functions:\n- `rescale` to rescale spectra using a robust log-log linear regression,\n- `detect_peak` to detect peak on spectra following a power law.\n\n#### Spectral rescaling\n\nMany analyses require a normalization / standardization step of spectra,\nto remove inter-spectra variabilities.\n\n![](/doc/fig_rescale_spectra.png)\n\nSee `examples\\rescale_simulated.py` for the complete analysis.\n\n#### Alpha peak detection in EEG spectrum\n\nAutomatic detection of alpha peak in the spectrum of an electroencephalogram\n(EEG), compared to peak finders provided by\n[SciPy](https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.find_peaks.html)\nand [MNE-Python](https://mne.tools/stable/generated/mne.preprocessing.peak_finder.html).\n\n![](/doc/fig_find_peak_eeg.png)\n\nSee `examples\\find_peak_eeg.py` for the complete analysis.\n\n## Installation\n\n#### From sources\n\nTo install PySpectrum as a standard module:\n```shell \npip install path/to/PySpectrum\n```\n\nTo install PySpectrum in editable / development mode, in the folder:\n```shell\npip install poetry\npoetry install\n```\n\n## Testing\n\nUse `pytest`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqbarthelemy%2Fpyspectrum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqbarthelemy%2Fpyspectrum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqbarthelemy%2Fpyspectrum/lists"}