Skip to main content

A locally hosted Flask application for astronomical calculations.

Project description

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. This will start a web server and open a browser window where you can type in your inputs. A input can be one of the following: 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

User units: 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

User units: km/s

1.9277e+05 km / s

Todos

  • Add latex preview

References

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

astrocalculator-0.2.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

AstroCalculator-0.2.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file astrocalculator-0.2.1.tar.gz.

File metadata

  • Download URL: astrocalculator-0.2.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.0

File hashes

Hashes for astrocalculator-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b2d0771762942e0f7c623e6f8ec54fd0ba0936aacaef8e3ee7b41a9562890fff
MD5 e2a4bd926a78403e3de465d2e8e65146
BLAKE2b-256 31c761854b0d782a3c9c425b6e01763ad5225e12830963a4afd2822cd0c11449

See more details on using hashes here.

File details

Details for the file AstroCalculator-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for AstroCalculator-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8483b96a6c3c3f846e0811516cc84743c8f56b8f59311d4da06a187928d3aad0
MD5 d1b79bcec733d27d6c13735378f65de0
BLAKE2b-256 96412513648766898389d44b5e741c316addcc9e65f0b81162f9c64ccd153c16

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