Skip to main content

Automated property interpolation and color calculations for main sequence stars

Project description

[![Build Status](https://travis-ci.org/dsavransky/MeanStars.svg?branch=master)](https://travis-ci.org/dsavransky/MeanStars) [![Coverage Status](https://coveralls.io/repos/github/dsavransky/MeanStars/badge.svg?branch=master)](https://coveralls.io/github/dsavransky/MeanStars?branch=master) [![astropy](http://img.shields.io/badge/powered%20by-AstroPy-orange.svg?style=flat)](http://www.astropy.org/) [![PyPI version](https://badge.fury.io/py/MeanStars.svg)](https://badge.fury.io/py/MeanStars) [![Requirements Status](https://requires.io/github/dsavransky/MeanStars/requirements.svg?branch=master)](https://requires.io/github/dsavransky/MeanStars/requirements/?branch=master)

# MeanStars

This code provides functionality for automating calculations based on Eric Mamajek’s “A Modern Mean Dwarf Stellar Color and Effective Temperature Sequence” (http://www.pas.rochester.edu/~emamajek/EEM_dwarf_UBVIJHK_colors_Teff.txt).

The purpose of the code is to allow users to automatically interpolate the property columns of the table, and to calcualte colors based on any combination of the photometry columns.

## Installation and Requirements MeanStars requires the following python modules: * numpy * scipy * astropy

To install, simply run:

pip install MeanStars

Alternatively, grab a copy of the repository and run:

python setup.py install

## Usage To use MeanStars, you must first create a MeanStars object:

`python from MeanStars import MeanStars ms = MeanStars() ` This object contains a number of useful attributes, including: * ms.data: The full dataset in astropy table format * ms.bands: The names of all unique bands from the dataset (in a string array) * ms.colors: All of the original colors from the dataset (in an nx2 string array, where n is the length of ms.bands and the color is the first column minus the second). The same information is also encoded in ms.colorstr, which is the original color name from the dataset * ms.noncolors: All data attributes not related to color (these include stellar masses, radii, etc.) * ms.SpecTypes: All of the major spectral types from the dataset (in a string array - nominally this will always be O,B,A,F,G,K,M,L,T,Y) * ms.colorgraph: A directed graph (encoded as a dictionary) mapping all relationships between bands established by the colors in the original dataset

### Interpolating Colors MeanStars provides two methods for interpolating colors: TeffColor and SpTColor, where the former interpolates by effective temperature, and the latter by spectral type. In general, it is unlikely that you will want to query the data by any spectral type not explicilty listed, so the SpTColor most frequently acts as a simple lookup table of the data. In each case, the methods are called by providing the two bands defining the color (called start and end in the code such that the color is start - end), and the temperature or spectral type.

So, to find the ‘U-B’ color of a 29000 K star, you would execute:

`python ms.TeffColor('U','B',29000) ` This particular instance corresponds to an exact entry in the data table, and the value returned should exactly match the entry. A more interesting case is the ‘U-H’ color of a 6000 K star: `python ms.TeffColor('U','H',6000) ` Here, you are requesting a color not found in the table at a temperature not found in the table (but bracketed by other temperature values). You can query to find the specific sets of color combined to give this result by running: `python ms.searchgraph('U','H') ` which will return [‘U’, ‘B’, ‘V’, ‘Ks’, ‘H’], meaning that the ‘U-B’,’B-V’,’V-Ks’, and ‘Ks-H’ colors were added to get the result.

Interpolating by spectral type works exactly the same way, excpet that the type is defined by two input variables representing the major and minor subtype. So, to find the ‘U-H’ color of a G2V dwarf, you would execute: `python ms.SpTColor('U','H','G',2) `

Each time one of these routines is called on a new color (for a given object instance), the generated interpolant is saved in ms.Teffinterps and ms.SpTinterps (as appropriate to the method call). This means that the interpolant is generated just once per object instance, speeding up subsequent computations.

### Interpolating Other Properties

Just as with colors, any other property in the original data set can be interpolated as a function of effective temperature or spectral type, via methods TeffOther and SpTOther, respectively. The methods use the same syntax as their color counterparts, save that the property is defined by a single string input.

So, to find the mean solar mass of a 5500 K star, you would run: `python ms.TeffOther('Msun',5500) ` and to find the mean radius of a K9V star, you would run: `python ms.SpTOther('R_Rsun','K',9) `

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

MeanStars-1.2.0.tar.gz (26.0 kB view details)

Uploaded Source

Built Distribution

MeanStars-1.2.0-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file MeanStars-1.2.0.tar.gz.

File metadata

  • Download URL: MeanStars-1.2.0.tar.gz
  • Upload date:
  • Size: 26.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.7

File hashes

Hashes for MeanStars-1.2.0.tar.gz
Algorithm Hash digest
SHA256 a75f899344e20bd56d1029b5eb078a77c541feacd90263ba26cbcd0a96578eac
MD5 a965112c8c7445b7dcb0ce14017ba42d
BLAKE2b-256 a92bc53d692fdc0574fb8841c2ff85cc715ee6fe46b4af1c17aee15069f7d76a

See more details on using hashes here.

File details

Details for the file MeanStars-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: MeanStars-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for MeanStars-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b754f997d5e714774c63281bbbb9a5249936e44aa1ca5ea52a2e00e80a8d3178
MD5 860b5e52b1b1687232de6521999eb2b2
BLAKE2b-256 06f429b4db9d5fb7ee690f642eacfa101c0fc2b450d4863221cd30989cb5cb1e

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