Useful Functions¶
Miscellaneous useful auxiliary functions:
- pyimfit.get_function_list()¶
Returns a list of Imfit image-function names (e.g., [“Gaussian”, “Exponential”, etc.])
- Returns:
function_list – list of Imfit image-function names
- Return type:
list of str
- pyimfit.get_function_dict()¶
Returns a dict mapping each Imfit image-function names to a list of its corresponding parameter names.
- Returns:
function_dict – dict where image-function names are keys and items are list of function parameter names
- Return type:
dict
- pyimfit.make_imfit_function(func_type, label='')¶
Given a string specifying the official name of an Imfit image function (e.g., “Sersic”, “Sersic_GenEllipse”, “ExponentialDisk3D”), this returns an instance of FunctionDescription describing that function and its parameters (with values all set to 0).
- Parameters:
func_type (string) – The function type; must be one of the recognized Imfit image-function names (E.g., “Sersic”, “BrokenExponential”, etc. Use “imfit –list-functions” on the command line to get the full list, or FunctionNames in this module.)
label (string, optional) – Custom identifying label for this instance of this function. Example: “disk”, “bulge”. Default: “” (which means no label).
- Returns:
func_desc – Instance of
FunctionDescription
.- Return type:
FunctionDescription
- pyimfit.parse_config_file(fileName: str) ModelDescription ¶
Read and parse an Imfit model-configuration file.
- Parameters:
fileName (str) – Path to the model configuration file.
- Returns:
model (
ModelDescription
) – A model description object.See Imfit documentation for details on the format of configuration files.
- pyimfit.parse_config(lines: List[str]) ModelDescription ¶
Parse an Imfit model configuration from a list of strings.
- Parameters:
lines (list of str) – String representantion of Imfit model configuration.
- Returns:
model – A model description object.
- Return type:
ModelDescription
See also
- pyimfit.MakePsfOversampler(psfImage, oversampleScale, regionSpec, psfNormalization=True)¶
Helper function to generate PsfOversampling objects (corrects input psfImage, sets up region string, etc.).
- Parameters:
psfImage (2-D numpy array) – the oversampled PSF image
oversampleScale (int) –
- oversampling scale of psfImage relative to data image: number of PSF-image
pixels per data-image pixel in one dimension (must be >= 1)
regionSpec (sequence of int) – specifies inclusive boundaries of image region to be oversampled [x1,x2,y1,y2]
psfNormalization (bool, optional) – Normalize the PSF image before using. Default:
True
.
- Returns:
oversampleInfo
- Return type:
instance of PsfOversampling class
- pyimfit.FixImage(array)¶
Checks an input numpy array and, if necessary, converts it to double-precision floating point, little-endian byte order, with contiguous layout, to enable use with Imfit.
- Parameters:
array (numpy ndarray) –
- Returns:
array – The input array, suitably converted
- Return type:
numpy ndarray