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.5.tar.gz (204.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.5-py3-none-any.whl (202.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sp00kyvectors-0.1.5.tar.gz
  • Upload date:
  • Size: 204.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.5.tar.gz
Algorithm Hash digest
SHA256 1b7ddbeff556c7875bc8c01189c9e2b83efb0885a1f34479e1a601e955bdd67e
MD5 fd9c5e96150cd74e94e2d71597c4b608
BLAKE2b-256 5142c1bbe3bcfd87d5279b61ae18f7bac36d1cde198367733324a7bd095a10fe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sp00kyvectors-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 202.4 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6b60e8d5ca606d2114b317b00f3b9b9a8bb97e45ac065c54146ccbcd9b4c11be
MD5 8f9c6689f8e03574c57d4ccd7155b1f9
BLAKE2b-256 61e5e15d181ae98094db0eb02c385a521fc7fad9404ff46696173e47af43d53d

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