Galfit models

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Galfit model functions.

Miscellaneous

Test

galfit.models.createIsFixedDict(fullListOfNames, fixedParams)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Make a dictionnary which stores which parameters should be fixed (value of 0) and which should not (value of 1).

Parameters
  • fixedParams (list[str]) –

    list of parameters names which must be fixed during galfit fitting routine.

    Note

    BY DEFAULT, ALL PARAMETERS ARE SET FREE.

    Example

    For instance, if one wants to fix re and n, one may provide

    >>> fixedParams=["re", "n"]
    >>> createIsFixedDict(fullListOfNames, fixedParams)
    

  • fullListOfNames (list[str]) – complete list of parameter names which can either be fixed or let free

Returns

dictionnary with key names equal to parameter names of the model and key values equal to 0 or 1

Return type

dict

galfit.models.createCommentsDict(fullListOfNames, comments)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Make a dictionnary which stores the comments associated to each line in the galfit configuration file.

Parameters
  • comments (dict) –

    dictionnary which contains a comment for each line. If comments is None, default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

  • fullListOfNames (list[str]) – complete list of parameter names which can either be fixed or let free

Returns

dictionnary with key names equal to parameter names of the model and key values equal to their comment

Return type

dict

galfit.models.genModel(modelName, listLineIndex, params, fixedOrNot, paramsFormat, comments=None, noComments=False, mainComment=None, removeLine0=False, prefix='')[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Very general function which can output any GALFIT model configuration.

Warning

This function is not supposed to be used directly by the user, but should be called by a function whose goal is to output the galfilt configuration of a specific profile.

This should only be seen as a bare skeleton which is used in function calls in order to build specific galfit model configuration for feedme files.

Parameters
  • fixedOrNot (list[bool]) – whether each parameter given in params must be fixed during GALFIT fitting routine or not. This takes the same shape as params.

  • listLineIndex (list[str]) – list of GALFIT indices for each line (generally from 1 to 10, including Z at the end)

  • modelName (str) – name of the model used

  • params (list) –

    parameters value for each line given in the same order as the indices. If, for a certain index, there are more than one parameter (ex: model center), then provide these as a list.

    *Example

    Say two indices are given such that

    >>> listLineIndex = [1, 2] 
    

    where the first one is for the Sersic index n=1 and the other for the effective radius re=10, then we would have

    >>> params = [1, 10]
    

    Say three indices are given such that

    >>> listLineIndex = [1, 2, 3] 
    

    with the first two as before and the last one as the model center position (let us assume it lies at position (3, 5)), then we would have

    >>> params = [1, 10 [3, 5]]
    

    This generalises for any number of parameters.

  • paramsFormat (list[str]) –

    format of the parameters used for the output. The shape of this parameter should be identical as that of params.

    Note

    This uses old Python format. If you do not care about the output format, just provide a simple format for each argument (“%d” for int, “%f” for float, “%e” for scientific notation, etc.).

    Otherwise, you can use more complex notation to truncate values, align strings to the left or the right and so on.

  • comments (list[str]) – (Optional) comments to add at the end of the lines. If you do not want to provide a comment for a specific index, just give None.

  • mainComment (str) – (Optional) main comment which appears before the configuration line (generally the full model name)

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • prefix (str) – (Optional) prefix to add before the line index. For instance the index 1) would become B1) with the prefix “B”.

  • removeLine0 (bool) – whether to remove line number 0 (model name). This is useful when one wants to make an output for additional terms such as bending modes.

Returns

galfit model configuration as formatted text

Return type

str

Galfit profiles

galfit.models.gendeVaucouleur(x=50, y=50, mag=25.0, re=10.0, bOvera=1.0, PA=0.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct a de Vaucouleur function configuration.

Parameters
  • mag (float) – (Optional) total integrated magnitude of the profile

  • x (int or float) – (Optional) X position of the de Vaucouleur profile center (in pixel)

  • y (int or float) – (Optional) Y position of the de Vaucouleur profile center (in pixel)

  • re (float) – (Optional) half-light (effective) radius of the profile (in pixel)

  • bOvera (float) – (Optional) axis ratio b/a of the minor over major axes. Must be between 0 and 1.

  • comments (dict) –

    (Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

    • to add a comment to the line with index Z, use the key name ‘Zline’

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • PA (int or float) – (Optional) position angle of the morphological major axis on the sky (in degrees). Up is 0° and Left is 90°.

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

  • skipComponentInResidual (bool) – (Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Returns

de Vaucouleur GALFIT configuration as formatted text

Return type

str

galfit.models.genEdgeOnDisk(x=50, y=50, mu=20.0, diskScaleLength=10.0, diskScaleHeight=2.0, PA=0.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

. codeauthor:: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct an Edge-on disk function configuration.

Parameters
  • diskScaleHeight (float) – (Optional) disk scale-height perpendicular to the disk (in pixel)

  • mu (float) – (Optional) central surface brightness (\(\rm{mag/arcsec^2}\)) of the profile

  • x (int or float) – (Optional) X position of the de Vaucouleur profile center (in pixel)

  • y (int or float) – (Optional) Y position of the de Vaucouleur profile center (in pixel)

  • diskScaleLength (float) – major axis disk scale-length (in pixel)

  • comments (dict) –

    (Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

    • to add a comment to the line with index Z, use the key name ‘Zline’

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • PA (int or float) – (Optional) position angle of the morphological major axis on the sky (in degrees). Up is 0° and Left is 90°.

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

  • skipComponentInResidual (bool) – (Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Returns

Edge-on disk GALFIT configuration as formatted text

Return type

str

galfit.models.genExpDisk(x=50, y=50, mag=25.0, rs=8.0, bOvera=1.0, PA=0.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct an exponential disk function configuration.

Parameters
  • mag (float) – (Optional) total integrated magnitude of the profile

  • x (int or float) – (Optional) X position of the de Vaucouleur profile center (in pixel)

  • y (int or float) – (Optional) Y position of the de Vaucouleur profile center (in pixel)

  • rs (float) – (Optional) disk scale-length (in pixel) such that \(R_{\rm{s}} = R_{\rm{e}}/1.678\), with \(R_{\rm{e}}\) the effective radius of an equivalent n=1 Sersic profile.

  • bOvera (float) – (Optional) axis ratio b/a of the minor over major axes (must be between 0 and 1)

  • comments (dict) –

    (Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

    • to add a comment to the line with index Z, use the key name ‘Zline’

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • PA (int or float) – (Optional) position angle of the morphological major axis on the sky (in degrees). Up is 0° and Left is 90°.

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

  • skipComponentInResidual (bool) – (Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Returns

Exponential disk GALFIT configuration as formatted text

Return type

str

galfit.models.genFerrer(x=50, y=50, mu=20.0, rt=5.0, alphaFerrer=3.0, betaFerrer=2.5, bOvera=1.0, PA=0.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct a Ferrer function configuration.

Parameters
  • mu (float) – (Optional) surface brightness (\(\rm{mag/arcsec^2}\)) at radius rb

  • x (int or float) – (Optional) X position of the de Vaucouleur profile center (in pixel)

  • y (int or float) – (Optional) Y position of the de Vaucouleur profile center (in pixel)

  • rt (float) – (Optional) outer truncation radius (in pixel)

  • alphaFerrer (float) – (Optional) sharpness of the truncation

  • betaFerrer (float) – (Optional) central slope

  • bOvera (float) – (Optional) axis ratio b/a of the minor over major axes (must be between 0 and 1)

  • comments (dict) –

    (Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

    • to add a comment to the line with index Z, use the key name ‘Zline’

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • PA (int or float) – (Optional) position angle of the morphological major axis on the sky (in degrees). Up is 0° and Left is 90°.

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

  • skipComponentInResidual (bool) – (Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Returns

Ferrer GALFIT configuration as formatted text

Return type

str

galfit.models.genGaussian(x=50, y=50, mag=25.0, FWHM=3.0, bOvera=1.0, PA=0.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct a Gaussian function configuration.

Parameters
  • FWHM (float) – (Optional) full width at half maximum of the PSF (in pixel)

  • mag (float) – (Optional) total integrated magnitude of the profile

  • x (int or float) – (Optional) X position of the de Vaucouleur profile center (in pixel)

  • y (int or float) – (Optional) Y position of the de Vaucouleur profile center (in pixel)

  • bOvera (float) – (Optional) axis ratio b/a of the minor over major axes (must be between 0 and 1)

  • comments (dict) –

    (Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

    • to add a comment to the line with index Z, use the key name ‘Zline’

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • PA (int or float) – (Optional) position angle of the morphological major axis on the sky (in degrees). Up is 0° and Left is 90°.

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

  • skipComponentInResidual (bool) – (Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Returns

Gaussian GALFIT configuration as formatted text

Return type

str

galfit.models.genKing(x=50, y=50, mu0=20.0, rc=3.0, rt=30.0, powerlaw=2.0, bOvera=1.0, PA=0.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct an empirical King profile configuration.

Parameters
  • mu0 (float) – (Optional) central surface brightness (\(\rm{mag/arcsec^2}\))

  • powerlaw (float) – (Optional) powerlaw (powerlaw=2.0 for a standard King profile)

  • x (int or float) – (Optional) X position of the de Vaucouleur profile center (in pixel)

  • y (int or float) – (Optional) Y position of the de Vaucouleur profile center (in pixel)

  • rc (float) – (Optional) core radius (in pixel)

  • rt (float) – (Optional) truncation radius (in pixel)

  • bOvera (float) – (Optional) axis ratio b/a of the minor over major axes (must be between 0 and 1)

  • comments (dict) –

    (Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

    • to add a comment to the line with index Z, use the key name ‘Zline’

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • PA (int or float) – (Optional) position angle of the morphological major axis on the sky (in degrees). Up is 0° and Left is 90°.

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

  • skipComponentInResidual (bool) – (Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Returns

King profile GALFIT configuration as formatted text

Return type

str

galfit.models.genMoffat(x=50, y=50, mag=25.0, FWHM=3.0, powerlaw=1.0, bOvera=1.0, PA=0.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct a de Vaucouleur function configuration.

Parameters
  • FWHM (float) – (Optional) full width at half maximum of the PSF (in pixel)

  • mag (float) – (Optional) total integrated magnitude of the profile

  • powerlaw (float) – (Optional) powerlaw

  • x (int or float) – (Optional) X position of the de Vaucouleur profile center (in pixel)

  • y (int or float) – (Optional) Y position of the de Vaucouleur profile center (in pixel)

  • bOvera (float) – (Optional) axis ratio b/a of the minor over major axes (must be between 0 and 1)

  • comments (dict) –

    (Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

    • to add a comment to the line with index Z, use the key name ‘Zline’

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • PA (int or float) – (Optional) position angle of the morphological major axis on the sky (in degrees). Up is 0° and Left is 90°.

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

  • skipComponentInResidual (bool) – (Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Returns a complete de Vaucouleur function galfit configuration as formatted text.

galfit.models.genNuker(x=50, y=50, mu=20.0, rb=10.0, alpha=1.0, beta=0.5, gamma=0.7, bOvera=1.0, PA=0.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct a Nuker function configuration.

param float mu

(Optional) surface brightness (\(\rm{mag/arcsec^2}\)) at radius rb

param x

(Optional) X position of the de Vaucouleur profile center (in pixel)

type x

int or float

param y

(Optional) Y position of the de Vaucouleur profile center (in pixel)

type y

int or float

param float rb

(Optional) break radius (in pixel) where the slope is the average between \(\beta\) and \(\gamma\), and where the maximum curvature (in log space) is reached. It roughly corresponds to the radius of transition between the inner and outer powerlaws.

param float alpha

(Optional) sharpness of transition between the inner part and the outer part

param float beta

(Optional) outer powerlaw slope

param float bOvera

(Optional) axis ratio b/a of the minor over major axes (must be between 0 and 1)

param dict comments

(Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

Note

In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

Warning

  • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

  • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

  • to add a comment to the line with index Z, use the key name ‘Zline’

param float gamma

(Optional) inner powerlaw slope

param bool noComments

(Optional) whether to not provide any comments or not

param PA

(Optional) position angle of the morphological major axis on the sky (in degrees). Up is 0° and Left is 90°.

type PA

int or float

param list fixedParams

(Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

param bool skipComponentInResidual

(Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Returns

Nuker GALFIT configuration as formatted text

Return type

str

galfit.models.genPSF(x=50, y=50, mag=25.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct PSF function configuration.

Note

This PSF is technically not a function, but uses the psf image provided in the header to fit a given point source.

Parameters
  • mag (float) – (Optional) total integrated magnitude of the profile

  • powerlaw (float) – (Optional) powerlaw

  • x (int or float) – (Optional) X position of the de Vaucouleur profile center (in pixel)

  • y (int or float) – (Optional) Y position of the de Vaucouleur profile center (in pixel)

  • comments (dict) –

    (Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

    • to add a comment to the line with index Z, use the key name ‘Zline’

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

  • skipComponentInResidual (bool) – (Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Returns a complete PSF function galfit configuration as formatted text.

galfit.models.genSersic(x=50, y=50, mag=25.0, re=10.0, n=4, bOvera=1.0, PA=0.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct a Sersic function configuration.

Parameters
  • mag (float) – (Optional) total integrated magnitude of the profile

  • powerlaw (float) – (Optional) powerlaw

  • x (int or float) – (Optional) X position of the de Vaucouleur profile center (in pixel)

  • y (int or float) – (Optional) Y position of the de Vaucouleur profile center (in pixel)

  • re (float) – half-light (effective) radius of the profile (in pixel)

  • bOvera (float) – (Optional) axis ratio b/a of the minor over major axes (must be between 0 and 1)

  • comments (dict) –

    (Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

    • to add a comment to the line with index Z, use the key name ‘Zline’

  • n (int or float) – Sersic index

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • PA (int or float) – (Optional) position angle of the morphological major axis on the sky (in degrees). Up is 0° and Left is 90°.

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

  • skipComponentInResidual (bool) – (Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Returns

Sersic GALFT configuration as formatted text

Return type

str

galfit.models.genSky(background=1.0, xGradient=0.0, yGradient=0.0, skipComponentInResidual=False, fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct a sky function configuration.

Parameters
  • background (float) – (Optional) sky background (in ADU counts)

  • xGradient (float) – (Optional) sky gradient along x, \(d{\rm{sky}}/dx\) (in ADU/pixel)

  • yGradient (float) – (Optional) sky gradient along y, \(d{\rm{sky}}/dy\) (in ADU/pixel)

  • comments (dict) –

    (Optional) dictionnary which contains a comment for each line. By default, it is set to None, and default comments will be used instead.

    Note

    In general, the dictionnary key name is the parameter name of the galfit configuration line (ex: ‘pos’ for position, ‘mag’ for total magnitude, ‘bOvera’ for b/a ratio, etc.). The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

    Warning

    • for the POSITION, USE THE KEY ‘pos’ INSTEAD OF ‘x’ or ‘y’ as both values appear on the same line

    • you can also provide a comment for the 0th line (i.e. the model name). To do so, use the key name ‘object’.

    • to add a comment to the line with index Z, use the key name ‘Zline’

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

  • skipComponentInResidual (bool) – (Optional) whether to not take into account this component when computing the residual or not. If False, the residual will skip this component in the best-fit model.

Return a complete sky function galfit configuration as formatted text.

Galfit additional tags

galfit.models.bendingModes(listModes=[1], listModesValues=[0.5], fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct bending modes GALFIT configuration.

Parameters
  • listModes (list[int]) – (Optional) mode number

  • listModesValues (list[float]) – (Optional) value of the corresponding mode

  • comments (dict) –

    (Optional) dictionary which contains a comment for each line.

    Note

    By default, comments is set to None, and default comments will be used instead.

    The dictionnary key names are the mode number. For instance

    • 1 for bending mode 1

    • 2 for bending mode 2, and so on…

    The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

  • noComments (bool) – (Optional) whether to not provide any comments or not

  • fixedParams (list) – (Optional) list of parameter names which must be fixed during galfit fitting routine. See genModel() for more information.

Returns

bending modes GALFIT configuration as formatted text

Return type

str

galfit.models.boxy_diskyness(value=0.5, isFixed=False, comment=None)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct a boxy/diskyness (genralised ellipses) GALFIT configuration.

Parma bool isFixed

(Optional) whether to fix the parameter during galfit fitting routine

Parameters
  • value (float) – value of the diskyness/boxyness parameter (negative = more disky, positive = more boxy)

  • comment (str) – comment to append at the end of the line

Returns

boxyness/diskyness GALFIT configuration

Return type

str

galfit.models.fourierModes(listModes=[1], listModesAmplitudes=[1.0], listModesPhases=[0.0], fixedParams=[], comments=None, noComments=False)[source]

Code author: Wilfried Mercier - IRAP <wilfried.mercier@irap.omp.eu>

Construct Azimuthal fourier modes GALFIT configuration.

Parameters
  • listModes (list[int]) – mode number

  • listModesAmplitudes (list[float]) – amplitudes of the corresponding mode

  • listModesPhases (list[float]) – phases of the corresponding mode

  • comments (dict) –

    dictionary which contains a comment for each line. By default, comments is set to None, and default comments will be used instead.

    Note

    The dictionnary key names are the modes number followed by A for amplitude and P for phase. For instance

    • ’1A’ for the amplitude of the fourier mode 1

    • ’2P’ for the phase of Fourier mode 2, and so on…

    The key value is the comment you want.

    You only need to provide comments for the parameters you want. Unprovided key names will result in no comment given to the line.

  • fixedParams (list[str]) –

    list of Fourier modes amplitudes and/or phases which must be fixed in GALFIT.

    Example

    Say one wants to fix the amplitude of the Fourier mode 1 and the phase of Fourier mode 2, then one may write

    >>> fixedParams=['1A', '2P']
    

  • noComments (bool) – whether to provide no comments or not

Returns

Azimuthal fourier modes GALFIT configuration as formatted text

Return type

str