A package to calculate and visualize light interactions with water droplets.
Project description
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:
- https://javalab.org/en/rainbow_by_raindrops_en/
- https://ux1.eiu.edu/~cfadd/3050/Adventures/chapter_17/ch17_3.htm
- http://hyperphysics.phy-astr.gsu.edu/hbase/atmos/rbowpath.html
- http://hyperphysics.phy-astr.gsu.edu/hbase/atmos/rbowpath.html#c2
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file refractulator-0.3.0.tar.gz.
File metadata
- Download URL: refractulator-0.3.0.tar.gz
- Upload date:
- Size: 202.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61f077e65c10f32d2425717bf936f2b80b85658fc9607c6fc491cd9f88e9da64
|
|
| MD5 |
f120647f537847c0b2c0586439783375
|
|
| BLAKE2b-256 |
0d919375bffb33a15e60016aae41e18ee432f967efdb57899ca1f84af4c9584e
|
File details
Details for the file refractulator-0.3.0-py3-none-any.whl.
File metadata
- Download URL: refractulator-0.3.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
083eb330a45d160f370f9d845adfffbe7763f81c6787b5e82d3b7da68167db0b
|
|
| MD5 |
a0592bfe1b45828c174dc7f8dac2c724
|
|
| BLAKE2b-256 |
ec2075b460defe0fcb3c484bb09089dcb84133866cc589a352b073d8110c703d
|