Skip to main content

Refractulator

More than a simple refraction calculator, refractulator is a Python package that calculates and visualizes how light interacts with water droplets (or any medium given the appropriate refraction data).

Installation

pip install refractulator

To install with visualization support:

pip install refractulator[visualization]

What's New in Version 0.2.0

  • Visualization Module: Added support for 2D and 3D visualizations using Plotly.
  • Data Generator Class: Simplified data generation with the new RefractulatorDataGenerator class.
  • Examples: See the examples/ directory for usage examples.

Usage

# example_usage.py

from refractulator import Refractulator

# Create an instance of Refractulator
refractulator = Refractulator(radius=1.0)

# Use the high-level method to calculate and visualize rays
refractulator.calculate_and_visualize_rays(
    num_rays=100,            # Number of rays
    cylinder_radius=0.5,     # Radius of the cylindrical beam
    theta_deg=120,           # Azimuth angle
    phi_deg=-30,             # Elevation angle
    mode='3d'                # Visualization mode
)

Features

  • Calculate refracted and reflected rays interacting with a spherical medium.
  • Support for multiple colors with different refractive indices.
  • (Optional) Visualization tools for ray paths.

Acknowledgements

This project was inspired by Dr. Brian Pasko, my math professor at ENMU.

As well as this article decribing the whole process in detail: Janke, S. (1999). Somewhere Within the Rainbow (UMAP). Consortium for Mathematics and its Applications (COMAP). https://www.comap.com/membership/member-resources/item/somewhere-within-the-rainbow-umap

Other resources I appreciate:

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright (c) 2024 Scott Kilgore

Metadata

Release files for refractulator 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for refractulator 0.3.0
File Size Uploaded Provenance Actions
refractulator-0.3.0.tar.gz 202.5 kB Without provenance Details for refractulator-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for refractulator 0.3.0
File Interpreter ABI Platform Actions
refractulator-0.3.0-py3-none-any.whl Python 3 none any Details for refractulator-0.3.0-py3-none-any.whl

Total release size: 211.8 kB

Release files / refractulator-0.3.0.tar.gz

Download URL refractulator-0.3.0.tar.gz
Size 202.5 kB
Tags Source
SHA-256 checksum
How to use checksums
61f077e65c10f32d2425717bf936f2b80b85658fc9607c6fc491cd9f88e9da64
BLAKE2b-256 checksum
How to use checksums
0d919375bffb33a15e60016aae41e18ee432f967efdb57899ca1f84af4c9584e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

Release files / refractulator-0.3.0-py3-none-any.whl

Download URL refractulator-0.3.0-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
083eb330a45d160f370f9d845adfffbe7763f81c6787b5e82d3b7da68167db0b
BLAKE2b-256 checksum
How to use checksums
ec2075b460defe0fcb3c484bb09089dcb84133866cc589a352b073d8110c703d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.1

Security for refractulator 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page