Skip to main content

Small scripts for astronomy

Project description


Try install many of the scripts with


pip install astro-scripts

This is still under development though, but it does work!

To check the installation run ``plot_fits`` in the terminal.


Look at the wiki instead:\_scripts/wiki It's not done,
but I will gradually move documentation to the wiki.

Small tools for an astronomer

Small scripts to make my life easier.

The tools are mainly (if not exclusive) for spectroscopy. All the small
scripts are fairly well documented, and the python scripts use the
module ``argparse`` which means you can run them like


python numpy2moog -h

and get some fancy help information on how to use them. The shell
scripts have a block comment in top of the file.

I recommend putting this folder in your PATH so the scripts are easily
accesible. To do so depends on your system. I am sure
`google <>`__ can help you ;)


- `Matplotlib <>`__
- `Astropy <>`__
- `numpy <>`__
- `argparse <>`__
- `PyAstronomy <>`__


This I find to be a very powerful and handy python script. It simply
plot a fits file and leave you in pan mode (matplotlib). More over it
has the feature to plot a part of the solar spectrum and telluric lines,
and finally redshift the spectrum.

For this script one needs to use the telluric and solar spectrum
provided here and change the path in ``plot_fits`` in line 46 and line

The wavelength vector is created from the fits (which should be 1D). It
uses the keywords - CRVAL1: The beginning of the wavelength. - CDELT1:
The step in wavelength. - NAXIS: The length of the wavelength vector.

.. figure:: figure1.png
:alt: An example of using plot_fits with matplotlib


This is a python script that converts ASCII arrays into the format for
`MOOG <]>`__. It can be a bit
tricky, but I will provide examples in the future.


This script is used to send emails to ``extract all`` from the VALD
database. A central wavelength should be inputted with the ``-h`` flag,
and the half range should be given with the ``-s`` flag.



VALDextraction -w 6743 -s 3

This will open a new email (Thunderbird) with the syntax required for
VALD (no reason to delete the signature) in a 6Å window centered on the
wavelength 6743Å.

This one-liner I have saved in a script put a ``#`` on all the lines
containing a ``center`` from a IRAF files after using the ``splot``
routine. This allows to easy read the ``splot.log`` with python using
something like ``np.loadtxt``. One probably need to remove date strings.
This should be easy to implement I guess.

This bash script unpack a linelist from
`VALD <>`__ when the
download option is set to FTP. The downloadable file is ``.gz``. This
file is unpacked and saved in an optional ``output`` argument (see the
block comment in the script). The references is saved in a seperate
file, and the final file is relatively easy to read with ``np.loadtxt``.


Feel free to open an issue with suggestions or bugs.


Read the LICENCE file.

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

astro_scripts-0.4.0.tar.gz (21.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page