Image Details

Choose export citation format:

galpy: A python Library for Galactic Dynamics

  • Authors: Jo Bovy

Bovy 2015 The Astrophysical Journal Supplement Series 216 29.

  • Provider: AAS Journals

Caption: Figure 5.

Minimal C implementation of galpy's LogarithmicHaloPotential. This figure illustrates the steps necessary for implementing a potential in C in such a way that it can automatically be used in the galpy framework. The top file is a new C file that has the implementation of the potential and its radial and vertical force law. These new C functions need to be declared in the general galpy_potentials.h header file on line 42. The following two files that require editing provide the glue between C and python: integrateFullOrbit.c's parse_leapFuncArgs_Full function contains the code that specifies the functions that implement the forces and the number of parameters (line 52); the python function _parse_pot in integrateFullOrbit.py contains the code that stores the potential parameters in an array that will be passed to the C code (line 61). Finally, the initialization of the LogarithmicHaloPotential instance needs to set the attribute hasC to True, such that all relevant code can automatically use C for speeding up calculations. To use this potential for action–angle calculations in C, more glue needs to be written that is similar to that in integrateFullOrbit.c.

Other Images in This Article

Show More

Copyright and Terms & Conditions