repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
fermiPy/fermipy | fermipy/utils.py | onesided_cl_to_dlnl | def onesided_cl_to_dlnl(cl):
"""Compute the delta-loglikehood values that corresponds to an
upper limit of the given confidence level.
Parameters
----------
cl : float
Confidence level.
Returns
-------
dlnl : float
Delta-loglikelihood value with respect to the maximum o... | python | def onesided_cl_to_dlnl(cl):
"""Compute the delta-loglikehood values that corresponds to an
upper limit of the given confidence level.
Parameters
----------
cl : float
Confidence level.
Returns
-------
dlnl : float
Delta-loglikelihood value with respect to the maximum o... | [
"def",
"onesided_cl_to_dlnl",
"(",
"cl",
")",
":",
"alpha",
"=",
"1.0",
"-",
"cl",
"return",
"0.5",
"*",
"np",
".",
"power",
"(",
"np",
".",
"sqrt",
"(",
"2.",
")",
"*",
"special",
".",
"erfinv",
"(",
"1",
"-",
"2",
"*",
"alpha",
")",
",",
"2."... | Compute the delta-loglikehood values that corresponds to an
upper limit of the given confidence level.
Parameters
----------
cl : float
Confidence level.
Returns
-------
dlnl : float
Delta-loglikelihood value with respect to the maximum of the
likelihood function. | [
"Compute",
"the",
"delta",
"-",
"loglikehood",
"values",
"that",
"corresponds",
"to",
"an",
"upper",
"limit",
"of",
"the",
"given",
"confidence",
"level",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L576-L592 | train |
fermiPy/fermipy | fermipy/utils.py | split_bin_edges | def split_bin_edges(edges, npts=2):
"""Subdivide an array of bins by splitting each bin into ``npts``
subintervals.
Parameters
----------
edges : `~numpy.ndarray`
Bin edge array.
npts : int
Number of intervals into which each bin will be subdivided.
Returns
-------
... | python | def split_bin_edges(edges, npts=2):
"""Subdivide an array of bins by splitting each bin into ``npts``
subintervals.
Parameters
----------
edges : `~numpy.ndarray`
Bin edge array.
npts : int
Number of intervals into which each bin will be subdivided.
Returns
-------
... | [
"def",
"split_bin_edges",
"(",
"edges",
",",
"npts",
"=",
"2",
")",
":",
"if",
"npts",
"<",
"2",
":",
"return",
"edges",
"x",
"=",
"(",
"edges",
"[",
":",
"-",
"1",
",",
"None",
"]",
"+",
"(",
"edges",
"[",
"1",
":",
",",
"None",
"]",
"-",
... | Subdivide an array of bins by splitting each bin into ``npts``
subintervals.
Parameters
----------
edges : `~numpy.ndarray`
Bin edge array.
npts : int
Number of intervals into which each bin will be subdivided.
Returns
-------
edges : `~numpy.ndarray`
Subdivide... | [
"Subdivide",
"an",
"array",
"of",
"bins",
"by",
"splitting",
"each",
"bin",
"into",
"npts",
"subintervals",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1010-L1034 | train |
fermiPy/fermipy | fermipy/utils.py | extend_array | def extend_array(edges, binsz, lo, hi):
"""Extend an array to encompass lo and hi values."""
numlo = int(np.ceil((edges[0] - lo) / binsz))
numhi = int(np.ceil((hi - edges[-1]) / binsz))
edges = copy.deepcopy(edges)
if numlo > 0:
edges_lo = np.linspace(edges[0] - numlo * binsz, edges[0], nu... | python | def extend_array(edges, binsz, lo, hi):
"""Extend an array to encompass lo and hi values."""
numlo = int(np.ceil((edges[0] - lo) / binsz))
numhi = int(np.ceil((hi - edges[-1]) / binsz))
edges = copy.deepcopy(edges)
if numlo > 0:
edges_lo = np.linspace(edges[0] - numlo * binsz, edges[0], nu... | [
"def",
"extend_array",
"(",
"edges",
",",
"binsz",
",",
"lo",
",",
"hi",
")",
":",
"numlo",
"=",
"int",
"(",
"np",
".",
"ceil",
"(",
"(",
"edges",
"[",
"0",
"]",
"-",
"lo",
")",
"/",
"binsz",
")",
")",
"numhi",
"=",
"int",
"(",
"np",
".",
"... | Extend an array to encompass lo and hi values. | [
"Extend",
"an",
"array",
"to",
"encompass",
"lo",
"and",
"hi",
"values",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1087-L1102 | train |
fermiPy/fermipy | fermipy/utils.py | fits_recarray_to_dict | def fits_recarray_to_dict(table):
"""Convert a FITS recarray to a python dictionary."""
cols = {}
for icol, col in enumerate(table.columns.names):
col_data = table.data[col]
if type(col_data[0]) == np.float32:
cols[col] = np.array(col_data, dtype=float)
elif type(col_da... | python | def fits_recarray_to_dict(table):
"""Convert a FITS recarray to a python dictionary."""
cols = {}
for icol, col in enumerate(table.columns.names):
col_data = table.data[col]
if type(col_data[0]) == np.float32:
cols[col] = np.array(col_data, dtype=float)
elif type(col_da... | [
"def",
"fits_recarray_to_dict",
"(",
"table",
")",
":",
"cols",
"=",
"{",
"}",
"for",
"icol",
",",
"col",
"in",
"enumerate",
"(",
"table",
".",
"columns",
".",
"names",
")",
":",
"col_data",
"=",
"table",
".",
"data",
"[",
"col",
"]",
"if",
"type",
... | Convert a FITS recarray to a python dictionary. | [
"Convert",
"a",
"FITS",
"recarray",
"to",
"a",
"python",
"dictionary",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1111-L1134 | train |
fermiPy/fermipy | fermipy/utils.py | merge_dict | def merge_dict(d0, d1, add_new_keys=False, append_arrays=False):
"""Recursively merge the contents of python dictionary d0 with
the contents of another python dictionary, d1.
Parameters
----------
d0 : dict
The input dictionary.
d1 : dict
Dictionary to be merged with the input di... | python | def merge_dict(d0, d1, add_new_keys=False, append_arrays=False):
"""Recursively merge the contents of python dictionary d0 with
the contents of another python dictionary, d1.
Parameters
----------
d0 : dict
The input dictionary.
d1 : dict
Dictionary to be merged with the input di... | [
"def",
"merge_dict",
"(",
"d0",
",",
"d1",
",",
"add_new_keys",
"=",
"False",
",",
"append_arrays",
"=",
"False",
")",
":",
"if",
"d1",
"is",
"None",
":",
"return",
"d0",
"elif",
"d0",
"is",
"None",
":",
"return",
"d1",
"elif",
"d0",
"is",
"None",
... | Recursively merge the contents of python dictionary d0 with
the contents of another python dictionary, d1.
Parameters
----------
d0 : dict
The input dictionary.
d1 : dict
Dictionary to be merged with the input dictionary.
add_new_keys : str
Do not skip keys that only exis... | [
"Recursively",
"merge",
"the",
"contents",
"of",
"python",
"dictionary",
"d0",
"with",
"the",
"contents",
"of",
"another",
"python",
"dictionary",
"d1",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1239-L1302 | train |
fermiPy/fermipy | fermipy/utils.py | tolist | def tolist(x):
""" convenience function that takes in a
nested structure of lists and dictionaries
and converts everything to its base objects.
This is useful for dupming a file to yaml.
(a) numpy arrays into python lists
>>> type(tolist(np.asarray(123))) == int
... | python | def tolist(x):
""" convenience function that takes in a
nested structure of lists and dictionaries
and converts everything to its base objects.
This is useful for dupming a file to yaml.
(a) numpy arrays into python lists
>>> type(tolist(np.asarray(123))) == int
... | [
"def",
"tolist",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"list",
")",
":",
"return",
"map",
"(",
"tolist",
",",
"x",
")",
"elif",
"isinstance",
"(",
"x",
",",
"dict",
")",
":",
"return",
"dict",
"(",
"(",
"tolist",
"(",
"k",
")",... | convenience function that takes in a
nested structure of lists and dictionaries
and converts everything to its base objects.
This is useful for dupming a file to yaml.
(a) numpy arrays into python lists
>>> type(tolist(np.asarray(123))) == int
True
>... | [
"convenience",
"function",
"that",
"takes",
"in",
"a",
"nested",
"structure",
"of",
"lists",
"and",
"dictionaries",
"and",
"converts",
"everything",
"to",
"its",
"base",
"objects",
".",
"This",
"is",
"useful",
"for",
"dupming",
"a",
"file",
"to",
"yaml",
"."... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1316-L1383 | train |
fermiPy/fermipy | fermipy/utils.py | make_gaussian_kernel | def make_gaussian_kernel(sigma, npix=501, cdelt=0.01, xpix=None, ypix=None):
"""Make kernel for a 2D gaussian.
Parameters
----------
sigma : float
Standard deviation in degrees.
"""
sigma /= cdelt
def fn(t, s): return 1. / (2 * np.pi * s ** 2) * np.exp(
-t ** 2 / (s ** 2 * ... | python | def make_gaussian_kernel(sigma, npix=501, cdelt=0.01, xpix=None, ypix=None):
"""Make kernel for a 2D gaussian.
Parameters
----------
sigma : float
Standard deviation in degrees.
"""
sigma /= cdelt
def fn(t, s): return 1. / (2 * np.pi * s ** 2) * np.exp(
-t ** 2 / (s ** 2 * ... | [
"def",
"make_gaussian_kernel",
"(",
"sigma",
",",
"npix",
"=",
"501",
",",
"cdelt",
"=",
"0.01",
",",
"xpix",
"=",
"None",
",",
"ypix",
"=",
"None",
")",
":",
"sigma",
"/=",
"cdelt",
"def",
"fn",
"(",
"t",
",",
"s",
")",
":",
"return",
"1.",
"/",... | Make kernel for a 2D gaussian.
Parameters
----------
sigma : float
Standard deviation in degrees. | [
"Make",
"kernel",
"for",
"a",
"2D",
"gaussian",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1542-L1560 | train |
fermiPy/fermipy | fermipy/utils.py | make_disk_kernel | def make_disk_kernel(radius, npix=501, cdelt=0.01, xpix=None, ypix=None):
"""Make kernel for a 2D disk.
Parameters
----------
radius : float
Disk radius in deg.
"""
radius /= cdelt
def fn(t, s): return 0.5 * (np.sign(s - t) + 1.0)
dxy = make_pixel_distance(npix, xpix, ypix)
... | python | def make_disk_kernel(radius, npix=501, cdelt=0.01, xpix=None, ypix=None):
"""Make kernel for a 2D disk.
Parameters
----------
radius : float
Disk radius in deg.
"""
radius /= cdelt
def fn(t, s): return 0.5 * (np.sign(s - t) + 1.0)
dxy = make_pixel_distance(npix, xpix, ypix)
... | [
"def",
"make_disk_kernel",
"(",
"radius",
",",
"npix",
"=",
"501",
",",
"cdelt",
"=",
"0.01",
",",
"xpix",
"=",
"None",
",",
"ypix",
"=",
"None",
")",
":",
"radius",
"/=",
"cdelt",
"def",
"fn",
"(",
"t",
",",
"s",
")",
":",
"return",
"0.5",
"*",
... | Make kernel for a 2D disk.
Parameters
----------
radius : float
Disk radius in deg. | [
"Make",
"kernel",
"for",
"a",
"2D",
"disk",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1563-L1581 | train |
fermiPy/fermipy | fermipy/utils.py | make_cdisk_kernel | def make_cdisk_kernel(psf, sigma, npix, cdelt, xpix, ypix, psf_scale_fn=None,
normalize=False):
"""Make a kernel for a PSF-convolved 2D disk.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
sigma : float
68% containment radius in degrees.
"""
sigma /= 0.8... | python | def make_cdisk_kernel(psf, sigma, npix, cdelt, xpix, ypix, psf_scale_fn=None,
normalize=False):
"""Make a kernel for a PSF-convolved 2D disk.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
sigma : float
68% containment radius in degrees.
"""
sigma /= 0.8... | [
"def",
"make_cdisk_kernel",
"(",
"psf",
",",
"sigma",
",",
"npix",
",",
"cdelt",
",",
"xpix",
",",
"ypix",
",",
"psf_scale_fn",
"=",
"None",
",",
"normalize",
"=",
"False",
")",
":",
"sigma",
"/=",
"0.8246211251235321",
"dtheta",
"=",
"psf",
".",
"dtheta... | Make a kernel for a PSF-convolved 2D disk.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
sigma : float
68% containment radius in degrees. | [
"Make",
"a",
"kernel",
"for",
"a",
"PSF",
"-",
"convolved",
"2D",
"disk",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1584-L1614 | train |
fermiPy/fermipy | fermipy/utils.py | make_radial_kernel | def make_radial_kernel(psf, fn, sigma, npix, cdelt, xpix, ypix, psf_scale_fn=None,
normalize=False, klims=None, sparse=False):
"""Make a kernel for a general radially symmetric 2D function.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
fn : callable
Function ... | python | def make_radial_kernel(psf, fn, sigma, npix, cdelt, xpix, ypix, psf_scale_fn=None,
normalize=False, klims=None, sparse=False):
"""Make a kernel for a general radially symmetric 2D function.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
fn : callable
Function ... | [
"def",
"make_radial_kernel",
"(",
"psf",
",",
"fn",
",",
"sigma",
",",
"npix",
",",
"cdelt",
",",
"xpix",
",",
"ypix",
",",
"psf_scale_fn",
"=",
"None",
",",
"normalize",
"=",
"False",
",",
"klims",
"=",
"None",
",",
"sparse",
"=",
"False",
")",
":",... | Make a kernel for a general radially symmetric 2D function.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
fn : callable
Function that evaluates the kernel at a radial coordinate r.
sigma : float
68% containment radius in degrees. | [
"Make",
"a",
"kernel",
"for",
"a",
"general",
"radially",
"symmetric",
"2D",
"function",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1663-L1738 | train |
fermiPy/fermipy | fermipy/utils.py | make_psf_kernel | def make_psf_kernel(psf, npix, cdelt, xpix, ypix, psf_scale_fn=None, normalize=False):
"""
Generate a kernel for a point-source.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
npix : int
Number of pixels in X and Y dimensions.
cdelt : float
Pixel size in degrees.
... | python | def make_psf_kernel(psf, npix, cdelt, xpix, ypix, psf_scale_fn=None, normalize=False):
"""
Generate a kernel for a point-source.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
npix : int
Number of pixels in X and Y dimensions.
cdelt : float
Pixel size in degrees.
... | [
"def",
"make_psf_kernel",
"(",
"psf",
",",
"npix",
",",
"cdelt",
",",
"xpix",
",",
"ypix",
",",
"psf_scale_fn",
"=",
"None",
",",
"normalize",
"=",
"False",
")",
":",
"egy",
"=",
"psf",
".",
"energies",
"x",
"=",
"make_pixel_distance",
"(",
"npix",
","... | Generate a kernel for a point-source.
Parameters
----------
psf : `~fermipy.irfs.PSFModel`
npix : int
Number of pixels in X and Y dimensions.
cdelt : float
Pixel size in degrees. | [
"Generate",
"a",
"kernel",
"for",
"a",
"point",
"-",
"source",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1777-L1805 | train |
fermiPy/fermipy | fermipy/utils.py | overlap_slices | def overlap_slices(large_array_shape, small_array_shape, position):
"""
Modified version of `~astropy.nddata.utils.overlap_slices`.
Get slices for the overlapping part of a small and a large array.
Given a certain position of the center of the small array, with
respect to the large array, tuples o... | python | def overlap_slices(large_array_shape, small_array_shape, position):
"""
Modified version of `~astropy.nddata.utils.overlap_slices`.
Get slices for the overlapping part of a small and a large array.
Given a certain position of the center of the small array, with
respect to the large array, tuples o... | [
"def",
"overlap_slices",
"(",
"large_array_shape",
",",
"small_array_shape",
",",
"position",
")",
":",
"edges_min",
"=",
"[",
"int",
"(",
"pos",
"-",
"small_shape",
"//",
"2",
")",
"for",
"(",
"pos",
",",
"small_shape",
")",
"in",
"zip",
"(",
"position",
... | Modified version of `~astropy.nddata.utils.overlap_slices`.
Get slices for the overlapping part of a small and a large array.
Given a certain position of the center of the small array, with
respect to the large array, tuples of slices are returned which can be
used to extract, add or subtract the smal... | [
"Modified",
"version",
"of",
"~astropy",
".",
"nddata",
".",
"utils",
".",
"overlap_slices",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L1828-L1878 | train |
fermiPy/fermipy | fermipy/diffuse/model_manager.py | make_library | def make_library(**kwargs):
"""Build and return a ModelManager object and fill the associated model library
"""
library_yaml = kwargs.pop('library', 'models/library.yaml')
comp_yaml = kwargs.pop('comp', 'config/binning.yaml')
basedir = kwargs.pop('basedir', os.path.abspath('.'))
model_man = kwa... | python | def make_library(**kwargs):
"""Build and return a ModelManager object and fill the associated model library
"""
library_yaml = kwargs.pop('library', 'models/library.yaml')
comp_yaml = kwargs.pop('comp', 'config/binning.yaml')
basedir = kwargs.pop('basedir', os.path.abspath('.'))
model_man = kwa... | [
"def",
"make_library",
"(",
"**",
"kwargs",
")",
":",
"library_yaml",
"=",
"kwargs",
".",
"pop",
"(",
"'library'",
",",
"'models/library.yaml'",
")",
"comp_yaml",
"=",
"kwargs",
".",
"pop",
"(",
"'comp'",
",",
"'config/binning.yaml'",
")",
"basedir",
"=",
"k... | Build and return a ModelManager object and fill the associated model library | [
"Build",
"and",
"return",
"a",
"ModelManager",
"object",
"and",
"fill",
"the",
"associated",
"model",
"library"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/model_manager.py#L472-L484 | train |
fermiPy/fermipy | fermipy/diffuse/model_manager.py | ModelInfo.edisp_disable_list | def edisp_disable_list(self):
""" Return the list of source for which energy dispersion should be turned off """
l = []
for model_comp in self.model_components.values():
if model_comp.edisp_disable:
l += [model_comp.info.source_name]
return l | python | def edisp_disable_list(self):
""" Return the list of source for which energy dispersion should be turned off """
l = []
for model_comp in self.model_components.values():
if model_comp.edisp_disable:
l += [model_comp.info.source_name]
return l | [
"def",
"edisp_disable_list",
"(",
"self",
")",
":",
"l",
"=",
"[",
"]",
"for",
"model_comp",
"in",
"self",
".",
"model_components",
".",
"values",
"(",
")",
":",
"if",
"model_comp",
".",
"edisp_disable",
":",
"l",
"+=",
"[",
"model_comp",
".",
"info",
... | Return the list of source for which energy dispersion should be turned off | [
"Return",
"the",
"list",
"of",
"source",
"for",
"which",
"energy",
"dispersion",
"should",
"be",
"turned",
"off"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/model_manager.py#L66-L72 | train |
fermiPy/fermipy | fermipy/diffuse/model_manager.py | ModelInfo.make_model_rois | def make_model_rois(self, components, name_factory):
""" Make the fermipy roi_model objects for each of a set of binning components """
ret_dict = {}
# Figure out which sources need to be split by components
master_roi_source_info = {}
sub_comp_sources = {}
for comp_name... | python | def make_model_rois(self, components, name_factory):
""" Make the fermipy roi_model objects for each of a set of binning components """
ret_dict = {}
# Figure out which sources need to be split by components
master_roi_source_info = {}
sub_comp_sources = {}
for comp_name... | [
"def",
"make_model_rois",
"(",
"self",
",",
"components",
",",
"name_factory",
")",
":",
"ret_dict",
"=",
"{",
"}",
"master_roi_source_info",
"=",
"{",
"}",
"sub_comp_sources",
"=",
"{",
"}",
"for",
"comp_name",
",",
"model_comp",
"in",
"self",
".",
"model_c... | Make the fermipy roi_model objects for each of a set of binning components | [
"Make",
"the",
"fermipy",
"roi_model",
"objects",
"for",
"each",
"of",
"a",
"set",
"of",
"binning",
"components"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/model_manager.py#L127-L177 | train |
fermiPy/fermipy | fermipy/diffuse/model_manager.py | ModelManager.read_model_yaml | def read_model_yaml(self, modelkey):
""" Read the yaml file for the diffuse components
"""
model_yaml = self._name_factory.model_yaml(modelkey=modelkey,
fullpath=True)
model = yaml.safe_load(open(model_yaml))
return model | python | def read_model_yaml(self, modelkey):
""" Read the yaml file for the diffuse components
"""
model_yaml = self._name_factory.model_yaml(modelkey=modelkey,
fullpath=True)
model = yaml.safe_load(open(model_yaml))
return model | [
"def",
"read_model_yaml",
"(",
"self",
",",
"modelkey",
")",
":",
"model_yaml",
"=",
"self",
".",
"_name_factory",
".",
"model_yaml",
"(",
"modelkey",
"=",
"modelkey",
",",
"fullpath",
"=",
"True",
")",
"model",
"=",
"yaml",
".",
"safe_load",
"(",
"open",
... | Read the yaml file for the diffuse components | [
"Read",
"the",
"yaml",
"file",
"for",
"the",
"diffuse",
"components"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/model_manager.py#L209-L215 | train |
fermiPy/fermipy | fermipy/diffuse/model_manager.py | ModelManager.make_library | def make_library(self, diffuse_yaml, catalog_yaml, binning_yaml):
""" Build up the library of all the components
Parameters
----------
diffuse_yaml : str
Name of the yaml file with the library of diffuse component definitions
catalog_yaml : str
Name of t... | python | def make_library(self, diffuse_yaml, catalog_yaml, binning_yaml):
""" Build up the library of all the components
Parameters
----------
diffuse_yaml : str
Name of the yaml file with the library of diffuse component definitions
catalog_yaml : str
Name of t... | [
"def",
"make_library",
"(",
"self",
",",
"diffuse_yaml",
",",
"catalog_yaml",
",",
"binning_yaml",
")",
":",
"ret_dict",
"=",
"{",
"}",
"components_dict",
"=",
"Component",
".",
"build_from_yamlfile",
"(",
"binning_yaml",
")",
"diffuse_ret_dict",
"=",
"make_diffus... | Build up the library of all the components
Parameters
----------
diffuse_yaml : str
Name of the yaml file with the library of diffuse component definitions
catalog_yaml : str
Name of the yaml file width the library of catalog split definitions
binning_ya... | [
"Build",
"up",
"the",
"library",
"of",
"all",
"the",
"components"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/model_manager.py#L232-L257 | train |
fermiPy/fermipy | fermipy/diffuse/model_manager.py | ModelManager.make_model_info | def make_model_info(self, modelkey):
""" Build a dictionary with the information for a particular model.
Parameters
----------
modelkey : str
Key used to identify this particular model
Return `ModelInfo`
"""
model = self.read_model_yaml(modelkey)
... | python | def make_model_info(self, modelkey):
""" Build a dictionary with the information for a particular model.
Parameters
----------
modelkey : str
Key used to identify this particular model
Return `ModelInfo`
"""
model = self.read_model_yaml(modelkey)
... | [
"def",
"make_model_info",
"(",
"self",
",",
"modelkey",
")",
":",
"model",
"=",
"self",
".",
"read_model_yaml",
"(",
"modelkey",
")",
"sources",
"=",
"model",
"[",
"'sources'",
"]",
"components",
"=",
"OrderedDict",
"(",
")",
"spec_model_yaml",
"=",
"self",
... | Build a dictionary with the information for a particular model.
Parameters
----------
modelkey : str
Key used to identify this particular model
Return `ModelInfo` | [
"Build",
"a",
"dictionary",
"with",
"the",
"information",
"for",
"a",
"particular",
"model",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/model_manager.py#L259-L314 | train |
fermiPy/fermipy | fermipy/diffuse/model_manager.py | ModelManager.get_sub_comp_info | def get_sub_comp_info(source_info, comp):
"""Build and return information about a sub-component for a particular selection
"""
sub_comps = source_info.get('components', None)
if sub_comps is None:
return source_info.copy()
moving = source_info.get('moving', False)
... | python | def get_sub_comp_info(source_info, comp):
"""Build and return information about a sub-component for a particular selection
"""
sub_comps = source_info.get('components', None)
if sub_comps is None:
return source_info.copy()
moving = source_info.get('moving', False)
... | [
"def",
"get_sub_comp_info",
"(",
"source_info",
",",
"comp",
")",
":",
"sub_comps",
"=",
"source_info",
".",
"get",
"(",
"'components'",
",",
"None",
")",
"if",
"sub_comps",
"is",
"None",
":",
"return",
"source_info",
".",
"copy",
"(",
")",
"moving",
"=",
... | Build and return information about a sub-component for a particular selection | [
"Build",
"and",
"return",
"information",
"about",
"a",
"sub",
"-",
"component",
"for",
"a",
"particular",
"selection"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/model_manager.py#L455-L469 | train |
fermiPy/fermipy | fermipy/validate/utils.py | replace_aliases | def replace_aliases(cut_dict, aliases):
"""Substitute aliases in a cut dictionary."""
for k, v in cut_dict.items():
for k0, v0 in aliases.items():
cut_dict[k] = cut_dict[k].replace(k0, '(%s)' % v0) | python | def replace_aliases(cut_dict, aliases):
"""Substitute aliases in a cut dictionary."""
for k, v in cut_dict.items():
for k0, v0 in aliases.items():
cut_dict[k] = cut_dict[k].replace(k0, '(%s)' % v0) | [
"def",
"replace_aliases",
"(",
"cut_dict",
",",
"aliases",
")",
":",
"for",
"k",
",",
"v",
"in",
"cut_dict",
".",
"items",
"(",
")",
":",
"for",
"k0",
",",
"v0",
"in",
"aliases",
".",
"items",
"(",
")",
":",
"cut_dict",
"[",
"k",
"]",
"=",
"cut_d... | Substitute aliases in a cut dictionary. | [
"Substitute",
"aliases",
"in",
"a",
"cut",
"dictionary",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/validate/utils.py#L25-L29 | train |
fermiPy/fermipy | fermipy/validate/utils.py | get_files | def get_files(files, extnames=['.root']):
"""Extract a list of file paths from a list containing both paths
and file lists with one path per line."""
files_out = []
for f in files:
mime = mimetypes.guess_type(f)
if os.path.splitext(f)[1] in extnames:
files_out += [f]
... | python | def get_files(files, extnames=['.root']):
"""Extract a list of file paths from a list containing both paths
and file lists with one path per line."""
files_out = []
for f in files:
mime = mimetypes.guess_type(f)
if os.path.splitext(f)[1] in extnames:
files_out += [f]
... | [
"def",
"get_files",
"(",
"files",
",",
"extnames",
"=",
"[",
"'.root'",
"]",
")",
":",
"files_out",
"=",
"[",
"]",
"for",
"f",
"in",
"files",
":",
"mime",
"=",
"mimetypes",
".",
"guess_type",
"(",
"f",
")",
"if",
"os",
".",
"path",
".",
"splitext",... | Extract a list of file paths from a list containing both paths
and file lists with one path per line. | [
"Extract",
"a",
"list",
"of",
"file",
"paths",
"from",
"a",
"list",
"containing",
"both",
"paths",
"and",
"file",
"lists",
"with",
"one",
"path",
"per",
"line",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/validate/utils.py#L37-L52 | train |
fermiPy/fermipy | fermipy/validate/utils.py | get_cuts_from_xml | def get_cuts_from_xml(xmlfile):
"""Extract event selection strings from the XML file."""
root = ElementTree.ElementTree(file=xmlfile).getroot()
event_maps = root.findall('EventMap')
alias_maps = root.findall('AliasDict')[0]
event_classes = {}
event_types = {}
event_aliases = {}
for m ... | python | def get_cuts_from_xml(xmlfile):
"""Extract event selection strings from the XML file."""
root = ElementTree.ElementTree(file=xmlfile).getroot()
event_maps = root.findall('EventMap')
alias_maps = root.findall('AliasDict')[0]
event_classes = {}
event_types = {}
event_aliases = {}
for m ... | [
"def",
"get_cuts_from_xml",
"(",
"xmlfile",
")",
":",
"root",
"=",
"ElementTree",
".",
"ElementTree",
"(",
"file",
"=",
"xmlfile",
")",
".",
"getroot",
"(",
")",
"event_maps",
"=",
"root",
".",
"findall",
"(",
"'EventMap'",
")",
"alias_maps",
"=",
"root",
... | Extract event selection strings from the XML file. | [
"Extract",
"event",
"selection",
"strings",
"from",
"the",
"XML",
"file",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/validate/utils.py#L84-L117 | train |
fermiPy/fermipy | fermipy/validate/utils.py | set_event_list | def set_event_list(tree, selection=None, fraction=None, start_fraction=None):
"""
Set the event list for a tree or chain.
Parameters
----------
tree : `ROOT.TTree`
Input tree/chain.
selection : str
Cut string defining the event list.
fraction : float
Fraction of ... | python | def set_event_list(tree, selection=None, fraction=None, start_fraction=None):
"""
Set the event list for a tree or chain.
Parameters
----------
tree : `ROOT.TTree`
Input tree/chain.
selection : str
Cut string defining the event list.
fraction : float
Fraction of ... | [
"def",
"set_event_list",
"(",
"tree",
",",
"selection",
"=",
"None",
",",
"fraction",
"=",
"None",
",",
"start_fraction",
"=",
"None",
")",
":",
"import",
"ROOT",
"elist",
"=",
"rand_str",
"(",
")",
"if",
"selection",
"is",
"None",
":",
"cuts",
"=",
"'... | Set the event list for a tree or chain.
Parameters
----------
tree : `ROOT.TTree`
Input tree/chain.
selection : str
Cut string defining the event list.
fraction : float
Fraction of the total file to include in the event list
starting from the *end* of the file. | [
"Set",
"the",
"event",
"list",
"for",
"a",
"tree",
"or",
"chain",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/validate/utils.py#L120-L160 | train |
fermiPy/fermipy | fermipy/sourcefind.py | SourceFind.localize | def localize(self, name, **kwargs):
"""Find the best-fit position of a source. Localization is
performed in two steps. First a TS map is computed centered
on the source with half-width set by ``dtheta_max``. A fit is
then performed to the maximum TS peak in this map. The source
... | python | def localize(self, name, **kwargs):
"""Find the best-fit position of a source. Localization is
performed in two steps. First a TS map is computed centered
on the source with half-width set by ``dtheta_max``. A fit is
then performed to the maximum TS peak in this map. The source
... | [
"def",
"localize",
"(",
"self",
",",
"name",
",",
"**",
"kwargs",
")",
":",
"timer",
"=",
"Timer",
".",
"create",
"(",
"start",
"=",
"True",
")",
"name",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
".",
"name",
"schema",
"... | Find the best-fit position of a source. Localization is
performed in two steps. First a TS map is computed centered
on the source with half-width set by ``dtheta_max``. A fit is
then performed to the maximum TS peak in this map. The source
position is then further refined by scanning... | [
"Find",
"the",
"best",
"-",
"fit",
"position",
"of",
"a",
"source",
".",
"Localization",
"is",
"performed",
"in",
"two",
"steps",
".",
"First",
"a",
"TS",
"map",
"is",
"computed",
"centered",
"on",
"the",
"source",
"with",
"half",
"-",
"width",
"set",
... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/sourcefind.py#L237-L301 | train |
fermiPy/fermipy | fermipy/sourcefind.py | SourceFind._fit_position_tsmap | def _fit_position_tsmap(self, name, **kwargs):
"""Localize a source from its TS map."""
prefix = kwargs.get('prefix', '')
dtheta_max = kwargs.get('dtheta_max', 0.5)
zmin = kwargs.get('zmin', -3.0)
kw = {
'map_size': 2.0 * dtheta_max,
'write_fits': kwarg... | python | def _fit_position_tsmap(self, name, **kwargs):
"""Localize a source from its TS map."""
prefix = kwargs.get('prefix', '')
dtheta_max = kwargs.get('dtheta_max', 0.5)
zmin = kwargs.get('zmin', -3.0)
kw = {
'map_size': 2.0 * dtheta_max,
'write_fits': kwarg... | [
"def",
"_fit_position_tsmap",
"(",
"self",
",",
"name",
",",
"**",
"kwargs",
")",
":",
"prefix",
"=",
"kwargs",
".",
"get",
"(",
"'prefix'",
",",
"''",
")",
"dtheta_max",
"=",
"kwargs",
".",
"get",
"(",
"'dtheta_max'",
",",
"0.5",
")",
"zmin",
"=",
"... | Localize a source from its TS map. | [
"Localize",
"a",
"source",
"from",
"its",
"TS",
"map",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/sourcefind.py#L503-L562 | train |
fermiPy/fermipy | fermipy/jobs/slac_impl.py | get_lsf_status | def get_lsf_status():
"""Count and print the number of jobs in various LSF states
"""
status_count = {'RUN': 0,
'PEND': 0,
'SUSP': 0,
'USUSP': 0,
'NJOB': 0,
'UNKNWN': 0}
try:
subproc = subprocess... | python | def get_lsf_status():
"""Count and print the number of jobs in various LSF states
"""
status_count = {'RUN': 0,
'PEND': 0,
'SUSP': 0,
'USUSP': 0,
'NJOB': 0,
'UNKNWN': 0}
try:
subproc = subprocess... | [
"def",
"get_lsf_status",
"(",
")",
":",
"status_count",
"=",
"{",
"'RUN'",
":",
"0",
",",
"'PEND'",
":",
"0",
",",
"'SUSP'",
":",
"0",
",",
"'USUSP'",
":",
"0",
",",
"'NJOB'",
":",
"0",
",",
"'UNKNWN'",
":",
"0",
"}",
"try",
":",
"subproc",
"=",
... | Count and print the number of jobs in various LSF states | [
"Count",
"and",
"print",
"the",
"number",
"of",
"jobs",
"in",
"various",
"LSF",
"states"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/slac_impl.py#L44-L75 | train |
fermiPy/fermipy | fermipy/jobs/slac_impl.py | build_bsub_command | def build_bsub_command(command_template, lsf_args):
"""Build and return a lsf batch command template
The structure will be 'bsub -s <key> <value> <command_template>'
where <key> and <value> refer to items in lsf_args
"""
if command_template is None:
return ""
full_command = 'bsub -o... | python | def build_bsub_command(command_template, lsf_args):
"""Build and return a lsf batch command template
The structure will be 'bsub -s <key> <value> <command_template>'
where <key> and <value> refer to items in lsf_args
"""
if command_template is None:
return ""
full_command = 'bsub -o... | [
"def",
"build_bsub_command",
"(",
"command_template",
",",
"lsf_args",
")",
":",
"if",
"command_template",
"is",
"None",
":",
"return",
"\"\"",
"full_command",
"=",
"'bsub -o {logfile}'",
"for",
"key",
",",
"value",
"in",
"lsf_args",
".",
"items",
"(",
")",
":... | Build and return a lsf batch command template
The structure will be 'bsub -s <key> <value> <command_template>'
where <key> and <value> refer to items in lsf_args | [
"Build",
"and",
"return",
"a",
"lsf",
"batch",
"command",
"template"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/slac_impl.py#L78-L92 | train |
fermiPy/fermipy | fermipy/jobs/slac_impl.py | SlacInterface.dispatch_job_hook | def dispatch_job_hook(self, link, key, job_config, logfile, stream=sys.stdout):
"""Send a single job to the LSF batch
Parameters
----------
link : `fermipy.jobs.chain.Link`
The link used to invoke the command we are running
key : str
A string that ident... | python | def dispatch_job_hook(self, link, key, job_config, logfile, stream=sys.stdout):
"""Send a single job to the LSF batch
Parameters
----------
link : `fermipy.jobs.chain.Link`
The link used to invoke the command we are running
key : str
A string that ident... | [
"def",
"dispatch_job_hook",
"(",
"self",
",",
"link",
",",
"key",
",",
"job_config",
",",
"logfile",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"full_sub_dict",
"=",
"job_config",
".",
"copy",
"(",
")",
"if",
"self",
".",
"_no_batch",
":",
"fu... | Send a single job to the LSF batch
Parameters
----------
link : `fermipy.jobs.chain.Link`
The link used to invoke the command we are running
key : str
A string that identifies this particular instance of the job
job_config : dict
A dictionr... | [
"Send",
"a",
"single",
"job",
"to",
"the",
"LSF",
"batch"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/slac_impl.py#L128-L174 | train |
fermiPy/fermipy | fermipy/jobs/slac_impl.py | SlacInterface.submit_jobs | def submit_jobs(self, link, job_dict=None, job_archive=None, stream=sys.stdout):
"""Submit all the jobs in job_dict """
if link is None:
return JobStatus.no_job
if job_dict is None:
job_keys = link.jobs.keys()
else:
job_keys = sorted(job_dict.keys())
... | python | def submit_jobs(self, link, job_dict=None, job_archive=None, stream=sys.stdout):
"""Submit all the jobs in job_dict """
if link is None:
return JobStatus.no_job
if job_dict is None:
job_keys = link.jobs.keys()
else:
job_keys = sorted(job_dict.keys())
... | [
"def",
"submit_jobs",
"(",
"self",
",",
"link",
",",
"job_dict",
"=",
"None",
",",
"job_archive",
"=",
"None",
",",
"stream",
"=",
"sys",
".",
"stdout",
")",
":",
"if",
"link",
"is",
"None",
":",
"return",
"JobStatus",
".",
"no_job",
"if",
"job_dict",
... | Submit all the jobs in job_dict | [
"Submit",
"all",
"the",
"jobs",
"in",
"job_dict"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/slac_impl.py#L176-L239 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | create_sc_table | def create_sc_table(scfile, colnames=None):
"""Load an FT2 file from a file or list of files."""
if utils.is_fits_file(scfile) and colnames is None:
return create_table_from_fits(scfile, 'SC_DATA')
if utils.is_fits_file(scfile):
files = [scfile]
else:
files = [line.strip() for ... | python | def create_sc_table(scfile, colnames=None):
"""Load an FT2 file from a file or list of files."""
if utils.is_fits_file(scfile) and colnames is None:
return create_table_from_fits(scfile, 'SC_DATA')
if utils.is_fits_file(scfile):
files = [scfile]
else:
files = [line.strip() for ... | [
"def",
"create_sc_table",
"(",
"scfile",
",",
"colnames",
"=",
"None",
")",
":",
"if",
"utils",
".",
"is_fits_file",
"(",
"scfile",
")",
"and",
"colnames",
"is",
"None",
":",
"return",
"create_table_from_fits",
"(",
"scfile",
",",
"'SC_DATA'",
")",
"if",
"... | Load an FT2 file from a file or list of files. | [
"Load",
"an",
"FT2",
"file",
"from",
"a",
"file",
"or",
"list",
"of",
"files",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L134-L148 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | create_table_from_fits | def create_table_from_fits(fitsfile, hduname, colnames=None):
"""Memory efficient function for loading a table from a FITS
file."""
if colnames is None:
return Table.read(fitsfile, hduname)
cols = []
with fits.open(fitsfile, memmap=True) as h:
for k in colnames:
data = ... | python | def create_table_from_fits(fitsfile, hduname, colnames=None):
"""Memory efficient function for loading a table from a FITS
file."""
if colnames is None:
return Table.read(fitsfile, hduname)
cols = []
with fits.open(fitsfile, memmap=True) as h:
for k in colnames:
data = ... | [
"def",
"create_table_from_fits",
"(",
"fitsfile",
",",
"hduname",
",",
"colnames",
"=",
"None",
")",
":",
"if",
"colnames",
"is",
"None",
":",
"return",
"Table",
".",
"read",
"(",
"fitsfile",
",",
"hduname",
")",
"cols",
"=",
"[",
"]",
"with",
"fits",
... | Memory efficient function for loading a table from a FITS
file. | [
"Memory",
"efficient",
"function",
"for",
"loading",
"a",
"table",
"from",
"a",
"FITS",
"file",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L151-L163 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | get_spectral_index | def get_spectral_index(src, egy):
"""Compute the local spectral index of a source."""
delta = 1E-5
f0 = src.spectrum()(pyLike.dArg(egy * (1 - delta)))
f1 = src.spectrum()(pyLike.dArg(egy * (1 + delta)))
if f0 > 0 and f1 > 0:
gamma = np.log10(f0 / f1) / np.log10((1 - delta) / (1 + delta))
... | python | def get_spectral_index(src, egy):
"""Compute the local spectral index of a source."""
delta = 1E-5
f0 = src.spectrum()(pyLike.dArg(egy * (1 - delta)))
f1 = src.spectrum()(pyLike.dArg(egy * (1 + delta)))
if f0 > 0 and f1 > 0:
gamma = np.log10(f0 / f1) / np.log10((1 - delta) / (1 + delta))
... | [
"def",
"get_spectral_index",
"(",
"src",
",",
"egy",
")",
":",
"delta",
"=",
"1E-5",
"f0",
"=",
"src",
".",
"spectrum",
"(",
")",
"(",
"pyLike",
".",
"dArg",
"(",
"egy",
"*",
"(",
"1",
"-",
"delta",
")",
")",
")",
"f1",
"=",
"src",
".",
"spectr... | Compute the local spectral index of a source. | [
"Compute",
"the",
"local",
"spectral",
"index",
"of",
"a",
"source",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L166-L177 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.create | def create(cls, infile, config=None, params=None, mask=None):
"""Create a new instance of GTAnalysis from an analysis output file
generated with `~fermipy.GTAnalysis.write_roi`. By default
the new instance will inherit the configuration of the saved
analysis instance. The configuration... | python | def create(cls, infile, config=None, params=None, mask=None):
"""Create a new instance of GTAnalysis from an analysis output file
generated with `~fermipy.GTAnalysis.write_roi`. By default
the new instance will inherit the configuration of the saved
analysis instance. The configuration... | [
"def",
"create",
"(",
"cls",
",",
"infile",
",",
"config",
"=",
"None",
",",
"params",
"=",
"None",
",",
"mask",
"=",
"None",
")",
":",
"infile",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"infile",
")",
"roi_file",
",",
"roi_data",
"=",
"utils",... | Create a new instance of GTAnalysis from an analysis output file
generated with `~fermipy.GTAnalysis.write_roi`. By default
the new instance will inherit the configuration of the saved
analysis instance. The configuration may be overriden by
passing a configuration file path with the `... | [
"Create",
"a",
"new",
"instance",
"of",
"GTAnalysis",
"from",
"an",
"analysis",
"output",
"file",
"generated",
"with",
"~fermipy",
".",
"GTAnalysis",
".",
"write_roi",
".",
"By",
"default",
"the",
"new",
"instance",
"will",
"inherit",
"the",
"configuration",
"... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L511-L549 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.clone | def clone(self, config, **kwargs):
"""Make a clone of this analysis instance."""
gta = GTAnalysis(config, **kwargs)
gta._roi = copy.deepcopy(self.roi)
return gta | python | def clone(self, config, **kwargs):
"""Make a clone of this analysis instance."""
gta = GTAnalysis(config, **kwargs)
gta._roi = copy.deepcopy(self.roi)
return gta | [
"def",
"clone",
"(",
"self",
",",
"config",
",",
"**",
"kwargs",
")",
":",
"gta",
"=",
"GTAnalysis",
"(",
"config",
",",
"**",
"kwargs",
")",
"gta",
".",
"_roi",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
".",
"roi",
")",
"return",
"gta"
] | Make a clone of this analysis instance. | [
"Make",
"a",
"clone",
"of",
"this",
"analysis",
"instance",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L551-L555 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.set_random_seed | def set_random_seed(self, seed):
"""Set the seed for the random number generator"""
self.config['mc']['seed'] = seed
np.random.seed(seed) | python | def set_random_seed(self, seed):
"""Set the seed for the random number generator"""
self.config['mc']['seed'] = seed
np.random.seed(seed) | [
"def",
"set_random_seed",
"(",
"self",
",",
"seed",
")",
":",
"self",
".",
"config",
"[",
"'mc'",
"]",
"[",
"'seed'",
"]",
"=",
"seed",
"np",
".",
"random",
".",
"seed",
"(",
"seed",
")"
] | Set the seed for the random number generator | [
"Set",
"the",
"seed",
"for",
"the",
"random",
"number",
"generator"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L557-L560 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.reload_source | def reload_source(self, name, init_source=True):
"""Delete and reload a source in the model. This will update
the spatial model of this source to the one defined in the XML
model."""
for c in self.components:
c.reload_source(name)
if init_source:
self._... | python | def reload_source(self, name, init_source=True):
"""Delete and reload a source in the model. This will update
the spatial model of this source to the one defined in the XML
model."""
for c in self.components:
c.reload_source(name)
if init_source:
self._... | [
"def",
"reload_source",
"(",
"self",
",",
"name",
",",
"init_source",
"=",
"True",
")",
":",
"for",
"c",
"in",
"self",
".",
"components",
":",
"c",
".",
"reload_source",
"(",
"name",
")",
"if",
"init_source",
":",
"self",
".",
"_init_source",
"(",
"nam... | Delete and reload a source in the model. This will update
the spatial model of this source to the one defined in the XML
model. | [
"Delete",
"and",
"reload",
"a",
"source",
"in",
"the",
"model",
".",
"This",
"will",
"update",
"the",
"spatial",
"model",
"of",
"this",
"source",
"to",
"the",
"one",
"defined",
"in",
"the",
"XML",
"model",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L630-L641 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.set_source_morphology | def set_source_morphology(self, name, **kwargs):
"""Set the spatial model of a source.
Parameters
----------
name : str
Source name.
spatial_model : str
Spatial model name (PointSource, RadialGaussian, etc.).
spatial_pars : dict
Diction... | python | def set_source_morphology(self, name, **kwargs):
"""Set the spatial model of a source.
Parameters
----------
name : str
Source name.
spatial_model : str
Spatial model name (PointSource, RadialGaussian, etc.).
spatial_pars : dict
Diction... | [
"def",
"set_source_morphology",
"(",
"self",
",",
"name",
",",
"**",
"kwargs",
")",
":",
"name",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
".",
"name",
"src",
"=",
"self",
".",
"roi",
"[",
"name",
"]",
"spatial_model",
"=",
... | Set the spatial model of a source.
Parameters
----------
name : str
Source name.
spatial_model : str
Spatial model name (PointSource, RadialGaussian, etc.).
spatial_pars : dict
Dictionary of spatial parameters (optional).
use_cache : b... | [
"Set",
"the",
"spatial",
"model",
"of",
"a",
"source",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L654-L696 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.set_source_spectrum | def set_source_spectrum(self, name, spectrum_type='PowerLaw',
spectrum_pars=None, update_source=True):
"""Set the spectral model of a source. This function can be
used to change the spectral type of a source or modify its
spectral parameters. If called with
... | python | def set_source_spectrum(self, name, spectrum_type='PowerLaw',
spectrum_pars=None, update_source=True):
"""Set the spectral model of a source. This function can be
used to change the spectral type of a source or modify its
spectral parameters. If called with
... | [
"def",
"set_source_spectrum",
"(",
"self",
",",
"name",
",",
"spectrum_type",
"=",
"'PowerLaw'",
",",
"spectrum_pars",
"=",
"None",
",",
"update_source",
"=",
"True",
")",
":",
"name",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
"... | Set the spectral model of a source. This function can be
used to change the spectral type of a source or modify its
spectral parameters. If called with
spectrum_type='FileFunction' and spectrum_pars=None, the
source spectrum will be replaced with a FileFunction with the
same di... | [
"Set",
"the",
"spectral",
"model",
"of",
"a",
"source",
".",
"This",
"function",
"can",
"be",
"used",
"to",
"change",
"the",
"spectral",
"type",
"of",
"a",
"source",
"or",
"modify",
"its",
"spectral",
"parameters",
".",
"If",
"called",
"with",
"spectrum_ty... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L698-L759 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.set_source_dnde | def set_source_dnde(self, name, dnde, update_source=True):
"""Set the differential flux distribution of a source with the
FileFunction spectral type.
Parameters
----------
name : str
Source name.
dnde : `~numpy.ndarray`
Array of differential flux v... | python | def set_source_dnde(self, name, dnde, update_source=True):
"""Set the differential flux distribution of a source with the
FileFunction spectral type.
Parameters
----------
name : str
Source name.
dnde : `~numpy.ndarray`
Array of differential flux v... | [
"def",
"set_source_dnde",
"(",
"self",
",",
"name",
",",
"dnde",
",",
"update_source",
"=",
"True",
")",
":",
"name",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
".",
"name",
"if",
"self",
".",
"roi",
"[",
"name",
"]",
"[",
... | Set the differential flux distribution of a source with the
FileFunction spectral type.
Parameters
----------
name : str
Source name.
dnde : `~numpy.ndarray`
Array of differential flux values (cm^{-2} s^{-1} MeV^{-1}). | [
"Set",
"the",
"differential",
"flux",
"distribution",
"of",
"a",
"source",
"with",
"the",
"FileFunction",
"spectral",
"type",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L761-L794 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.get_source_dnde | def get_source_dnde(self, name):
"""Return differential flux distribution of a source. For
sources with FileFunction spectral type this returns the
internal differential flux array.
Returns
-------
loge : `~numpy.ndarray`
Array of energies at which the differ... | python | def get_source_dnde(self, name):
"""Return differential flux distribution of a source. For
sources with FileFunction spectral type this returns the
internal differential flux array.
Returns
-------
loge : `~numpy.ndarray`
Array of energies at which the differ... | [
"def",
"get_source_dnde",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
".",
"name",
"if",
"self",
".",
"roi",
"[",
"name",
"]",
"[",
"'SpectrumType'",
"]",
"!=",
"'FileFunction'",
":"... | Return differential flux distribution of a source. For
sources with FileFunction spectral type this returns the
internal differential flux array.
Returns
-------
loge : `~numpy.ndarray`
Array of energies at which the differential flux is
evaluated (log10(E... | [
"Return",
"differential",
"flux",
"distribution",
"of",
"a",
"source",
".",
"For",
"sources",
"with",
"FileFunction",
"spectral",
"type",
"this",
"returns",
"the",
"internal",
"differential",
"flux",
"array",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L796-L835 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis._create_filefunction | def _create_filefunction(self, name, spectrum_pars):
"""Replace the spectrum of an existing source with a
FileFunction."""
spectrum_pars = {} if spectrum_pars is None else spectrum_pars
if 'loge' in spectrum_pars:
loge = spectrum_pars.get('loge')
else:
e... | python | def _create_filefunction(self, name, spectrum_pars):
"""Replace the spectrum of an existing source with a
FileFunction."""
spectrum_pars = {} if spectrum_pars is None else spectrum_pars
if 'loge' in spectrum_pars:
loge = spectrum_pars.get('loge')
else:
e... | [
"def",
"_create_filefunction",
"(",
"self",
",",
"name",
",",
"spectrum_pars",
")",
":",
"spectrum_pars",
"=",
"{",
"}",
"if",
"spectrum_pars",
"is",
"None",
"else",
"spectrum_pars",
"if",
"'loge'",
"in",
"spectrum_pars",
":",
"loge",
"=",
"spectrum_pars",
"."... | Replace the spectrum of an existing source with a
FileFunction. | [
"Replace",
"the",
"spectrum",
"of",
"an",
"existing",
"source",
"with",
"a",
"FileFunction",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L837-L876 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.stage_output | def stage_output(self):
"""Copy data products to final output directory."""
if self.workdir == self.outdir:
return
elif not os.path.isdir(self.workdir):
self.logger.error('Working directory does not exist.')
return
regex = self.config['fileio']['outd... | python | def stage_output(self):
"""Copy data products to final output directory."""
if self.workdir == self.outdir:
return
elif not os.path.isdir(self.workdir):
self.logger.error('Working directory does not exist.')
return
regex = self.config['fileio']['outd... | [
"def",
"stage_output",
"(",
"self",
")",
":",
"if",
"self",
".",
"workdir",
"==",
"self",
".",
"outdir",
":",
"return",
"elif",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
".",
"workdir",
")",
":",
"self",
".",
"logger",
".",
"error",
"(",... | Copy data products to final output directory. | [
"Copy",
"data",
"products",
"to",
"final",
"output",
"directory",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L926-L966 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.stage_input | def stage_input(self):
"""Copy input files to working directory."""
if self.workdir == self.outdir:
return
elif not os.path.isdir(self.workdir):
self.logger.error('Working directory does not exist.')
return
self.logger.info('Staging files to %s', sel... | python | def stage_input(self):
"""Copy input files to working directory."""
if self.workdir == self.outdir:
return
elif not os.path.isdir(self.workdir):
self.logger.error('Working directory does not exist.')
return
self.logger.info('Staging files to %s', sel... | [
"def",
"stage_input",
"(",
"self",
")",
":",
"if",
"self",
".",
"workdir",
"==",
"self",
".",
"outdir",
":",
"return",
"elif",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
".",
"workdir",
")",
":",
"self",
".",
"logger",
".",
"error",
"(",
... | Copy input files to working directory. | [
"Copy",
"input",
"files",
"to",
"working",
"directory",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L968-L1009 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis._create_likelihood | def _create_likelihood(self, srcmdl=None):
"""Instantiate the likelihood object for each component and
create a SummedLikelihood."""
self._like = SummedLikelihood()
for c in self.components:
c._create_binned_analysis(srcmdl)
self._like.addComponent(c.like)
... | python | def _create_likelihood(self, srcmdl=None):
"""Instantiate the likelihood object for each component and
create a SummedLikelihood."""
self._like = SummedLikelihood()
for c in self.components:
c._create_binned_analysis(srcmdl)
self._like.addComponent(c.like)
... | [
"def",
"_create_likelihood",
"(",
"self",
",",
"srcmdl",
"=",
"None",
")",
":",
"self",
".",
"_like",
"=",
"SummedLikelihood",
"(",
")",
"for",
"c",
"in",
"self",
".",
"components",
":",
"c",
".",
"_create_binned_analysis",
"(",
"srcmdl",
")",
"self",
".... | Instantiate the likelihood object for each component and
create a SummedLikelihood. | [
"Instantiate",
"the",
"likelihood",
"object",
"for",
"each",
"component",
"and",
"create",
"a",
"SummedLikelihood",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1070-L1081 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.generate_model | def generate_model(self, model_name=None):
"""Generate model maps for all components. model_name should
be a unique identifier for the model. If model_name is None
then the model maps will be generated using the current
parameters of the ROI."""
for i, c in enumerate(self._com... | python | def generate_model(self, model_name=None):
"""Generate model maps for all components. model_name should
be a unique identifier for the model. If model_name is None
then the model maps will be generated using the current
parameters of the ROI."""
for i, c in enumerate(self._com... | [
"def",
"generate_model",
"(",
"self",
",",
"model_name",
"=",
"None",
")",
":",
"for",
"i",
",",
"c",
"in",
"enumerate",
"(",
"self",
".",
"_components",
")",
":",
"c",
".",
"generate_model",
"(",
"model_name",
"=",
"model_name",
")"
] | Generate model maps for all components. model_name should
be a unique identifier for the model. If model_name is None
then the model maps will be generated using the current
parameters of the ROI. | [
"Generate",
"model",
"maps",
"for",
"all",
"components",
".",
"model_name",
"should",
"be",
"a",
"unique",
"identifier",
"for",
"the",
"model",
".",
"If",
"model_name",
"is",
"None",
"then",
"the",
"model",
"maps",
"will",
"be",
"generated",
"using",
"the",
... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1142-L1149 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.set_energy_range | def set_energy_range(self, logemin, logemax):
"""Set the energy bounds of the analysis. This restricts the
evaluation of the likelihood to the data that falls in this
range. Input values will be rounded to the closest bin edge
value. If either argument is None then the lower or upper
... | python | def set_energy_range(self, logemin, logemax):
"""Set the energy bounds of the analysis. This restricts the
evaluation of the likelihood to the data that falls in this
range. Input values will be rounded to the closest bin edge
value. If either argument is None then the lower or upper
... | [
"def",
"set_energy_range",
"(",
"self",
",",
"logemin",
",",
"logemax",
")",
":",
"if",
"logemin",
"is",
"None",
":",
"logemin",
"=",
"self",
".",
"log_energies",
"[",
"0",
"]",
"else",
":",
"imin",
"=",
"int",
"(",
"utils",
".",
"val_to_edge",
"(",
... | Set the energy bounds of the analysis. This restricts the
evaluation of the likelihood to the data that falls in this
range. Input values will be rounded to the closest bin edge
value. If either argument is None then the lower or upper
bound of the analysis instance will be used.
... | [
"Set",
"the",
"energy",
"bounds",
"of",
"the",
"analysis",
".",
"This",
"restricts",
"the",
"evaluation",
"of",
"the",
"likelihood",
"to",
"the",
"data",
"that",
"falls",
"in",
"this",
"range",
".",
"Input",
"values",
"will",
"be",
"rounded",
"to",
"the",
... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1154-L1195 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.model_counts_map | def model_counts_map(self, name=None, exclude=None, use_mask=False):
"""Return the model counts map for a single source, a list of
sources, or for the sum of all sources in the ROI. The
exclude parameter can be used to exclude one or more
components when generating the model map.
... | python | def model_counts_map(self, name=None, exclude=None, use_mask=False):
"""Return the model counts map for a single source, a list of
sources, or for the sum of all sources in the ROI. The
exclude parameter can be used to exclude one or more
components when generating the model map.
... | [
"def",
"model_counts_map",
"(",
"self",
",",
"name",
"=",
"None",
",",
"exclude",
"=",
"None",
",",
"use_mask",
"=",
"False",
")",
":",
"maps",
"=",
"[",
"c",
".",
"model_counts_map",
"(",
"name",
",",
"exclude",
",",
"use_mask",
"=",
"use_mask",
")",
... | Return the model counts map for a single source, a list of
sources, or for the sum of all sources in the ROI. The
exclude parameter can be used to exclude one or more
components when generating the model map.
Parameters
----------
name : str or list of str
P... | [
"Return",
"the",
"model",
"counts",
"map",
"for",
"a",
"single",
"source",
"a",
"list",
"of",
"sources",
"or",
"for",
"the",
"sum",
"of",
"all",
"sources",
"in",
"the",
"ROI",
".",
"The",
"exclude",
"parameter",
"can",
"be",
"used",
"to",
"exclude",
"o... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1219-L1249 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.model_counts_spectrum | def model_counts_spectrum(self, name, logemin=None, logemax=None,
summed=False, weighted=False):
"""Return the predicted number of model counts versus energy
for a given source and energy range. If summed=True return
the counts spectrum summed over all components o... | python | def model_counts_spectrum(self, name, logemin=None, logemax=None,
summed=False, weighted=False):
"""Return the predicted number of model counts versus energy
for a given source and energy range. If summed=True return
the counts spectrum summed over all components o... | [
"def",
"model_counts_spectrum",
"(",
"self",
",",
"name",
",",
"logemin",
"=",
"None",
",",
"logemax",
"=",
"None",
",",
"summed",
"=",
"False",
",",
"weighted",
"=",
"False",
")",
":",
"if",
"logemin",
"is",
"None",
":",
"logemin",
"=",
"self",
".",
... | Return the predicted number of model counts versus energy
for a given source and energy range. If summed=True return
the counts spectrum summed over all components otherwise
return a list of model spectra. If weighted=True return
the weighted version of the counts spectrum | [
"Return",
"the",
"predicted",
"number",
"of",
"model",
"counts",
"versus",
"energy",
"for",
"a",
"given",
"source",
"and",
"energy",
"range",
".",
"If",
"summed",
"=",
"True",
"return",
"the",
"counts",
"spectrum",
"summed",
"over",
"all",
"components",
"oth... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1251-L1286 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.get_sources | def get_sources(self, cuts=None, distance=None, skydir=None,
minmax_ts=None, minmax_npred=None, exclude=None,
square=False):
"""Retrieve list of sources in the ROI satisfying the given
selections.
Returns
-------
srcs : list
A ... | python | def get_sources(self, cuts=None, distance=None, skydir=None,
minmax_ts=None, minmax_npred=None, exclude=None,
square=False):
"""Retrieve list of sources in the ROI satisfying the given
selections.
Returns
-------
srcs : list
A ... | [
"def",
"get_sources",
"(",
"self",
",",
"cuts",
"=",
"None",
",",
"distance",
"=",
"None",
",",
"skydir",
"=",
"None",
",",
"minmax_ts",
"=",
"None",
",",
"minmax_npred",
"=",
"None",
",",
"exclude",
"=",
"None",
",",
"square",
"=",
"False",
")",
":"... | Retrieve list of sources in the ROI satisfying the given
selections.
Returns
-------
srcs : list
A list of `~fermipy.roi_model.Model` objects. | [
"Retrieve",
"list",
"of",
"sources",
"in",
"the",
"ROI",
"satisfying",
"the",
"given",
"selections",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1288-L1305 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.add_source | def add_source(self, name, src_dict, free=None, init_source=True,
save_source_maps=True, use_pylike=True,
use_single_psf=False, **kwargs):
"""Add a source to the ROI model. This function may be called
either before or after `~fermipy.gtanalysis.GTAnalysis.setup`.
... | python | def add_source(self, name, src_dict, free=None, init_source=True,
save_source_maps=True, use_pylike=True,
use_single_psf=False, **kwargs):
"""Add a source to the ROI model. This function may be called
either before or after `~fermipy.gtanalysis.GTAnalysis.setup`.
... | [
"def",
"add_source",
"(",
"self",
",",
"name",
",",
"src_dict",
",",
"free",
"=",
"None",
",",
"init_source",
"=",
"True",
",",
"save_source_maps",
"=",
"True",
",",
"use_pylike",
"=",
"True",
",",
"use_single_psf",
"=",
"False",
",",
"**",
"kwargs",
")"... | Add a source to the ROI model. This function may be called
either before or after `~fermipy.gtanalysis.GTAnalysis.setup`.
Parameters
----------
name : str
Source name.
src_dict : dict or `~fermipy.roi_model.Source` object
Dictionary or source object def... | [
"Add",
"a",
"source",
"to",
"the",
"ROI",
"model",
".",
"This",
"function",
"may",
"be",
"called",
"either",
"before",
"or",
"after",
"~fermipy",
".",
"gtanalysis",
".",
"GTAnalysis",
".",
"setup",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1307-L1370 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.add_sources_from_roi | def add_sources_from_roi(self, names, roi, free=False, **kwargs):
"""Add multiple sources to the current ROI model copied from another ROI model.
Parameters
----------
names : list
List of str source names to add.
roi : `~fermipy.roi_model.ROIModel` object
... | python | def add_sources_from_roi(self, names, roi, free=False, **kwargs):
"""Add multiple sources to the current ROI model copied from another ROI model.
Parameters
----------
names : list
List of str source names to add.
roi : `~fermipy.roi_model.ROIModel` object
... | [
"def",
"add_sources_from_roi",
"(",
"self",
",",
"names",
",",
"roi",
",",
"free",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"for",
"name",
"in",
"names",
":",
"self",
".",
"add_source",
"(",
"name",
",",
"roi",
"[",
"name",
"]",
".",
"data",
",... | Add multiple sources to the current ROI model copied from another ROI model.
Parameters
----------
names : list
List of str source names to add.
roi : `~fermipy.roi_model.ROIModel` object
The roi model from which to add sources.
free : bool
... | [
"Add",
"multiple",
"sources",
"to",
"the",
"current",
"ROI",
"model",
"copied",
"from",
"another",
"ROI",
"model",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1372-L1390 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.delete_source | def delete_source(self, name, save_template=True, delete_source_map=False,
build_fixed_wts=True, **kwargs):
"""Delete a source from the ROI model.
Parameters
----------
name : str
Source name.
save_template : bool
Keep the SpatialMa... | python | def delete_source(self, name, save_template=True, delete_source_map=False,
build_fixed_wts=True, **kwargs):
"""Delete a source from the ROI model.
Parameters
----------
name : str
Source name.
save_template : bool
Keep the SpatialMa... | [
"def",
"delete_source",
"(",
"self",
",",
"name",
",",
"save_template",
"=",
"True",
",",
"delete_source_map",
"=",
"False",
",",
"build_fixed_wts",
"=",
"True",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"roi",
".",
"has_source",
"(",
"nam... | Delete a source from the ROI model.
Parameters
----------
name : str
Source name.
save_template : bool
Keep the SpatialMap FITS template associated with this
source.
delete_source_map : bool
Delete the source map associated with ... | [
"Delete",
"a",
"source",
"from",
"the",
"ROI",
"model",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1392-L1438 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.delete_sources | def delete_sources(self, cuts=None, distance=None,
skydir=None, minmax_ts=None, minmax_npred=None,
exclude=None, square=False, names=None):
"""Delete sources in the ROI model satisfying the given
selection criteria.
Parameters
----------
... | python | def delete_sources(self, cuts=None, distance=None,
skydir=None, minmax_ts=None, minmax_npred=None,
exclude=None, square=False, names=None):
"""Delete sources in the ROI model satisfying the given
selection criteria.
Parameters
----------
... | [
"def",
"delete_sources",
"(",
"self",
",",
"cuts",
"=",
"None",
",",
"distance",
"=",
"None",
",",
"skydir",
"=",
"None",
",",
"minmax_ts",
"=",
"None",
",",
"minmax_npred",
"=",
"None",
",",
"exclude",
"=",
"None",
",",
"square",
"=",
"False",
",",
... | Delete sources in the ROI model satisfying the given
selection criteria.
Parameters
----------
cuts : dict
Dictionary of [min,max] selections on source properties.
distance : float
Cut on angular distance from ``skydir``. If None then no
sel... | [
"Delete",
"sources",
"in",
"the",
"ROI",
"model",
"satisfying",
"the",
"given",
"selection",
"criteria",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1440-L1504 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.free_sources_by_name | def free_sources_by_name(self, names, free=True, pars=None,
**kwargs):
"""Free all sources with names matching ``names``.
Parameters
----------
names : list
List of source names.
free : bool
Choose whether to free (free=True)... | python | def free_sources_by_name(self, names, free=True, pars=None,
**kwargs):
"""Free all sources with names matching ``names``.
Parameters
----------
names : list
List of source names.
free : bool
Choose whether to free (free=True)... | [
"def",
"free_sources_by_name",
"(",
"self",
",",
"names",
",",
"free",
"=",
"True",
",",
"pars",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"names",
"is",
"None",
":",
"return",
"names",
"=",
"[",
"names",
"]",
"if",
"not",
"isinstance",
"(",
... | Free all sources with names matching ``names``.
Parameters
----------
names : list
List of source names.
free : bool
Choose whether to free (free=True) or fix (free=False)
source parameters.
pars : list
Set a list of parameters t... | [
"Free",
"all",
"sources",
"with",
"names",
"matching",
"names",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1573-L1607 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.set_parameter | def set_parameter(self, name, par, value, true_value=True, scale=None,
bounds=None, error=None, update_source=True):
"""
Update the value of a parameter. Parameter bounds will
automatically be adjusted to encompass the new parameter
value.
Parameters
... | python | def set_parameter(self, name, par, value, true_value=True, scale=None,
bounds=None, error=None, update_source=True):
"""
Update the value of a parameter. Parameter bounds will
automatically be adjusted to encompass the new parameter
value.
Parameters
... | [
"def",
"set_parameter",
"(",
"self",
",",
"name",
",",
"par",
",",
"value",
",",
"true_value",
"=",
"True",
",",
"scale",
"=",
"None",
",",
"bounds",
"=",
"None",
",",
"error",
"=",
"None",
",",
"update_source",
"=",
"True",
")",
":",
"name",
"=",
... | Update the value of a parameter. Parameter bounds will
automatically be adjusted to encompass the new parameter
value.
Parameters
----------
name : str
Source name.
par : str
Parameter name.
value : float
Parameter value. ... | [
"Update",
"the",
"value",
"of",
"a",
"parameter",
".",
"Parameter",
"bounds",
"will",
"automatically",
"be",
"adjusted",
"to",
"encompass",
"the",
"new",
"parameter",
"value",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1702-L1784 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.set_parameter_scale | def set_parameter_scale(self, name, par, scale):
"""Update the scale of a parameter while keeping its value constant."""
name = self.roi.get_source_by_name(name).name
idx = self.like.par_index(name, par)
current_bounds = list(self.like.model[idx].getBounds())
current_scale = self... | python | def set_parameter_scale(self, name, par, scale):
"""Update the scale of a parameter while keeping its value constant."""
name = self.roi.get_source_by_name(name).name
idx = self.like.par_index(name, par)
current_bounds = list(self.like.model[idx].getBounds())
current_scale = self... | [
"def",
"set_parameter_scale",
"(",
"self",
",",
"name",
",",
"par",
",",
"scale",
")",
":",
"name",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
".",
"name",
"idx",
"=",
"self",
".",
"like",
".",
"par_index",
"(",
"name",
","... | Update the scale of a parameter while keeping its value constant. | [
"Update",
"the",
"scale",
"of",
"a",
"parameter",
"while",
"keeping",
"its",
"value",
"constant",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1786-L1798 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.set_parameter_bounds | def set_parameter_bounds(self, name, par, bounds):
"""Set the bounds on the scaled value of a parameter.
Parameters
----------
name : str
Source name.
par : str
Parameter name.
bounds : list
Upper and lower bound.
"""
... | python | def set_parameter_bounds(self, name, par, bounds):
"""Set the bounds on the scaled value of a parameter.
Parameters
----------
name : str
Source name.
par : str
Parameter name.
bounds : list
Upper and lower bound.
"""
... | [
"def",
"set_parameter_bounds",
"(",
"self",
",",
"name",
",",
"par",
",",
"bounds",
")",
":",
"idx",
"=",
"self",
".",
"like",
".",
"par_index",
"(",
"name",
",",
"par",
")",
"self",
".",
"like",
"[",
"idx",
"]",
".",
"setBounds",
"(",
"*",
"bounds... | Set the bounds on the scaled value of a parameter.
Parameters
----------
name : str
Source name.
par : str
Parameter name.
bounds : list
Upper and lower bound. | [
"Set",
"the",
"bounds",
"on",
"the",
"scaled",
"value",
"of",
"a",
"parameter",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1800-L1818 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.set_parameter_error | def set_parameter_error(self, name, par, error):
"""Set the error on the value of a parameter.
Parameters
----------
name : str
Source name.
par : str
Parameter name.
error : float
The value for the parameter error
"""
... | python | def set_parameter_error(self, name, par, error):
"""Set the error on the value of a parameter.
Parameters
----------
name : str
Source name.
par : str
Parameter name.
error : float
The value for the parameter error
"""
... | [
"def",
"set_parameter_error",
"(",
"self",
",",
"name",
",",
"par",
",",
"error",
")",
":",
"idx",
"=",
"self",
".",
"like",
".",
"par_index",
"(",
"name",
",",
"par",
")",
"self",
".",
"like",
"[",
"idx",
"]",
".",
"setError",
"(",
"error",
")",
... | Set the error on the value of a parameter.
Parameters
----------
name : str
Source name.
par : str
Parameter name.
error : float
The value for the parameter error | [
"Set",
"the",
"error",
"on",
"the",
"value",
"of",
"a",
"parameter",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L1820-L1837 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.get_source_name | def get_source_name(self, name):
"""Return the name of a source as it is defined in the
pyLikelihood model object."""
if name not in self.like.sourceNames():
name = self.roi.get_source_by_name(name).name
return name | python | def get_source_name(self, name):
"""Return the name of a source as it is defined in the
pyLikelihood model object."""
if name not in self.like.sourceNames():
name = self.roi.get_source_by_name(name).name
return name | [
"def",
"get_source_name",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"like",
".",
"sourceNames",
"(",
")",
":",
"name",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
".",
"name",
"return",
"nam... | Return the name of a source as it is defined in the
pyLikelihood model object. | [
"Return",
"the",
"name",
"of",
"a",
"source",
"as",
"it",
"is",
"defined",
"in",
"the",
"pyLikelihood",
"model",
"object",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L2160-L2165 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.constrain_norms | def constrain_norms(self, srcNames, cov_scale=1.0):
"""Constrain the normalizations of one or more sources by
adding gaussian priors with sigma equal to the parameter
error times a scaling factor."""
# Get the covariance matrix
for name in srcNames:
par = self.like.... | python | def constrain_norms(self, srcNames, cov_scale=1.0):
"""Constrain the normalizations of one or more sources by
adding gaussian priors with sigma equal to the parameter
error times a scaling factor."""
# Get the covariance matrix
for name in srcNames:
par = self.like.... | [
"def",
"constrain_norms",
"(",
"self",
",",
"srcNames",
",",
"cov_scale",
"=",
"1.0",
")",
":",
"for",
"name",
"in",
"srcNames",
":",
"par",
"=",
"self",
".",
"like",
".",
"normPar",
"(",
"name",
")",
"err",
"=",
"par",
".",
"error",
"(",
")",
"val... | Constrain the normalizations of one or more sources by
adding gaussian priors with sigma equal to the parameter
error times a scaling factor. | [
"Constrain",
"the",
"normalizations",
"of",
"one",
"or",
"more",
"sources",
"by",
"adding",
"gaussian",
"priors",
"with",
"sigma",
"equal",
"to",
"the",
"parameter",
"error",
"times",
"a",
"scaling",
"factor",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L2719-L2736 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.remove_priors | def remove_priors(self):
"""Clear all priors."""
for src in self.roi.sources:
for par in self.like[src.name].funcs["Spectrum"].params.values():
par.removePrior() | python | def remove_priors(self):
"""Clear all priors."""
for src in self.roi.sources:
for par in self.like[src.name].funcs["Spectrum"].params.values():
par.removePrior() | [
"def",
"remove_priors",
"(",
"self",
")",
":",
"for",
"src",
"in",
"self",
".",
"roi",
".",
"sources",
":",
"for",
"par",
"in",
"self",
".",
"like",
"[",
"src",
".",
"name",
"]",
".",
"funcs",
"[",
"\"Spectrum\"",
"]",
".",
"params",
".",
"values",... | Clear all priors. | [
"Clear",
"all",
"priors",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L2748-L2754 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis._create_optObject | def _create_optObject(self, **kwargs):
""" Make MINUIT or NewMinuit type optimizer object """
optimizer = kwargs.get('optimizer',
self.config['optimizer']['optimizer'])
if optimizer.upper() == 'MINUIT':
optObject = pyLike.Minuit(self.like.logLike)
... | python | def _create_optObject(self, **kwargs):
""" Make MINUIT or NewMinuit type optimizer object """
optimizer = kwargs.get('optimizer',
self.config['optimizer']['optimizer'])
if optimizer.upper() == 'MINUIT':
optObject = pyLike.Minuit(self.like.logLike)
... | [
"def",
"_create_optObject",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"optimizer",
"=",
"kwargs",
".",
"get",
"(",
"'optimizer'",
",",
"self",
".",
"config",
"[",
"'optimizer'",
"]",
"[",
"'optimizer'",
"]",
")",
"if",
"optimizer",
".",
"upper",
"(",
... | Make MINUIT or NewMinuit type optimizer object | [
"Make",
"MINUIT",
"or",
"NewMinuit",
"type",
"optimizer",
"object"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L2756-L2769 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.load_xml | def load_xml(self, xmlfile):
"""Load model definition from XML.
Parameters
----------
xmlfile : str
Name of the input XML file.
"""
self.logger.info('Loading XML')
for c in self.components:
c.load_xml(xmlfile)
for name in self.... | python | def load_xml(self, xmlfile):
"""Load model definition from XML.
Parameters
----------
xmlfile : str
Name of the input XML file.
"""
self.logger.info('Loading XML')
for c in self.components:
c.load_xml(xmlfile)
for name in self.... | [
"def",
"load_xml",
"(",
"self",
",",
"xmlfile",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'Loading XML'",
")",
"for",
"c",
"in",
"self",
".",
"components",
":",
"c",
".",
"load_xml",
"(",
"xmlfile",
")",
"for",
"name",
"in",
"self",
".",
... | Load model definition from XML.
Parameters
----------
xmlfile : str
Name of the input XML file. | [
"Load",
"model",
"definition",
"from",
"XML",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3177-L3197 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.load_parameters_from_yaml | def load_parameters_from_yaml(self, yamlfile, update_sources=False):
"""Load model parameters from yaml
Parameters
----------
yamlfile : str
Name of the input yaml file.
"""
d = utils.load_yaml(yamlfile)
for src, src_pars in d.items():
for... | python | def load_parameters_from_yaml(self, yamlfile, update_sources=False):
"""Load model parameters from yaml
Parameters
----------
yamlfile : str
Name of the input yaml file.
"""
d = utils.load_yaml(yamlfile)
for src, src_pars in d.items():
for... | [
"def",
"load_parameters_from_yaml",
"(",
"self",
",",
"yamlfile",
",",
"update_sources",
"=",
"False",
")",
":",
"d",
"=",
"utils",
".",
"load_yaml",
"(",
"yamlfile",
")",
"for",
"src",
",",
"src_pars",
"in",
"d",
".",
"items",
"(",
")",
":",
"for",
"p... | Load model parameters from yaml
Parameters
----------
yamlfile : str
Name of the input yaml file. | [
"Load",
"model",
"parameters",
"from",
"yaml"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3211-L3247 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis._restore_counts_maps | def _restore_counts_maps(self):
"""
Revert counts maps to their state prior to injecting any simulated
components.
"""
for c in self.components:
c.restore_counts_maps()
if hasattr(self.like.components[0].logLike, 'setCountsMap'):
self._init_roi_m... | python | def _restore_counts_maps(self):
"""
Revert counts maps to their state prior to injecting any simulated
components.
"""
for c in self.components:
c.restore_counts_maps()
if hasattr(self.like.components[0].logLike, 'setCountsMap'):
self._init_roi_m... | [
"def",
"_restore_counts_maps",
"(",
"self",
")",
":",
"for",
"c",
"in",
"self",
".",
"components",
":",
"c",
".",
"restore_counts_maps",
"(",
")",
"if",
"hasattr",
"(",
"self",
".",
"like",
".",
"components",
"[",
"0",
"]",
".",
"logLike",
",",
"'setCo... | Revert counts maps to their state prior to injecting any simulated
components. | [
"Revert",
"counts",
"maps",
"to",
"their",
"state",
"prior",
"to",
"injecting",
"any",
"simulated",
"components",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3249-L3267 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.simulate_source | def simulate_source(self, src_dict=None):
"""
Inject simulated source counts into the data.
Parameters
----------
src_dict : dict
Dictionary defining the spatial and spectral properties of
the source that will be injected.
"""
self._fitcac... | python | def simulate_source(self, src_dict=None):
"""
Inject simulated source counts into the data.
Parameters
----------
src_dict : dict
Dictionary defining the spatial and spectral properties of
the source that will be injected.
"""
self._fitcac... | [
"def",
"simulate_source",
"(",
"self",
",",
"src_dict",
"=",
"None",
")",
":",
"self",
".",
"_fitcache",
"=",
"None",
"if",
"src_dict",
"is",
"None",
":",
"src_dict",
"=",
"{",
"}",
"else",
":",
"src_dict",
"=",
"copy",
".",
"deepcopy",
"(",
"src_dict"... | Inject simulated source counts into the data.
Parameters
----------
src_dict : dict
Dictionary defining the spatial and spectral properties of
the source that will be injected. | [
"Inject",
"simulated",
"source",
"counts",
"into",
"the",
"data",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3269-L3313 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.simulate_roi | def simulate_roi(self, name=None, randomize=True, restore=False):
"""Generate a simulation of the ROI using the current best-fit model
and replace the data counts cube with this simulation. The
simulation is created by generating an array of Poisson random
numbers with expectation value... | python | def simulate_roi(self, name=None, randomize=True, restore=False):
"""Generate a simulation of the ROI using the current best-fit model
and replace the data counts cube with this simulation. The
simulation is created by generating an array of Poisson random
numbers with expectation value... | [
"def",
"simulate_roi",
"(",
"self",
",",
"name",
"=",
"None",
",",
"randomize",
"=",
"True",
",",
"restore",
"=",
"False",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'Simulating ROI'",
")",
"self",
".",
"_fitcache",
"=",
"None",
"if",
"restore... | Generate a simulation of the ROI using the current best-fit model
and replace the data counts cube with this simulation. The
simulation is created by generating an array of Poisson random
numbers with expectation values drawn from the model cube of
the binned analysis instance. This fu... | [
"Generate",
"a",
"simulation",
"of",
"the",
"ROI",
"using",
"the",
"current",
"best",
"-",
"fit",
"model",
"and",
"replace",
"the",
"data",
"counts",
"cube",
"with",
"this",
"simulation",
".",
"The",
"simulation",
"is",
"created",
"by",
"generating",
"an",
... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3315-L3359 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.load_roi | def load_roi(self, infile, reload_sources=False, params=None, mask=None):
"""This function reloads the analysis state from a previously
saved instance generated with
`~fermipy.gtanalysis.GTAnalysis.write_roi`.
Parameters
----------
infile : str
reload_sources :... | python | def load_roi(self, infile, reload_sources=False, params=None, mask=None):
"""This function reloads the analysis state from a previously
saved instance generated with
`~fermipy.gtanalysis.GTAnalysis.write_roi`.
Parameters
----------
infile : str
reload_sources :... | [
"def",
"load_roi",
"(",
"self",
",",
"infile",
",",
"reload_sources",
"=",
"False",
",",
"params",
"=",
"None",
",",
"mask",
"=",
"None",
")",
":",
"infile",
"=",
"utils",
".",
"resolve_path",
"(",
"infile",
",",
"workdir",
"=",
"self",
".",
"workdir",... | This function reloads the analysis state from a previously
saved instance generated with
`~fermipy.gtanalysis.GTAnalysis.write_roi`.
Parameters
----------
infile : str
reload_sources : bool
Regenerate source maps for non-diffuse sources.
params : st... | [
"This",
"function",
"reloads",
"the",
"analysis",
"state",
"from",
"a",
"previously",
"saved",
"instance",
"generated",
"with",
"~fermipy",
".",
"gtanalysis",
".",
"GTAnalysis",
".",
"write_roi",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3519-L3610 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.write_roi | def write_roi(self, outfile=None,
save_model_map=False, **kwargs):
"""Write current state of the analysis to a file. This method
writes an XML model definition, a ROI dictionary, and a FITS
source catalog file. A previously saved analysis state can be
reloaded from th... | python | def write_roi(self, outfile=None,
save_model_map=False, **kwargs):
"""Write current state of the analysis to a file. This method
writes an XML model definition, a ROI dictionary, and a FITS
source catalog file. A previously saved analysis state can be
reloaded from th... | [
"def",
"write_roi",
"(",
"self",
",",
"outfile",
"=",
"None",
",",
"save_model_map",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"make_plots",
"=",
"kwargs",
".",
"get",
"(",
"'make_plots'",
",",
"False",
")",
"save_weight_map",
"=",
"kwargs",
".",
"get... | Write current state of the analysis to a file. This method
writes an XML model definition, a ROI dictionary, and a FITS
source catalog file. A previously saved analysis state can be
reloaded from the ROI dictionary file with the
`~fermipy.gtanalysis.GTAnalysis.load_roi` method.
... | [
"Write",
"current",
"state",
"of",
"the",
"analysis",
"to",
"a",
"file",
".",
"This",
"method",
"writes",
"an",
"XML",
"model",
"definition",
"a",
"ROI",
"dictionary",
"and",
"a",
"FITS",
"source",
"catalog",
"file",
".",
"A",
"previously",
"saved",
"analy... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3612-L3690 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.make_plots | def make_plots(self, prefix, mcube_map=None, **kwargs):
"""Make diagnostic plots using the current ROI model."""
#mcube_maps = kwargs.pop('mcube_maps', None)
if mcube_map is None:
mcube_map = self.model_counts_map()
plotter = plotting.AnalysisPlotter(self.config['plotting']... | python | def make_plots(self, prefix, mcube_map=None, **kwargs):
"""Make diagnostic plots using the current ROI model."""
#mcube_maps = kwargs.pop('mcube_maps', None)
if mcube_map is None:
mcube_map = self.model_counts_map()
plotter = plotting.AnalysisPlotter(self.config['plotting']... | [
"def",
"make_plots",
"(",
"self",
",",
"prefix",
",",
"mcube_map",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"mcube_map",
"is",
"None",
":",
"mcube_map",
"=",
"self",
".",
"model_counts_map",
"(",
")",
"plotter",
"=",
"plotting",
".",
"AnalysisPl... | Make diagnostic plots using the current ROI model. | [
"Make",
"diagnostic",
"plots",
"using",
"the",
"current",
"ROI",
"model",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3755-L3765 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.update_source | def update_source(self, name, paramsonly=False, reoptimize=False, **kwargs):
"""Update the dictionary for this source.
Parameters
----------
name : str
paramsonly : bool
reoptimize : bool
Re-fit background parameters in likelihood scan.
"""
... | python | def update_source(self, name, paramsonly=False, reoptimize=False, **kwargs):
"""Update the dictionary for this source.
Parameters
----------
name : str
paramsonly : bool
reoptimize : bool
Re-fit background parameters in likelihood scan.
"""
... | [
"def",
"update_source",
"(",
"self",
",",
"name",
",",
"paramsonly",
"=",
"False",
",",
"reoptimize",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"npts",
"=",
"self",
".",
"config",
"[",
"'gtlike'",
"]",
"[",
"'llscan_npts'",
"]",
"optimizer",
"=",
"k... | Update the dictionary for this source.
Parameters
----------
name : str
paramsonly : bool
reoptimize : bool
Re-fit background parameters in likelihood scan. | [
"Update",
"the",
"dictionary",
"for",
"this",
"source",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3969-L3990 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.compute_srcprob | def compute_srcprob(self,xmlfile=None, overwrite=False):
"""Run the gtsrcprob app with the current model or a user provided xmlfile"""
for i,c in enumerate(self.components):
# compute diffuse response, necessary for srcprob
c._diffrsp_app(xmlfile=xmlfile)
# compute s... | python | def compute_srcprob(self,xmlfile=None, overwrite=False):
"""Run the gtsrcprob app with the current model or a user provided xmlfile"""
for i,c in enumerate(self.components):
# compute diffuse response, necessary for srcprob
c._diffrsp_app(xmlfile=xmlfile)
# compute s... | [
"def",
"compute_srcprob",
"(",
"self",
",",
"xmlfile",
"=",
"None",
",",
"overwrite",
"=",
"False",
")",
":",
"for",
"i",
",",
"c",
"in",
"enumerate",
"(",
"self",
".",
"components",
")",
":",
"c",
".",
"_diffrsp_app",
"(",
"xmlfile",
"=",
"xmlfile",
... | Run the gtsrcprob app with the current model or a user provided xmlfile | [
"Run",
"the",
"gtsrcprob",
"app",
"with",
"the",
"current",
"model",
"or",
"a",
"user",
"provided",
"xmlfile"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4231-L4238 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.reload_source | def reload_source(self, name):
"""Recompute the source map for a single source in the model.
"""
src = self.roi.get_source_by_name(name)
if hasattr(self.like.logLike, 'loadSourceMap'):
self.like.logLike.loadSourceMap(str(name), True, False)
srcmap_utils.delete_s... | python | def reload_source(self, name):
"""Recompute the source map for a single source in the model.
"""
src = self.roi.get_source_by_name(name)
if hasattr(self.like.logLike, 'loadSourceMap'):
self.like.logLike.loadSourceMap(str(name), True, False)
srcmap_utils.delete_s... | [
"def",
"reload_source",
"(",
"self",
",",
"name",
")",
":",
"src",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
"if",
"hasattr",
"(",
"self",
".",
"like",
".",
"logLike",
",",
"'loadSourceMap'",
")",
":",
"self",
".",
"like",
... | Recompute the source map for a single source in the model. | [
"Recompute",
"the",
"source",
"map",
"for",
"a",
"single",
"source",
"in",
"the",
"model",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4528-L4545 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.reload_sources | def reload_sources(self, names):
"""Recompute the source map for a list of sources in the model.
"""
try:
self.like.logLike.loadSourceMaps(names, True, True)
# loadSourceMaps doesn't overwrite the header so we need
# to ignore EXPSCALE by setting check_header... | python | def reload_sources(self, names):
"""Recompute the source map for a list of sources in the model.
"""
try:
self.like.logLike.loadSourceMaps(names, True, True)
# loadSourceMaps doesn't overwrite the header so we need
# to ignore EXPSCALE by setting check_header... | [
"def",
"reload_sources",
"(",
"self",
",",
"names",
")",
":",
"try",
":",
"self",
".",
"like",
".",
"logLike",
".",
"loadSourceMaps",
"(",
"names",
",",
"True",
",",
"True",
")",
"self",
".",
"_scale_srcmap",
"(",
"self",
".",
"_src_expscale",
",",
"ch... | Recompute the source map for a list of sources in the model. | [
"Recompute",
"the",
"source",
"map",
"for",
"a",
"list",
"of",
"sources",
"in",
"the",
"model",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4547-L4559 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis._create_source | def _create_source(self, src):
"""Create a pyLikelihood Source object from a
`~fermipy.roi_model.Model` object."""
if src['SpatialType'] == 'SkyDirFunction':
pylike_src = pyLike.PointSource(self.like.logLike.observation())
pylike_src.setDir(src.skydir.ra.deg, src.skydir.... | python | def _create_source(self, src):
"""Create a pyLikelihood Source object from a
`~fermipy.roi_model.Model` object."""
if src['SpatialType'] == 'SkyDirFunction':
pylike_src = pyLike.PointSource(self.like.logLike.observation())
pylike_src.setDir(src.skydir.ra.deg, src.skydir.... | [
"def",
"_create_source",
"(",
"self",
",",
"src",
")",
":",
"if",
"src",
"[",
"'SpatialType'",
"]",
"==",
"'SkyDirFunction'",
":",
"pylike_src",
"=",
"pyLike",
".",
"PointSource",
"(",
"self",
".",
"like",
".",
"logLike",
".",
"observation",
"(",
")",
")... | Create a pyLikelihood Source object from a
`~fermipy.roi_model.Model` object. | [
"Create",
"a",
"pyLikelihood",
"Source",
"object",
"from",
"a",
"~fermipy",
".",
"roi_model",
".",
"Model",
"object",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4629-L4695 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.set_exposure_scale | def set_exposure_scale(self, name, scale=None):
"""Set the exposure correction of a source.
Parameters
----------
name : str
Source name.
scale : factor
Exposure scale factor (1.0 = nominal exposure).
"""
name = self.roi.get_source_by_na... | python | def set_exposure_scale(self, name, scale=None):
"""Set the exposure correction of a source.
Parameters
----------
name : str
Source name.
scale : factor
Exposure scale factor (1.0 = nominal exposure).
"""
name = self.roi.get_source_by_na... | [
"def",
"set_exposure_scale",
"(",
"self",
",",
"name",
",",
"scale",
"=",
"None",
")",
":",
"name",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
".",
"name",
"if",
"scale",
"is",
"None",
"and",
"name",
"not",
"in",
"self",
".... | Set the exposure correction of a source.
Parameters
----------
name : str
Source name.
scale : factor
Exposure scale factor (1.0 = nominal exposure). | [
"Set",
"the",
"exposure",
"correction",
"of",
"a",
"source",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4727-L4746 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.set_energy_range | def set_energy_range(self, logemin, logemax):
"""Set the energy range of the analysis.
Parameters
----------
logemin: float
Lower end of energy range in log10(E/MeV).
logemax : float
Upper end of energy range in log10(E/MeV).
"""
if logem... | python | def set_energy_range(self, logemin, logemax):
"""Set the energy range of the analysis.
Parameters
----------
logemin: float
Lower end of energy range in log10(E/MeV).
logemax : float
Upper end of energy range in log10(E/MeV).
"""
if logem... | [
"def",
"set_energy_range",
"(",
"self",
",",
"logemin",
",",
"logemax",
")",
":",
"if",
"logemin",
"is",
"None",
":",
"logemin",
"=",
"self",
".",
"log_energies",
"[",
"0",
"]",
"if",
"logemax",
"is",
"None",
":",
"logemax",
"=",
"self",
".",
"log_ener... | Set the energy range of the analysis.
Parameters
----------
logemin: float
Lower end of energy range in log10(E/MeV).
logemax : float
Upper end of energy range in log10(E/MeV). | [
"Set",
"the",
"energy",
"range",
"of",
"the",
"analysis",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4755-L4785 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.counts_map | def counts_map(self):
"""Return 3-D counts map for this component as a Map object.
Returns
-------
map : `~fermipy.skymap.MapBase`
"""
try:
if isinstance(self.like, gtutils.SummedLikelihood):
cmap = self.like.components[0].logLike.countsMap()... | python | def counts_map(self):
"""Return 3-D counts map for this component as a Map object.
Returns
-------
map : `~fermipy.skymap.MapBase`
"""
try:
if isinstance(self.like, gtutils.SummedLikelihood):
cmap = self.like.components[0].logLike.countsMap()... | [
"def",
"counts_map",
"(",
"self",
")",
":",
"try",
":",
"if",
"isinstance",
"(",
"self",
".",
"like",
",",
"gtutils",
".",
"SummedLikelihood",
")",
":",
"cmap",
"=",
"self",
".",
"like",
".",
"components",
"[",
"0",
"]",
".",
"logLike",
".",
"countsM... | Return 3-D counts map for this component as a Map object.
Returns
-------
map : `~fermipy.skymap.MapBase` | [
"Return",
"3",
"-",
"D",
"counts",
"map",
"for",
"this",
"component",
"as",
"a",
"Map",
"object",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4787-L4816 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.weight_map | def weight_map(self):
"""Return 3-D weights map for this component as a Map object.
Returns
-------
map : `~fermipy.skymap.MapBase`
"""
# EAC we need the try blocks b/c older versions of the ST don't have some of these functions
if isinstance(self.like, gtutils.... | python | def weight_map(self):
"""Return 3-D weights map for this component as a Map object.
Returns
-------
map : `~fermipy.skymap.MapBase`
"""
# EAC we need the try blocks b/c older versions of the ST don't have some of these functions
if isinstance(self.like, gtutils.... | [
"def",
"weight_map",
"(",
"self",
")",
":",
"if",
"isinstance",
"(",
"self",
".",
"like",
",",
"gtutils",
".",
"SummedLikelihood",
")",
":",
"cmap",
"=",
"self",
".",
"like",
".",
"components",
"[",
"0",
"]",
".",
"logLike",
".",
"countsMap",
"(",
")... | Return 3-D weights map for this component as a Map object.
Returns
-------
map : `~fermipy.skymap.MapBase` | [
"Return",
"3",
"-",
"D",
"weights",
"map",
"for",
"this",
"component",
"as",
"a",
"Map",
"object",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4818-L4872 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.model_counts_spectrum | def model_counts_spectrum(self, name, logemin, logemax, weighted=False):
"""Return the model counts spectrum of a source.
Parameters
----------
name : str
Source name.
"""
# EAC, we need this b/c older version of the ST don't have the right signature
... | python | def model_counts_spectrum(self, name, logemin, logemax, weighted=False):
"""Return the model counts spectrum of a source.
Parameters
----------
name : str
Source name.
"""
# EAC, we need this b/c older version of the ST don't have the right signature
... | [
"def",
"model_counts_spectrum",
"(",
"self",
",",
"name",
",",
"logemin",
",",
"logemax",
",",
"weighted",
"=",
"False",
")",
":",
"try",
":",
"cs",
"=",
"np",
".",
"array",
"(",
"self",
".",
"like",
".",
"logLike",
".",
"modelCountsSpectrum",
"(",
"st... | Return the model counts spectrum of a source.
Parameters
----------
name : str
Source name. | [
"Return",
"the",
"model",
"counts",
"spectrum",
"of",
"a",
"source",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4982-L5001 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.setup | def setup(self, overwrite=False, **kwargs):
"""Run pre-processing step for this component. This will
generate all of the auxiliary files needed to instantiate a
likelihood object. By default this function will skip any
steps for which the output file already exists.
Parameters... | python | def setup(self, overwrite=False, **kwargs):
"""Run pre-processing step for this component. This will
generate all of the auxiliary files needed to instantiate a
likelihood object. By default this function will skip any
steps for which the output file already exists.
Parameters... | [
"def",
"setup",
"(",
"self",
",",
"overwrite",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"loglevel",
"=",
"kwargs",
".",
"get",
"(",
"'loglevel'",
",",
"self",
".",
"loglevel",
")",
"self",
".",
"logger",
".",
"log",
"(",
"loglevel",
",",
"'Runnin... | Run pre-processing step for this component. This will
generate all of the auxiliary files needed to instantiate a
likelihood object. By default this function will skip any
steps for which the output file already exists.
Parameters
----------
overwrite : bool
... | [
"Run",
"pre",
"-",
"processing",
"step",
"for",
"this",
"component",
".",
"This",
"will",
"generate",
"all",
"of",
"the",
"auxiliary",
"files",
"needed",
"to",
"instantiate",
"a",
"likelihood",
"object",
".",
"By",
"default",
"this",
"function",
"will",
"ski... | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5003-L5071 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis._scale_srcmap | def _scale_srcmap(self, scale_map, check_header=True, names=None):
"""Apply exposure corrections to the source map file.
Parameters
----------
scale_map : dict
Dictionary of exposure corrections.
check_header : bool
Check EXPSCALE header keyword to see i... | python | def _scale_srcmap(self, scale_map, check_header=True, names=None):
"""Apply exposure corrections to the source map file.
Parameters
----------
scale_map : dict
Dictionary of exposure corrections.
check_header : bool
Check EXPSCALE header keyword to see i... | [
"def",
"_scale_srcmap",
"(",
"self",
",",
"scale_map",
",",
"check_header",
"=",
"True",
",",
"names",
"=",
"None",
")",
":",
"srcmap",
"=",
"fits",
".",
"open",
"(",
"self",
".",
"files",
"[",
"'srcmap'",
"]",
")",
"for",
"hdu",
"in",
"srcmap",
"[",... | Apply exposure corrections to the source map file.
Parameters
----------
scale_map : dict
Dictionary of exposure corrections.
check_header : bool
Check EXPSCALE header keyword to see if an exposure
correction has already been applied to this source.
... | [
"Apply",
"exposure",
"corrections",
"to",
"the",
"source",
"map",
"file",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5357-L5401 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis._make_scaled_srcmap | def _make_scaled_srcmap(self):
"""Make an exposure cube with the same binning as the counts map."""
self.logger.info('Computing scaled source map.')
bexp0 = fits.open(self.files['bexpmap_roi'])
bexp1 = fits.open(self.config['gtlike']['bexpmap'])
srcmap = fits.open(self.config['... | python | def _make_scaled_srcmap(self):
"""Make an exposure cube with the same binning as the counts map."""
self.logger.info('Computing scaled source map.')
bexp0 = fits.open(self.files['bexpmap_roi'])
bexp1 = fits.open(self.config['gtlike']['bexpmap'])
srcmap = fits.open(self.config['... | [
"def",
"_make_scaled_srcmap",
"(",
"self",
")",
":",
"self",
".",
"logger",
".",
"info",
"(",
"'Computing scaled source map.'",
")",
"bexp0",
"=",
"fits",
".",
"open",
"(",
"self",
".",
"files",
"[",
"'bexpmap_roi'",
"]",
")",
"bexp1",
"=",
"fits",
".",
... | Make an exposure cube with the same binning as the counts map. | [
"Make",
"an",
"exposure",
"cube",
"with",
"the",
"same",
"binning",
"as",
"the",
"counts",
"map",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5403-L5431 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.simulate_roi | def simulate_roi(self, name=None, clear=True, randomize=True):
"""Simulate the whole ROI or inject a simulation of one or
more model components into the data.
Parameters
----------
name : str
Name of the model component to be simulated. If None then
the wh... | python | def simulate_roi(self, name=None, clear=True, randomize=True):
"""Simulate the whole ROI or inject a simulation of one or
more model components into the data.
Parameters
----------
name : str
Name of the model component to be simulated. If None then
the wh... | [
"def",
"simulate_roi",
"(",
"self",
",",
"name",
"=",
"None",
",",
"clear",
"=",
"True",
",",
"randomize",
"=",
"True",
")",
":",
"cm",
"=",
"self",
".",
"counts_map",
"(",
")",
"data",
"=",
"cm",
".",
"data",
"m",
"=",
"self",
".",
"model_counts_m... | Simulate the whole ROI or inject a simulation of one or
more model components into the data.
Parameters
----------
name : str
Name of the model component to be simulated. If None then
the whole ROI will be simulated.
clear : bool
Zero the curre... | [
"Simulate",
"the",
"whole",
"ROI",
"or",
"inject",
"a",
"simulation",
"of",
"one",
"or",
"more",
"model",
"components",
"into",
"the",
"data",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5444-L5487 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis._update_srcmap_file | def _update_srcmap_file(self, sources, overwrite=True):
"""Check the contents of the source map file and generate
source maps for any components that are not present."""
if not os.path.isfile(self.files['srcmap']):
return
hdulist = fits.open(self.files['srcmap'])
hd... | python | def _update_srcmap_file(self, sources, overwrite=True):
"""Check the contents of the source map file and generate
source maps for any components that are not present."""
if not os.path.isfile(self.files['srcmap']):
return
hdulist = fits.open(self.files['srcmap'])
hd... | [
"def",
"_update_srcmap_file",
"(",
"self",
",",
"sources",
",",
"overwrite",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"self",
".",
"files",
"[",
"'srcmap'",
"]",
")",
":",
"return",
"hdulist",
"=",
"fits",
".",
"open... | Check the contents of the source map file and generate
source maps for any components that are not present. | [
"Check",
"the",
"contents",
"of",
"the",
"source",
"map",
"file",
"and",
"generate",
"source",
"maps",
"for",
"any",
"components",
"that",
"are",
"not",
"present",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5527-L5551 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis._create_srcmap | def _create_srcmap(self, name, src, **kwargs):
"""Generate the source map for a source."""
psf_scale_fn = kwargs.get('psf_scale_fn', None)
skydir = src.skydir
spatial_model = src['SpatialModel']
spatial_width = src['SpatialWidth']
xpix, ypix = self.geom.to_image().coord_... | python | def _create_srcmap(self, name, src, **kwargs):
"""Generate the source map for a source."""
psf_scale_fn = kwargs.get('psf_scale_fn', None)
skydir = src.skydir
spatial_model = src['SpatialModel']
spatial_width = src['SpatialWidth']
xpix, ypix = self.geom.to_image().coord_... | [
"def",
"_create_srcmap",
"(",
"self",
",",
"name",
",",
"src",
",",
"**",
"kwargs",
")",
":",
"psf_scale_fn",
"=",
"kwargs",
".",
"get",
"(",
"'psf_scale_fn'",
",",
"None",
")",
"skydir",
"=",
"src",
".",
"skydir",
"spatial_model",
"=",
"src",
"[",
"'S... | Generate the source map for a source. | [
"Generate",
"the",
"source",
"map",
"for",
"a",
"source",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5571-L5592 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis._update_srcmap | def _update_srcmap(self, name, src, **kwargs):
"""Update the source map for an existing source in memory."""
k = self._create_srcmap(name, src, **kwargs)
scale = self._src_expscale.get(name, 1.0)
k *= scale
# Force the source map to be cached
# FIXME: No longer necessar... | python | def _update_srcmap(self, name, src, **kwargs):
"""Update the source map for an existing source in memory."""
k = self._create_srcmap(name, src, **kwargs)
scale = self._src_expscale.get(name, 1.0)
k *= scale
# Force the source map to be cached
# FIXME: No longer necessar... | [
"def",
"_update_srcmap",
"(",
"self",
",",
"name",
",",
"src",
",",
"**",
"kwargs",
")",
":",
"k",
"=",
"self",
".",
"_create_srcmap",
"(",
"name",
",",
"src",
",",
"**",
"kwargs",
")",
"scale",
"=",
"self",
".",
"_src_expscale",
".",
"get",
"(",
"... | Update the source map for an existing source in memory. | [
"Update",
"the",
"source",
"map",
"for",
"an",
"existing",
"source",
"in",
"memory",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5594-L5609 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.generate_model | def generate_model(self, model_name=None, outfile=None):
"""Generate a counts model map from an XML model file using
gtmodel.
Parameters
----------
model_name : str
Name of the model. If no name is given it will use the
baseline model.
outfile :... | python | def generate_model(self, model_name=None, outfile=None):
"""Generate a counts model map from an XML model file using
gtmodel.
Parameters
----------
model_name : str
Name of the model. If no name is given it will use the
baseline model.
outfile :... | [
"def",
"generate_model",
"(",
"self",
",",
"model_name",
"=",
"None",
",",
"outfile",
"=",
"None",
")",
":",
"if",
"model_name",
"is",
"not",
"None",
":",
"model_name",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"model_name",
")",
"[",
"0",
"]",
"... | Generate a counts model map from an XML model file using
gtmodel.
Parameters
----------
model_name : str
Name of the model. If no name is given it will use the
baseline model.
outfile : str
Override the name of the output model file. | [
"Generate",
"a",
"counts",
"model",
"map",
"from",
"an",
"XML",
"model",
"file",
"using",
"gtmodel",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5611-L5660 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.write_xml | def write_xml(self, xmlfile):
"""Write the XML model for this analysis component."""
xmlfile = self.get_model_path(xmlfile)
self.logger.info('Writing %s...', xmlfile)
self.like.writeXml(str(xmlfile)) | python | def write_xml(self, xmlfile):
"""Write the XML model for this analysis component."""
xmlfile = self.get_model_path(xmlfile)
self.logger.info('Writing %s...', xmlfile)
self.like.writeXml(str(xmlfile)) | [
"def",
"write_xml",
"(",
"self",
",",
"xmlfile",
")",
":",
"xmlfile",
"=",
"self",
".",
"get_model_path",
"(",
"xmlfile",
")",
"self",
".",
"logger",
".",
"info",
"(",
"'Writing %s...'",
",",
"xmlfile",
")",
"self",
".",
"like",
".",
"writeXml",
"(",
"... | Write the XML model for this analysis component. | [
"Write",
"the",
"XML",
"model",
"for",
"this",
"analysis",
"component",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5670-L5675 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.get_model_path | def get_model_path(self, name):
"""Infer the path to the XML model name."""
name, ext = os.path.splitext(name)
ext = '.xml'
xmlfile = name + self.config['file_suffix'] + ext
xmlfile = utils.resolve_path(xmlfile,
workdir=self.config['fileio'][... | python | def get_model_path(self, name):
"""Infer the path to the XML model name."""
name, ext = os.path.splitext(name)
ext = '.xml'
xmlfile = name + self.config['file_suffix'] + ext
xmlfile = utils.resolve_path(xmlfile,
workdir=self.config['fileio'][... | [
"def",
"get_model_path",
"(",
"self",
",",
"name",
")",
":",
"name",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"name",
")",
"ext",
"=",
"'.xml'",
"xmlfile",
"=",
"name",
"+",
"self",
".",
"config",
"[",
"'file_suffix'",
"]",
"+",
"e... | Infer the path to the XML model name. | [
"Infer",
"the",
"path",
"to",
"the",
"XML",
"model",
"name",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5677-L5686 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis._tscube_app | def _tscube_app(self, xmlfile):
"""Run gttscube as an application."""
xmlfile = self.get_model_path(xmlfile)
outfile = os.path.join(self.config['fileio']['workdir'],
'tscube%s.fits' % (self.config['file_suffix']))
kw = dict(cmap=self.files['ccube'],
... | python | def _tscube_app(self, xmlfile):
"""Run gttscube as an application."""
xmlfile = self.get_model_path(xmlfile)
outfile = os.path.join(self.config['fileio']['workdir'],
'tscube%s.fits' % (self.config['file_suffix']))
kw = dict(cmap=self.files['ccube'],
... | [
"def",
"_tscube_app",
"(",
"self",
",",
"xmlfile",
")",
":",
"xmlfile",
"=",
"self",
".",
"get_model_path",
"(",
"xmlfile",
")",
"outfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"config",
"[",
"'fileio'",
"]",
"[",
"'workdir'",
"]",
... | Run gttscube as an application. | [
"Run",
"gttscube",
"as",
"an",
"application",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5688-L5711 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis._diffrsp_app | def _diffrsp_app(self,xmlfile=None, **kwargs):
"""
Compute the diffuse response
"""
loglevel = kwargs.get('loglevel', self.loglevel)
self.logger.log(loglevel, 'Computing diffuse repsonce for component %s.',
self.name)
# set the srcmdl
sr... | python | def _diffrsp_app(self,xmlfile=None, **kwargs):
"""
Compute the diffuse response
"""
loglevel = kwargs.get('loglevel', self.loglevel)
self.logger.log(loglevel, 'Computing diffuse repsonce for component %s.',
self.name)
# set the srcmdl
sr... | [
"def",
"_diffrsp_app",
"(",
"self",
",",
"xmlfile",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"loglevel",
"=",
"kwargs",
".",
"get",
"(",
"'loglevel'",
",",
"self",
".",
"loglevel",
")",
"self",
".",
"logger",
".",
"log",
"(",
"loglevel",
",",
"'Co... | Compute the diffuse response | [
"Compute",
"the",
"diffuse",
"response"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5713-L5734 | train |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis._srcprob_app | def _srcprob_app(self,xmlfile=None, overwrite=False, **kwargs):
"""
Run srcprob for an analysis component as an application
"""
loglevel = kwargs.get('loglevel', self.loglevel)
self.logger.log(loglevel, 'Computing src probability for component %s.',
self... | python | def _srcprob_app(self,xmlfile=None, overwrite=False, **kwargs):
"""
Run srcprob for an analysis component as an application
"""
loglevel = kwargs.get('loglevel', self.loglevel)
self.logger.log(loglevel, 'Computing src probability for component %s.',
self... | [
"def",
"_srcprob_app",
"(",
"self",
",",
"xmlfile",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"loglevel",
"=",
"kwargs",
".",
"get",
"(",
"'loglevel'",
",",
"self",
".",
"loglevel",
")",
"self",
".",
"logger",
".",
"... | Run srcprob for an analysis component as an application | [
"Run",
"srcprob",
"for",
"an",
"analysis",
"component",
"as",
"an",
"application"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5736-L5769 | train |
fermiPy/fermipy | fermipy/jobs/chain.py | purge_dict | def purge_dict(idict):
"""Remove null items from a dictionary """
odict = {}
for key, val in idict.items():
if is_null(val):
continue
odict[key] = val
return odict | python | def purge_dict(idict):
"""Remove null items from a dictionary """
odict = {}
for key, val in idict.items():
if is_null(val):
continue
odict[key] = val
return odict | [
"def",
"purge_dict",
"(",
"idict",
")",
":",
"odict",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"idict",
".",
"items",
"(",
")",
":",
"if",
"is_null",
"(",
"val",
")",
":",
"continue",
"odict",
"[",
"key",
"]",
"=",
"val",
"return",
"odict"
... | Remove null items from a dictionary | [
"Remove",
"null",
"items",
"from",
"a",
"dictionary"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L20-L27 | train |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain.main | def main(cls):
"""Hook to run this `Chain` from the command line """
chain = cls.create()
args = chain._run_argparser(sys.argv[1:])
chain._run_chain(sys.stdout, args.dry_run)
chain._finalize(args.dry_run) | python | def main(cls):
"""Hook to run this `Chain` from the command line """
chain = cls.create()
args = chain._run_argparser(sys.argv[1:])
chain._run_chain(sys.stdout, args.dry_run)
chain._finalize(args.dry_run) | [
"def",
"main",
"(",
"cls",
")",
":",
"chain",
"=",
"cls",
".",
"create",
"(",
")",
"args",
"=",
"chain",
".",
"_run_argparser",
"(",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
")",
"chain",
".",
"_run_chain",
"(",
"sys",
".",
"stdout",
",",
"args",
... | Hook to run this `Chain` from the command line | [
"Hook",
"to",
"run",
"this",
"Chain",
"from",
"the",
"command",
"line"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L48-L53 | train |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain._set_link | def _set_link(self, linkname, cls, **kwargs):
"""Transfer options kwargs to a `Link` object,
optionally building the `Link if needed.
Parameters
----------
linkname : str
Unique name of this particular link
cls : type
Type of `Link` being create... | python | def _set_link(self, linkname, cls, **kwargs):
"""Transfer options kwargs to a `Link` object,
optionally building the `Link if needed.
Parameters
----------
linkname : str
Unique name of this particular link
cls : type
Type of `Link` being create... | [
"def",
"_set_link",
"(",
"self",
",",
"linkname",
",",
"cls",
",",
"**",
"kwargs",
")",
":",
"val_copy",
"=",
"purge_dict",
"(",
"kwargs",
".",
"copy",
"(",
")",
")",
"sub_link_prefix",
"=",
"val_copy",
".",
"pop",
"(",
"'link_prefix'",
",",
"''",
")",... | Transfer options kwargs to a `Link` object,
optionally building the `Link if needed.
Parameters
----------
linkname : str
Unique name of this particular link
cls : type
Type of `Link` being created or managed | [
"Transfer",
"options",
"kwargs",
"to",
"a",
"Link",
"object",
"optionally",
"building",
"the",
"Link",
"if",
"needed",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L96-L128 | train |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain._set_links_job_archive | def _set_links_job_archive(self):
"""Pass self._job_archive along to links"""
for link in self._links.values():
link._job_archive = self._job_archive | python | def _set_links_job_archive(self):
"""Pass self._job_archive along to links"""
for link in self._links.values():
link._job_archive = self._job_archive | [
"def",
"_set_links_job_archive",
"(",
"self",
")",
":",
"for",
"link",
"in",
"self",
".",
"_links",
".",
"values",
"(",
")",
":",
"link",
".",
"_job_archive",
"=",
"self",
".",
"_job_archive"
] | Pass self._job_archive along to links | [
"Pass",
"self",
".",
"_job_archive",
"along",
"to",
"links"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L130-L133 | train |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain._run_chain | def _run_chain(self,
stream=sys.stdout,
dry_run=False,
stage_files=True,
force_run=False,
resubmit_failed=False):
"""Run all the links in the chain
Parameters
-----------
stream : `file`
... | python | def _run_chain(self,
stream=sys.stdout,
dry_run=False,
stage_files=True,
force_run=False,
resubmit_failed=False):
"""Run all the links in the chain
Parameters
-----------
stream : `file`
... | [
"def",
"_run_chain",
"(",
"self",
",",
"stream",
"=",
"sys",
".",
"stdout",
",",
"dry_run",
"=",
"False",
",",
"stage_files",
"=",
"True",
",",
"force_run",
"=",
"False",
",",
"resubmit_failed",
"=",
"False",
")",
":",
"self",
".",
"_set_links_job_archive"... | Run all the links in the chain
Parameters
-----------
stream : `file`
Stream to print to,
Must have 'write' function
dry_run : bool
Print commands but do not run them
stage_files : bool
Stage files to and from the scratch area
... | [
"Run",
"all",
"the",
"links",
"in",
"the",
"chain"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L135-L234 | train |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain.clear_jobs | def clear_jobs(self, recursive=True):
"""Clear a dictionary with all the jobs
If recursive is True this will include jobs from all internal `Link`
"""
if recursive:
for link in self._links.values():
link.clear_jobs(recursive)
self.jobs.clear() | python | def clear_jobs(self, recursive=True):
"""Clear a dictionary with all the jobs
If recursive is True this will include jobs from all internal `Link`
"""
if recursive:
for link in self._links.values():
link.clear_jobs(recursive)
self.jobs.clear() | [
"def",
"clear_jobs",
"(",
"self",
",",
"recursive",
"=",
"True",
")",
":",
"if",
"recursive",
":",
"for",
"link",
"in",
"self",
".",
"_links",
".",
"values",
"(",
")",
":",
"link",
".",
"clear_jobs",
"(",
"recursive",
")",
"self",
".",
"jobs",
".",
... | Clear a dictionary with all the jobs
If recursive is True this will include jobs from all internal `Link` | [
"Clear",
"a",
"dictionary",
"with",
"all",
"the",
"jobs"
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L236-L244 | train |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain.check_links_status | def check_links_status(self,
fail_running=False,
fail_pending=False):
""""Check the status of all the jobs run from the
`Link` objects in this `Chain` and return a status
flag that summarizes that.
Parameters
----------
... | python | def check_links_status(self,
fail_running=False,
fail_pending=False):
""""Check the status of all the jobs run from the
`Link` objects in this `Chain` and return a status
flag that summarizes that.
Parameters
----------
... | [
"def",
"check_links_status",
"(",
"self",
",",
"fail_running",
"=",
"False",
",",
"fail_pending",
"=",
"False",
")",
":",
"status_vector",
"=",
"JobStatusVector",
"(",
")",
"for",
"link",
"in",
"self",
".",
"_links",
".",
"values",
"(",
")",
":",
"key",
... | Check the status of all the jobs run from the
`Link` objects in this `Chain` and return a status
flag that summarizes that.
Parameters
----------
fail_running : `bool`
If True, consider running jobs as failed
fail_pending : `bool`
If True, consi... | [
"Check",
"the",
"status",
"of",
"all",
"the",
"jobs",
"run",
"from",
"the",
"Link",
"objects",
"in",
"this",
"Chain",
"and",
"return",
"a",
"status",
"flag",
"that",
"summarizes",
"that",
"."
] | 9df5e7e3728307fd58c5bba36fd86783c39fbad4 | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L290-L320 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.