Skip to main content

Helps you with solid angles and cones.

Project description

TestStatus PyPiStatus BlackStyle

A python-package to help with solid angles.

install

pip install solid_angle_utils

simple conversion of units

Inspired by numpy rad2deg and deg2rad.

import solid_angle_utils

a_sr = solid_angle_utils.squaredeg2sr(10)
print(a)
0.0030461741978670856

a_sqdeg = solid_angle_utils.sr2squaredeg(a_sr)
print(a_sqdeg)
10.0

Cones

Convert solid angle to half angle, and the other way around.

import solid_angle_utils

cone_sa = solid_angle_utils.cone.solid_angle(half_angle_rad=0.1)
0.031389755322205774

cone_ha = solid_angle_utils.cone.half_angle(solid_angle_sr=cone_sa)
0.0999999

solid_angle_utils.cone.half_angle_space(0, 0.1, 3)
array([0.        , 0.07069594, 0.1       ])

Triangles

Estimate the solid angle of a spherical triangle.

import solid_angle_utils
import numpy as np

x, y, z = np.eye(3)
full_sphere_solid_angle = 4 * np.pi

triangle_solid_angle = solid_angle_utils.triangle.solid_angle(
    v0=x, v1=y, v2=z
)

print("Expect 1/8: ", triangle_solid_angle/full_sphere_solid_angle)

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

solid_angle_utils-0.1.2.tar.gz (6.8 kB view hashes)

Uploaded Source

Built Distribution

solid_angle_utils-0.1.2-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

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