Skip to main content

An angle parsing module

Project description

angle-parser

A simple Python module for parsing angle strings.

Installation

pip install angle-parser

Usage

from angle_parser import parse_angle

parse_angle("90 deg")       # 1.5707963267948966  (π/2 radians)
parse_angle("180 deg")      # 3.141592653589793   (π radians)
parse_angle("1 arcmin")     # 0.000290888...       (1/60 degree in radians)
parse_angle("1 arcsec")     # 4.8481368...e-06     (1/3600 degree in radians)
parse_angle("1 rad")        # 1.0
parse_angle("-45 deg")      # -0.785398...         (negative angles)
parse_angle("1.5e2 deg")    # 2.617993...          (scientific notation)

Supported Suffixes

Suffix Description Radians multiplier
deg Degrees π/180
arcmin Arcminutes (1/60 degree) π/10800
arcsec Arcseconds (1/3600 deg) π/648000
rad Radians 1.0

API

parse_angle(string)

Parse an angle string and return the value in radians.

  • Parameters: string — A string containing a numeric value followed by a valid suffix (deg, arcmin, arcsec, rad), with optional whitespace.
  • Returns: float — The angle in radians.
  • Raises: ValueError — if the string does not match the expected format.

License

Copyright (c) Tim Molteno 2026 (tim@elec.ac.nz)

MIT License

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

angle_parser-0.1.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

angle_parser-0.1.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file angle_parser-0.1.0.tar.gz.

File metadata

  • Download URL: angle_parser-0.1.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for angle_parser-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fa1d3ee2096393c96f079f79f3efa1291ea94a94018571a869878d0b4cc5c82d
MD5 651a982a21b03cbe846ddfbabeb6b4c3
BLAKE2b-256 0ffad28ec199a04f83da08ca2d6b8568004f6947598766d9cda161d0cca0d1f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for angle_parser-0.1.0.tar.gz:

Publisher: publish.yml on tmolteno/angle-parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file angle_parser-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: angle_parser-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for angle_parser-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0065724c9f153efc2051f923fa11eb713bd518fadb63d0fd72da768f0b765a17
MD5 c2c906dcb579cd7338c9e6e3a0217da4
BLAKE2b-256 75558b5b2ac53695de84aca190bc39c28b35fc2875475b1aa741b1fa7f78a8a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for angle_parser-0.1.0-py3-none-any.whl:

Publisher: publish.yml on tmolteno/angle-parser

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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