Learn R Programming

ProFit (version 1.3.3)

profitRemakeModellist: Reconstruct an Image Model

Description

This is a convenience function that allows users to easily substitute into a legal image model results from an optimisation run. This can be parsed directly into profitMakeModel. It uses the same conversion functions in the same manner as profitLikeModel so you can create an image model that is fully consistent. These consistent model lists can be used for other analysis, e.g. profitEllipsePlot.

Usage

profitRemakeModellist(parm, modellist, tofit, tolog, intervals, constraints, Data)

Arguments

parm

Vector; required, of parameters that will be inserted into the modellist provided.

modellist

List; required, the basic model list that describes the structure of the object (see profitMakeModel for details).

tofit

List; required, of elements that are being fitted, flagging which elements of modellist will be replaced with parm (see profitSetupData for details).

tolog

List; optional, of elements that are being fitted in log space, flagging which elements of modellist will be replaced with unlogged elements of parm (see profitSetupData for details). If missing then all parameters are assumed to be provided in native linear space.

intervals

List; optional, interval limits for each parameter, using a similar list structure to modellist (see profitSetupData for details). If missing then no interval limits are applied.

constraints

Function; optional, takes the modellist and returns a list with exactly the same structure (see profitSetupData for details). If missing then no constraints are applied.

Data

Data of class profit.data; optional. This must be generated by the profitSetupData function. If the Data structure is present then modellist, tofit, tolog, intervals and constraints are taken from the list items within Data. If they are also provided as separate input arguments then these are used instead, so be careful when mixing and matching.

Value

A list with two elements: modellist; a list with the same structure as modellist; and parm, a vector with the same structure as parm.

See Also

profitMakeModel, profitSetupData, profitLikeModel, profitEllipsePlot

Examples

Run this code
# NOT RUN {
modellist = list(
  sersic = list(
    xcen   = c(50, 50),
    ycen   = c(50, 50),
    mag = c(15, 13),
    re  = c(14, 5),
    nser  = c(3, 10),
    ang  = c(46, 80),
    axrat  = c(0.4, 0.6),
    box = c(0,-0.5)
  )
)

magimage(profitMakeModel(modellist))

tofit = list(
  sersic = list(
    xcen   = c(TRUE, NA),
    ycen   = c(TRUE, NA),
    mag = c(TRUE, FALSE),
    re  = c(TRUE, FALSE),
    nser  = c(TRUE, TRUE),
    ang  = c(FALSE, FALSE),
    axrat  = c(TRUE, FALSE),
    box = c(FALSE, FALSE)
  )
)

parm=c(55,55,12,20,1,4,0.8)

magimage(profitMakeModel(profitRemakeModellist(parm, modellist, tofit)$modellist))
# }

Run the code above in your browser using DataLab