semvec/pypi-packages huggingface dataset:
folium-pmtiles 0.4.3
Folium Plugin to Support PMTiles
License: MIT
Requires Python: >=3.8,<4.0

# 🗺️ Folium Plugin to support PMTiles

## Basic usage

### Installation

```
pip install folium folium-pmtiles
```

### Usage

The recommend way is to use `PMTilesVector`. This converts a simple mapbox style to a appropriate leaflet/protomaps styles.
If you need more complex styling, you can use `PMTilesMapLibreLayer`

A simple folium example is as follows:

```python
import folium

from folium_pmtiles.vector import PMTilesVector

m = folium.Map(location=[43.7798, 11.24148], zoom_start=12)
pmtiles_layer = PMTilesVector(
    "https://pmtiles.jtmiclat.me/protomaps(vector)ODbL_firenze.pmtiles",
    "folium_layer_name",
    style={
        "layers": [
            {
                "source-layer": "landuse",
                "type": "fill",
                "paint": {"fill-color": "steelblue"},
            },
            {
                "source-layer": "roads",
                "type": "line",
                "paint": {"line-color": "black"},
            },
        ],
    },
    options={
        "attribution": """<a href="https://protomaps.com">Protomaps</a> © <a href="https://openstreetmap.org/copyright">OpenStreetMap</a>'"""
    },
)
m.add_child(pmtiles_layer)
```

See [example/](example/) to see more examples and live demos via google collab or github.dev.

## Dev Setup

```
poetry install --with dev
poetry run pre-commit install
```
pyaudioaliasingmetrics 0.1.0
Computes SNR and SINAD from spectral data
License: MIT

# pyaudioaliasingmetrics
A Python implementation of SNR and SINAD metrics, using Numpy and Numba

These implementations expects three types of inputs :
- spectral magnitudes of the required signals
- the fundamental frequency of the signal
- a description of which harmonics are part of the signal

## Installation
You can install this library using pip
```shell
pip install pyaudioaliasingmetrics
```

## Usage
*Matlab suggest using a Kaiser window with a beta factor of 38*

### SNR
Computing the SNR of a saw wave at 440Hz, sampled at 44100Hz
```py
import numpy as np
import audioaliasingmetrics as aam

noisy_signal : np.ndarray[np.float32] = ... # audio time serie of the noisy signal

length = noisy_signal.shape[0]
window = window = np.kaiser(length, 38)
magnitude = np.abs(np.fft.rfft(noisy_signal * window))
snr = aam.snr(magnitude, 44100, 440.0, aam.Harmonics.ALL)
```

### SINAD
Computing the SINAD of a saw wave at 440Hz, sampled at 44100Hz
```py
import numpy as np
import audioaliasingmetrics as aam

noisy_signal : np.ndarray[np.float32] = ... # audio time serie of the noisy signal
clean_signal : np.ndarray[np.float32] = ... # audio time serie of the clean signal

length = noisy_signal.shape[0]
window = window = np.kaiser(length, 38)
noisy_magnitude = np.abs(np.fft.rfft(noisy_signal * window))
clean_magnitude = np.abs(np.fft.rfft(clean_signal * window))

sinad = aam.sinad(noisy_magnitude, clean_magnitude, 44100, 440.0, aam.Harmonics.ALL)
```

### Harmonics selection
You can select which harmonics are part of your signal with the `harmonics` parameter of both methods. It supports two modes:

- A `Harmonics` enum value (`ODD` / `EVEN` / `ALL`) to respectively select all possible odd, even or both harmonics.
- A list/numpy array of integers values >2 of harmonics factors by which to multiply the fundamental with, to precisely select harmonics.