Giter Site home page Giter Site logo

pyares's Introduction

pyARES

A package to run ARES, configure the input file, and read the output.

This require ARES to already be installed in your PATH.

Requirements

This was developed on python=3.6 and use f-strings, and is thus not compatible with versions lower than that. It also requires matplotlib, numpy, and pandas.

If you would like to run this on an earlier version, it is straight forward to fix it, however you should consider using python3 instead as it is only a matter of time before python2.7 is no longer supported.

Usage

Run ARES with some standard inputs

from ARES import ARES
config = {'specfits': 'path/to/fits',
          'readlinedat': 'path/to/linelist',
          'fileout': 'path/to/output'}
a = ARES(**config)   # Setup and run ARES
output = ARES.output # Return an ARESOutput object
rv = ARES.rv         # Get the RV as meausered by ARES

Run ARES from an input file

If you prefer to edit the mine.opt file by hand, that is possible as well.

from ARES import ARES

a = ARES.from_config('path/to/mine.opt')  # Does not have to be called mine.opt, but need same structure
output = a.output

Get RV and/or output from a previous run

If you have run ARES from another application, and you just want to analyse the results, you can do that as well!

from ARES import ARES

output = ARES.read_output('path/to/output')
rv = ARES.get_rv('path/to/log')

Be careful, the log file is overwritten everytime ARES is run on new. It is called logARES.txt and is the default value of ARES.get_rv.

Plotting with ARESOutput

# Run ARES and get the output object
a = ARES(**config)
output = ARES.output
plt.figure()
output.plot('EW')  # Plot EW against wavelength

plt.figure()
output.plot('EW', 'EWerr') # EWerr against EW
# plot method also takes standard matplotlib inputs
plt.show()

Comparing two outputs

o1 = ARES.read_output('path/to/output1')
o2 = ARES.read_output('path/to/output2')

# Percentage difference for amplitude between two outputs from ARES
p_diff = o1.percent_diff(o2, 'amplitude')

# Mean squared error (MSE) between two outputs from ARES
mse = o1.mse(o2, 'fwhm')

Columns available

These are the columns available from the ARES output:

  • wavelength
  • nlines
  • depth
  • fwhm
  • EW
  • EWerr
  • amplitude
  • sigma
  • mean

pyares's People

Stargazers

Phileas Lebada avatar Maria Tsantaki avatar João Faria avatar

Watchers

James Cloos avatar Daniel Thaagaard Andreasen avatar  avatar

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.