Skip to main content

A library for reading, writing, and viewing photometric files.

Project description

PhotomPy: Photometric Python

A library for reading, writing, and viewing photometric files.

Installation

Install with pip:

pip install photompy

Alternatively, clone the repo and build locally:

git clone https://github.com/jvbelenky/photompy.git
cd photompy
python setup.py sdist
pip install .

Usage

Modern API (Recommended)

The recommended way to work with IES files is through the IESFile class:

from photompy import IESFile

# Read an IES file
ies = IESFile.read("lamp.ies")

# Access photometry data
print(ies.photometry.thetas)  # vertical angles
print(ies.photometry.phis)    # horizontal angles
print(ies.photometry.values)  # candela values

# Calculate total optical power
power = ies.photometry.total_optical_power()

# Get intensity at specific angles
intensity = ies.photometry.get_intensity(theta=45, phi=0)

# Plot the photometry
fig, ax = ies.plot(plot_type="polar")
fig, ax = ies.plot(plot_type="cartesian", elev=45, azim=30)

# Scale values
ies.scale_to_max(5000)           # Scale to max candela value
ies.scale_to_total(1000)         # Scale to total power
ies.scale_to_center(2500)        # Scale to center intensity
ies.scale(2.0)                   # Scale by factor

# Write to file
ies.write("output.ies")                    # Write original angles
ies.write("output.ies", which="full")      # Write expanded angles
ies.write("output.ies", which="interp")    # Write interpolated angles

# Access header information
print(ies.header.units)           # FEET or METERS
print(ies.header.width)           # luminous width
print(ies.header.length)          # luminous length
print(ies.header.input_watts)     # input watts

Legacy API (Deprecated)

The following functions are still available but deprecated. They will emit deprecation warnings:

from photompy import read_ies_data, write_ies_data, total_optical_power, plot_ies

# These still work but will warn
lampdict = read_ies_data(filename)
power = total_optical_power(filename)
fig, ax = plot_ies(filename)

See docs/migration.md for a complete guide on migrating from the legacy API.

Working with Photometry Directly

For advanced use cases, you can work with the Photometry class directly:

from photompy import IESFile

ies = IESFile.read("lamp.ies")
phot = ies.photometry

# Get expanded (mirrored) photometry
expanded = phot.expanded()

# Get interpolated photometry
interpolated = phot.interpolated(num_thetas=361, num_phis=721)

Simple calculations

from photompy import total_optical_power, lamp_area

power = total_optical_power(filename)
luminous_area = lamp_area(filename, units="meters")

Writing files

To scale and write IES files:

from photompy import scale_lamp_to_max, scale_lamp_to_total

# Scale to specific maximum value
scale_lamp_to_max(5000, "input.ies", "output.ies")

# Scale to specific total optical power
scale_lamp_to_total(1000, "input.ies", "output.ies")

Roadmap

  • PhotometricData and AngleData objects (IESFile and Photometry classes)
  • Generate .ies files from an angular distribution table
  • Type A and B photometry support
  • Dialux file (.ldt) support
  • More extensive write support

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Vivian Belenky - jvb@osluv.org

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

photompy-0.1.6.tar.gz (61.5 kB view details)

Uploaded Source

Built Distribution

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

photompy-0.1.6-py3-none-any.whl (43.5 kB view details)

Uploaded Python 3

File details

Details for the file photompy-0.1.6.tar.gz.

File metadata

  • Download URL: photompy-0.1.6.tar.gz
  • Upload date:
  • Size: 61.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for photompy-0.1.6.tar.gz
Algorithm Hash digest
SHA256 ca1ccf05b3862b8f05395c5ac97f85993967706ba5a869e216b65eefdd2da02b
MD5 515e5ad4f8533651799e4cbd93515862
BLAKE2b-256 0aef26b83d82202b60f29d63cfd7c1e1ae97b21821928f7e2348896d2c6da3c8

See more details on using hashes here.

File details

Details for the file photompy-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: photompy-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 43.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for photompy-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 748bea275fa6afde288ef2f04a957b7598ef7d320e701a380c450f401e554df0
MD5 6f985b114d57c8dc4e39cdb60ac1ae55
BLAKE2b-256 1e77423e6847591eea5e07787b898a0944a31d284d6a4e15a0fddec310feda06

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