Skip to main content

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:

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


Download files

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

Source Distribution

refractulator-0.3.0.tar.gz (202.5 kB view details)

Uploaded Source

Built Distribution

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

refractulator-0.3.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

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

Hashes for refractulator-0.3.0.tar.gz
Algorithm Hash digest
SHA256 61f077e65c10f32d2425717bf936f2b80b85658fc9607c6fc491cd9f88e9da64
MD5 f120647f537847c0b2c0586439783375
BLAKE2b-256 0d919375bffb33a15e60016aae41e18ee432f967efdb57899ca1f84af4c9584e

See more details on using hashes here.

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

Hashes for refractulator-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 083eb330a45d160f370f9d845adfffbe7763f81c6787b5e82d3b7da68167db0b
MD5 a0592bfe1b45828c174dc7f8dac2c724
BLAKE2b-256 ec2075b460defe0fcb3c484bb09089dcb84133866cc589a352b073d8110c703d

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