Skip to main content

A spooky vector analysis library

Project description

🎃 Sp00kyVectors: Haunted Vector Analysis for the Living and the Dead 📈💀

Welcome to Sp00kyVectors, the eerily intuitive Python class for vector analysis, statistical computation, and sinister visualizations — all coded to thrill and analyze! 🪄👻

Whether you’re chasing spectral patterns or just need basic stats with dramatic flair, this library’s got your back (from beyond).


🧼 Cleaning Example

Before After
Before Cleaning After Cleaning
Before Bin After Bin
Vector Projections Normalize

🧠 Features

  • 🧮 Vector Magic:

    • Load 1D or 2D arrays into Vector objects
    • X/Y decomposition for 2D data
    • Linear algebra methods like magnitude, angle, dot, and projection
  • 📊 Statistical Potions:

    • Mean, median, standard deviation 💀
    • Probability vectors and PDFs 🧪
    • Z-score normalization 🧼
    • Entropy between aligned vectors 🌀
    • Internal entropy of a vector
  • 🖼️ Visualizations:

    • Linear and log-scale histogramming
    • Vector plots with tails, heads, and haunted trails
    • Optional "entropy mode" that colors plots based on mysterious disorder 👀
  • 🔧 Tools of the Craft:

    • Gaussian kernel smoothing for smoothing out your nightmares
    • Elementwise operations: .normalize(), .project(), .difference(), and more
    • Pretty __repr__ so your print statements conjure elegant summaries

🧪 Example


from sp00kyvectors import Vector

v = Vector([1, 2, 3, 4, 5])
print(v.mean())  # Output: 3.0

v2 = Vector([1, 1, 1, 1, 6])
print(v.entropy(v2))  # Output: spooky entropy value

📦 Installation


pip install sp00kyvectors

Or summon it from your own local clone:


git clone https://github.com/yourname/sp00kyvectors.git
cd sp00kyvectors
pip install .

📚 Documentation

🧪 Class: Vector

✨ Initialization

Create a new Vector from a list or numpy array.


from sp00kyvectors import Vector

v = Vector([1, 2, 3, 4, 5])

If you're working with 2D data:


v2d = Vector([[1, 2], [3, 4], [5, 6]])

📊 Methods

.mean()

Returns the mean of the vector.


v.mean()  # ➜ 3.0

.median()

Returns the median.


v.median()  # ➜ 3

.std()

Returns the standard deviation.


v.std()  # ➜ 1.5811...

.normalize()

Normalizes the vector using Z-score (zero mean, unit variance).


v_norm = v.normalize()

.entropy(other: Vector)

Computes Shannon entropy between this vector and another.


v2 = Vector([1, 1, 1, 1, 6])
v.entropy(v2)  # ➜ ~0.72 (varies based on normalization)

.difference(other: Vector)

Returns a new Vector representing the difference between this vector and another.


v3 = v.difference(v2)

.project(dim: int)

Projects a 2D vector onto a specific dimension (0 = x, 1 = y).


vx = v2d.project(0)
vy = v2d.project(1)

🔢 Linear Algebra Methods

.magnitude()

Returns the magnitude (length) of the vector.


v.magnitude()  # ➜ 7.416

.angle(other: Vector)

Returns the angle between this vector and another, in radians.


v.angle(v2)  # ➜ 0.225 (radians)

.dot(other: Vector)

Computes the dot product of this vector and another.


v.dot(v2)  # ➜ 24

.cross(other: Vector)

Computes the cross product (only for 3D vectors).


v3d = Vector([1, 2, 3])
v3d2 = Vector([4, 5, 6])
v3d.cross(v3d2)  # ➜ [-3, 6, -3]

.projection(other: Vector)

Returns the projection of this vector onto another.


v.projection(v2)  # ➜ Vector with projected values

📈 Plotting

.histogram(log=False)

Plots a histogram of the vector values. Set log=True for logarithmic scale.


v.histogram()
v.histogram(log=True)

.plot_vectors(mode="line", entropy=False)

Plots 2D vectors.

  • mode: "line", "arrow", or "trail"
  • entropy: if True, colorizes vectors by entropy

v2d.plot_vectors(mode="arrow", entropy=True)

🔮 Utilities

.gaussian_smooth(sigma=1.0)

Applies Gaussian smoothing to the vector.


v_smooth = v.gaussian_smooth(sigma=2.0)

💀 Dunder Methods

__repr__()

Pretty string representation.


print(v)  # Vector(mean=3.0, std=1.58, ...)

🛠 Developer Notes

  • Internal data is stored as numpy.ndarray
  • Methods use scipy.stats, numpy, and matplotlib
  • Entropy assumes aligned distributions (normalized first)

🧛 License

MIT — haunt and hack as you please.


🕸️ Coming Soon

  • 3D support
  • More spooky plots
  • CLI interface: spookify file.csv --plot

👻 Contributing

Spirits and sorcerers of all levels are welcome. Open an issue, fork the repo, or summon a pull request.


🧛 License

MIT — you’re free to haunt this code as you wish as long as money is never involved!


✨ Stay spooky, and may your vectors always point toward the unknown. 🕸️

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sp00kyvectors-0.1.6.tar.gz (196.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sp00kyvectors-0.1.6-py3-none-any.whl (195.3 kB view details)

Uploaded Python 3

File details

Details for the file sp00kyvectors-0.1.6.tar.gz.

File metadata

  • Download URL: sp00kyvectors-0.1.6.tar.gz
  • Upload date:
  • Size: 196.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.5.0

File hashes

Hashes for sp00kyvectors-0.1.6.tar.gz
Algorithm Hash digest
SHA256 c5ccc5952c62eacfe35429e5cbc4efc69de357c8362b504dc38725c32c91c381
MD5 b49911e2d7934bfd313bb70683f2f6e6
BLAKE2b-256 1468c3c38bb1fec432049eb6125c4ca2fd632a91b22d2831cfe9f187cab4549e

See more details on using hashes here.

File details

Details for the file sp00kyvectors-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: sp00kyvectors-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 195.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.3 Darwin/24.5.0

File hashes

Hashes for sp00kyvectors-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 839cd31b54a21eb8519d5c0e5422248483f3dd08fc919c84e6a8f7b5c23d65e4
MD5 8b77bde7a3c44914d7336c09a8df36fe
BLAKE2b-256 7b8aea0fff21edee3119400a7ca96c4ed87e746bc94f5f259a44cfa2e30e7754

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page