repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis._fit_newton | def _fit_newton(self, fitcache=None, ebin=None, **kwargs):
"""Fast fitting method using newton fitter."""
tol = kwargs.get('tol', self.config['optimizer']['tol'])
max_iter = kwargs.get('max_iter',
self.config['optimizer']['max_iter'])
init_lambda = kwargs.g... | python | def _fit_newton(self, fitcache=None, ebin=None, **kwargs):
"""Fast fitting method using newton fitter."""
tol = kwargs.get('tol', self.config['optimizer']['tol'])
max_iter = kwargs.get('max_iter',
self.config['optimizer']['max_iter'])
init_lambda = kwargs.g... | [
"def",
"_fit_newton",
"(",
"self",
",",
"fitcache",
"=",
"None",
",",
"ebin",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"tol",
"=",
"kwargs",
".",
"get",
"(",
"'tol'",
",",
"self",
".",
"config",
"[",
"'optimizer'",
"]",
"[",
"'tol'",
"]",
... | Fast fitting method using newton fitter. | [
"Fast",
"fitting",
"method",
"using",
"newton",
"fitter",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3045-L3150 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3177-L3197 |
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"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3211-L3247 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3249-L3267 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3269-L3313 |
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",
... | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3315-L3359 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.write_model_map | def write_model_map(self, model_name, name=None):
"""Save the counts model map to a FITS file.
Parameters
----------
model_name : str
String that will be append to the name of the output file.
name : str
Name of the component.
Returns
---... | python | def write_model_map(self, model_name, name=None):
"""Save the counts model map to a FITS file.
Parameters
----------
model_name : str
String that will be append to the name of the output file.
name : str
Name of the component.
Returns
---... | [
"def",
"write_model_map",
"(",
"self",
",",
"model_name",
",",
"name",
"=",
"None",
")",
":",
"maps",
"=",
"[",
"c",
".",
"write_model_map",
"(",
"model_name",
",",
"name",
")",
"for",
"c",
"in",
"self",
".",
"components",
"]",
"outfile",
"=",
"os",
... | Save the counts model map to a FITS file.
Parameters
----------
model_name : str
String that will be append to the name of the output file.
name : str
Name of the component.
Returns
------- | [
"Save",
"the",
"counts",
"model",
"map",
"to",
"a",
"FITS",
"file",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3361-L3384 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.write_weight_map | def write_weight_map(self, model_name):
"""Save the counts model map to a FITS file.
Parameters
----------
model_name : str
String that will be append to the name of the output file.
Returns
-------
"""
maps = [c.write_weight_map(model_name)... | python | def write_weight_map(self, model_name):
"""Save the counts model map to a FITS file.
Parameters
----------
model_name : str
String that will be append to the name of the output file.
Returns
-------
"""
maps = [c.write_weight_map(model_name)... | [
"def",
"write_weight_map",
"(",
"self",
",",
"model_name",
")",
":",
"maps",
"=",
"[",
"c",
".",
"write_weight_map",
"(",
"model_name",
")",
"for",
"c",
"in",
"self",
".",
"components",
"]",
"outfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
... | Save the counts model map to a FITS file.
Parameters
----------
model_name : str
String that will be append to the name of the output file.
Returns
------- | [
"Save",
"the",
"counts",
"model",
"map",
"to",
"a",
"FITS",
"file",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3386-L3408 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.print_roi | def print_roi(self, loglevel=logging.INFO):
"""Print information about the spectral and spatial properties
of the ROI (sources, diffuse components)."""
self.logger.log(loglevel, '\n' + str(self.roi)) | python | def print_roi(self, loglevel=logging.INFO):
"""Print information about the spectral and spatial properties
of the ROI (sources, diffuse components)."""
self.logger.log(loglevel, '\n' + str(self.roi)) | [
"def",
"print_roi",
"(",
"self",
",",
"loglevel",
"=",
"logging",
".",
"INFO",
")",
":",
"self",
".",
"logger",
".",
"log",
"(",
"loglevel",
",",
"'\\n'",
"+",
"str",
"(",
"self",
".",
"roi",
")",
")"
] | Print information about the spectral and spatial properties
of the ROI (sources, diffuse components). | [
"Print",
"information",
"about",
"the",
"spectral",
"and",
"spatial",
"properties",
"of",
"the",
"ROI",
"(",
"sources",
"diffuse",
"components",
")",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3410-L3413 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.print_params | def print_params(self, allpars=False, loglevel=logging.INFO):
"""Print information about the model parameters (values,
errors, bounds, scale)."""
pars = self.get_params()
o = '\n'
o += '%4s %-20s%10s%10s%10s%10s%10s%5s\n' % (
'idx', 'parname', 'value', 'error',
... | python | def print_params(self, allpars=False, loglevel=logging.INFO):
"""Print information about the model parameters (values,
errors, bounds, scale)."""
pars = self.get_params()
o = '\n'
o += '%4s %-20s%10s%10s%10s%10s%10s%5s\n' % (
'idx', 'parname', 'value', 'error',
... | [
"def",
"print_params",
"(",
"self",
",",
"allpars",
"=",
"False",
",",
"loglevel",
"=",
"logging",
".",
"INFO",
")",
":",
"pars",
"=",
"self",
".",
"get_params",
"(",
")",
"o",
"=",
"'\\n'",
"o",
"+=",
"'%4s %-20s%10s%10s%10s%10s%10s%5s\\n'",
"%",
"(",
"... | Print information about the model parameters (values,
errors, bounds, scale). | [
"Print",
"information",
"about",
"the",
"model",
"parameters",
"(",
"values",
"errors",
"bounds",
"scale",
")",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3415-L3463 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3519-L3610 |
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",
")",
":",
"# extract the results in a convenient format",
"make_plots",
"=",
"kwargs",
".",
"get",
"(",
"'make_plots'",
",",
"False",
")... | 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... | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3612-L3690 |
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",
")",
":",
"#mcube_maps = kwargs.pop('mcube_maps', None)",
"if",
"mcube_map",
"is",
"None",
":",
"mcube_map",
"=",
"self",
".",
"model_counts_map",
"(",
")"... | Make diagnostic plots using the current ROI model. | [
"Make",
"diagnostic",
"plots",
"using",
"the",
"current",
"ROI",
"model",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3755-L3765 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.curvature | def curvature(self, name, **kwargs):
"""Test whether a source shows spectral curvature by comparing
the likelihood ratio of PowerLaw and LogParabola spectral
models.
Parameters
----------
name : str
Source name.
"""
name = self.roi.get_sourc... | python | def curvature(self, name, **kwargs):
"""Test whether a source shows spectral curvature by comparing
the likelihood ratio of PowerLaw and LogParabola spectral
models.
Parameters
----------
name : str
Source name.
"""
name = self.roi.get_sourc... | [
"def",
"curvature",
"(",
"self",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"name",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
".",
"name",
"saved_state",
"=",
"LikelihoodState",
"(",
"self",
".",
"like",
")",
"source",
... | Test whether a source shows spectral curvature by comparing
the likelihood ratio of PowerLaw and LogParabola spectral
models.
Parameters
----------
name : str
Source name. | [
"Test",
"whether",
"a",
"source",
"shows",
"spectral",
"curvature",
"by",
"comparing",
"the",
"likelihood",
"ratio",
"of",
"PowerLaw",
"and",
"LogParabola",
"spectral",
"models",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3767-L3870 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.bowtie | def bowtie(self, name, fd=None, loge=None):
"""Generate a spectral uncertainty band (bowtie) for the given
source. This will create an uncertainty band on the
differential flux as a function of energy by propagating the
errors on the global fit parameters. Note that this band only
... | python | def bowtie(self, name, fd=None, loge=None):
"""Generate a spectral uncertainty band (bowtie) for the given
source. This will create an uncertainty band on the
differential flux as a function of energy by propagating the
errors on the global fit parameters. Note that this band only
... | [
"def",
"bowtie",
"(",
"self",
",",
"name",
",",
"fd",
"=",
"None",
",",
"loge",
"=",
"None",
")",
":",
"if",
"loge",
"is",
"None",
":",
"logemin",
"=",
"self",
".",
"log_energies",
"[",
"0",
"]",
"logemax",
"=",
"self",
".",
"log_energies",
"[",
... | Generate a spectral uncertainty band (bowtie) for the given
source. This will create an uncertainty band on the
differential flux as a function of energy by propagating the
errors on the global fit parameters. Note that this band only
reflects the uncertainty for parameters that are cu... | [
"Generate",
"a",
"spectral",
"uncertainty",
"band",
"(",
"bowtie",
")",
"for",
"the",
"given",
"source",
".",
"This",
"will",
"create",
"an",
"uncertainty",
"band",
"on",
"the",
"differential",
"flux",
"as",
"a",
"function",
"of",
"energy",
"by",
"propagatin... | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3872-L3947 |
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",
"="... | 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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3969-L3990 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTAnalysis.get_src_model | def get_src_model(self, name, paramsonly=False, reoptimize=False,
npts=None, **kwargs):
"""Compose a dictionary for a source with the current best-fit
parameters.
Parameters
----------
name : str
paramsonly : bool
Skip computing TS and ... | python | def get_src_model(self, name, paramsonly=False, reoptimize=False,
npts=None, **kwargs):
"""Compose a dictionary for a source with the current best-fit
parameters.
Parameters
----------
name : str
paramsonly : bool
Skip computing TS and ... | [
"def",
"get_src_model",
"(",
"self",
",",
"name",
",",
"paramsonly",
"=",
"False",
",",
"reoptimize",
"=",
"False",
",",
"npts",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"logger",
".",
"debug",
"(",
"'Generating source dict for '",
"+... | Compose a dictionary for a source with the current best-fit
parameters.
Parameters
----------
name : str
paramsonly : bool
Skip computing TS and likelihood profile.
reoptimize : bool
Re-fit background parameters in likelihood scan.
npts ... | [
"Compose",
"a",
"dictionary",
"for",
"a",
"source",
"with",
"the",
"current",
"best",
"-",
"fit",
"parameters",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L3992-L4229 |
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",
")",
":",
"# compute diffuse response, necessary for srcprob",
"c",
".",
"_... | 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"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4231-L4238 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4528-L4545 |
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",
")",
"# loadSourceMaps doesn't overwrite the header so we need",
"# to ignore EXPSCALE by se... | Recompute the source map for a list of sources in the model. | [
"Recompute",
"the",
"source",
"map",
"for",
"a",
"list",
"of",
"sources",
"in",
"the",
"model",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4547-L4559 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.add_source | def add_source(self, name, src_dict, free=None, save_source_maps=True,
use_pylike=True, use_single_psf=False):
"""Add a new source to the model. Source properties
(spectrum, spatial model) are set with the src_dict argument.
Parameters
----------
name : str... | python | def add_source(self, name, src_dict, free=None, save_source_maps=True,
use_pylike=True, use_single_psf=False):
"""Add a new source to the model. Source properties
(spectrum, spatial model) are set with the src_dict argument.
Parameters
----------
name : str... | [
"def",
"add_source",
"(",
"self",
",",
"name",
",",
"src_dict",
",",
"free",
"=",
"None",
",",
"save_source_maps",
"=",
"True",
",",
"use_pylike",
"=",
"True",
",",
"use_single_psf",
"=",
"False",
")",
":",
"# if self.roi.has_source(name):",
"# msg = 'Source ... | Add a new source to the model. Source properties
(spectrum, spatial model) are set with the src_dict argument.
Parameters
----------
name : str
Source name.
src_dict : dict or `~fermipy.roi_model.Source` object
Dictionary or Source object defining the... | [
"Add",
"a",
"new",
"source",
"to",
"the",
"model",
".",
"Source",
"properties",
"(",
"spectrum",
"spatial",
"model",
")",
"are",
"set",
"with",
"the",
"src_dict",
"argument",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4561-L4627 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4629-L4695 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4727-L4746 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.set_edisp_flag | def set_edisp_flag(self, name, flag=True):
"""Enable/Disable the energy dispersion correction for a
source."""
src = self.roi.get_source_by_name(name)
name = src.name
self.like[name].src.set_edisp_flag(flag) | python | def set_edisp_flag(self, name, flag=True):
"""Enable/Disable the energy dispersion correction for a
source."""
src = self.roi.get_source_by_name(name)
name = src.name
self.like[name].src.set_edisp_flag(flag) | [
"def",
"set_edisp_flag",
"(",
"self",
",",
"name",
",",
"flag",
"=",
"True",
")",
":",
"src",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
"name",
"=",
"src",
".",
"name",
"self",
".",
"like",
"[",
"name",
"]",
".",
"src",
... | Enable/Disable the energy dispersion correction for a
source. | [
"Enable",
"/",
"Disable",
"the",
"energy",
"dispersion",
"correction",
"for",
"a",
"source",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4748-L4753 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4755-L4785 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4787-L4816 |
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",
")",
":",
"# 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",
".",
"SummedLikelihood",
")",
":",
"cmap",
"=",
"self",
".",
"like",... | 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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4818-L4872 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.model_counts_map | def model_counts_map(self, name=None, exclude=None, use_mask=False):
"""Return the model expectation map for a single source, a set
of sources, or all sources in the ROI. The map will be
computed using the current model parameters.
Parameters
----------
name : str
... | python | def model_counts_map(self, name=None, exclude=None, use_mask=False):
"""Return the model expectation map for a single source, a set
of sources, or all sources in the ROI. The map will be
computed using the current model parameters.
Parameters
----------
name : str
... | [
"def",
"model_counts_map",
"(",
"self",
",",
"name",
"=",
"None",
",",
"exclude",
"=",
"None",
",",
"use_mask",
"=",
"False",
")",
":",
"if",
"self",
".",
"projtype",
"==",
"\"WCS\"",
":",
"v",
"=",
"pyLike",
".",
"FloatVector",
"(",
"self",
".",
"np... | Return the model expectation map for a single source, a set
of sources, or all sources in the ROI. The map will be
computed using the current model parameters.
Parameters
----------
name : str
Parameter that defines the sources for which the model map
wil... | [
"Return",
"the",
"model",
"expectation",
"map",
"for",
"a",
"single",
"source",
"a",
"set",
"of",
"sources",
"or",
"all",
"sources",
"in",
"the",
"ROI",
".",
"The",
"map",
"will",
"be",
"computed",
"using",
"the",
"current",
"model",
"parameters",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4874-L4980 |
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",
")",
":",
"# EAC, we need this b/c older version of the ST don't have the right signature",
"try",
":",
"cs",
"=",
"np",
".",
"array",
"(",
"self... | Return the model counts spectrum of a source.
Parameters
----------
name : str
Source name. | [
"Return",
"the",
"model",
"counts",
"spectrum",
"of",
"a",
"source",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L4982-L5001 |
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",
",",
"'... | 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... | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5003-L5071 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5357-L5401 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5403-L5431 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5444-L5487 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.write_model_map | def write_model_map(self, model_name=None, name=None):
"""Save counts model map to a FITS file.
"""
if model_name is None:
suffix = self.config['file_suffix']
else:
suffix = '_%s%s' % (model_name, self.config['file_suffix'])
self.logger.info('Generating... | python | def write_model_map(self, model_name=None, name=None):
"""Save counts model map to a FITS file.
"""
if model_name is None:
suffix = self.config['file_suffix']
else:
suffix = '_%s%s' % (model_name, self.config['file_suffix'])
self.logger.info('Generating... | [
"def",
"write_model_map",
"(",
"self",
",",
"model_name",
"=",
"None",
",",
"name",
"=",
"None",
")",
":",
"if",
"model_name",
"is",
"None",
":",
"suffix",
"=",
"self",
".",
"config",
"[",
"'file_suffix'",
"]",
"else",
":",
"suffix",
"=",
"'_%s%s'",
"%... | Save counts model map to a FITS file. | [
"Save",
"counts",
"model",
"map",
"to",
"a",
"FITS",
"file",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5489-L5506 |
fermiPy/fermipy | fermipy/gtanalysis.py | GTBinnedAnalysis.write_weight_map | def write_weight_map(self, model_name=None):
"""Save counts model map to a FITS file.
"""
if model_name is None:
suffix = self.config['file_suffix']
else:
suffix = '_%s%s' % (model_name, self.config['file_suffix'])
self.logger.info('Generating model map... | python | def write_weight_map(self, model_name=None):
"""Save counts model map to a FITS file.
"""
if model_name is None:
suffix = self.config['file_suffix']
else:
suffix = '_%s%s' % (model_name, self.config['file_suffix'])
self.logger.info('Generating model map... | [
"def",
"write_weight_map",
"(",
"self",
",",
"model_name",
"=",
"None",
")",
":",
"if",
"model_name",
"is",
"None",
":",
"suffix",
"=",
"self",
".",
"config",
"[",
"'file_suffix'",
"]",
"else",
":",
"suffix",
"=",
"'_%s%s'",
"%",
"(",
"model_name",
",",
... | Save counts model map to a FITS file. | [
"Save",
"counts",
"model",
"map",
"to",
"a",
"FITS",
"file",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5508-L5525 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5527-L5551 |
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",
"[",... | Generate the source map for a source. | [
"Generate",
"the",
"source",
"map",
"for",
"a",
"source",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5571-L5592 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5594-L5609 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5611-L5660 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5670-L5675 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5677-L5686 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5688-L5711 |
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",
",",
... | Compute the diffuse response | [
"Compute",
"the",
"diffuse",
"response"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5713-L5734 |
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"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtanalysis.py#L5736-L5769 |
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"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L20-L27 |
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"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L48-L53 |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain._latch_file_info | def _latch_file_info(self):
"""Internal function to update the dictionaries
keeping track of input and output files
"""
self._map_arguments(self.args)
self.files.latch_file_info(self.args)
self.sub_files.file_dict.clear()
self.sub_files.update(self.files.file_dict... | python | def _latch_file_info(self):
"""Internal function to update the dictionaries
keeping track of input and output files
"""
self._map_arguments(self.args)
self.files.latch_file_info(self.args)
self.sub_files.file_dict.clear()
self.sub_files.update(self.files.file_dict... | [
"def",
"_latch_file_info",
"(",
"self",
")",
":",
"self",
".",
"_map_arguments",
"(",
"self",
".",
"args",
")",
"self",
".",
"files",
".",
"latch_file_info",
"(",
"self",
".",
"args",
")",
"self",
".",
"sub_files",
".",
"file_dict",
".",
"clear",
"(",
... | Internal function to update the dictionaries
keeping track of input and output files | [
"Internal",
"function",
"to",
"update",
"the",
"dictionaries",
"keeping",
"track",
"of",
"input",
"and",
"output",
"files"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L69-L79 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L96-L128 |
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"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L130-L133 |
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"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L135-L234 |
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"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L236-L244 |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain.get_jobs | def get_jobs(self, recursive=True):
"""Return a dictionary with all the jobs
If recursive is True this will include jobs from all internal `Link`
"""
if recursive:
ret_dict = self.jobs.copy()
for link in self._links.values():
ret_dict.update(link.... | python | def get_jobs(self, recursive=True):
"""Return a dictionary with all the jobs
If recursive is True this will include jobs from all internal `Link`
"""
if recursive:
ret_dict = self.jobs.copy()
for link in self._links.values():
ret_dict.update(link.... | [
"def",
"get_jobs",
"(",
"self",
",",
"recursive",
"=",
"True",
")",
":",
"if",
"recursive",
":",
"ret_dict",
"=",
"self",
".",
"jobs",
".",
"copy",
"(",
")",
"for",
"link",
"in",
"self",
".",
"_links",
".",
"values",
"(",
")",
":",
"ret_dict",
".",... | Return a dictionary with all the jobs
If recursive is True this will include jobs from all internal `Link` | [
"Return",
"a",
"dictionary",
"with",
"all",
"the",
"jobs"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L246-L256 |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain.missing_input_files | def missing_input_files(self):
"""Make and return a dictionary of the missing input files.
This returns a dictionary mapping
filepath to list of `Link` that use the file as input.
"""
ret_dict = OrderedDict()
for link in self._links.values():
link_dict = link... | python | def missing_input_files(self):
"""Make and return a dictionary of the missing input files.
This returns a dictionary mapping
filepath to list of `Link` that use the file as input.
"""
ret_dict = OrderedDict()
for link in self._links.values():
link_dict = link... | [
"def",
"missing_input_files",
"(",
"self",
")",
":",
"ret_dict",
"=",
"OrderedDict",
"(",
")",
"for",
"link",
"in",
"self",
".",
"_links",
".",
"values",
"(",
")",
":",
"link_dict",
"=",
"link",
".",
"missing_input_files",
"(",
")",
"for",
"key",
",",
... | Make and return a dictionary of the missing input files.
This returns a dictionary mapping
filepath to list of `Link` that use the file as input. | [
"Make",
"and",
"return",
"a",
"dictionary",
"of",
"the",
"missing",
"input",
"files",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L258-L272 |
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",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L290-L320 |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain.run | def run(self, stream=sys.stdout, dry_run=False,
stage_files=True, resubmit_failed=False):
"""Runs this `Chain`.
Parameters
-----------
stream : `file`
Stream that this `Link` will print to,
Must have 'write' function
dry_run : bool
... | python | def run(self, stream=sys.stdout, dry_run=False,
stage_files=True, resubmit_failed=False):
"""Runs this `Chain`.
Parameters
-----------
stream : `file`
Stream that this `Link` will print to,
Must have 'write' function
dry_run : bool
... | [
"def",
"run",
"(",
"self",
",",
"stream",
"=",
"sys",
".",
"stdout",
",",
"dry_run",
"=",
"False",
",",
"stage_files",
"=",
"True",
",",
"resubmit_failed",
"=",
"False",
")",
":",
"self",
".",
"_run_chain",
"(",
"stream",
",",
"dry_run",
",",
"stage_fi... | Runs this `Chain`.
Parameters
-----------
stream : `file`
Stream that this `Link` will print to,
Must have 'write' function
dry_run : bool
Print command but do not run it.
stage_files : bool
Copy files to and from scratch staging... | [
"Runs",
"this",
"Chain",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L322-L343 |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain.update_args | def update_args(self, override_args):
"""Update the argument used to invoke the application
Note that this will also update the dictionary of input
and output files.
Parameters
-----------
override_args : dict
dictionary passed to the links
"""
... | python | def update_args(self, override_args):
"""Update the argument used to invoke the application
Note that this will also update the dictionary of input
and output files.
Parameters
-----------
override_args : dict
dictionary passed to the links
"""
... | [
"def",
"update_args",
"(",
"self",
",",
"override_args",
")",
":",
"self",
".",
"args",
"=",
"extract_arguments",
"(",
"override_args",
",",
"self",
".",
"args",
")",
"self",
".",
"_map_arguments",
"(",
"self",
".",
"args",
")",
"scratch_dir",
"=",
"self",... | Update the argument used to invoke the application
Note that this will also update the dictionary of input
and output files.
Parameters
-----------
override_args : dict
dictionary passed to the links | [
"Update",
"the",
"argument",
"used",
"to",
"invoke",
"the",
"application"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L345-L365 |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain.print_status | def print_status(self, indent="", recurse=False):
"""Print a summary of the job status for each `Link` in this `Chain`"""
print ("%s%30s : %15s : %20s" %
(indent, "Linkname", "Link Status", "Jobs Status"))
for link in self._links.values():
if hasattr(link, 'check_statu... | python | def print_status(self, indent="", recurse=False):
"""Print a summary of the job status for each `Link` in this `Chain`"""
print ("%s%30s : %15s : %20s" %
(indent, "Linkname", "Link Status", "Jobs Status"))
for link in self._links.values():
if hasattr(link, 'check_statu... | [
"def",
"print_status",
"(",
"self",
",",
"indent",
"=",
"\"\"",
",",
"recurse",
"=",
"False",
")",
":",
"print",
"(",
"\"%s%30s : %15s : %20s\"",
"%",
"(",
"indent",
",",
"\"Linkname\"",
",",
"\"Link Status\"",
",",
"\"Jobs Status\"",
")",
")",
"for",
"link"... | Print a summary of the job status for each `Link` in this `Chain` | [
"Print",
"a",
"summary",
"of",
"the",
"job",
"status",
"for",
"each",
"Link",
"in",
"this",
"Chain"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L367-L388 |
fermiPy/fermipy | fermipy/jobs/chain.py | Chain.print_summary | def print_summary(self, stream=sys.stdout, indent="", recurse_level=2):
"""Print a summary of the activity done by this `Chain`.
Parameters
-----------
stream : `file`
Stream to print to, must have 'write' method.
indent : str
Indentation at start of li... | python | def print_summary(self, stream=sys.stdout, indent="", recurse_level=2):
"""Print a summary of the activity done by this `Chain`.
Parameters
-----------
stream : `file`
Stream to print to, must have 'write' method.
indent : str
Indentation at start of li... | [
"def",
"print_summary",
"(",
"self",
",",
"stream",
"=",
"sys",
".",
"stdout",
",",
"indent",
"=",
"\"\"",
",",
"recurse_level",
"=",
"2",
")",
":",
"Link",
".",
"print_summary",
"(",
"self",
",",
"stream",
",",
"indent",
",",
"recurse_level",
")",
"if... | Print a summary of the activity done by this `Chain`.
Parameters
-----------
stream : `file`
Stream to print to, must have 'write' method.
indent : str
Indentation at start of line
recurse_level : int
Number of recursion levels to print | [
"Print",
"a",
"summary",
"of",
"the",
"activity",
"done",
"by",
"this",
"Chain",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/chain.py#L390-L412 |
fermiPy/fermipy | fermipy/diffuse/solar.py | register_classes | def register_classes():
"""Register these classes with the `LinkFactory` """
Gtlink_exphpsun.register_class()
Gtlink_suntemp.register_class()
Gtexphpsun_SG.register_class()
Gtsuntemp_SG.register_class()
SunMoonChain.register_class() | python | def register_classes():
"""Register these classes with the `LinkFactory` """
Gtlink_exphpsun.register_class()
Gtlink_suntemp.register_class()
Gtexphpsun_SG.register_class()
Gtsuntemp_SG.register_class()
SunMoonChain.register_class() | [
"def",
"register_classes",
"(",
")",
":",
"Gtlink_exphpsun",
".",
"register_class",
"(",
")",
"Gtlink_suntemp",
".",
"register_class",
"(",
")",
"Gtexphpsun_SG",
".",
"register_class",
"(",
")",
"Gtsuntemp_SG",
".",
"register_class",
"(",
")",
"SunMoonChain",
".",... | Register these classes with the `LinkFactory` | [
"Register",
"these",
"classes",
"with",
"the",
"LinkFactory"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/solar.py#L336-L342 |
fermiPy/fermipy | fermipy/diffuse/solar.py | Gtexpcube2wcs_SG.build_job_configs | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
NAME_FACTORY.update_base_dict(args['data'])
mktime = args['mktimefilter']
base_config = dict(nxpix=args['nxpix']... | python | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
NAME_FACTORY.update_base_dict(args['data'])
mktime = args['mktimefilter']
base_config = dict(nxpix=args['nxpix']... | [
"def",
"build_job_configs",
"(",
"self",
",",
"args",
")",
":",
"job_configs",
"=",
"{",
"}",
"components",
"=",
"Component",
".",
"build_from_yamlfile",
"(",
"args",
"[",
"'comp'",
"]",
")",
"NAME_FACTORY",
".",
"update_base_dict",
"(",
"args",
"[",
"'data'... | Hook to build job configurations | [
"Hook",
"to",
"build",
"job",
"configurations"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/solar.py#L136-L173 |
fermiPy/fermipy | fermipy/diffuse/solar.py | Gtexphpsun_SG.build_job_configs | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
NAME_FACTORY.update_base_dict(args['data'])
mktime = args['mktimefilter']
for comp in components:
zc... | python | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
NAME_FACTORY.update_base_dict(args['data'])
mktime = args['mktimefilter']
for comp in components:
zc... | [
"def",
"build_job_configs",
"(",
"self",
",",
"args",
")",
":",
"job_configs",
"=",
"{",
"}",
"components",
"=",
"Component",
".",
"build_from_yamlfile",
"(",
"args",
"[",
"'comp'",
"]",
")",
"NAME_FACTORY",
".",
"update_base_dict",
"(",
"args",
"[",
"'data'... | Hook to build job configurations | [
"Hook",
"to",
"build",
"job",
"configurations"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/solar.py#L193-L223 |
fermiPy/fermipy | fermipy/diffuse/solar.py | Gtsuntemp_SG.build_job_configs | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
NAME_FACTORY.update_base_dict(args['data'])
# FIXME
mktime = args['mktimefilter']
for comp in components... | python | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
NAME_FACTORY.update_base_dict(args['data'])
# FIXME
mktime = args['mktimefilter']
for comp in components... | [
"def",
"build_job_configs",
"(",
"self",
",",
"args",
")",
":",
"job_configs",
"=",
"{",
"}",
"components",
"=",
"Component",
".",
"build_from_yamlfile",
"(",
"args",
"[",
"'comp'",
"]",
")",
"NAME_FACTORY",
".",
"update_base_dict",
"(",
"args",
"[",
"'data'... | Hook to build job configurations | [
"Hook",
"to",
"build",
"job",
"configurations"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/solar.py#L244-L280 |
fermiPy/fermipy | fermipy/diffuse/solar.py | SunMoonChain._map_arguments | def _map_arguments(self, input_dict):
"""Map from the top-level arguments to the arguments provided to
the indiviudal links """
config_yaml = input_dict['config']
config_dict = load_yaml(config_yaml)
data = config_dict.get('data')
comp = config_dict.get('comp')
... | python | def _map_arguments(self, input_dict):
"""Map from the top-level arguments to the arguments provided to
the indiviudal links """
config_yaml = input_dict['config']
config_dict = load_yaml(config_yaml)
data = config_dict.get('data')
comp = config_dict.get('comp')
... | [
"def",
"_map_arguments",
"(",
"self",
",",
"input_dict",
")",
":",
"config_yaml",
"=",
"input_dict",
"[",
"'config'",
"]",
"config_dict",
"=",
"load_yaml",
"(",
"config_yaml",
")",
"data",
"=",
"config_dict",
".",
"get",
"(",
"'data'",
")",
"comp",
"=",
"c... | Map from the top-level arguments to the arguments provided to
the indiviudal links | [
"Map",
"from",
"the",
"top",
"-",
"level",
"arguments",
"to",
"the",
"arguments",
"provided",
"to",
"the",
"indiviudal",
"links"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/solar.py#L308-L332 |
fermiPy/fermipy | fermipy/diffuse/model_component.py | ModelComponentInfo.get_component_info | def get_component_info(self, comp):
"""Return the information about sub-component specific to a particular data selection
Parameters
----------
comp : `binning.Component` object
Specifies the sub-component
Returns `ModelComponentInfo` object
"""
if ... | python | def get_component_info(self, comp):
"""Return the information about sub-component specific to a particular data selection
Parameters
----------
comp : `binning.Component` object
Specifies the sub-component
Returns `ModelComponentInfo` object
"""
if ... | [
"def",
"get_component_info",
"(",
"self",
",",
"comp",
")",
":",
"if",
"self",
".",
"components",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Model component %s does not have sub-components'",
"%",
"self",
".",
"sourcekey",
")",
"if",
"self",
".",
"moving",... | Return the information about sub-component specific to a particular data selection
Parameters
----------
comp : `binning.Component` object
Specifies the sub-component
Returns `ModelComponentInfo` object | [
"Return",
"the",
"information",
"about",
"sub",
"-",
"component",
"specific",
"to",
"a",
"particular",
"data",
"selection"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/model_component.py#L138-L159 |
fermiPy/fermipy | fermipy/diffuse/model_component.py | ModelComponentInfo.add_component_info | def add_component_info(self, compinfo):
"""Add sub-component specific information to a particular data selection
Parameters
----------
compinfo : `ModelComponentInfo` object
Sub-component being added
"""
if self.components is None:
self.component... | python | def add_component_info(self, compinfo):
"""Add sub-component specific information to a particular data selection
Parameters
----------
compinfo : `ModelComponentInfo` object
Sub-component being added
"""
if self.components is None:
self.component... | [
"def",
"add_component_info",
"(",
"self",
",",
"compinfo",
")",
":",
"if",
"self",
".",
"components",
"is",
"None",
":",
"self",
".",
"components",
"=",
"{",
"}",
"self",
".",
"components",
"[",
"compinfo",
".",
"comp_key",
"]",
"=",
"compinfo"
] | Add sub-component specific information to a particular data selection
Parameters
----------
compinfo : `ModelComponentInfo` object
Sub-component being added | [
"Add",
"sub",
"-",
"component",
"specific",
"information",
"to",
"a",
"particular",
"data",
"selection"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/model_component.py#L161-L172 |
fermiPy/fermipy | fermipy/diffuse/model_component.py | ModelComponentInfo.clone_and_merge_sub | def clone_and_merge_sub(self, key):
"""Clones self and merges clone with sub-component specific information
Parameters
----------
key : str
Key specifying which sub-component
Returns `ModelComponentInfo` object
"""
new_comp = copy.deepcopy(self)
... | python | def clone_and_merge_sub(self, key):
"""Clones self and merges clone with sub-component specific information
Parameters
----------
key : str
Key specifying which sub-component
Returns `ModelComponentInfo` object
"""
new_comp = copy.deepcopy(self)
... | [
"def",
"clone_and_merge_sub",
"(",
"self",
",",
"key",
")",
":",
"new_comp",
"=",
"copy",
".",
"deepcopy",
"(",
"self",
")",
"#sub_com = self.components[key]",
"new_comp",
".",
"components",
"=",
"None",
"new_comp",
".",
"comp_key",
"=",
"key",
"return",
"new_... | Clones self and merges clone with sub-component specific information
Parameters
----------
key : str
Key specifying which sub-component
Returns `ModelComponentInfo` object | [
"Clones",
"self",
"and",
"merges",
"clone",
"with",
"sub",
"-",
"component",
"specific",
"information"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/model_component.py#L174-L189 |
fermiPy/fermipy | fermipy/catalog.py | add_columns | def add_columns(t0, t1):
"""Add columns of table t1 to table t0."""
for colname in t1.colnames:
col = t1.columns[colname]
if colname in t0.columns:
continue
new_col = Column(name=col.name, length=len(t0), dtype=col.dtype) # ,
# shape=col.shape)
t0.add_column... | python | def add_columns(t0, t1):
"""Add columns of table t1 to table t0."""
for colname in t1.colnames:
col = t1.columns[colname]
if colname in t0.columns:
continue
new_col = Column(name=col.name, length=len(t0), dtype=col.dtype) # ,
# shape=col.shape)
t0.add_column... | [
"def",
"add_columns",
"(",
"t0",
",",
"t1",
")",
":",
"for",
"colname",
"in",
"t1",
".",
"colnames",
":",
"col",
"=",
"t1",
".",
"columns",
"[",
"colname",
"]",
"if",
"colname",
"in",
"t0",
".",
"columns",
":",
"continue",
"new_col",
"=",
"Column",
... | Add columns of table t1 to table t0. | [
"Add",
"columns",
"of",
"table",
"t1",
"to",
"table",
"t0",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/catalog.py#L14-L23 |
fermiPy/fermipy | fermipy/catalog.py | join_tables | def join_tables(left, right, key_left, key_right,
cols_right=None):
"""Perform a join of two tables.
Parameters
----------
left : `~astropy.Table`
Left table for join.
right : `~astropy.Table`
Right table for join.
key_left : str
Key used to match eleme... | python | def join_tables(left, right, key_left, key_right,
cols_right=None):
"""Perform a join of two tables.
Parameters
----------
left : `~astropy.Table`
Left table for join.
right : `~astropy.Table`
Right table for join.
key_left : str
Key used to match eleme... | [
"def",
"join_tables",
"(",
"left",
",",
"right",
",",
"key_left",
",",
"key_right",
",",
"cols_right",
"=",
"None",
")",
":",
"right",
"=",
"right",
".",
"copy",
"(",
")",
"if",
"cols_right",
"is",
"None",
":",
"cols_right",
"=",
"right",
".",
"colname... | Perform a join of two tables.
Parameters
----------
left : `~astropy.Table`
Left table for join.
right : `~astropy.Table`
Right table for join.
key_left : str
Key used to match elements from ``left`` table.
key_right : str
Key used to match elements from ``rig... | [
"Perform",
"a",
"join",
"of",
"two",
"tables",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/catalog.py#L26-L73 |
fermiPy/fermipy | fermipy/catalog.py | strip_columns | def strip_columns(tab):
"""Strip whitespace from string columns."""
for colname in tab.colnames:
if tab[colname].dtype.kind in ['S', 'U']:
tab[colname] = np.core.defchararray.strip(tab[colname]) | python | def strip_columns(tab):
"""Strip whitespace from string columns."""
for colname in tab.colnames:
if tab[colname].dtype.kind in ['S', 'U']:
tab[colname] = np.core.defchararray.strip(tab[colname]) | [
"def",
"strip_columns",
"(",
"tab",
")",
":",
"for",
"colname",
"in",
"tab",
".",
"colnames",
":",
"if",
"tab",
"[",
"colname",
"]",
".",
"dtype",
".",
"kind",
"in",
"[",
"'S'",
",",
"'U'",
"]",
":",
"tab",
"[",
"colname",
"]",
"=",
"np",
".",
... | Strip whitespace from string columns. | [
"Strip",
"whitespace",
"from",
"string",
"columns",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/catalog.py#L76-L80 |
fermiPy/fermipy | fermipy/catalog.py | row_to_dict | def row_to_dict(row):
"""Convert a table row to a dictionary."""
o = {}
for colname in row.colnames:
if isinstance(row[colname], np.string_) and row[colname].dtype.kind in ['S', 'U']:
o[colname] = str(row[colname])
else:
o[colname] = row[colname]
return o | python | def row_to_dict(row):
"""Convert a table row to a dictionary."""
o = {}
for colname in row.colnames:
if isinstance(row[colname], np.string_) and row[colname].dtype.kind in ['S', 'U']:
o[colname] = str(row[colname])
else:
o[colname] = row[colname]
return o | [
"def",
"row_to_dict",
"(",
"row",
")",
":",
"o",
"=",
"{",
"}",
"for",
"colname",
"in",
"row",
".",
"colnames",
":",
"if",
"isinstance",
"(",
"row",
"[",
"colname",
"]",
",",
"np",
".",
"string_",
")",
"and",
"row",
"[",
"colname",
"]",
".",
"dty... | Convert a table row to a dictionary. | [
"Convert",
"a",
"table",
"row",
"to",
"a",
"dictionary",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/catalog.py#L83-L93 |
fermiPy/fermipy | fermipy/diffuse/gt_merge_srcmaps.py | GtMergeSrcmaps.run_analysis | def run_analysis(self, argv):
"""Run this analysis"""
args = self._parser.parse_args(argv)
obs = BinnedAnalysis.BinnedObs(irfs=args.irfs,
expCube=args.expcube,
srcMaps=args.srcmaps,
... | python | def run_analysis(self, argv):
"""Run this analysis"""
args = self._parser.parse_args(argv)
obs = BinnedAnalysis.BinnedObs(irfs=args.irfs,
expCube=args.expcube,
srcMaps=args.srcmaps,
... | [
"def",
"run_analysis",
"(",
"self",
",",
"argv",
")",
":",
"args",
"=",
"self",
".",
"_parser",
".",
"parse_args",
"(",
"argv",
")",
"obs",
"=",
"BinnedAnalysis",
".",
"BinnedObs",
"(",
"irfs",
"=",
"args",
".",
"irfs",
",",
"expCube",
"=",
"args",
"... | Run this analysis | [
"Run",
"this",
"analysis"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_merge_srcmaps.py#L55-L102 |
fermiPy/fermipy | fermipy/diffuse/gt_merge_srcmaps.py | MergeSrcmaps_SG.build_job_configs | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
NAME_FACTORY.update_base_dict(args['data'])
ret_dict = make_catalog_comp_dict(sources=args['library'], basedir='.')
... | python | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
NAME_FACTORY.update_base_dict(args['data'])
ret_dict = make_catalog_comp_dict(sources=args['library'], basedir='.')
... | [
"def",
"build_job_configs",
"(",
"self",
",",
"args",
")",
":",
"job_configs",
"=",
"{",
"}",
"components",
"=",
"Component",
".",
"build_from_yamlfile",
"(",
"args",
"[",
"'comp'",
"]",
")",
"NAME_FACTORY",
".",
"update_base_dict",
"(",
"args",
"[",
"'data'... | Hook to build job configurations | [
"Hook",
"to",
"build",
"job",
"configurations"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_merge_srcmaps.py#L122-L168 |
fermiPy/fermipy | fermipy/batch.py | check_log | def check_log(logfile, exited='Exited with exit code',
successful='Successfully completed', exists=True):
""" Often logfile doesn't exist because the job hasn't begun
to run. It is unclear what you want to do in that case...
Parameters
----------
logfile : str
String with path... | python | def check_log(logfile, exited='Exited with exit code',
successful='Successfully completed', exists=True):
""" Often logfile doesn't exist because the job hasn't begun
to run. It is unclear what you want to do in that case...
Parameters
----------
logfile : str
String with path... | [
"def",
"check_log",
"(",
"logfile",
",",
"exited",
"=",
"'Exited with exit code'",
",",
"successful",
"=",
"'Successfully completed'",
",",
"exists",
"=",
"True",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"logfile",
")",
":",
"return",
... | Often logfile doesn't exist because the job hasn't begun
to run. It is unclear what you want to do in that case...
Parameters
----------
logfile : str
String with path to logfile
exists : bool
Is the logfile required to exist
exited : str
String in logfile used to dete... | [
"Often",
"logfile",
"doesn",
"t",
"exist",
"because",
"the",
"job",
"hasn",
"t",
"begun",
"to",
"run",
".",
"It",
"is",
"unclear",
"what",
"you",
"want",
"to",
"do",
"in",
"that",
"case",
"..."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/batch.py#L50-L75 |
fermiPy/fermipy | fermipy/batch.py | dispatch_job | def dispatch_job(jobname, exe, args, opts, batch_opts, dry_run=True):
"""Dispatch an LSF job.
Parameters
----------
exe : str
Execution string.
args : list
Positional arguments.
opts : dict
Dictionary of command-line options.
"""
batch_opts.setdefault('W', 300... | python | def dispatch_job(jobname, exe, args, opts, batch_opts, dry_run=True):
"""Dispatch an LSF job.
Parameters
----------
exe : str
Execution string.
args : list
Positional arguments.
opts : dict
Dictionary of command-line options.
"""
batch_opts.setdefault('W', 300... | [
"def",
"dispatch_job",
"(",
"jobname",
",",
"exe",
",",
"args",
",",
"opts",
",",
"batch_opts",
",",
"dry_run",
"=",
"True",
")",
":",
"batch_opts",
".",
"setdefault",
"(",
"'W'",
",",
"300",
")",
"batch_opts",
".",
"setdefault",
"(",
"'R'",
",",
"'rhe... | Dispatch an LSF job.
Parameters
----------
exe : str
Execution string.
args : list
Positional arguments.
opts : dict
Dictionary of command-line options. | [
"Dispatch",
"an",
"LSF",
"job",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/batch.py#L119-L160 |
fermiPy/fermipy | fermipy/diffuse/gt_coadd_split.py | _make_input_file_list | def _make_input_file_list(binnedfile, num_files):
"""Make the list of input files for a particular energy bin X psf type """
outdir_base = os.path.abspath(os.path.dirname(binnedfile))
outbasename = os.path.basename(binnedfile)
filelist = ""
for i in range(num_files):
split_key = "%06i" % i
... | python | def _make_input_file_list(binnedfile, num_files):
"""Make the list of input files for a particular energy bin X psf type """
outdir_base = os.path.abspath(os.path.dirname(binnedfile))
outbasename = os.path.basename(binnedfile)
filelist = ""
for i in range(num_files):
split_key = "%06i" % i
... | [
"def",
"_make_input_file_list",
"(",
"binnedfile",
",",
"num_files",
")",
":",
"outdir_base",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"binnedfile",
")",
")",
"outbasename",
"=",
"os",
".",
"path",
".",
"basena... | Make the list of input files for a particular energy bin X psf type | [
"Make",
"the",
"list",
"of",
"input",
"files",
"for",
"a",
"particular",
"energy",
"bin",
"X",
"psf",
"type"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_coadd_split.py#L31-L42 |
fermiPy/fermipy | fermipy/diffuse/gt_coadd_split.py | CoaddSplit._map_arguments | def _map_arguments(self, args):
"""Map from the top-level arguments to the arguments provided to
the indiviudal links """
comp_file = args.get('comp', None)
datafile = args.get('data', None)
do_ltsum = args.get('do_ltsum', False)
NAME_FACTORY.update_base_dict(datafile)
... | python | def _map_arguments(self, args):
"""Map from the top-level arguments to the arguments provided to
the indiviudal links """
comp_file = args.get('comp', None)
datafile = args.get('data', None)
do_ltsum = args.get('do_ltsum', False)
NAME_FACTORY.update_base_dict(datafile)
... | [
"def",
"_map_arguments",
"(",
"self",
",",
"args",
")",
":",
"comp_file",
"=",
"args",
".",
"get",
"(",
"'comp'",
",",
"None",
")",
"datafile",
"=",
"args",
".",
"get",
"(",
"'data'",
",",
"None",
")",
"do_ltsum",
"=",
"args",
".",
"get",
"(",
"'do... | Map from the top-level arguments to the arguments provided to
the indiviudal links | [
"Map",
"from",
"the",
"top",
"-",
"level",
"arguments",
"to",
"the",
"arguments",
"provided",
"to",
"the",
"indiviudal",
"links"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_coadd_split.py#L73-L133 |
fermiPy/fermipy | fermipy/diffuse/gt_coadd_split.py | CoaddSplit_SG.build_job_configs | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
datafile = args['data']
if datafile is None or datafile == 'None':
return job_configs
NAME_FACTORY.up... | python | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
components = Component.build_from_yamlfile(args['comp'])
datafile = args['data']
if datafile is None or datafile == 'None':
return job_configs
NAME_FACTORY.up... | [
"def",
"build_job_configs",
"(",
"self",
",",
"args",
")",
":",
"job_configs",
"=",
"{",
"}",
"components",
"=",
"Component",
".",
"build_from_yamlfile",
"(",
"args",
"[",
"'comp'",
"]",
")",
"datafile",
"=",
"args",
"[",
"'data'",
"]",
"if",
"datafile",
... | Hook to build job configurations | [
"Hook",
"to",
"build",
"job",
"configurations"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_coadd_split.py#L153-L204 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction.create_from_flux | def create_from_flux(cls, params, emin, emax, flux, scale=1.0):
"""Create a spectral function instance given its flux."""
params = params.copy()
params[0] = 1.0
params[0] = flux / cls.eval_flux(emin, emax, params, scale=scale)
return cls(params, scale) | python | def create_from_flux(cls, params, emin, emax, flux, scale=1.0):
"""Create a spectral function instance given its flux."""
params = params.copy()
params[0] = 1.0
params[0] = flux / cls.eval_flux(emin, emax, params, scale=scale)
return cls(params, scale) | [
"def",
"create_from_flux",
"(",
"cls",
",",
"params",
",",
"emin",
",",
"emax",
",",
"flux",
",",
"scale",
"=",
"1.0",
")",
":",
"params",
"=",
"params",
".",
"copy",
"(",
")",
"params",
"[",
"0",
"]",
"=",
"1.0",
"params",
"[",
"0",
"]",
"=",
... | Create a spectral function instance given its flux. | [
"Create",
"a",
"spectral",
"function",
"instance",
"given",
"its",
"flux",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L146-L151 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction.create_from_eflux | def create_from_eflux(cls, params, emin, emax, eflux, scale=1.0):
"""Create a spectral function instance given its energy flux."""
params = params.copy()
params[0] = 1.0
params[0] = eflux / cls.eval_eflux(emin, emax, params, scale=scale)
return cls(params, scale) | python | def create_from_eflux(cls, params, emin, emax, eflux, scale=1.0):
"""Create a spectral function instance given its energy flux."""
params = params.copy()
params[0] = 1.0
params[0] = eflux / cls.eval_eflux(emin, emax, params, scale=scale)
return cls(params, scale) | [
"def",
"create_from_eflux",
"(",
"cls",
",",
"params",
",",
"emin",
",",
"emax",
",",
"eflux",
",",
"scale",
"=",
"1.0",
")",
":",
"params",
"=",
"params",
".",
"copy",
"(",
")",
"params",
"[",
"0",
"]",
"=",
"1.0",
"params",
"[",
"0",
"]",
"=",
... | Create a spectral function instance given its energy flux. | [
"Create",
"a",
"spectral",
"function",
"instance",
"given",
"its",
"energy",
"flux",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L154-L159 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction._integrate | def _integrate(cls, fn, emin, emax, params, scale=1.0, extra_params=None,
npt=20):
"""Fast numerical integration method using mid-point rule."""
emin = np.expand_dims(emin, -1)
emax = np.expand_dims(emax, -1)
params = copy.deepcopy(params)
for i, p in enumera... | python | def _integrate(cls, fn, emin, emax, params, scale=1.0, extra_params=None,
npt=20):
"""Fast numerical integration method using mid-point rule."""
emin = np.expand_dims(emin, -1)
emax = np.expand_dims(emax, -1)
params = copy.deepcopy(params)
for i, p in enumera... | [
"def",
"_integrate",
"(",
"cls",
",",
"fn",
",",
"emin",
",",
"emax",
",",
"params",
",",
"scale",
"=",
"1.0",
",",
"extra_params",
"=",
"None",
",",
"npt",
"=",
"20",
")",
":",
"emin",
"=",
"np",
".",
"expand_dims",
"(",
"emin",
",",
"-",
"1",
... | Fast numerical integration method using mid-point rule. | [
"Fast",
"numerical",
"integration",
"method",
"using",
"mid",
"-",
"point",
"rule",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L230-L246 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction.dnde | def dnde(self, x, params=None):
"""Evaluate differential flux."""
params = self.params if params is None else params
return np.squeeze(self.eval_dnde(x, params, self.scale,
self.extra_params)) | python | def dnde(self, x, params=None):
"""Evaluate differential flux."""
params = self.params if params is None else params
return np.squeeze(self.eval_dnde(x, params, self.scale,
self.extra_params)) | [
"def",
"dnde",
"(",
"self",
",",
"x",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"params",
"if",
"params",
"is",
"None",
"else",
"params",
"return",
"np",
".",
"squeeze",
"(",
"self",
".",
"eval_dnde",
"(",
"x",
",",
"params"... | Evaluate differential flux. | [
"Evaluate",
"differential",
"flux",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L270-L274 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction.ednde | def ednde(self, x, params=None):
"""Evaluate E times differential flux."""
params = self.params if params is None else params
return np.squeeze(self.eval_ednde(x, params, self.scale,
self.extra_params)) | python | def ednde(self, x, params=None):
"""Evaluate E times differential flux."""
params = self.params if params is None else params
return np.squeeze(self.eval_ednde(x, params, self.scale,
self.extra_params)) | [
"def",
"ednde",
"(",
"self",
",",
"x",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"params",
"if",
"params",
"is",
"None",
"else",
"params",
"return",
"np",
".",
"squeeze",
"(",
"self",
".",
"eval_ednde",
"(",
"x",
",",
"param... | Evaluate E times differential flux. | [
"Evaluate",
"E",
"times",
"differential",
"flux",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L276-L280 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction.e2dnde | def e2dnde(self, x, params=None):
"""Evaluate E^2 times differential flux."""
params = self.params if params is None else params
return np.squeeze(self.eval_e2dnde(x, params, self.scale,
self.extra_params)) | python | def e2dnde(self, x, params=None):
"""Evaluate E^2 times differential flux."""
params = self.params if params is None else params
return np.squeeze(self.eval_e2dnde(x, params, self.scale,
self.extra_params)) | [
"def",
"e2dnde",
"(",
"self",
",",
"x",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"params",
"if",
"params",
"is",
"None",
"else",
"params",
"return",
"np",
".",
"squeeze",
"(",
"self",
".",
"eval_e2dnde",
"(",
"x",
",",
"par... | Evaluate E^2 times differential flux. | [
"Evaluate",
"E^2",
"times",
"differential",
"flux",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L282-L286 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction.dnde_deriv | def dnde_deriv(self, x, params=None):
"""Evaluate derivative of the differential flux with respect to E."""
params = self.params if params is None else params
return np.squeeze(self.eval_dnde_deriv(x, params, self.scale,
self.extra_params)) | python | def dnde_deriv(self, x, params=None):
"""Evaluate derivative of the differential flux with respect to E."""
params = self.params if params is None else params
return np.squeeze(self.eval_dnde_deriv(x, params, self.scale,
self.extra_params)) | [
"def",
"dnde_deriv",
"(",
"self",
",",
"x",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"params",
"if",
"params",
"is",
"None",
"else",
"params",
"return",
"np",
".",
"squeeze",
"(",
"self",
".",
"eval_dnde_deriv",
"(",
"x",
","... | Evaluate derivative of the differential flux with respect to E. | [
"Evaluate",
"derivative",
"of",
"the",
"differential",
"flux",
"with",
"respect",
"to",
"E",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L288-L292 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction.ednde_deriv | def ednde_deriv(self, x, params=None):
"""Evaluate derivative of E times differential flux with respect to
E."""
params = self.params if params is None else params
return np.squeeze(self.eval_ednde_deriv(x, params, self.scale,
self.extra_pa... | python | def ednde_deriv(self, x, params=None):
"""Evaluate derivative of E times differential flux with respect to
E."""
params = self.params if params is None else params
return np.squeeze(self.eval_ednde_deriv(x, params, self.scale,
self.extra_pa... | [
"def",
"ednde_deriv",
"(",
"self",
",",
"x",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"params",
"if",
"params",
"is",
"None",
"else",
"params",
"return",
"np",
".",
"squeeze",
"(",
"self",
".",
"eval_ednde_deriv",
"(",
"x",
"... | Evaluate derivative of E times differential flux with respect to
E. | [
"Evaluate",
"derivative",
"of",
"E",
"times",
"differential",
"flux",
"with",
"respect",
"to",
"E",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L294-L299 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction.e2dnde_deriv | def e2dnde_deriv(self, x, params=None):
"""Evaluate derivative of E^2 times differential flux with
respect to E."""
params = self.params if params is None else params
return np.squeeze(self.eval_e2dnde_deriv(x, params, self.scale,
self.ext... | python | def e2dnde_deriv(self, x, params=None):
"""Evaluate derivative of E^2 times differential flux with
respect to E."""
params = self.params if params is None else params
return np.squeeze(self.eval_e2dnde_deriv(x, params, self.scale,
self.ext... | [
"def",
"e2dnde_deriv",
"(",
"self",
",",
"x",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"params",
"if",
"params",
"is",
"None",
"else",
"params",
"return",
"np",
".",
"squeeze",
"(",
"self",
".",
"eval_e2dnde_deriv",
"(",
"x",
... | Evaluate derivative of E^2 times differential flux with
respect to E. | [
"Evaluate",
"derivative",
"of",
"E^2",
"times",
"differential",
"flux",
"with",
"respect",
"to",
"E",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L301-L306 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction.flux | def flux(self, emin, emax, params=None):
"""Evaluate the integral flux."""
params = self.params if params is None else params
return np.squeeze(self.eval_flux(emin, emax, params, self.scale,
self.extra_params)) | python | def flux(self, emin, emax, params=None):
"""Evaluate the integral flux."""
params = self.params if params is None else params
return np.squeeze(self.eval_flux(emin, emax, params, self.scale,
self.extra_params)) | [
"def",
"flux",
"(",
"self",
",",
"emin",
",",
"emax",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"params",
"if",
"params",
"is",
"None",
"else",
"params",
"return",
"np",
".",
"squeeze",
"(",
"self",
".",
"eval_flux",
"(",
"e... | Evaluate the integral flux. | [
"Evaluate",
"the",
"integral",
"flux",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L308-L312 |
fermiPy/fermipy | fermipy/spectrum.py | SpectralFunction.eflux | def eflux(self, emin, emax, params=None):
"""Evaluate the integral energy flux."""
params = self.params if params is None else params
return np.squeeze(self.eval_eflux(emin, emax, params, self.scale,
self.extra_params)) | python | def eflux(self, emin, emax, params=None):
"""Evaluate the integral energy flux."""
params = self.params if params is None else params
return np.squeeze(self.eval_eflux(emin, emax, params, self.scale,
self.extra_params)) | [
"def",
"eflux",
"(",
"self",
",",
"emin",
",",
"emax",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"params",
"if",
"params",
"is",
"None",
"else",
"params",
"return",
"np",
".",
"squeeze",
"(",
"self",
".",
"eval_eflux",
"(",
... | Evaluate the integral energy flux. | [
"Evaluate",
"the",
"integral",
"energy",
"flux",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/spectrum.py#L314-L318 |
fermiPy/fermipy | fermipy/extension.py | ExtensionFit.extension | def extension(self, name, **kwargs):
"""Test this source for spatial extension with the likelihood
ratio method (TS_ext). This method will substitute an
extended spatial model for the given source and perform a
one-dimensional scan of the spatial extension parameter over
the ran... | python | def extension(self, name, **kwargs):
"""Test this source for spatial extension with the likelihood
ratio method (TS_ext). This method will substitute an
extended spatial model for the given source and perform a
one-dimensional scan of the spatial extension parameter over
the ran... | [
"def",
"extension",
"(",
"self",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"timer",
"=",
"Timer",
".",
"create",
"(",
"start",
"=",
"True",
")",
"name",
"=",
"self",
".",
"roi",
".",
"get_source_by_name",
"(",
"name",
")",
".",
"name",
"schem... | Test this source for spatial extension with the likelihood
ratio method (TS_ext). This method will substitute an
extended spatial model for the given source and perform a
one-dimensional scan of the spatial extension parameter over
the range specified with the width parameters. The 1-D... | [
"Test",
"this",
"source",
"for",
"spatial",
"extension",
"with",
"the",
"likelihood",
"ratio",
"method",
"(",
"TS_ext",
")",
".",
"This",
"method",
"will",
"substitute",
"an",
"extended",
"spatial",
"model",
"for",
"the",
"given",
"source",
"and",
"perform",
... | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/extension.py#L27-L98 |
fermiPy/fermipy | fermipy/sed_plotting.py | plotNLL_v_Flux | def plotNLL_v_Flux(nll, fluxType, nstep=25, xlims=None):
""" Plot the (negative) log-likelihood as a function of normalization
nll : a LnLFN object
nstep : Number of steps to plot
xlims : x-axis limits, if None, take tem from the nll object
returns fig,ax, which are matplotlib figure and axes o... | python | def plotNLL_v_Flux(nll, fluxType, nstep=25, xlims=None):
""" Plot the (negative) log-likelihood as a function of normalization
nll : a LnLFN object
nstep : Number of steps to plot
xlims : x-axis limits, if None, take tem from the nll object
returns fig,ax, which are matplotlib figure and axes o... | [
"def",
"plotNLL_v_Flux",
"(",
"nll",
",",
"fluxType",
",",
"nstep",
"=",
"25",
",",
"xlims",
"=",
"None",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"if",
"xlims",
"is",
"None",
":",
"xmin",
"=",
"nll",
".",
"interp",
".",
"xmin",
... | Plot the (negative) log-likelihood as a function of normalization
nll : a LnLFN object
nstep : Number of steps to plot
xlims : x-axis limits, if None, take tem from the nll object
returns fig,ax, which are matplotlib figure and axes objects | [
"Plot",
"the",
"(",
"negative",
")",
"log",
"-",
"likelihood",
"as",
"a",
"function",
"of",
"normalization"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/sed_plotting.py#L26-L62 |
fermiPy/fermipy | fermipy/sed_plotting.py | plotCastro_base | def plotCastro_base(castroData, ylims,
xlabel, ylabel, nstep=25, zlims=None, global_min=False):
""" Make a color plot (castro plot) of the
log-likelihood as a function of
energy and flux normalization
castroData : A CastroData_Base object, with the
log-li... | python | def plotCastro_base(castroData, ylims,
xlabel, ylabel, nstep=25, zlims=None, global_min=False):
""" Make a color plot (castro plot) of the
log-likelihood as a function of
energy and flux normalization
castroData : A CastroData_Base object, with the
log-li... | [
"def",
"plotCastro_base",
"(",
"castroData",
",",
"ylims",
",",
"xlabel",
",",
"ylabel",
",",
"nstep",
"=",
"25",
",",
"zlims",
"=",
"None",
",",
"global_min",
"=",
"False",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"ymin",
"=",
"yl... | Make a color plot (castro plot) of the
log-likelihood as a function of
energy and flux normalization
castroData : A CastroData_Base object, with the
log-likelihood v. normalization for each energy bin
ylims : y-axis limits
xlabel : x-axis title
ylabel : ... | [
"Make",
"a",
"color",
"plot",
"(",
"castro",
"plot",
")",
"of",
"the",
"log",
"-",
"likelihood",
"as",
"a",
"function",
"of",
"energy",
"and",
"flux",
"normalization"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/sed_plotting.py#L85-L164 |
fermiPy/fermipy | fermipy/sed_plotting.py | plotCastro | def plotCastro(castroData, ylims, nstep=25, zlims=None):
""" Make a color plot (castro plot) of the
delta log-likelihood as a function of
energy and flux normalization
castroData : A CastroData object, with the
log-likelihood v. normalization for each energy bin
ylims ... | python | def plotCastro(castroData, ylims, nstep=25, zlims=None):
""" Make a color plot (castro plot) of the
delta log-likelihood as a function of
energy and flux normalization
castroData : A CastroData object, with the
log-likelihood v. normalization for each energy bin
ylims ... | [
"def",
"plotCastro",
"(",
"castroData",
",",
"ylims",
",",
"nstep",
"=",
"25",
",",
"zlims",
"=",
"None",
")",
":",
"xlabel",
"=",
"\"Energy [MeV]\"",
"ylabel",
"=",
"NORM_LABEL",
"[",
"castroData",
".",
"norm_type",
"]",
"return",
"plotCastro_base",
"(",
... | Make a color plot (castro plot) of the
delta log-likelihood as a function of
energy and flux normalization
castroData : A CastroData object, with the
log-likelihood v. normalization for each energy bin
ylims : y-axis limits
nstep : Number of y-axis steps to plo... | [
"Make",
"a",
"color",
"plot",
"(",
"castro",
"plot",
")",
"of",
"the",
"delta",
"log",
"-",
"likelihood",
"as",
"a",
"function",
"of",
"energy",
"and",
"flux",
"normalization"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/sed_plotting.py#L167-L183 |
fermiPy/fermipy | fermipy/sed_plotting.py | plotSED | def plotSED(castroData, ylims, TS_thresh=4.0, errSigma=1.0, specVals=[]):
""" Make a color plot (castro plot) of the (negative) log-likelihood
as a function of energy and flux normalization
castroData : A CastroData object, with the
log-likelihood v. normalization for each energy bin... | python | def plotSED(castroData, ylims, TS_thresh=4.0, errSigma=1.0, specVals=[]):
""" Make a color plot (castro plot) of the (negative) log-likelihood
as a function of energy and flux normalization
castroData : A CastroData object, with the
log-likelihood v. normalization for each energy bin... | [
"def",
"plotSED",
"(",
"castroData",
",",
"ylims",
",",
"TS_thresh",
"=",
"4.0",
",",
"errSigma",
"=",
"1.0",
",",
"specVals",
"=",
"[",
"]",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"xmin",
"=",
"castroData",
".",
"refSpec",
".",
... | Make a color plot (castro plot) of the (negative) log-likelihood
as a function of energy and flux normalization
castroData : A CastroData object, with the
log-likelihood v. normalization for each energy bin
ylims : y-axis limits
TS_thresh : TS value above with to plot a poi... | [
"Make",
"a",
"color",
"plot",
"(",
"castro",
"plot",
")",
"of",
"the",
"(",
"negative",
")",
"log",
"-",
"likelihood",
"as",
"a",
"function",
"of",
"energy",
"and",
"flux",
"normalization"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/sed_plotting.py#L220-L257 |
fermiPy/fermipy | fermipy/sed_plotting.py | compare_SED | def compare_SED(castroData1, castroData2, ylims, TS_thresh=4.0,
errSigma=1.0, specVals=[]):
""" Compare two SEDs
castroData1: A CastroData object, with the
log-likelihood v. normalization for each energy bin
castroData2: A CastroData object, with the
log... | python | def compare_SED(castroData1, castroData2, ylims, TS_thresh=4.0,
errSigma=1.0, specVals=[]):
""" Compare two SEDs
castroData1: A CastroData object, with the
log-likelihood v. normalization for each energy bin
castroData2: A CastroData object, with the
log... | [
"def",
"compare_SED",
"(",
"castroData1",
",",
"castroData2",
",",
"ylims",
",",
"TS_thresh",
"=",
"4.0",
",",
"errSigma",
"=",
"1.0",
",",
"specVals",
"=",
"[",
"]",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"xmin",
"=",
"min",
"("... | Compare two SEDs
castroData1: A CastroData object, with the
log-likelihood v. normalization for each energy bin
castroData2: A CastroData object, with the
log-likelihood v. normalization for each energy bin
ylims : y-axis limits
TS_thresh : TS value above with... | [
"Compare",
"two",
"SEDs"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/sed_plotting.py#L260-L301 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | make_ring_dicts | def make_ring_dicts(**kwargs):
"""Build and return the information about the Galprop rings
"""
library_yamlfile = kwargs.get('library', 'models/library.yaml')
gmm = kwargs.get('GalpropMapManager', GalpropMapManager(**kwargs))
if library_yamlfile is None or library_yamlfile == 'None':
return ... | python | def make_ring_dicts(**kwargs):
"""Build and return the information about the Galprop rings
"""
library_yamlfile = kwargs.get('library', 'models/library.yaml')
gmm = kwargs.get('GalpropMapManager', GalpropMapManager(**kwargs))
if library_yamlfile is None or library_yamlfile == 'None':
return ... | [
"def",
"make_ring_dicts",
"(",
"*",
"*",
"kwargs",
")",
":",
"library_yamlfile",
"=",
"kwargs",
".",
"get",
"(",
"'library'",
",",
"'models/library.yaml'",
")",
"gmm",
"=",
"kwargs",
".",
"get",
"(",
"'GalpropMapManager'",
",",
"GalpropMapManager",
"(",
"*",
... | Build and return the information about the Galprop rings | [
"Build",
"and",
"return",
"the",
"information",
"about",
"the",
"Galprop",
"rings"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L437-L453 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | make_diffuse_comp_info_dict | def make_diffuse_comp_info_dict(**kwargs):
"""Build and return the information about the diffuse components
"""
library_yamlfile = kwargs.pop('library', 'models/library.yaml')
components = kwargs.pop('components', None)
if components is None:
comp_yamlfile = kwargs.pop('comp', 'config/binnin... | python | def make_diffuse_comp_info_dict(**kwargs):
"""Build and return the information about the diffuse components
"""
library_yamlfile = kwargs.pop('library', 'models/library.yaml')
components = kwargs.pop('components', None)
if components is None:
comp_yamlfile = kwargs.pop('comp', 'config/binnin... | [
"def",
"make_diffuse_comp_info_dict",
"(",
"*",
"*",
"kwargs",
")",
":",
"library_yamlfile",
"=",
"kwargs",
".",
"pop",
"(",
"'library'",
",",
"'models/library.yaml'",
")",
"components",
"=",
"kwargs",
".",
"pop",
"(",
"'components'",
",",
"None",
")",
"if",
... | Build and return the information about the diffuse components | [
"Build",
"and",
"return",
"the",
"information",
"about",
"the",
"diffuse",
"components"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L456-L485 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | GalpropMapManager.read_galprop_rings_yaml | def read_galprop_rings_yaml(self, galkey):
""" Read the yaml file for a partiuclar galprop key
"""
galprop_rings_yaml = self._name_factory.galprop_rings_yaml(galkey=galkey,
fullpath=True)
galprop_rings = yaml.safe_load(op... | python | def read_galprop_rings_yaml(self, galkey):
""" Read the yaml file for a partiuclar galprop key
"""
galprop_rings_yaml = self._name_factory.galprop_rings_yaml(galkey=galkey,
fullpath=True)
galprop_rings = yaml.safe_load(op... | [
"def",
"read_galprop_rings_yaml",
"(",
"self",
",",
"galkey",
")",
":",
"galprop_rings_yaml",
"=",
"self",
".",
"_name_factory",
".",
"galprop_rings_yaml",
"(",
"galkey",
"=",
"galkey",
",",
"fullpath",
"=",
"True",
")",
"galprop_rings",
"=",
"yaml",
".",
"saf... | Read the yaml file for a partiuclar galprop key | [
"Read",
"the",
"yaml",
"file",
"for",
"a",
"partiuclar",
"galprop",
"key"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L50-L56 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | GalpropMapManager.make_ring_filename | def make_ring_filename(self, source_name, ring, galprop_run):
""" Make the name of a gasmap file for a single ring
Parameters
----------
source_name : str
The galprop component, used to define path to gasmap files
ring : int
The ring index
galpro... | python | def make_ring_filename(self, source_name, ring, galprop_run):
""" Make the name of a gasmap file for a single ring
Parameters
----------
source_name : str
The galprop component, used to define path to gasmap files
ring : int
The ring index
galpro... | [
"def",
"make_ring_filename",
"(",
"self",
",",
"source_name",
",",
"ring",
",",
"galprop_run",
")",
":",
"format_dict",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"format_dict",
"[",
"'sourcekey'",
"]",
"=",
"self",
".",
"_name_factory",
".",
"ga... | Make the name of a gasmap file for a single ring
Parameters
----------
source_name : str
The galprop component, used to define path to gasmap files
ring : int
The ring index
galprop_run : str
String identifying the galprop parameters | [
"Make",
"the",
"name",
"of",
"a",
"gasmap",
"file",
"for",
"a",
"single",
"ring"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L77-L94 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | GalpropMapManager.make_merged_name | def make_merged_name(self, source_name, galkey, fullpath):
""" Make the name of a gasmap file for a set of merged rings
Parameters
----------
source_name : str
The galprop component, used to define path to gasmap files
galkey : str
A short key identifyin... | python | def make_merged_name(self, source_name, galkey, fullpath):
""" Make the name of a gasmap file for a set of merged rings
Parameters
----------
source_name : str
The galprop component, used to define path to gasmap files
galkey : str
A short key identifyin... | [
"def",
"make_merged_name",
"(",
"self",
",",
"source_name",
",",
"galkey",
",",
"fullpath",
")",
":",
"format_dict",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"format_dict",
"[",
"'sourcekey'",
"]",
"=",
"self",
".",
"_name_factory",
".",
"galpr... | Make the name of a gasmap file for a set of merged rings
Parameters
----------
source_name : str
The galprop component, used to define path to gasmap files
galkey : str
A short key identifying the galprop parameters
fullpath : bool
Return the... | [
"Make",
"the",
"name",
"of",
"a",
"gasmap",
"file",
"for",
"a",
"set",
"of",
"merged",
"rings"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L96-L113 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | GalpropMapManager.make_xml_name | def make_xml_name(self, source_name, galkey, fullpath):
""" Make the name of an xml file for a model definition for a set of merged rings
Parameters
----------
source_name : str
The galprop component, used to define path to gasmap files
galkey : str
A sh... | python | def make_xml_name(self, source_name, galkey, fullpath):
""" Make the name of an xml file for a model definition for a set of merged rings
Parameters
----------
source_name : str
The galprop component, used to define path to gasmap files
galkey : str
A sh... | [
"def",
"make_xml_name",
"(",
"self",
",",
"source_name",
",",
"galkey",
",",
"fullpath",
")",
":",
"format_dict",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"format_dict",
"[",
"'sourcekey'",
"]",
"=",
"self",
".",
"_name_factory",
".",
"galprop_... | Make the name of an xml file for a model definition for a set of merged rings
Parameters
----------
source_name : str
The galprop component, used to define path to gasmap files
galkey : str
A short key identifying the galprop parameters
fullpath : bool
... | [
"Make",
"the",
"name",
"of",
"an",
"xml",
"file",
"for",
"a",
"model",
"definition",
"for",
"a",
"set",
"of",
"merged",
"rings"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L115-L132 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.