ctools  2.0.0
 All Classes Namespaces Files Functions Variables Macros Pages
cscripts.modutils Namespace Reference

Functions

def test_source
 
def normalisation_parameter
 
def ds9attributes
 
def model2ds9string
 
def models2ds9file
 

Function Documentation

def cscripts.modutils.ds9attributes (   model,
  free_color = 'green',
  fixed_color = 'magenta',
  width = 2,
  fontfamily = 'helvetica',
  fontsize = 12,
  fontweight = 'normal',
  fontslant = 'roman' 
)
Returns attributes for DS9 string

Parameters
----------
model : `~gammalib.GModel`
    Model
free_color : str, optional
    Color for sources with free parameters (any DS9 color or hex code)
fixed_color : str, optional
    Color for source without free parameters (any DS9 color or hex code)
width : int, optional
    Line width for regions
fontfamily : str, optional
    Font family for source labels (helvetica,times,courier)
fontsize : int, optional
    Font size for source labels
fontweight : str, optional
    Font weight for source labels (normal,bold)
fontslant : str, optional
    Font slant for source labels (roman,italic)

Returns
-------
attributes : str
    DS9 attribute string

Definition at line 163 of file modutils.py.

References cscripts.modutils.model2ds9string().

Referenced by cscripts.modutils.model2ds9string(), and cscripts.modutils.normalisation_parameter().

def cscripts.modutils.model2ds9string (   model,
  pnt_type = 'cross',
  pnt_mark_size = 12,
  show_labels = True,
  show_ext_type = True,
  free_color = 'green',
  fixed_color = 'magenta',
  width = 2,
  fontfamily = 'helvetica',
  fontsize = 12,
  fontweight = 'normal',
  fontslant = 'roman' 
)
Converts model into a DS9 region string

Parameters
----------
model : `~gammalib.GModel`
    Model
pnt_type : str, optional
    Marker type for point sources (circle,box,diamond,cross,x,arrow,boxcircle)
pnt_mark_size : integer, optional
    Marker size for point sources
show_labels : boolean, optional
    Add source labels?
show_ext_type : boolean, optional
    Show type of extended model in source name?
free_color : str, optional
    Color for sources with free parameters (any DS9 color or hex code)
fixed_color : str, optional
    Color for source without free parameters (any DS9 color or hex code)
width : int, optional
    Line width for regions
fontfamily : str, optional
    Font family for source labels (helvetica,times,courier)
fontsize : int, optional
    Font size for source labels
fontweight : str, optional
    Font weight for source labels (normal,bold)
fontslant : str, optional
    Font slant for source labels (roman,italic)

Returns
-------
ds9string : str
    DS9 region string
msg : str
    Error message

Definition at line 215 of file modutils.py.

References cscripts.modutils.ds9attributes(), and cscripts.modutils.models2ds9file().

Referenced by cscripts.modutils.ds9attributes(), and cscripts.modutils.models2ds9file().

def cscripts.modutils.models2ds9file (   models,
  filename,
  pnt_type = 'cross',
  pnt_mark_size = 12,
  show_labels = True,
  show_ext_type = True,
  free_color = 'green',
  fixed_color = 'magenta',
  width = 2,
  fontfamily = 'helvetica',
  fontsize = 12,
  fontweight = 'normal',
  fontslant = 'roman' 
)
Save models in a DS9 region file

Parameters
----------
model : `~gammalib.GModel`
    Model
filename : str
    DS9 region file name
pnt_type : str, optional
    Marker type for point sources (circle,box,diamond,cross,x,arrow,boxcircle)
pnt_mark_size : integer, optional
    Marker size for point sources
show_labels : boolean, optional
    Add source labels?
show_ext_type : boolean, optional
    Show type of extended model in source name?
free_color : str, optional
    Color for sources with free parameters (any DS9 color or hex code)
fixed_color : str, optional
    Color for source without free parameters (any DS9 color or hex code)
width : int, optional
    Line width for regions
fontfamily : str, optional
    Font family for source labels (helvetica,times,courier)
fontsize : int, optional
    Font size for source labels
fontweight : str, optional
    Font weight for source labels (normal,bold)
fontslant : str, optional
    Font slant for source labels (roman,italic)

Returns
-------
errors : str
    Error message

Definition at line 371 of file modutils.py.

References cscripts.modutils.model2ds9string().

Referenced by cscripts.modutils.model2ds9string().

def cscripts.modutils.normalisation_parameter (   model)
Return spectral model normalisation parameter

Parameters
----------
model : `~gammalib.GModel`
    Input model

Returns
-------
par : `~gammalib.GModelPar`
    Spectral model normalisation parameter

Definition at line 116 of file modutils.py.

References cscripts.modutils.ds9attributes().

def cscripts.modutils.test_source (   models,
  srcname,
  ra = None,
  dec = None,
  fitspat = False,
  fitspec = False 
)
Return model for TS fitting of a test source

Parameters
----------
models : `~gammalib.GModels`
    Input model container
srcname : str
    Test source name
ra : float, optional
    Right Ascension of test source (deg)
dec : float, optional
    Declination of test source (deg)
fitspat : bool, optional
    Fit spatial parameters of all models?
fitspec : bool, optional
    Fit spectral parameters of all models?

Returns
-------
model : `~gammalib.GModels`
    Model container for TS fitting

Definition at line 28 of file modutils.py.