Skip to main content

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.csv
Data in `SWEET_cat.csv` is recent.
There are 25 columns with 2627 entries each in `SWEET_cat.csv`

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.csv` is recent.
There are 25 columns with 2627 entries each in `SWEET_cat.csv`

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.

Metadata

Release files for pySWEETCat 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pySWEETCat 1.1.1
File Size Uploaded
pysweetcat-1.1.1.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pySWEETCat 1.1.1
File Interpreter ABI Platform
pySWEETCat-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.5 kB

Release files / pysweetcat-1.1.1.tar.gz

Download URL pysweetcat-1.1.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f4e97d13c08b649de60b527174ebe9ffee0cedc68bc0addb1db8b63390434f92
BLAKE2b-256 checksum
How to use checksums
aed6f07b955967a3a9bde56e40519e1a48e530e8b702833f412e77d21b9d2090
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release files / pySWEETCat-1.1.1-py3-none-any.whl

Download URL pySWEETCat-1.1.1-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a177d94adaa4229d087ce7e0dffe3d6152628b75a1178da73eec0c8d8f51086d
BLAKE2b-256 checksum
How to use checksums
b477628e4e36cc90b095fc348ce985fa9ea2ba4c33e2cd3da9a78db06653bd25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0.2

2 release files

1.0.1

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page