semvec/pypi-packages huggingface dataset:
boitrann 0.1.4
Some useful utilities for data structures
Requires Python: >=3.8

# boitrann: Some useful utilities for data structures

## What is it?

**boitrann** is a Python package offering efficient, flexible, and expressive data structures. It is designed to enhance the performance of various functions, tailored to the specific needs of the author and the broader programming community.

## Where to get it
The source code is currently hosted on GitHub at:
https://github.com/boitrann/boitrann

```sh
# or PyPI
pip install boitrann
```
gemf-map 0.4.0
GEMF, an efficient tile-based map format.
Requires Python: >=3.8
Keywords: gemf, tiles, map, mobile map, locus

# GEMF

Python package for the GEMF map format. From the format [specification](https://www.cgtk.co.uk/gemf):

> This tile store format is intended to provide a static (i.e. cannot be updated without regenerating from scratch) file containing a large number of tiles, stored
> in a manner that makes efficient use of SD cards and with which it is easy to access individual tiles very quickly. It is intended to overcome the existing issues
> with the way tiles are stored in most existing Android map applications as these are not very scalable.

`.gemf` files may be used in mobile mapping applications like [Locus](https://www.locusmap.app/)

# Installation
```cmd
pip install gemf-map
```


# Features
**Core features** are...
- reading `.gemf` map files via the `GEMF.from_file()` classmethod
- creating a GEMF object from PNG or JPG tiles via the `GEMF.from_tiles()` classmethod
- writing a newly created GEMF object to file via the `write()` method

**Further features** are...
- spatially subset (crop) a .gemf file
- extracting tiles (PNG or JPG) from binary `.gemf` files via the `save_tiles()` method
- adding tiles to an existing `.gemf` file (TODO)

**Visualization features**:
- show the tiles of a .gemf file on a `folium` map
- show tile boundaries on a map

<!-- TODO: explain lazy laoding -->

# Usage

## Core
```python
from gemf import GEMF

# load an existing .gemf file
my_gemf = GEMF.from_file("MY_GEMF.gemf")

# extract the tiles
my_gemf.save_tiles("PATH/TO/TILEDIR")

# create a GEMF object from tiles on disk
new_gemf = GEMF.from_tiles("PATH/TO/TILEDIR")

# write GEMF object to .gemf file
new_gemf.write("PATH/TO/GEMF_FILE.gemf")
```

## Manipulation
```python
# crop to bounding box (all zoom levels will be cropped accordingly)
gemf_crop = my_gemf.crop(7, 60, 62, 36, 38)
```


## Visualization
<!-- TODO: limitations for large gemf files -->
```python
from gemf.plot import GEMFPlot

# visualize tiles and tile boundaries
gemf_map = GEMFPlot(my_gemf)

# visualize tiles without boundaries
tile_map = GEMFPlot(my_gemf, show_tile_boundaries=False)

# visualize only boundaries (to avoid loading tile contents from disk)
boundary_map = GEMFPlot(my_gemf, show_tiles=False)
```

## Other
```python
# save the embedded tiles to image files
gemf_map.save_tiles("path/to/output/dir")
```
torch-legendre 0.1.1
A Legendre Polynomial Layer for PyTorch
Requires Python: >=3.9
Keywords: machine learning

# torch-legendre

A PyTorch layer for expanding input features into **Legendre polynomial bases**.
Useful for building models with polynomial feature expansions while keeping the
workflow compatible with standard PyTorch `nn.Module` layers.

## Features

- Computes **Legendre polynomial** terms P₀(x), P₁(x), …, Pₙ₋₁(x) for each input feature
- Supports arbitrary input dimensionality
- Optional trainable linear projection after expansion
- Drop-in compatible with `torch.nn.Sequential`
- Efficient recurrence-based computation (no loops over batches)

---

## Installation

```bash
pip install -e .
```

## Usage

You can see a full demonstration of the `LegendreLayer` in the provided [example.ipynb](example.ipynb) notebook.

### 1. Basic Legendre Expansion

```python
import torch
from torch_legendre import LegendreLayer

# Example: 2 input features, expand to degree 4 (P₀...P₃)
layer = LegendreLayer(in_features=2, degree=4)

x = torch.tensor([[0.1, -0.3],
                  [0.5,  0.2]])  # shape (batch=2, in_features=2)

y = layer(x)
print(y.shape)  # (2, 2 * 4) = (2, 8)
```

### 2. With Trainable Projection

```python
# Expand then project down to 3 outputs
layer = LegendreLayer(in_features=2, degree=4, out_features=3)

x = torch.rand(5, 2)
y = layer(x)
print(y.shape)  # (5, 3)
```

### 3. Stacking in a Sequential Model

```python
import torch.nn as nn

model = nn.Sequential(
    LegendreLayer(in_features=1, degree=5, out_features=10),
    LegendreLayer(in_features=10, degree=3, out_features=1)
)
```

## API

### `LegendreLayer`

Expands each input feature into its Legendre polynomial basis and optionally applies a trainable linear projection.

**Parameters**

- **in_features** (*int*):
  Number of input features.

- **degree** (*int*):
  Number of polynomial degrees to compute per input feature.
  `degree = 1` means only the constant term `P₀(x) = 1`.

- **out_features** (*int, optional*):
  If provided, a final `nn.Linear` layer maps from `(in_features * degree)` → `out_features`.
  If `None`, returns the raw expanded features.

- **bias** (*bool, default=True*):
  Whether to include a bias term in the optional linear mapping.

**Shapes**

- **Input**: `(batch_size, in_features)`
- **Output**:
  - If `out_features is None`: `(batch_size, in_features * degree)`
  - Else: `(batch_size, out_features)`

## License

This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.