CylindricalSymmetry#
- class gala.potential.potential.CylindricalSymmetry[source]#
Bases:
PotentialSymmetryCylindrical (axisymmetric) symmetry for potentials with no azimuthal dependence.
This symmetry is appropriate for potentials that depend only on the cylindrical radius R = sqrt(x² + y²) and height z, but not on the azimuthal angle phi.
Examples
>>> import astropy.units as u >>> import numpy as np >>> from gala.potential import MiyamotoNagaiPotential >>> pot = MiyamotoNagaiPotential(m=1e11*u.Msun, a=3*u.kpc, b=0.3*u.kpc) >>> R = np.linspace(1, 15, 100) * u.kpc >>> z = np.zeros_like(R) >>> energy = pot.energy(R=R, z=z) >>> >>> # z can be omitted and defaults to zero >>> energy = pot.energy(R=R)
Attributes Summary
Methods Summary
to_cartesian(R[, z])Convert cylindrical coordinates to Cartesian coordinates.
validate_coords(**coords)Validate cylindrical coordinates.
Attributes Documentation
- coord_names = ('R', 'z')#
Methods Documentation
- to_cartesian(R, z=None)[source]#
Convert cylindrical coordinates to Cartesian coordinates.
- Parameters:
- Rarray_like,
Quantity Cylindrical radius values. Can be scalar or array.
- zarray_like,
Quantity, optional Height above/below the midplane. If not provided, defaults to zero with the same shape as R. Must have the same shape as R if provided.
- Rarray_like,
- Returns:
- Raises:
ValueErrorIf R and z have incompatible shapes.
- validate_coords(**coords)[source]#
Validate cylindrical coordinates.
- Parameters:
- **coords
Coordinate keyword arguments. Must contain ‘R’, may contain ‘z’.
- Raises:
ValueErrorIf R values are negative or invalid coordinates are provided.