Skip to main content

AstroCalculator, a Calculator for Astronomers and Physicists

About

AstroCalculator is a calculator for astronomers and physicists written in Python.
Author: ChongChong He (chongchong.he@anu.edu.au)

Installation

You can install astrocalculator from PyPI:

pip install astrocalculator

astrocalculator is supported on Python 3.6 and above.

How to use

Start the program with calc. You will see a modernized, color-coded interactive command line interface powered by rich and prompt_toolkit. An input can be 1) a single variable or constant like k_B, 2) an expression like m_e c^2, or 3) a list of variable assignments followed by a final expression to evaluate, e.g. M = 1.4 M_sun, R = 10 km, sqrt(2 G M / R).

Another way is to use it as a Python module in your script or interactively in iPython. Put the following in your code:

from calc import *

Now you can use all the physical constants defined in astrocalculator as listed in here.

Example inputs and outputs

Input[1]: m_p

Parsed input = m_p
Result (SI)  = 
  Name   = Proton mass
  Value  = 1.67262192369e-27
  Uncertainty  = 5.1e-37
  Unit  = kg
  Reference = CODATA 2018
Result (cgs) = 1.6726e-24 g

Input[2]: m_e c^2

Parsed input = c**2*m_e
Result (SI)  = 8.1871e-14 m N
Result (cgs) = 8.1871e-07 erg

Input[3]: in MeV

0.51100 MeV

Input[4]: M = 1.4 M_sun, R = 10 km, sqrt(2 G M / R)

Parsed input = sqrt(2*G*M*1/R)
Result (SI)  = 1.9277e+08 m / s
Result (cgs) = 1.9277e+10 cm / s

Input[5]: in km/s

1.9277e+05 km / s

Todos

  • Add latex preview

References

Metadata

Release files for AstroCalculator 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for AstroCalculator 0.4.0
File Size Uploaded
astrocalculator-0.4.0.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for AstroCalculator 0.4.0
File Interpreter ABI Platform
astrocalculator-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.5 kB

Release files / astrocalculator-0.4.0.tar.gz

Download URL astrocalculator-0.4.0.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
dc8277f62b1380c41ecb4bcd8b37b1a13fbc3676f557a076194d1dcd8fd3e0ad
BLAKE2b-256 checksum
How to use checksums
32c55b1c83b038d4af80a0e744d684199fd5a796b0abdb8895fc2ea67063e9ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / astrocalculator-0.4.0-py3-none-any.whl

Download URL astrocalculator-0.4.0-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
caa80637bd9b113407a534e602a652f6269a0a7612784832152751750b2e06a9
BLAKE2b-256 checksum
How to use checksums
efbcaf8ec6101772a71e83141250347f144f7e9e662452c1d44146ca4630fd74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page