Galaxy Parameters

Signature

class galpak.GalaxyParameters(x=None, y=None, z=None, flux=None, radius=None, inclination=None, pa=None, turnover_radius=None, maximum_velocity=None, velocity_dispersion=None)[source]

A simple wrapper for an array of galaxy parameters. It is basically a flat numpy.ndarray of a bunch of floats with convenience attributes for explicit (and autocompleted!) access and mutation of parameters, and nice casting to string.

Warning

Undefined parameters will be NaN, not None.

Example :

from galpak import GalaxyParameters
gp = GalaxyParameters(x=1.618)

// Classic numpy.ndarray numeric access
assert(gp[0] == 1.618)
// Autocompleted and documented property access
assert(gp.x == 1.618)
// Convenience dictionary access,
assert(gp['x'] == 1.618)
// ... useful when you're iterating :
for (name in GalaxyParameters.names):
    print gp[name]
Parameters :
  • x (pix)

  • y (pix)

  • z (pix)

  • flux

  • radius aka. r½ (pix)

    half-light radius in pixel

  • inclination (deg)

  • pa (deg)

    position angle from y-axis, anti-clockwise.

  • turnover_radius aka. rv (pix)

    turnover radius for arctan, exp, velocity profile [is ignored for mass profile]

  • maximum_velocity aka. Vmax (km/s)

    de-projected V_max [forced to be positive, with 180deg added to PA]

  • velocity_dispersion aka. s0 (km/s)

Note that all the parameters are lowercase, even if they’re sometimes displayed mixed-case.

Additional attributes :
  • stdev
    : Optional stdev margin (GalaxyParametersError).

    GalPaK3D fills up this attribute.

static from_ndarray(a)[source]

Factory to easily create a GalaxyParameters object from an ordered ndarray whose elements are in the order of GalaxyParameters.names.

Use like this :

from galpak import GalaxyParameters
gp = GalaxyParameters.from_ndarray(my_ndarray_of_data)
Return type:GalaxyParameters
long_info(error_as_percentage=False)[source]

Casts to multi-line string. This is called by repr().

error_as_percentage: bool
When true, will print the stdev margin as a percentage of the value.
Return type:string
short_info()[source]

Casts to single-line string. This is called by print().

Looks like this : x=0.00 y=1.00 z=2.000000 flux=3.00e+00 r½=4.00 incl=5.00 PA=6.00 rv=7.00 Vmax=8.00 s0=9.00

Return type:string

Description

A GalaxyParameters object gp is merely a glorified numpy.ndarray with convenience accessors and mutators :

Component Description
gp.x X coordinates of the center of the galaxy. (in pixels)
gp.y Y coordinates of the center of the galaxy. (in pixels)
gp.z Z coordinates of the center of the peak. (in pixels)
gp.flux Sum of the values of all pixels. (in the unit of the cube)
gp.radius Radius of the galaxy. (in pixels)
gp.inclination |br| gp.pitch Inclination of the galaxy (in degrees), aka. pitch along observation axis.
gp.pa |br| gp.roll Position Angle, clockwise from Y (in degrees), aka. roll along observation axis.
gp.rv |br| gp.turnover_radius Inverse factor rv in expression arctan(r/rv).
gp.maximum_velocity Maximum Velocity. (in km/s)
gp.velocity_dispersion |br| gp.sigma0 Disk Dispersion spatially constant (in km/s) added in addition to kinematics dispersion.

You still can access the parameters like an indexed array

assert gp.x == gp[0]  # true
assert gp.y == gp[1]  # true
# ...
assert gp.sigma0 == gp[9]  # true

You may instantiate a GalaxyParameters object like so

from galpak import GalaxyParameters

gp = GalaxyParameters(z=0.65)
gp.x = 5.
assert gp.z == 0.65       # true
assert gp.x == 5.         # true

Warning

An undefined value in GalaxyParameters will be nan, not None

assert math.isnan(gp.pa)  # true
assert gp.pa is None      # false

Getting the Wavelength

The z attribute in a GalaxyParameter is in pixels, you may want the value in the physical unit specified in your Cube’s header.

To that effect, you may use the wavelength_of method of the HyperspectralCube:

from galpak import GalPaK3D
gk = GalPaK3D('my_muse_cube.fits')
gk.run_mcmc()

wavelength = gk.cube.wavelength_of(gk.galaxy.z)