kinms_fitter.kinms_fitter¶
- class kinms_fitter.kinms_fitter(filename, spatial_trim=None, spectral_trim=None, linefree_chans=[1, 5])¶
Wrapper for easily kinematically modelling datacubes (typically from ALMA or VLA) using KinMS. …
- xc_guessfloat
Guess for Kinematic/morphological centre of the disc. RA, in degrees. [Default = Centre of supplied cube after clipping]
- yc_guessfloat
Guess for Kinematic/morphological centre of the disc. Dec, in degrees. [Default = Centre of supplied cube after clipping]
- vsys_guessfloat
Guess for Systemic velocity of the gas, in the radio velocity convention. km/s. [Default = Velocity of central channel of supplied cube after clipping]
- totflux_guessfloat
Total flux guess. Units the same as those used in the cube (e.g. Jy km/s). [Default = total sum of the input cube] velDisp_guess : float Velocity dispersion guess. km/s. [Default = 8 km/s]
- pa_guessfloat
Optional position angle guess, if no warp specified. Degrees. [Default = 0 deg]
- inc_guessfloat
Optional Inclination angle guess, if no warp specified. Degrees. [Default = 45 deg]
- inc_profilelist of warp_profile objects
Optional variation of the inclination with radius as described by warp_profile objects. [Default = None]
- pa_profilelist of warp_profile objects
Optional variation of the inclination with radius as described by warp_profile objects. [Default = None]
- sb_profilelist of sb_profs objects
Optional - Define the surface brightness profile with a list of sb_profs objects which will be evaluated in order. [Default = single exponential disc] expscale_guess : float Optional - defines the scalelength of the default single exponential disc used if sb_profile is not set. arcseconds. [Default = a fifth of the total extent of the cube] skySampClouds : ndarray Optional - Input cloud model made with the skySampler tool if you dont want to fit the gas distribution.
- vel_profilelist of vel_profs objects
Define the circular velocity profile with a list of vel_profs objects. [Default = tilted rings]
- radial_motionlist of radial_motion objects
Optional - Define the radial motion types with radial_motion objects (see base KinMS documentation). [Default: None]
- nringsint
Optional - Number of tilted rings to use, spaced a beamwidth apart. [Default = fill the total extent of the cube]
- vel_guessfloat
Optional - starting guess for the tilted ring asymptotic velocity. km/s [Default = 28percent of the velocity width coverved by the cube]
- xcent_rangetwo element ndarray
Allowed range for fitting of the kinematic centre. RA in degrees [Default: minimum and maximum RA within the input cube]
- ycent_rangetwo element ndarray
Allowed range for fitting of the kinematic centre. Dec in degrees [Default: minimum and maximum Dec within the input cube] vsys_range : two element ndarray Allowed range for fitting of the systemic velocity. km/s. [Default: minimum and maximum velocity contained within the input cube]
- totflux_rangetwo element ndarray
Allowed range for fitting of the total flux. Units the same as input cube. [Default: Min=0 and Max=3x the total flux in the input cube]
- velDisp_rangetwo element ndarray
Allowed range for fitting of the velocity dispersion. km/s. [Default: Min=0 and Max=50 km/s]
- pa_rangetwo element ndarray
Optional - Allowed range for fitting of the position angle. Degrees. [Default: Min=0 and Max=360 degrees]
- inc_rangetwo element ndarray
Optional - Allowed range for fitting of the inclination angle. Degrees. [Default: Min=0 and Max=89 degrees]
- expscale_rangetwo element ndarray
Optional - Allowed range for fitting of the default exponential scale radius. arcseconds. [Default: Min=0 and Max=the size of your input cube]
- vel_rangetwo element ndarray
Optional - Allowed range for fitting of the tilted ring velocities. km/s. [Default: Min=0 and Max=half the cube total velocity width]
- pa_priorobject
Optional - supply an object defining the PA prior (see GAStimator documentation). [Default = boxcar between range limits]
- xc_priorobject
Optional - supply an object defining the RA centre prior (see GAStimator documentation). [Default = boxcar between range limits]
- yc_priorobject
Optional - supply an object defining the Dec centre prior (see GAStimator documentation). [Default = boxcar between range limits]
- vsys_priorobject
Optional - supply an object defining the Vsys prior (see GAStimator documentation). [Default = boxcar between range limits]
- inc_priorobject
Optional - supply an object defining the inc prior (see GAStimator documentation). [Default = boxcar between range limits]
- totflux_priorobject
Optional - supply an object defining the totflux prior (see GAStimator documentation). [Default = boxcar between range limits]
- velDisp_priorobject
Optional - supply an object defining the velocity dispersion prior (see GAStimator documentation). [Default = boxcar between range limits] initial_guesses : ndarray Override the initial guesses used for the fit. [Default = No override]
objname : string Name of the object you are fitting. [Default = read from FITS header OBJECT entry, or ‘object’] nprocesses : int Number of processors to use for MCMC fitting. [Default = fall back on GAStimator default choices]
- nitersint
Number of iterations to use when fitting. [Default=3000]
- output_initial_modelbool
Save the initially generated model as a FITS file. [Default=False]
- pdfbool
Make PDF outputs. [Default = True]
- silentbool
Fit silently. [Default = False]
- show_cornerbool
Show corner plots if MCMC fitting. [Default = True]
- nSampsint
Number of samples to use for KinMS model. [Default = 5e5] chi2_var_correct : bool Use chi-sqr variance correction. [Default = True] text_output : bool Save output text files. [Default = True]
- save_all_acceptedbool
Save all the accepted guesses (allowing you to recreate corner plots etc). [Default = True]
- interactivebool
Use interactive mode for plots. [Default = True]
- show_plotsbool
Show the diagnotic plots. [Default = True]
- output_cube_filerootstring
File root for output best fit datacube. [Default = False] lnlike_func : object Override the default likelihood function. [Default =. Dont override] tolerance : float Tolerance for simple fit. Smaller numbers are more stringent (longer runtime) [Default=0.1]
bunit : string Unit of datacube fluxes
- cellsizefloat
Cube cellsize in arcsec timetaken : float Time taken for the fit in seconds.
- chi2_correct_facfloat
chi2 correction factor applied.
- mask_sum0
Number of detected pixels in the data mask.
- labelsndarray of strings
Label for each fitted quantity
- __init__(filename, spatial_trim=None, spectral_trim=None, linefree_chans=[1, 5])¶
Initalise the KinMS_fitter instance, reading in the observed datacube and trimming it as needed.
- Parameters
filename (string) – Path to datacube in FITS format.
spatial_trim (list[int] or None) – Spatial trim in pixels [xstart,xstop,ystart,ystop]
spectral_trim (list[int] or None) – Channels to include spectrally [channel_start, channel_stop]
linefree_chans (list[int] or None) – Channels to use when estimating the RMS [channel_start, channel_stop]
Methods
__init__
(filename[, spatial_trim, ...])Initalise the KinMS_fitter instance, reading in the observed datacube and trimming it as needed.
Clip the input datacube to size.
colorbar
(mappable[, ticks])Add a colorbar to a given plot
from_fits_history
(hdr)Get beam parameters if they happen to be in history keywords.
Get coordinate arrays from a FITS header
logo
()Returns the KinMS logo.
mcmc_fit
(initial_guesses, labels, minimums, ...)Function to run the MCMC fit.
model_simple
(param[, fileName])Function to create a model from the given input parameters.
plot
([block, overcube, savepath])Makes the plots.
read_in_a_cube
(path)Reads in the datacube.
read_primary_cube
(cube)Wrapper method for reading in datacube.
rms_estimate
(cube, chanstart, chanend)Estimate the RMS in the inner quarter of the datacube in a given channel range.
run
([method, justplot, savepath])Run the fit.
Setup the fit guesses, minima, maxima etc from the inputs.
simple_chi2
(theargs, info)Likelihood function for the simple fit mode.
simple_fit
(initial_guesses, labels, ...)Runs the simple fit.
write_text
(bestvals, errup, errdown, units, ...)Write output text files.