Skip to main content

A package for refractive index values.

Project description

PyOptik is a powerful Python tool designed to import refractive indexes and extinction coefficients for various materials across different wavelengths. The data provided by PyOptik can be used in numerous applications, including simulating light interactions with particles. All data is sourced from the reputable RefractiveIndex.INFO database.

Logo

python docs PyPi PyPi_download Unittest coverage

Features

  • Comprehensive Database Access: Seamlessly import refractive index and extinction coefficient data for a wide range of materials.

  • Simulation Ready: Ideal for light-matter interaction simulations, particularly in optics and photonics.

  • Simple API: Easy-to-use API that integrates well with other Python libraries.

  • Open Source: Fully open-source.

Installation

To install PyOptik, simply use pip:

pip install pyoptik

Usage

After installing PyOptik, you can easily access material properties:

from PyOptik import UsualMaterial

# Access the refractive index of BK7 glass
bk7 = UsualMaterial.BK7
n = bk7.compute_refractive_index(0.55e-6)
print(f"Refractive index at 0.55 µm: {n}")

# Accessing and plotting material properties
bk7.plot(wavelength_range=[0.3e-6, 2.5e-6])

Example

Here’s a quick example demonstrating how to use PyOptik to retrieve and plot the refractive index of a material:

import numpy as np
from PyOptik import UsualMaterial

# Define wavelength range
wavelengths = np.linspace(0.3e-6, 2.5e-6, 100)

# Retrieve refractive index for BK7 glass
bk7 = UsualMaterial.BK7
n_values = bk7.compute_refractive_index(wavelengths)

# Plot the results
bk7.plot(wavelength_range=wavelengths)

Testing

To test locally after cloning the GitHub repository, install the dependencies and run the tests:

git clone https://github.com/MartinPdeS/PyOptik.git
cd PyOptik
pip install .
pytest

Contributing

PyOptik is open to contributions. Whether you’re fixing bugs, adding new features, or improving documentation, your help is welcome! Please feel free to fork the repository and submit pull requests.

Contact Information

As of 2024, PyOptik is still under development. If you would like to collaborate, it would be a pleasure to hear from you. Contact me at:

Author: Martin Poinsinet de Sivry-Houle

Email: martin.poinsinet.de.sivry@gmail.com

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

pyoptik-1.1.4.post0.tar.gz (562.1 kB view details)

Uploaded Source

Built Distribution

PyOptik-1.1.4.post0-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

File details

Details for the file pyoptik-1.1.4.post0.tar.gz.

File metadata

  • Download URL: pyoptik-1.1.4.post0.tar.gz
  • Upload date:
  • Size: 562.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for pyoptik-1.1.4.post0.tar.gz
Algorithm Hash digest
SHA256 c062b1c20620d9ab935e48a44ab2a55332d8c4a4aae6a96b2194cb22f272dc59
MD5 479e9a87f59fe2492e2bb5b636929f22
BLAKE2b-256 397e648523a2e439a95cfacb859ded31f1f2f6968f3d76fbfb5bda393278187a

See more details on using hashes here.

File details

Details for the file PyOptik-1.1.4.post0-py3-none-any.whl.

File metadata

File hashes

Hashes for PyOptik-1.1.4.post0-py3-none-any.whl
Algorithm Hash digest
SHA256 20eed65fe9d047ee7fc90d22297882a6f4db0d1e2fc624f2311d14231400b2c0
MD5 cd8d94da04277060e93c87daa49040d2
BLAKE2b-256 5d1a5a324682464c50cea9fcfb5e429185cfe04e905eb4bb13931ac5f1345ba9

See more details on using hashes here.

Supported by

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