semvec/pypi-packages huggingface dataset:
pyellispeed 0.1.0
Ellipsoids drawing and analysis in 3D volumetric images.
Requires Python: <3.13,>=3.8

# PyEllispeed

**PyEllispeed** is the package for drawing and analysis of ellipsoids in 3D volumetric images (3D arrays).
Forked from [PyEllipsoid](https://github.com/ashkarin/pyellipsoid). 

## How to use

To draw an ellipsoid:

```python

import numpy as np
from pyellispeed import drawing

# Define an image shape, axis order is: Z, Y, X
image_shape = (128, 128, 128)

# Define an ellipsoid, axis order is: X, Y, Z
ell_center = (64, 64, 64)
ell_radii = (5, 50, 30)
ell_angles = np.deg2rad([80, 30, 20]) # Order of rotations is X, Y, Z

# Draw a 3D binary image containing the ellipsoid
image = drawing.make_ellipsoid_image(image_shape, ell_center, ell_radii, ell_angles)
```

To compute inertia ellipsoid for given ellipsoid image:

```python

import numpy as np
from pyellispeed import drawing, analysis

# Draw a 3D binary image containing an ellipsoid
image_shape = (128, 128, 128)
ell_center = (64, 64, 64)
ell_radii = (5, 50, 30)
ell_angles = np.deg2rad([80, 30, 20])
image = drawing.make_ellipsoid_image(image_shape, ell_center, ell_radii, ell_angles)

# Compute inertia ellipsoid
points = analysis.sample_random_points(image)
inertia_ellipsoid = analysis.compute_inertia_ellipsoid(points)
```

To rotate axes and find relative rotation between the original and rotated axes:

```python

import numpy as np
from pyellispeed import geometry

original_axes = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
rot_angles = np.deg2rad([0, 0, 45]) # Rotate around Z-axis by 45 deg

# Build rotation matrix and rotate the axes
rotm = geometry.build_rotation_matrix(*rot_angles)
rotated_axes = np.dot(rotm, np.transpose(original_axes)).T

# Find relative rotation
rel_rotm = geometry.find_relative_axes_rotation(original_axes, rotated_axes)

# Validate relative rotation matrix
rel_rotated_axes = np.dot(rel_rotm, np.transpose(original_axes)).T
assert(np.all(rotated_axes == rel_rotated_axes))

# Compute rotation angles
# Please note, that these angles might differ from rot_angles!
rel_rot_angles = geometry.rotation_matrix_to_angles(rel_rotm)
print(np.rad2deg(rel_rot_angles))
```

## How to work on the project

```bash
# Create a venv
virtualenv .venv

source .venv/bin/activate

# Install maturin
pip install maturin
```

```bash
# To compile on your computer to do some work
maturin develop

# If you want to test
pip install pytest
pytest tests


# If you want to benchmark
pip install pytest-benchmark
pytest --benchmark-only test_benchmark
# It is recommended to compile in release mode with 
maturin develop --release

```

## Next steps

* Add stub file for type annotation and documentation
* Use GPU with python libraries (cupy...)
unlzw3 0.2.3
Pure Python decompression module for .Z files compressed using Unix compress utility
Requires Python: >=3.9
Keywords: lzw

# unlzw3

[![ci](https://github.com/scivision/unlzw3/actions/workflows/ci.yml/badge.svg)](https://github.com/scivision/unlzw3/actions/workflows/ci.yml)
[![PyPi Download stats](http://pepy.tech/badge/unlzw3)](http://pepy.tech/project/unlzw3)

Pure Python decompression module for .Z files compressed using Unix compress utility.
Unlike the faster but Linux-specific
[unlzw](https://pypi.org/project/unlzw/)
using Python CFFI, `unlzw3` is slower but works on any platform that runs Python including Windows.

This is a purely Python adaptation of Mark Adler's
['unlzw' C function](http://mathematica.stackexchange.com/questions/60531/how-can-i-read-compressed-z-file-automatically-by-mathematica/60879#60879)
on Stackoverflow.
Python can be much slower than using any compiled utility for the same purpose.

## Usage

`unlzw3.unlzw(data)` takes LZW .Z compressed data as any type which can be converted to a bytearray (generally a string).
It returns a UTF-8 decoded string containing the decompressed data.

```python
import unlzw3
from pathlib import Path

uncompressed_data = unlzw3.unlzw(Path('file.Z').read_bytes())

# or

uncompressed_data = unlzw3.unlzw(Path('file.Z'))
```

## Contributions

* reference C code: Mark Adler
* pure Python implemetation: [Brandon Owen](https://github.com/umeat/unlzw)
* modernization, test / CI and PyPi: Michael Hirsch