Skip to main content

A pure-Python package to download data from SWEET-Cat

Project description

A pure-Python package to download data from SWEET-Cat.

This small package was developed as an exercise in a Python course (see CONTRIBUTORS). It downloads all the data from the SWEET-Cat online catalogue of stellar parameters and builds a (custom) dictionary with each column. It is a pure-Python package with no extra dependencies (see below).

License MIT PyPI version

How to use

Install it from pip (pySWEETCat has no extra depencies)

pip install pySWEETCat

and it’s ready to use from Python

import pysweetcat

pySWEETCat has one simple function, get_data(), which downloads the data from the online archive and returns it in a dictionary.

>>> data = pysweetcat.get_data()
Downloading SWEET-Cat data
Saved SWEET-Cat data to $HOME/.pysweetcat/SWEET_cat.tsv
Data in `SWEET_cat.tsv` is recent.
There are 25 columns with 2627 entries each in `SWEET_cat.tsv`

where $HOME will be your home directory. The second time you call get_data() it will check if the data was downloaded recently, and only conditionally download it again.

>>> data = pysweetcat.get_data()
Data in `SWEET_cat.tsv` is recent.
There are 25 columns with 2627 entries each in `SWEET_cat.tsv`

Now, data is (basically) a Python dictionary with the each column as keys. But it has a couple extra methods and properties. For example

data.size
2627

returns the number of values in each column.

The columns can be accessed as in a normal dictionary, as in

data['feh']   # stellar metallicity
data['name']  # name of the star

and both of these will work

data['σ_vmag']
data['sigma_vmag']

Also, to drop the NaN values in a column (for some columns there will be quite a few) we can use

data['teff_nonan']

np.isnan(data['teff']).any()       # True
np.isnan(data['teff_nonan']).any() # False

which allows us to more easily do histograms of the values.

Finnally, the .to_numpy(inplace=True) method converts all the columns to numpy arrays, either in place or not (this is the only function in pySWEETCat that requires numpy).

License

Copyright 2018 João Faria.

pySWEETCat is free software made available under the MIT License. For details see the LICENSE 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

pySWEETCat-1.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pySWEETCat-1.0.1-py3.6.egg (8.6 kB view details)

Uploaded Egg

pySWEETCat-1.0.1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pySWEETCat-1.0.1.tar.gz.

File metadata

  • Download URL: pySWEETCat-1.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pySWEETCat-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fcc6f2b1a36a169c4a5d0eb447625408e57d0add1b1636d13710987491d0089a
MD5 bf4cc4f5328e4d1323e6dcee46302c38
BLAKE2b-256 213716e75ed415c2f05279c18898752ef9ae11de4ccf9acacdb6d9fa84222402

See more details on using hashes here.

File details

Details for the file pySWEETCat-1.0.1-py3.6.egg.

File metadata

  • Download URL: pySWEETCat-1.0.1-py3.6.egg
  • Upload date:
  • Size: 8.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/2.7.14

File hashes

Hashes for pySWEETCat-1.0.1-py3.6.egg
Algorithm Hash digest
SHA256 1d66f8d1bf08e2ce3bb34989220de03662e52c0cd1af071da9b8ed919bfea8f9
MD5 ac561158d9334f0b411316730063dd71
BLAKE2b-256 01f211ceb4c840f7e13fdcaaf85f0053a60ea4d86b0d6d9de494b65cfb91e26b

See more details on using hashes here.

File details

Details for the file pySWEETCat-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pySWEETCat-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4f18b67692448000dbcacfda6ef74478954a249d919fd938f0946f1cf3b2131
MD5 87326738baa093199a86780b6762d540
BLAKE2b-256 99f79491599a874a405792c91a137899d59c936f4354f0d4721b138b7ed523b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page