kinms.KinMS

class kinms.KinMS(xs, ys, vs, cellSize, dv, beamSize, nSamps=None, seed=None, fixSeed=True, cleanOut=False, huge_beam=False, verbose=False)
Class KinMS

Main workhorse of KinMSpy, used to generate spectral cubes.

__init__(xs, ys, vs, cellSize, dv, beamSize, nSamps=None, seed=None, fixSeed=True, cleanOut=False, huge_beam=False, verbose=False)
Parameters
  • xs – (float or int) x-axis size for resultant cube (in arcseconds)

  • ys – (float or int) y-axis size for resultant cube (in arcseconds)

  • vs – (float or int) Velocity axis size for resultant cube (in km/s)

  • cellSize – (float or int) Pixel size required (arcsec/pixel)

  • dv – (float or int) Channel size in velocity direction (km/s/channel)

  • beamSize – (float or int, or list or array of float or int) Scalar or three element list for size of convolving beam (in arcseconds). If a scalar then beam is assumed to be circular. If a list/array of length two. these are the sizes of the major and minor axes, and the position angle is assumed to be 0. If a list/array of length 3, the first 2 elements are the major and minor beam sizes, and the last the position angle (i.e. [bmaj, bmin, bpa]).

  • nSamps – (float or int) Optional, default value is 1e5. Number of cloudlets to use to create the model. Large numbers will reduce numerical noise (especially in large cubes), at the cost of increasing runtime.

  • fixSeed – (bool) Whether to use a fixed (or random) seed (list of four integers).

  • cleanOut – (bool) Optional, default value is False. If True then do not convolve with the beam, and output the “clean components”. Useful to create input for other simulation tools (e.g sim_observe in CASA).

  • huge_beam – (bool) Optional, default is False. If True then astropy’s convolve_fft is used instead of convolve, which is faster for very large beams.

  • verbose – (bool) Optional, default is False. If True, messages are printed throughout the code.

Methods

__init__(xs, ys, vs, cellSize, dv, beamSize)

param xs

add_fluxes(clouds2do, subs)

If there are clouds to use, and we know the flux of each cloud, add them to the cube.

create_warp(array, r_flat)

If the array provided has a length > 1, create a warp.

find_clouds_in_cube(los_vel, cent, x2, y2)

Returns the clouds that lie inside the cube.

gasGravity_velocity(x_pos, y_pos, z_pos, ...)

Calculates an array of line-of-sight velocity alterations, accounting for the effects of the mass of gas in the disk (in this case assuming spherical symmetry).

generate_cloudlets()

A helper function for generating cloudlets by running kinms_sampleFromArbDist_oneSided.

histo_with_bincount(vals, bins)

bincount is subtantially faster than histogramdd unless you need weights

inclination_projection(ang, x1, y1, z1)

Apply the projection as a result of inclination to the cloudlets.

kinms_create_velField_oneSided(velRad[, ...])

Creates an array of line-of-sight velocities, accounting for velocity dispersion and projection.

kinms_sampleFromArbDist_oneSided(sbRad, ...)

Samples cloudlets from radial profiles provided given that inClouds is not provided in the __init__.

makebeam(xpixels, ypixels, beamSize[, ...])

Creates a psf with which one can convolve their cube based on the beam provided.

model_cube(inc, posAng[, gasSigma, ...])

Do the actual modelling of the spectral cube

normalise_cube(cube, psf)

Normalise cube by the known integrated flux.

position_angle_rotation(ang, x2, y2, z2)

Apply the projection as a result of the position angle to the cloudlets.

print_variables()

If "verbose", prints a summary of parameters for the user's convenience.

save_fits(cube, cent)

Outputs a .fits file containing the datacube and relevant header information.

set_cloud_positions()

Calculate and return the positions and velocities of the cloudlets in inClouds, and the radial distance in the x and y plane.

set_cloud_velocities()

Find the los velocity and cube position of the clouds.