ctools 2.1.0.dev
Loading...
Searching...
No Matches
cscripts.modutils Namespace Reference

Functions

 test_source (models, srcname, ra=None, dec=None, fitspat=False, fitspec=False)
 
 normalisation_parameter (model)
 
 ds9attributes (model, free_color='green', fixed_color='magenta', width=2, fontfamily='helvetica', fontsize=12, fontweight='normal', fontslant='roman')
 
 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')
 
 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')
 

Function Documentation

◆ ds9attributes()

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 161 of file modutils.py.

Referenced by cscripts.modutils.model2ds9string().

◆ model2ds9string()

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 211 of file modutils.py.

References cscripts.modutils.ds9attributes().

Referenced by cscripts.modutils.models2ds9file().

◆ models2ds9file()

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 366 of file modutils.py.

References cscripts.modutils.model2ds9string().

◆ normalisation_parameter()

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.

◆ test_source()

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 27 of file modutils.py.