Coder Social home page Coder Social logo

astro_scripts's Introduction

Build Status Codacy Badge Codacy Badge

Install

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.

WARNING

Look at the wiki instead: https://github.com/DanielAndreasen/astro_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 ;)

Dependencies

plot_fits

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 57.

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.

Example

numpy2moog

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.

VALDextraction

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.

Example

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ร….

splotCommenter.sh

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.

VALDprepare.sh

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.

CONTRIBUTE

Feel free to open an issue with suggestions or bugs.

LICENCE

Read the LICENCE file.

astro_scripts's People

Contributors

danielandreasen avatar jason-neal avatar pyup-bot avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

astro_scripts's Issues

Detect fits instrument / help text hidden behind boxes in gooey

It could be easier for quick excecution if plot_fits.py detected the instrument type in the header instead of the drop down list.

Having it default to ARES I have missed changing it to CRIRES in a hurry and therefore get the error.

Traceback (most recent call last):
  File "..Repos/astro_scripts/plot_fits.py", line 566, in <module>
    main(fname, **opts)
  File "..Repos/astro_scripts/plot_fits.py", line 334, in main
    w = get_wavelength(hdr)
UnboundLocalError: local variable 'hdr' referenced before assignment

The CRIRES header has a value INSTRUMENT= 'CRIRES' (I assume ARES would be similar), which would be simple enough to check for example something like ...

if hdr["INSTRUMENT"] is "CRIRES ":
    do this    
elif hdr["INSTRUMENT"] is "ARES":
    do that

Also a bug:
The help text gets hidden behind the Gooey boxes for model and lines. Also a spelling mistake in model help.

Add UVES to plot_fits

Here is a sample that might help read UVES data

def read_uves(filename):
    hdulist = pyfits.open(filename)
    header = hdulist[0].header #read header
    spec = hdulist['SPECTRUM'].data
    wave = spec['WAVE'][0]
    flux = spec['FLUX_REDUCED'][0]
    return wave, flux

Wiki/homepage

Since some of the scripts is working nice, maybe a web page with tutourials and examples would be nice, so other people start using it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.