Giter VIP home page Giter VIP logo

velociraptor-python's Introduction

Velociraptor Python Library

Documentation Status

Velociraptor catalogues provide a signifciant amount of information, but applying units to it can be painful. Here, the unyt python library is used to automatically apply units to velociraptor data and perform generic halo-catalogue reduction. This library is primarily intended to be used on SWIFT data that has been post-processed with velociraptor, but can be used for any velociraptor catalogue.

The internals of this library are based heavily on the internals of the swiftsimio library, and essentially allow the velociraptor catalogue to be accessed in a lazy, object-oriented way. This enables users to be able to reduce data quickly and in a computationally efficient manner, without having to resort to using the h5py library to manually load data (and hence manually apply units)!

Requirements

The velociraptor library requires:

  • unyt and its dependencies
  • h5py and its dependencies
  • python3.6 or above

Note that for development, we suggest that you have pytest and black installed. To create the plots in the example directory, you will need the plotting framework matplotlib.

Installation

You can install this library from PyPI using:

pip3 install velociraptor

Documentation

Full documentation is available on ReadTheDocs.

Why a custom library?

This custom library, instead of something like pandas, allows us to only load in the data that we require, and provide significant context-dependent features that would not be available for something generic. One example of this is the automatic labelling of properties, as shown in the below example.

from velociraptor import load
from velociraptor.tools import get_full_label

catalogue = load("/path/to/catalogue.properties")

stellar_masses = catalogue.apertures.mass_star_30_kpc
stellar_masses.convert_to_units("msun")

print(get_full_label(stellar_masses))

This outputs "Stellar Mass $M_*$ (30 kpc) $\left[M_\odot\right]$", which is easy to add as, for example, a label on a plot.

velociraptor-python's People

Contributors

jborrow avatar evgeniichaikin avatar jtrayford avatar bwvdnbro avatar kyleaoman avatar matthieuschaller avatar correac avatar fonotec 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.