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/diffuse/diffuse_src_manager.py | GalpropMapManager.make_ring_filelist | def make_ring_filelist(self, sourcekeys, rings, galprop_run):
""" Make a list of all the template files for a merged component
Parameters
----------
sourcekeys : list-like of str
The names of the componenents to merge
rings : list-like of int
The indices... | python | def make_ring_filelist(self, sourcekeys, rings, galprop_run):
""" Make a list of all the template files for a merged component
Parameters
----------
sourcekeys : list-like of str
The names of the componenents to merge
rings : list-like of int
The indices... | [
"def",
"make_ring_filelist",
"(",
"self",
",",
"sourcekeys",
",",
"rings",
",",
"galprop_run",
")",
":",
"flist",
"=",
"[",
"]",
"for",
"sourcekey",
"in",
"sourcekeys",
":",
"for",
"ring",
"in",
"rings",
":",
"flist",
"+=",
"[",
"self",
".",
"make_ring_f... | Make a list of all the template files for a merged component
Parameters
----------
sourcekeys : list-like of str
The names of the componenents to merge
rings : list-like of int
The indices of the rings to merge
galprop_run : str
String identi... | [
"Make",
"a",
"list",
"of",
"all",
"the",
"template",
"files",
"for",
"a",
"merged",
"component"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L134-L152 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | GalpropMapManager.make_ring_dict | def make_ring_dict(self, galkey):
""" Make a dictionary mapping the merged component names to list of template files
Parameters
----------
galkey : str
Unique key for this ring dictionary
Returns `model_component.GalpropMergedRingInfo`
"""
galprop_r... | python | def make_ring_dict(self, galkey):
""" Make a dictionary mapping the merged component names to list of template files
Parameters
----------
galkey : str
Unique key for this ring dictionary
Returns `model_component.GalpropMergedRingInfo`
"""
galprop_r... | [
"def",
"make_ring_dict",
"(",
"self",
",",
"galkey",
")",
":",
"galprop_rings",
"=",
"self",
".",
"read_galprop_rings_yaml",
"(",
"galkey",
")",
"galprop_run",
"=",
"galprop_rings",
"[",
"'galprop_run'",
"]",
"ring_limits",
"=",
"galprop_rings",
"[",
"'ring_limits... | Make a dictionary mapping the merged component names to list of template files
Parameters
----------
galkey : str
Unique key for this ring dictionary
Returns `model_component.GalpropMergedRingInfo` | [
"Make",
"a",
"dictionary",
"mapping",
"the",
"merged",
"component",
"names",
"to",
"list",
"of",
"template",
"files"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L154-L190 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | GalpropMapManager.make_diffuse_comp_info | def make_diffuse_comp_info(self, merged_name, galkey):
""" Make the information about a single merged component
Parameters
----------
merged_name : str
The name of the merged component
galkey : str
A short key identifying the galprop parameters
... | python | def make_diffuse_comp_info(self, merged_name, galkey):
""" Make the information about a single merged component
Parameters
----------
merged_name : str
The name of the merged component
galkey : str
A short key identifying the galprop parameters
... | [
"def",
"make_diffuse_comp_info",
"(",
"self",
",",
"merged_name",
",",
"galkey",
")",
":",
"kwargs",
"=",
"dict",
"(",
"source_name",
"=",
"merged_name",
",",
"source_ver",
"=",
"galkey",
",",
"model_type",
"=",
"'MapCubeSource'",
",",
"Spatial_Filename",
"=",
... | Make the information about a single merged component
Parameters
----------
merged_name : str
The name of the merged component
galkey : str
A short key identifying the galprop parameters
Returns `Model_component.ModelComponentInfo` | [
"Make",
"the",
"information",
"about",
"a",
"single",
"merged",
"component"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L192-L211 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | GalpropMapManager.make_diffuse_comp_info_dict | def make_diffuse_comp_info_dict(self, galkey):
""" Make a dictionary maping from merged component to information about that component
Parameters
----------
galkey : str
A short key identifying the galprop parameters
"""
galprop_rings = self.read_galprop_ring... | python | def make_diffuse_comp_info_dict(self, galkey):
""" Make a dictionary maping from merged component to information about that component
Parameters
----------
galkey : str
A short key identifying the galprop parameters
"""
galprop_rings = self.read_galprop_ring... | [
"def",
"make_diffuse_comp_info_dict",
"(",
"self",
",",
"galkey",
")",
":",
"galprop_rings",
"=",
"self",
".",
"read_galprop_rings_yaml",
"(",
"galkey",
")",
"ring_limits",
"=",
"galprop_rings",
".",
"get",
"(",
"'ring_limits'",
")",
"comp_dict",
"=",
"galprop_rin... | Make a dictionary maping from merged component to information about that component
Parameters
----------
galkey : str
A short key identifying the galprop parameters | [
"Make",
"a",
"dictionary",
"maping",
"from",
"merged",
"component",
"to",
"information",
"about",
"that",
"component"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L213-L237 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | DiffuseModelManager.make_template_name | def make_template_name(self, model_type, sourcekey):
""" Make the name of a template file for particular component
Parameters
----------
model_type : str
Type of model to use for this component
sourcekey : str
Key to identify this component
Retu... | python | def make_template_name(self, model_type, sourcekey):
""" Make the name of a template file for particular component
Parameters
----------
model_type : str
Type of model to use for this component
sourcekey : str
Key to identify this component
Retu... | [
"def",
"make_template_name",
"(",
"self",
",",
"model_type",
",",
"sourcekey",
")",
":",
"format_dict",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"format_dict",
"[",
"'sourcekey'",
"]",
"=",
"sourcekey",
"if",
"model_type",
"==",
"'IsoSource'",
":... | Make the name of a template file for particular component
Parameters
----------
model_type : str
Type of model to use for this component
sourcekey : str
Key to identify this component
Returns filename or None if component does not require a template fil... | [
"Make",
"the",
"name",
"of",
"a",
"template",
"file",
"for",
"particular",
"component"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L290-L310 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | DiffuseModelManager.make_xml_name | def make_xml_name(self, sourcekey):
""" Make the name of an xml file for a model definition of a single component
Parameters
----------
sourcekey : str
Key to identify this component
"""
format_dict = self.__dict__.copy()
format_dict['sourcekey'] = s... | python | def make_xml_name(self, sourcekey):
""" Make the name of an xml file for a model definition of a single component
Parameters
----------
sourcekey : str
Key to identify this component
"""
format_dict = self.__dict__.copy()
format_dict['sourcekey'] = s... | [
"def",
"make_xml_name",
"(",
"self",
",",
"sourcekey",
")",
":",
"format_dict",
"=",
"self",
".",
"__dict__",
".",
"copy",
"(",
")",
"format_dict",
"[",
"'sourcekey'",
"]",
"=",
"sourcekey",
"return",
"self",
".",
"_name_factory",
".",
"srcmdl_xml",
"(",
"... | Make the name of an xml file for a model definition of a single component
Parameters
----------
sourcekey : str
Key to identify this component | [
"Make",
"the",
"name",
"of",
"an",
"xml",
"file",
"for",
"a",
"model",
"definition",
"of",
"a",
"single",
"component"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L312-L323 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | DiffuseModelManager.make_diffuse_comp_info | def make_diffuse_comp_info(self, source_name, source_ver, diffuse_dict,
components=None, comp_key=None):
""" Make a dictionary mapping the merged component names to list of template files
Parameters
----------
source_name : str
Name of the sour... | python | def make_diffuse_comp_info(self, source_name, source_ver, diffuse_dict,
components=None, comp_key=None):
""" Make a dictionary mapping the merged component names to list of template files
Parameters
----------
source_name : str
Name of the sour... | [
"def",
"make_diffuse_comp_info",
"(",
"self",
",",
"source_name",
",",
"source_ver",
",",
"diffuse_dict",
",",
"components",
"=",
"None",
",",
"comp_key",
"=",
"None",
")",
":",
"model_type",
"=",
"diffuse_dict",
"[",
"'model_type'",
"]",
"sourcekey",
"=",
"'%... | Make a dictionary mapping the merged component names to list of template files
Parameters
----------
source_name : str
Name of the source
source_ver : str
Key identifying the version of the source
diffuse_dict : dict
Information about this compo... | [
"Make",
"a",
"dictionary",
"mapping",
"the",
"merged",
"component",
"names",
"to",
"list",
"of",
"template",
"files"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L325-L375 |
fermiPy/fermipy | fermipy/diffuse/diffuse_src_manager.py | DiffuseModelManager.make_diffuse_comp_info_dict | def make_diffuse_comp_info_dict(self, diffuse_sources, components):
""" Make a dictionary maping from diffuse component to information about that component
Parameters
----------
diffuse_sources : dict
Dictionary with diffuse source defintions
components : dict
... | python | def make_diffuse_comp_info_dict(self, diffuse_sources, components):
""" Make a dictionary maping from diffuse component to information about that component
Parameters
----------
diffuse_sources : dict
Dictionary with diffuse source defintions
components : dict
... | [
"def",
"make_diffuse_comp_info_dict",
"(",
"self",
",",
"diffuse_sources",
",",
"components",
")",
":",
"ret_dict",
"=",
"{",
"}",
"for",
"key",
",",
"value",
"in",
"diffuse_sources",
".",
"items",
"(",
")",
":",
"if",
"value",
"is",
"None",
":",
"continue... | Make a dictionary maping from diffuse component to information about that component
Parameters
----------
diffuse_sources : dict
Dictionary with diffuse source defintions
components : dict
Dictionary with event selection defintions,
needed for select... | [
"Make",
"a",
"dictionary",
"maping",
"from",
"diffuse",
"component",
"to",
"information",
"about",
"that",
"component"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/diffuse_src_manager.py#L377-L434 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | get_unique_match | def get_unique_match(table, colname, value):
"""Get the row matching value for a particular column.
If exactly one row matchs, return index of that row,
Otherwise raise KeyError.
"""
# FIXME, This is here for python 3.5, where astropy is now returning bytes
# instead of str
if table[colname]... | python | def get_unique_match(table, colname, value):
"""Get the row matching value for a particular column.
If exactly one row matchs, return index of that row,
Otherwise raise KeyError.
"""
# FIXME, This is here for python 3.5, where astropy is now returning bytes
# instead of str
if table[colname]... | [
"def",
"get_unique_match",
"(",
"table",
",",
"colname",
",",
"value",
")",
":",
"# FIXME, This is here for python 3.5, where astropy is now returning bytes",
"# instead of str",
"if",
"table",
"[",
"colname",
"]",
".",
"dtype",
".",
"kind",
"in",
"[",
"'S'",
",",
"... | Get the row matching value for a particular column.
If exactly one row matchs, return index of that row,
Otherwise raise KeyError. | [
"Get",
"the",
"row",
"matching",
"value",
"for",
"a",
"particular",
"column",
".",
"If",
"exactly",
"one",
"row",
"matchs",
"return",
"index",
"of",
"that",
"row",
"Otherwise",
"raise",
"KeyError",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L31-L46 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | main_browse | def main_browse():
"""Entry point for command line use for browsing a FileArchive """
import argparse
parser = argparse.ArgumentParser(usage="file_archive.py [options]",
description="Browse a job archive")
parser.add_argument('--files', action='store', dest='file_... | python | def main_browse():
"""Entry point for command line use for browsing a FileArchive """
import argparse
parser = argparse.ArgumentParser(usage="file_archive.py [options]",
description="Browse a job archive")
parser.add_argument('--files', action='store', dest='file_... | [
"def",
"main_browse",
"(",
")",
":",
"import",
"argparse",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"usage",
"=",
"\"file_archive.py [options]\"",
",",
"description",
"=",
"\"Browse a job archive\"",
")",
"parser",
".",
"add_argument",
"(",
"'--files'"... | Entry point for command line use for browsing a FileArchive | [
"Entry",
"point",
"for",
"command",
"line",
"use",
"for",
"browsing",
"a",
"FileArchive"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L815-L829 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.latch_file_info | def latch_file_info(self, args):
"""Extract the file paths from a set of arguments
"""
self.file_dict.clear()
for key, val in self.file_args.items():
try:
file_path = args[key]
if file_path is None:
continue
... | python | def latch_file_info(self, args):
"""Extract the file paths from a set of arguments
"""
self.file_dict.clear()
for key, val in self.file_args.items():
try:
file_path = args[key]
if file_path is None:
continue
... | [
"def",
"latch_file_info",
"(",
"self",
",",
"args",
")",
":",
"self",
".",
"file_dict",
".",
"clear",
"(",
")",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_args",
".",
"items",
"(",
")",
":",
"try",
":",
"file_path",
"=",
"args",
"[",
"key",... | Extract the file paths from a set of arguments | [
"Extract",
"the",
"file",
"paths",
"from",
"a",
"set",
"of",
"arguments"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L96-L119 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.update | def update(self, file_dict):
"""Update self with values from a dictionary
mapping file path [str] to `FileFlags` enum """
for key, val in file_dict.items():
if key in self.file_dict:
self.file_dict[key] |= val
else:
self.file_dict[key] = va... | python | def update(self, file_dict):
"""Update self with values from a dictionary
mapping file path [str] to `FileFlags` enum """
for key, val in file_dict.items():
if key in self.file_dict:
self.file_dict[key] |= val
else:
self.file_dict[key] = va... | [
"def",
"update",
"(",
"self",
",",
"file_dict",
")",
":",
"for",
"key",
",",
"val",
"in",
"file_dict",
".",
"items",
"(",
")",
":",
"if",
"key",
"in",
"self",
".",
"file_dict",
":",
"self",
".",
"file_dict",
"[",
"key",
"]",
"|=",
"val",
"else",
... | Update self with values from a dictionary
mapping file path [str] to `FileFlags` enum | [
"Update",
"self",
"with",
"values",
"from",
"a",
"dictionary",
"mapping",
"file",
"path",
"[",
"str",
"]",
"to",
"FileFlags",
"enum"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L121-L128 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.input_files | def input_files(self):
"""Return a list of the input files needed by this link.
For `Link` sub-classes this will return the union
of all the input files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as input to anot... | python | def input_files(self):
"""Return a list of the input files needed by this link.
For `Link` sub-classes this will return the union
of all the input files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as input to anot... | [
"def",
"input_files",
"(",
"self",
")",
":",
"ret_list",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_dict",
".",
"items",
"(",
")",
":",
"# For input files we only want files that were marked as input",
"if",
"val",
"&",
"FileFlags",
".",... | Return a list of the input files needed by this link.
For `Link` sub-classes this will return the union
of all the input files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as input to another `Link` in the `Chain` | [
"Return",
"a",
"list",
"of",
"the",
"input",
"files",
"needed",
"by",
"this",
"link",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L135-L149 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.output_files | def output_files(self):
"""Return a list of the output files produced by this link.
For `Link` sub-classes this will return the union
of all the output files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as input to... | python | def output_files(self):
"""Return a list of the output files produced by this link.
For `Link` sub-classes this will return the union
of all the output files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as input to... | [
"def",
"output_files",
"(",
"self",
")",
":",
"ret_list",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_dict",
".",
"items",
"(",
")",
":",
"# For output files we only want files that were marked as output",
"if",
"val",
"&",
"FileFlags",
"... | Return a list of the output files produced by this link.
For `Link` sub-classes this will return the union
of all the output files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as input to another `Link` in the `Chain` | [
"Return",
"a",
"list",
"of",
"the",
"output",
"files",
"produced",
"by",
"this",
"link",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L152-L166 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.chain_input_files | def chain_input_files(self):
"""Return a list of the input files needed by this chain.
For `Link` sub-classes this will return only those files
that were not created by any internal `Link`
"""
ret_list = []
for key, val in self.file_dict.items():
# For chain ... | python | def chain_input_files(self):
"""Return a list of the input files needed by this chain.
For `Link` sub-classes this will return only those files
that were not created by any internal `Link`
"""
ret_list = []
for key, val in self.file_dict.items():
# For chain ... | [
"def",
"chain_input_files",
"(",
"self",
")",
":",
"ret_list",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_dict",
".",
"items",
"(",
")",
":",
"# For chain input files we only want files that were not marked as output",
"# (I.e., not produced by ... | Return a list of the input files needed by this chain.
For `Link` sub-classes this will return only those files
that were not created by any internal `Link` | [
"Return",
"a",
"list",
"of",
"the",
"input",
"files",
"needed",
"by",
"this",
"chain",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L169-L181 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.chain_output_files | def chain_output_files(self):
"""Return a list of the all the output files produced by this link.
For `Link` sub-classes this will return only those files
that were not marked as internal files or marked for removal.
"""
ret_list = []
for key, val in self.file_dict.items... | python | def chain_output_files(self):
"""Return a list of the all the output files produced by this link.
For `Link` sub-classes this will return only those files
that were not marked as internal files or marked for removal.
"""
ret_list = []
for key, val in self.file_dict.items... | [
"def",
"chain_output_files",
"(",
"self",
")",
":",
"ret_list",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_dict",
".",
"items",
"(",
")",
":",
"# For pure input files we only want output files that were not",
"# marked as internal or temp",
"i... | Return a list of the all the output files produced by this link.
For `Link` sub-classes this will return only those files
that were not marked as internal files or marked for removal. | [
"Return",
"a",
"list",
"of",
"the",
"all",
"the",
"output",
"files",
"produced",
"by",
"this",
"link",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L184-L196 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.input_files_to_stage | def input_files_to_stage(self):
"""Return a list of the input files needed by this link.
For `Link` sub-classes this will return the union
of all the input files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as inpu... | python | def input_files_to_stage(self):
"""Return a list of the input files needed by this link.
For `Link` sub-classes this will return the union
of all the input files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as inpu... | [
"def",
"input_files_to_stage",
"(",
"self",
")",
":",
"ret_list",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_dict",
".",
"items",
"(",
")",
":",
"# For input files we only want files that were marked as input",
"if",
"val",
"&",
"FileFlags... | Return a list of the input files needed by this link.
For `Link` sub-classes this will return the union
of all the input files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as input to another `Link` in the `Chain` | [
"Return",
"a",
"list",
"of",
"the",
"input",
"files",
"needed",
"by",
"this",
"link",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L199-L213 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.output_files_to_stage | def output_files_to_stage(self):
"""Return a list of the input files needed by this link.
For `Link` sub-classes this will return the union
of all the input files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as inp... | python | def output_files_to_stage(self):
"""Return a list of the input files needed by this link.
For `Link` sub-classes this will return the union
of all the input files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as inp... | [
"def",
"output_files_to_stage",
"(",
"self",
")",
":",
"ret_list",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_dict",
".",
"items",
"(",
")",
":",
"# For input files we only want files that were marked as input",
"if",
"val",
"&",
"FileFlag... | Return a list of the input files needed by this link.
For `Link` sub-classes this will return the union
of all the input files of each internal `Link`.
That is to say this will include files produced by one
`Link` in a `Chain` and used as input to another `Link` in the `Chain` | [
"Return",
"a",
"list",
"of",
"the",
"input",
"files",
"needed",
"by",
"this",
"link",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L216-L230 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.internal_files | def internal_files(self):
"""Return a list of the intermediate files produced by this link.
This returns all files that were explicitly marked as internal files.
"""
ret_list = []
for key, val in self.file_dict.items():
# For internal files we only want files that we... | python | def internal_files(self):
"""Return a list of the intermediate files produced by this link.
This returns all files that were explicitly marked as internal files.
"""
ret_list = []
for key, val in self.file_dict.items():
# For internal files we only want files that we... | [
"def",
"internal_files",
"(",
"self",
")",
":",
"ret_list",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_dict",
".",
"items",
"(",
")",
":",
"# For internal files we only want files that were marked as",
"# internal",
"if",
"val",
"&",
"Fi... | Return a list of the intermediate files produced by this link.
This returns all files that were explicitly marked as internal files. | [
"Return",
"a",
"list",
"of",
"the",
"intermediate",
"files",
"produced",
"by",
"this",
"link",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L233-L244 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.temp_files | def temp_files(self):
"""Return a list of the temporary files produced by this link.
This returns all files that were explicitly marked for removal.
"""
ret_list = []
for key, val in self.file_dict.items():
# For temp files we only want files that were marked for rem... | python | def temp_files(self):
"""Return a list of the temporary files produced by this link.
This returns all files that were explicitly marked for removal.
"""
ret_list = []
for key, val in self.file_dict.items():
# For temp files we only want files that were marked for rem... | [
"def",
"temp_files",
"(",
"self",
")",
":",
"ret_list",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_dict",
".",
"items",
"(",
")",
":",
"# For temp files we only want files that were marked for removal",
"if",
"val",
"&",
"FileFlags",
"."... | Return a list of the temporary files produced by this link.
This returns all files that were explicitly marked for removal. | [
"Return",
"a",
"list",
"of",
"the",
"temporary",
"files",
"produced",
"by",
"this",
"link",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L247-L257 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.gzip_files | def gzip_files(self):
"""Return a list of the files compressed by this link.
This returns all files that were explicitly marked for compression.
"""
ret_list = []
for key, val in self.file_dict.items():
# For temp files we only want files that were marked for removal... | python | def gzip_files(self):
"""Return a list of the files compressed by this link.
This returns all files that were explicitly marked for compression.
"""
ret_list = []
for key, val in self.file_dict.items():
# For temp files we only want files that were marked for removal... | [
"def",
"gzip_files",
"(",
"self",
")",
":",
"ret_list",
"=",
"[",
"]",
"for",
"key",
",",
"val",
"in",
"self",
".",
"file_dict",
".",
"items",
"(",
")",
":",
"# For temp files we only want files that were marked for removal",
"if",
"val",
"&",
"FileFlags",
"."... | Return a list of the files compressed by this link.
This returns all files that were explicitly marked for compression. | [
"Return",
"a",
"list",
"of",
"the",
"files",
"compressed",
"by",
"this",
"link",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L260-L270 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.print_summary | def print_summary(self, stream=sys.stdout, indent=""):
"""Print a summary of the files in this file dict.
This version explictly counts the union of all input and output files.
"""
stream.write("%sTotal files : %i\n" %
(indent, len(self.file_dict)))
str... | python | def print_summary(self, stream=sys.stdout, indent=""):
"""Print a summary of the files in this file dict.
This version explictly counts the union of all input and output files.
"""
stream.write("%sTotal files : %i\n" %
(indent, len(self.file_dict)))
str... | [
"def",
"print_summary",
"(",
"self",
",",
"stream",
"=",
"sys",
".",
"stdout",
",",
"indent",
"=",
"\"\"",
")",
":",
"stream",
".",
"write",
"(",
"\"%sTotal files : %i\\n\"",
"%",
"(",
"indent",
",",
"len",
"(",
"self",
".",
"file_dict",
")",
")",
... | Print a summary of the files in this file dict.
This version explictly counts the union of all input and output files. | [
"Print",
"a",
"summary",
"of",
"the",
"files",
"in",
"this",
"file",
"dict",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L272-L286 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileDict.print_chain_summary | def print_chain_summary(self, stream=sys.stdout, indent=""):
"""Print a summary of the files in this file dict.
This version uses chain_input_files and chain_output_files to
count the input and output files.
"""
stream.write("%sTotal files : %i\n" %
(in... | python | def print_chain_summary(self, stream=sys.stdout, indent=""):
"""Print a summary of the files in this file dict.
This version uses chain_input_files and chain_output_files to
count the input and output files.
"""
stream.write("%sTotal files : %i\n" %
(in... | [
"def",
"print_chain_summary",
"(",
"self",
",",
"stream",
"=",
"sys",
".",
"stdout",
",",
"indent",
"=",
"\"\"",
")",
":",
"stream",
".",
"write",
"(",
"\"%sTotal files : %i\\n\"",
"%",
"(",
"indent",
",",
"len",
"(",
"self",
".",
"file_dict",
")",
... | Print a summary of the files in this file dict.
This version uses chain_input_files and chain_output_files to
count the input and output files. | [
"Print",
"a",
"summary",
"of",
"the",
"files",
"in",
"this",
"file",
"dict",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L288-L303 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileStageManager.split_local_path | def split_local_path(self, local_file):
"""Split the local path into a directory name and a file name
If local_file is in self.workdir or a subdirectory of it,
the directory will consist of the relative path from workdir.
If local_file is not in self.workdir, directory will be empty.
... | python | def split_local_path(self, local_file):
"""Split the local path into a directory name and a file name
If local_file is in self.workdir or a subdirectory of it,
the directory will consist of the relative path from workdir.
If local_file is not in self.workdir, directory will be empty.
... | [
"def",
"split_local_path",
"(",
"self",
",",
"local_file",
")",
":",
"abspath",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"local_file",
")",
"if",
"abspath",
".",
"find",
"(",
"self",
".",
"workdir",
")",
">=",
"0",
":",
"relpath",
"=",
"abspath",
... | Split the local path into a directory name and a file name
If local_file is in self.workdir or a subdirectory of it,
the directory will consist of the relative path from workdir.
If local_file is not in self.workdir, directory will be empty.
Returns (dirname, basename) | [
"Split",
"the",
"local",
"path",
"into",
"a",
"directory",
"name",
"and",
"a",
"file",
"name"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L319-L337 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileStageManager.construct_scratch_path | def construct_scratch_path(self, dirname, basename):
"""Construct and return a path in the scratch area.
This will be <self.scratchdir>/<dirname>/<basename>
"""
return os.path.join(self.scratchdir, dirname, basename) | python | def construct_scratch_path(self, dirname, basename):
"""Construct and return a path in the scratch area.
This will be <self.scratchdir>/<dirname>/<basename>
"""
return os.path.join(self.scratchdir, dirname, basename) | [
"def",
"construct_scratch_path",
"(",
"self",
",",
"dirname",
",",
"basename",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"scratchdir",
",",
"dirname",
",",
"basename",
")"
] | Construct and return a path in the scratch area.
This will be <self.scratchdir>/<dirname>/<basename> | [
"Construct",
"and",
"return",
"a",
"path",
"in",
"the",
"scratch",
"area",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L339-L344 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileStageManager.get_scratch_path | def get_scratch_path(self, local_file):
"""Construct and return a path in the scratch area from a local file.
"""
(local_dirname, local_basename) = self.split_local_path(local_file)
return self.construct_scratch_path(local_dirname, local_basename) | python | def get_scratch_path(self, local_file):
"""Construct and return a path in the scratch area from a local file.
"""
(local_dirname, local_basename) = self.split_local_path(local_file)
return self.construct_scratch_path(local_dirname, local_basename) | [
"def",
"get_scratch_path",
"(",
"self",
",",
"local_file",
")",
":",
"(",
"local_dirname",
",",
"local_basename",
")",
"=",
"self",
".",
"split_local_path",
"(",
"local_file",
")",
"return",
"self",
".",
"construct_scratch_path",
"(",
"local_dirname",
",",
"loca... | Construct and return a path in the scratch area from a local file. | [
"Construct",
"and",
"return",
"a",
"path",
"in",
"the",
"scratch",
"area",
"from",
"a",
"local",
"file",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L346-L350 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileStageManager.map_files | def map_files(self, local_files):
"""Build a dictionary mapping local paths to scratch paths.
Parameters
----------
local_files : list
List of filenames to be mapped to scratch area
Returns dict
Mapping local_file : fullpath of scratch file
"""
... | python | def map_files(self, local_files):
"""Build a dictionary mapping local paths to scratch paths.
Parameters
----------
local_files : list
List of filenames to be mapped to scratch area
Returns dict
Mapping local_file : fullpath of scratch file
"""
... | [
"def",
"map_files",
"(",
"self",
",",
"local_files",
")",
":",
"ret_dict",
"=",
"{",
"}",
"for",
"local_file",
"in",
"local_files",
":",
"ret_dict",
"[",
"local_file",
"]",
"=",
"self",
".",
"get_scratch_path",
"(",
"local_file",
")",
"return",
"ret_dict"
] | Build a dictionary mapping local paths to scratch paths.
Parameters
----------
local_files : list
List of filenames to be mapped to scratch area
Returns dict
Mapping local_file : fullpath of scratch file | [
"Build",
"a",
"dictionary",
"mapping",
"local",
"paths",
"to",
"scratch",
"paths",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L352-L367 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileStageManager.make_scratch_dirs | def make_scratch_dirs(file_mapping, dry_run=True):
"""Make any directories need in the scratch area"""
scratch_dirs = {}
for value in file_mapping.values():
scratch_dirname = os.path.dirname(value)
scratch_dirs[scratch_dirname] = True
for scratch_dirname in scratc... | python | def make_scratch_dirs(file_mapping, dry_run=True):
"""Make any directories need in the scratch area"""
scratch_dirs = {}
for value in file_mapping.values():
scratch_dirname = os.path.dirname(value)
scratch_dirs[scratch_dirname] = True
for scratch_dirname in scratc... | [
"def",
"make_scratch_dirs",
"(",
"file_mapping",
",",
"dry_run",
"=",
"True",
")",
":",
"scratch_dirs",
"=",
"{",
"}",
"for",
"value",
"in",
"file_mapping",
".",
"values",
"(",
")",
":",
"scratch_dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"va... | Make any directories need in the scratch area | [
"Make",
"any",
"directories",
"need",
"in",
"the",
"scratch",
"area"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L370-L383 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileStageManager.copy_to_scratch | def copy_to_scratch(file_mapping, dry_run=True):
"""Copy input files to scratch area """
for key, value in file_mapping.items():
if not os.path.exists(key):
continue
if dry_run:
print ("copy %s %s" % (key, value))
else:
... | python | def copy_to_scratch(file_mapping, dry_run=True):
"""Copy input files to scratch area """
for key, value in file_mapping.items():
if not os.path.exists(key):
continue
if dry_run:
print ("copy %s %s" % (key, value))
else:
... | [
"def",
"copy_to_scratch",
"(",
"file_mapping",
",",
"dry_run",
"=",
"True",
")",
":",
"for",
"key",
",",
"value",
"in",
"file_mapping",
".",
"items",
"(",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"key",
")",
":",
"continue",
"if"... | Copy input files to scratch area | [
"Copy",
"input",
"files",
"to",
"scratch",
"area"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L386-L397 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileStageManager.copy_from_scratch | def copy_from_scratch(file_mapping, dry_run=True):
"""Copy output files from scratch area """
for key, value in file_mapping.items():
if dry_run:
print ("copy %s %s" % (value, key))
else:
try:
outdir = os.path.dirname(key)
... | python | def copy_from_scratch(file_mapping, dry_run=True):
"""Copy output files from scratch area """
for key, value in file_mapping.items():
if dry_run:
print ("copy %s %s" % (value, key))
else:
try:
outdir = os.path.dirname(key)
... | [
"def",
"copy_from_scratch",
"(",
"file_mapping",
",",
"dry_run",
"=",
"True",
")",
":",
"for",
"key",
",",
"value",
"in",
"file_mapping",
".",
"items",
"(",
")",
":",
"if",
"dry_run",
":",
"print",
"(",
"\"copy %s %s\"",
"%",
"(",
"value",
",",
"key",
... | Copy output files from scratch area | [
"Copy",
"output",
"files",
"from",
"scratch",
"area"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L400-L413 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileHandle.make_table | def make_table(file_dict):
"""Build and return an `astropy.table.Table` to store `FileHandle`"""
col_key = Column(name='key', dtype=int)
col_path = Column(name='path', dtype='S256')
col_creator = Column(name='creator', dtype=int)
col_timestamp = Column(name='timestamp', dtype=int... | python | def make_table(file_dict):
"""Build and return an `astropy.table.Table` to store `FileHandle`"""
col_key = Column(name='key', dtype=int)
col_path = Column(name='path', dtype='S256')
col_creator = Column(name='creator', dtype=int)
col_timestamp = Column(name='timestamp', dtype=int... | [
"def",
"make_table",
"(",
"file_dict",
")",
":",
"col_key",
"=",
"Column",
"(",
"name",
"=",
"'key'",
",",
"dtype",
"=",
"int",
")",
"col_path",
"=",
"Column",
"(",
"name",
"=",
"'path'",
",",
"dtype",
"=",
"'S256'",
")",
"col_creator",
"=",
"Column",
... | Build and return an `astropy.table.Table` to store `FileHandle` | [
"Build",
"and",
"return",
"an",
"astropy",
".",
"table",
".",
"Table",
"to",
"store",
"FileHandle"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L456-L469 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileHandle.make_dict | def make_dict(cls, table):
"""Build and return a dict of `FileHandle` from an `astropy.table.Table`
The dictionary is keyed by FileHandle.key, which is a unique integer for each file
"""
ret_dict = {}
for row in table:
file_handle = cls.create_from_row(row)
r... | python | def make_dict(cls, table):
"""Build and return a dict of `FileHandle` from an `astropy.table.Table`
The dictionary is keyed by FileHandle.key, which is a unique integer for each file
"""
ret_dict = {}
for row in table:
file_handle = cls.create_from_row(row)
r... | [
"def",
"make_dict",
"(",
"cls",
",",
"table",
")",
":",
"ret_dict",
"=",
"{",
"}",
"for",
"row",
"in",
"table",
":",
"file_handle",
"=",
"cls",
".",
"create_from_row",
"(",
"row",
")",
"ret_dict",
"[",
"file_handle",
".",
"key",
"]",
"=",
"file_handle"... | Build and return a dict of `FileHandle` from an `astropy.table.Table`
The dictionary is keyed by FileHandle.key, which is a unique integer for each file | [
"Build",
"and",
"return",
"a",
"dict",
"of",
"FileHandle",
"from",
"an",
"astropy",
".",
"table",
".",
"Table"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L472-L481 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileHandle.create_from_row | def create_from_row(cls, table_row):
"""Build and return a `FileHandle` from an `astropy.table.row.Row` """
kwargs = {}
for key in table_row.colnames:
kwargs[key] = table_row[key]
try:
return cls(**kwargs)
except KeyError:
print(kwargs) | python | def create_from_row(cls, table_row):
"""Build and return a `FileHandle` from an `astropy.table.row.Row` """
kwargs = {}
for key in table_row.colnames:
kwargs[key] = table_row[key]
try:
return cls(**kwargs)
except KeyError:
print(kwargs) | [
"def",
"create_from_row",
"(",
"cls",
",",
"table_row",
")",
":",
"kwargs",
"=",
"{",
"}",
"for",
"key",
"in",
"table_row",
".",
"colnames",
":",
"kwargs",
"[",
"key",
"]",
"=",
"table_row",
"[",
"key",
"]",
"try",
":",
"return",
"cls",
"(",
"*",
"... | Build and return a `FileHandle` from an `astropy.table.row.Row` | [
"Build",
"and",
"return",
"a",
"FileHandle",
"from",
"an",
"astropy",
".",
"table",
".",
"row",
".",
"Row"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L484-L492 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileHandle.check_status | def check_status(self, basepath=None):
"""Check on the status of this particular file"""
if basepath is None:
fullpath = self.path
else:
fullpath = os.path.join(basepath, self.path)
exists = os.path.exists(fullpath)
if not exists:
if self.flag... | python | def check_status(self, basepath=None):
"""Check on the status of this particular file"""
if basepath is None:
fullpath = self.path
else:
fullpath = os.path.join(basepath, self.path)
exists = os.path.exists(fullpath)
if not exists:
if self.flag... | [
"def",
"check_status",
"(",
"self",
",",
"basepath",
"=",
"None",
")",
":",
"if",
"basepath",
"is",
"None",
":",
"fullpath",
"=",
"self",
".",
"path",
"else",
":",
"fullpath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"basepath",
",",
"self",
".",
... | Check on the status of this particular file | [
"Check",
"on",
"the",
"status",
"of",
"this",
"particular",
"file"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L494-L522 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileHandle.append_to_table | def append_to_table(self, table):
"""Add this instance as a row on a `astropy.table.Table` """
table.add_row(dict(path=self.path,
key=self.key,
creator=self.creator,
timestamp=self.timestamp,
stat... | python | def append_to_table(self, table):
"""Add this instance as a row on a `astropy.table.Table` """
table.add_row(dict(path=self.path,
key=self.key,
creator=self.creator,
timestamp=self.timestamp,
stat... | [
"def",
"append_to_table",
"(",
"self",
",",
"table",
")",
":",
"table",
".",
"add_row",
"(",
"dict",
"(",
"path",
"=",
"self",
".",
"path",
",",
"key",
"=",
"self",
".",
"key",
",",
"creator",
"=",
"self",
".",
"creator",
",",
"timestamp",
"=",
"se... | Add this instance as a row on a `astropy.table.Table` | [
"Add",
"this",
"instance",
"as",
"a",
"row",
"on",
"a",
"astropy",
".",
"table",
".",
"Table"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L524-L531 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileHandle.update_table_row | def update_table_row(self, table, row_idx):
"""Update the values in an `astropy.table.Table` for this instances"""
table[row_idx]['path'] = self.path
table[row_idx]['key'] = self.key
table[row_idx]['creator'] = self.creator
table[row_idx]['timestamp'] = self.timestamp
tab... | python | def update_table_row(self, table, row_idx):
"""Update the values in an `astropy.table.Table` for this instances"""
table[row_idx]['path'] = self.path
table[row_idx]['key'] = self.key
table[row_idx]['creator'] = self.creator
table[row_idx]['timestamp'] = self.timestamp
tab... | [
"def",
"update_table_row",
"(",
"self",
",",
"table",
",",
"row_idx",
")",
":",
"table",
"[",
"row_idx",
"]",
"[",
"'path'",
"]",
"=",
"self",
".",
"path",
"table",
"[",
"row_idx",
"]",
"[",
"'key'",
"]",
"=",
"self",
".",
"key",
"table",
"[",
"row... | Update the values in an `astropy.table.Table` for this instances | [
"Update",
"the",
"values",
"in",
"an",
"astropy",
".",
"table",
".",
"Table",
"for",
"this",
"instances"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L533-L540 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive._get_fullpath | def _get_fullpath(self, filepath):
"""Return filepath with the base_path prefixed """
if filepath[0] == '/':
return filepath
return os.path.join(self._base_path, filepath) | python | def _get_fullpath(self, filepath):
"""Return filepath with the base_path prefixed """
if filepath[0] == '/':
return filepath
return os.path.join(self._base_path, filepath) | [
"def",
"_get_fullpath",
"(",
"self",
",",
"filepath",
")",
":",
"if",
"filepath",
"[",
"0",
"]",
"==",
"'/'",
":",
"return",
"filepath",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"_base_path",
",",
"filepath",
")"
] | Return filepath with the base_path prefixed | [
"Return",
"filepath",
"with",
"the",
"base_path",
"prefixed"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L597-L601 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive._fill_cache | def _fill_cache(self):
"""Fill the cache from the `astropy.table.Table`"""
for irow in range(len(self._table)):
file_handle = self._make_file_handle(irow)
self._cache[file_handle.path] = file_handle | python | def _fill_cache(self):
"""Fill the cache from the `astropy.table.Table`"""
for irow in range(len(self._table)):
file_handle = self._make_file_handle(irow)
self._cache[file_handle.path] = file_handle | [
"def",
"_fill_cache",
"(",
"self",
")",
":",
"for",
"irow",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"_table",
")",
")",
":",
"file_handle",
"=",
"self",
".",
"_make_file_handle",
"(",
"irow",
")",
"self",
".",
"_cache",
"[",
"file_handle",
".",
... | Fill the cache from the `astropy.table.Table` | [
"Fill",
"the",
"cache",
"from",
"the",
"astropy",
".",
"table",
".",
"Table"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L607-L611 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive._read_table_file | def _read_table_file(self, table_file):
"""Read an `astropy.table.Table` to set up the archive"""
self._table_file = table_file
if os.path.exists(self._table_file):
self._table = Table.read(self._table_file)
else:
self._table = FileHandle.make_table({})
se... | python | def _read_table_file(self, table_file):
"""Read an `astropy.table.Table` to set up the archive"""
self._table_file = table_file
if os.path.exists(self._table_file):
self._table = Table.read(self._table_file)
else:
self._table = FileHandle.make_table({})
se... | [
"def",
"_read_table_file",
"(",
"self",
",",
"table_file",
")",
":",
"self",
".",
"_table_file",
"=",
"table_file",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_table_file",
")",
":",
"self",
".",
"_table",
"=",
"Table",
".",
"read",
"("... | Read an `astropy.table.Table` to set up the archive | [
"Read",
"an",
"astropy",
".",
"table",
".",
"Table",
"to",
"set",
"up",
"the",
"archive"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L613-L620 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive._make_file_handle | def _make_file_handle(self, row_idx):
"""Build and return a `FileHandle` object from an `astropy.table.row.Row` """
row = self._table[row_idx]
return FileHandle.create_from_row(row) | python | def _make_file_handle(self, row_idx):
"""Build and return a `FileHandle` object from an `astropy.table.row.Row` """
row = self._table[row_idx]
return FileHandle.create_from_row(row) | [
"def",
"_make_file_handle",
"(",
"self",
",",
"row_idx",
")",
":",
"row",
"=",
"self",
".",
"_table",
"[",
"row_idx",
"]",
"return",
"FileHandle",
".",
"create_from_row",
"(",
"row",
")"
] | Build and return a `FileHandle` object from an `astropy.table.row.Row` | [
"Build",
"and",
"return",
"a",
"FileHandle",
"object",
"from",
"an",
"astropy",
".",
"table",
".",
"row",
".",
"Row"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L622-L625 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive.get_handle | def get_handle(self, filepath):
"""Get the `FileHandle` object associated to a particular file """
localpath = self._get_localpath(filepath)
return self._cache[localpath] | python | def get_handle(self, filepath):
"""Get the `FileHandle` object associated to a particular file """
localpath = self._get_localpath(filepath)
return self._cache[localpath] | [
"def",
"get_handle",
"(",
"self",
",",
"filepath",
")",
":",
"localpath",
"=",
"self",
".",
"_get_localpath",
"(",
"filepath",
")",
"return",
"self",
".",
"_cache",
"[",
"localpath",
"]"
] | Get the `FileHandle` object associated to a particular file | [
"Get",
"the",
"FileHandle",
"object",
"associated",
"to",
"a",
"particular",
"file"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L627-L630 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive.register_file | def register_file(self, filepath, creator, status=FileStatus.no_file, flags=FileFlags.no_flags):
"""Register a file in the archive.
If the file already exists, this raises a `KeyError`
Parameters
----------
filepath : str
The path to the file
creatror : int... | python | def register_file(self, filepath, creator, status=FileStatus.no_file, flags=FileFlags.no_flags):
"""Register a file in the archive.
If the file already exists, this raises a `KeyError`
Parameters
----------
filepath : str
The path to the file
creatror : int... | [
"def",
"register_file",
"(",
"self",
",",
"filepath",
",",
"creator",
",",
"status",
"=",
"FileStatus",
".",
"no_file",
",",
"flags",
"=",
"FileFlags",
".",
"no_flags",
")",
":",
"# check to see if the file already exists",
"try",
":",
"file_handle",
"=",
"self"... | Register a file in the archive.
If the file already exists, this raises a `KeyError`
Parameters
----------
filepath : str
The path to the file
creatror : int
A unique key for the job that created this file
status : `FileStatus`
Enu... | [
"Register",
"a",
"file",
"in",
"the",
"archive",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L632-L678 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive.update_file | def update_file(self, filepath, creator, status):
"""Update a file in the archive
If the file does not exists, this raises a `KeyError`
Parameters
----------
filepath : str
The path to the file
creatror : int
A unique key for the job that create... | python | def update_file(self, filepath, creator, status):
"""Update a file in the archive
If the file does not exists, this raises a `KeyError`
Parameters
----------
filepath : str
The path to the file
creatror : int
A unique key for the job that create... | [
"def",
"update_file",
"(",
"self",
",",
"filepath",
",",
"creator",
",",
"status",
")",
":",
"file_handle",
"=",
"self",
".",
"get_handle",
"(",
"filepath",
")",
"if",
"status",
"in",
"[",
"FileStatus",
".",
"exists",
",",
"FileStatus",
".",
"superseded",
... | Update a file in the archive
If the file does not exists, this raises a `KeyError`
Parameters
----------
filepath : str
The path to the file
creatror : int
A unique key for the job that created this file
status : `FileStatus`
Enume... | [
"Update",
"a",
"file",
"in",
"the",
"archive"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L680-L710 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive.get_file_ids | def get_file_ids(self, file_list, creator=None,
status=FileStatus.no_file, file_dict=None):
"""Get or create a list of file ids based on file names
Parameters
----------
file_list : list
The paths to the file
creatror : int
A unique ... | python | def get_file_ids(self, file_list, creator=None,
status=FileStatus.no_file, file_dict=None):
"""Get or create a list of file ids based on file names
Parameters
----------
file_list : list
The paths to the file
creatror : int
A unique ... | [
"def",
"get_file_ids",
"(",
"self",
",",
"file_list",
",",
"creator",
"=",
"None",
",",
"status",
"=",
"FileStatus",
".",
"no_file",
",",
"file_dict",
"=",
"None",
")",
":",
"ret_list",
"=",
"[",
"]",
"for",
"fname",
"in",
"file_list",
":",
"if",
"file... | Get or create a list of file ids based on file names
Parameters
----------
file_list : list
The paths to the file
creatror : int
A unique key for the job that created these files
status : `FileStatus`
Enumeration giving current status of fi... | [
"Get",
"or",
"create",
"a",
"list",
"of",
"file",
"ids",
"based",
"on",
"file",
"names"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L712-L744 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive.get_file_paths | def get_file_paths(self, id_list):
"""Get a list of file paths based of a set of ids
Parameters
----------
id_list : list
List of integer file keys
Returns list of file paths
"""
if id_list is None:
return []
try:
pat... | python | def get_file_paths(self, id_list):
"""Get a list of file paths based of a set of ids
Parameters
----------
id_list : list
List of integer file keys
Returns list of file paths
"""
if id_list is None:
return []
try:
pat... | [
"def",
"get_file_paths",
"(",
"self",
",",
"id_list",
")",
":",
"if",
"id_list",
"is",
"None",
":",
"return",
"[",
"]",
"try",
":",
"path_array",
"=",
"self",
".",
"_table",
"[",
"id_list",
"-",
"1",
"]",
"[",
"'path'",
"]",
"except",
"IndexError",
"... | Get a list of file paths based of a set of ids
Parameters
----------
id_list : list
List of integer file keys
Returns list of file paths | [
"Get",
"a",
"list",
"of",
"file",
"paths",
"based",
"of",
"a",
"set",
"of",
"ids"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L746-L764 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive.write_table_file | def write_table_file(self, table_file=None):
"""Write the table to self._table_file"""
if self._table is None:
raise RuntimeError("No table to write")
if table_file is not None:
self._table_file = table_file
if self._table_file is None:
raise RuntimeEr... | python | def write_table_file(self, table_file=None):
"""Write the table to self._table_file"""
if self._table is None:
raise RuntimeError("No table to write")
if table_file is not None:
self._table_file = table_file
if self._table_file is None:
raise RuntimeEr... | [
"def",
"write_table_file",
"(",
"self",
",",
"table_file",
"=",
"None",
")",
":",
"if",
"self",
".",
"_table",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"No table to write\"",
")",
"if",
"table_file",
"is",
"not",
"None",
":",
"self",
".",
"_table... | Write the table to self._table_file | [
"Write",
"the",
"table",
"to",
"self",
".",
"_table_file"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L766-L775 |
fermiPy/fermipy | fermipy/jobs/file_archive.py | FileArchive.update_file_status | def update_file_status(self):
"""Update the status of all the files in the archive"""
nfiles = len(self.cache.keys())
status_vect = np.zeros((6), int)
sys.stdout.write("Updating status of %i files: " % nfiles)
sys.stdout.flush()
for i, key in enumerate(self.cache.keys()):... | python | def update_file_status(self):
"""Update the status of all the files in the archive"""
nfiles = len(self.cache.keys())
status_vect = np.zeros((6), int)
sys.stdout.write("Updating status of %i files: " % nfiles)
sys.stdout.flush()
for i, key in enumerate(self.cache.keys()):... | [
"def",
"update_file_status",
"(",
"self",
")",
":",
"nfiles",
"=",
"len",
"(",
"self",
".",
"cache",
".",
"keys",
"(",
")",
")",
"status_vect",
"=",
"np",
".",
"zeros",
"(",
"(",
"6",
")",
",",
"int",
")",
"sys",
".",
"stdout",
".",
"write",
"(",... | Update the status of all the files in the archive | [
"Update",
"the",
"status",
"of",
"all",
"the",
"files",
"in",
"the",
"archive"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/file_archive.py#L777-L800 |
fermiPy/fermipy | fermipy/diffuse/job_library.py | _make_ltcube_file_list | def _make_ltcube_file_list(ltsumfile, num_files):
"""Make the list of input files for a particular energy bin X psf type """
outbasename = os.path.basename(ltsumfile)
lt_list_file = ltsumfile.replace('fits', 'lst')
outfile = open(lt_list_file, 'w')
for i in range(num_files):
split_key = "%06... | python | def _make_ltcube_file_list(ltsumfile, num_files):
"""Make the list of input files for a particular energy bin X psf type """
outbasename = os.path.basename(ltsumfile)
lt_list_file = ltsumfile.replace('fits', 'lst')
outfile = open(lt_list_file, 'w')
for i in range(num_files):
split_key = "%06... | [
"def",
"_make_ltcube_file_list",
"(",
"ltsumfile",
",",
"num_files",
")",
":",
"outbasename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"ltsumfile",
")",
"lt_list_file",
"=",
"ltsumfile",
".",
"replace",
"(",
"'fits'",
",",
"'lst'",
")",
"outfile",
"=",
... | 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/job_library.py#L27-L39 |
fermiPy/fermipy | fermipy/diffuse/job_library.py | register_classes | def register_classes():
"""Register these classes with the `LinkFactory` """
Gtlink_select.register_class()
Gtlink_bin.register_class()
Gtlink_expcube2.register_class()
Gtlink_scrmaps.register_class()
Gtlink_mktime.register_class()
Gtlink_ltcube.register_class()
Link_FermipyCoadd.registe... | python | def register_classes():
"""Register these classes with the `LinkFactory` """
Gtlink_select.register_class()
Gtlink_bin.register_class()
Gtlink_expcube2.register_class()
Gtlink_scrmaps.register_class()
Gtlink_mktime.register_class()
Gtlink_ltcube.register_class()
Link_FermipyCoadd.registe... | [
"def",
"register_classes",
"(",
")",
":",
"Gtlink_select",
".",
"register_class",
"(",
")",
"Gtlink_bin",
".",
"register_class",
"(",
")",
"Gtlink_expcube2",
".",
"register_class",
"(",
")",
"Gtlink_scrmaps",
".",
"register_class",
"(",
")",
"Gtlink_mktime",
".",
... | Register these classes with the `LinkFactory` | [
"Register",
"these",
"classes",
"with",
"the",
"LinkFactory"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/job_library.py#L622-L639 |
fermiPy/fermipy | fermipy/diffuse/job_library.py | Gtexpcube2_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.upd... | 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.upd... | [
"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/job_library.py#L279-L329 |
fermiPy/fermipy | fermipy/diffuse/job_library.py | SumRings_SG.build_job_configs | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
gmm = make_ring_dicts(library=args['library'], basedir='.')
for galkey in gmm.galkeys():
ring_dict = gmm.ring_dict(galkey)
for ring_key, ring_info in ring_dict.it... | python | def build_job_configs(self, args):
"""Hook to build job configurations
"""
job_configs = {}
gmm = make_ring_dicts(library=args['library'], basedir='.')
for galkey in gmm.galkeys():
ring_dict = gmm.ring_dict(galkey)
for ring_key, ring_info in ring_dict.it... | [
"def",
"build_job_configs",
"(",
"self",
",",
"args",
")",
":",
"job_configs",
"=",
"{",
"}",
"gmm",
"=",
"make_ring_dicts",
"(",
"library",
"=",
"args",
"[",
"'library'",
"]",
",",
"basedir",
"=",
"'.'",
")",
"for",
"galkey",
"in",
"gmm",
".",
"galkey... | Hook to build job configurations | [
"Hook",
"to",
"build",
"job",
"configurations"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/job_library.py#L418-L437 |
fermiPy/fermipy | fermipy/diffuse/job_library.py | Vstack_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_diffuse_comp_info_dict(components=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'])
ret_dict = make_diffuse_comp_info_dict(components=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/job_library.py#L458-L500 |
fermiPy/fermipy | fermipy/diffuse/job_library.py | GatherSrcmaps_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(library=args['library'],
... | 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(library=args['library'],
... | [
"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/job_library.py#L520-L553 |
fermiPy/fermipy | fermipy/stats_utils.py | norm | def norm(x, mu, sigma=1.0):
""" Scipy norm function """
return stats.norm(loc=mu, scale=sigma).pdf(x) | python | def norm(x, mu, sigma=1.0):
""" Scipy norm function """
return stats.norm(loc=mu, scale=sigma).pdf(x) | [
"def",
"norm",
"(",
"x",
",",
"mu",
",",
"sigma",
"=",
"1.0",
")",
":",
"return",
"stats",
".",
"norm",
"(",
"loc",
"=",
"mu",
",",
"scale",
"=",
"sigma",
")",
".",
"pdf",
"(",
"x",
")"
] | Scipy norm function | [
"Scipy",
"norm",
"function"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L14-L16 |
fermiPy/fermipy | fermipy/stats_utils.py | ln_norm | def ln_norm(x, mu, sigma=1.0):
""" Natural log of scipy norm function truncated at zero """
return np.log(stats.norm(loc=mu, scale=sigma).pdf(x)) | python | def ln_norm(x, mu, sigma=1.0):
""" Natural log of scipy norm function truncated at zero """
return np.log(stats.norm(loc=mu, scale=sigma).pdf(x)) | [
"def",
"ln_norm",
"(",
"x",
",",
"mu",
",",
"sigma",
"=",
"1.0",
")",
":",
"return",
"np",
".",
"log",
"(",
"stats",
".",
"norm",
"(",
"loc",
"=",
"mu",
",",
"scale",
"=",
"sigma",
")",
".",
"pdf",
"(",
"x",
")",
")"
] | Natural log of scipy norm function truncated at zero | [
"Natural",
"log",
"of",
"scipy",
"norm",
"function",
"truncated",
"at",
"zero"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L19-L21 |
fermiPy/fermipy | fermipy/stats_utils.py | lognorm | def lognorm(x, mu, sigma=1.0):
""" Log-normal function from scipy """
return stats.lognorm(sigma, scale=mu).pdf(x) | python | def lognorm(x, mu, sigma=1.0):
""" Log-normal function from scipy """
return stats.lognorm(sigma, scale=mu).pdf(x) | [
"def",
"lognorm",
"(",
"x",
",",
"mu",
",",
"sigma",
"=",
"1.0",
")",
":",
"return",
"stats",
".",
"lognorm",
"(",
"sigma",
",",
"scale",
"=",
"mu",
")",
".",
"pdf",
"(",
"x",
")"
] | Log-normal function from scipy | [
"Log",
"-",
"normal",
"function",
"from",
"scipy"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L24-L26 |
fermiPy/fermipy | fermipy/stats_utils.py | log10norm | def log10norm(x, mu, sigma=1.0):
""" Scale scipy lognorm from natural log to base 10
x : input parameter
mu : mean of the underlying log10 gaussian
sigma : variance of underlying log10 gaussian
"""
return stats.lognorm(sigma * np.log(10), scale=mu).pdf(x) | python | def log10norm(x, mu, sigma=1.0):
""" Scale scipy lognorm from natural log to base 10
x : input parameter
mu : mean of the underlying log10 gaussian
sigma : variance of underlying log10 gaussian
"""
return stats.lognorm(sigma * np.log(10), scale=mu).pdf(x) | [
"def",
"log10norm",
"(",
"x",
",",
"mu",
",",
"sigma",
"=",
"1.0",
")",
":",
"return",
"stats",
".",
"lognorm",
"(",
"sigma",
"*",
"np",
".",
"log",
"(",
"10",
")",
",",
"scale",
"=",
"mu",
")",
".",
"pdf",
"(",
"x",
")"
] | Scale scipy lognorm from natural log to base 10
x : input parameter
mu : mean of the underlying log10 gaussian
sigma : variance of underlying log10 gaussian | [
"Scale",
"scipy",
"lognorm",
"from",
"natural",
"log",
"to",
"base",
"10",
"x",
":",
"input",
"parameter",
"mu",
":",
"mean",
"of",
"the",
"underlying",
"log10",
"gaussian",
"sigma",
":",
"variance",
"of",
"underlying",
"log10",
"gaussian"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L29-L35 |
fermiPy/fermipy | fermipy/stats_utils.py | lgauss | def lgauss(x, mu, sigma=1.0, logpdf=False):
""" Log10 normal distribution...
x : Parameter of interest for scanning the pdf
mu : Peak of the lognormal distribution (mean of the underlying
normal distribution is log10(mu)
sigma : Standard deviation of the underlying normal distributio... | python | def lgauss(x, mu, sigma=1.0, logpdf=False):
""" Log10 normal distribution...
x : Parameter of interest for scanning the pdf
mu : Peak of the lognormal distribution (mean of the underlying
normal distribution is log10(mu)
sigma : Standard deviation of the underlying normal distributio... | [
"def",
"lgauss",
"(",
"x",
",",
"mu",
",",
"sigma",
"=",
"1.0",
",",
"logpdf",
"=",
"False",
")",
":",
"x",
"=",
"np",
".",
"array",
"(",
"x",
",",
"ndmin",
"=",
"1",
")",
"lmu",
"=",
"np",
".",
"log10",
"(",
"mu",
")",
"s2",
"=",
"sigma",
... | Log10 normal distribution...
x : Parameter of interest for scanning the pdf
mu : Peak of the lognormal distribution (mean of the underlying
normal distribution is log10(mu)
sigma : Standard deviation of the underlying normal distribution | [
"Log10",
"normal",
"distribution",
"..."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L53-L78 |
fermiPy/fermipy | fermipy/stats_utils.py | create_prior_functor | def create_prior_functor(d):
"""Build a prior from a dictionary.
Parameters
----------
d : A dictionary, it must contain:
d['functype'] : a recognized function type
and all of the required parameters for the
prior_functor of the desired type
... | python | def create_prior_functor(d):
"""Build a prior from a dictionary.
Parameters
----------
d : A dictionary, it must contain:
d['functype'] : a recognized function type
and all of the required parameters for the
prior_functor of the desired type
... | [
"def",
"create_prior_functor",
"(",
"d",
")",
":",
"functype",
"=",
"d",
".",
"get",
"(",
"'functype'",
",",
"'lgauss_like'",
")",
"j_ref",
"=",
"d",
".",
"get",
"(",
"'j_ref'",
",",
"1.0",
")",
"if",
"functype",
"==",
"'norm'",
":",
"return",
"norm_pr... | Build a prior from a dictionary.
Parameters
----------
d : A dictionary, it must contain:
d['functype'] : a recognized function type
and all of the required parameters for the
prior_functor of the desired type
Returns
----------
A sub-... | [
"Build",
"a",
"prior",
"from",
"a",
"dictionary",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L314-L358 |
fermiPy/fermipy | fermipy/stats_utils.py | prior_functor.marginalization_bins | def marginalization_bins(self):
"""Binning to use to do the marginalization integrals
"""
log_mean = np.log10(self.mean())
# Default is to marginalize over two decades,
# centered on mean, using 1000 bins
return np.logspace(-1. + log_mean, 1. + log_mean, 1001)/self._j_ref | python | def marginalization_bins(self):
"""Binning to use to do the marginalization integrals
"""
log_mean = np.log10(self.mean())
# Default is to marginalize over two decades,
# centered on mean, using 1000 bins
return np.logspace(-1. + log_mean, 1. + log_mean, 1001)/self._j_ref | [
"def",
"marginalization_bins",
"(",
"self",
")",
":",
"log_mean",
"=",
"np",
".",
"log10",
"(",
"self",
".",
"mean",
"(",
")",
")",
"# Default is to marginalize over two decades,",
"# centered on mean, using 1000 bins",
"return",
"np",
".",
"logspace",
"(",
"-",
"... | Binning to use to do the marginalization integrals | [
"Binning",
"to",
"use",
"to",
"do",
"the",
"marginalization",
"integrals"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L148-L154 |
fermiPy/fermipy | fermipy/stats_utils.py | prior_functor.profile_bins | def profile_bins(self):
""" The binning to use to do the profile fitting
"""
log_mean = np.log10(self.mean())
log_half_width = max(5. * self.sigma(), 3.)
# Default is to profile over +-5 sigma,
# centered on mean, using 100 bins
return np.logspace(log_mean - log_h... | python | def profile_bins(self):
""" The binning to use to do the profile fitting
"""
log_mean = np.log10(self.mean())
log_half_width = max(5. * self.sigma(), 3.)
# Default is to profile over +-5 sigma,
# centered on mean, using 100 bins
return np.logspace(log_mean - log_h... | [
"def",
"profile_bins",
"(",
"self",
")",
":",
"log_mean",
"=",
"np",
".",
"log10",
"(",
"self",
".",
"mean",
"(",
")",
")",
"log_half_width",
"=",
"max",
"(",
"5.",
"*",
"self",
".",
"sigma",
"(",
")",
",",
"3.",
")",
"# Default is to profile over +-5 ... | The binning to use to do the profile fitting | [
"The",
"binning",
"to",
"use",
"to",
"do",
"the",
"profile",
"fitting"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L156-L164 |
fermiPy/fermipy | fermipy/stats_utils.py | function_prior.normalization | def normalization(self):
""" The normalization
i.e., the intergral of the function over the normalization_range
"""
norm_r = self.normalization_range()
return quad(self, norm_r[0]*self._j_ref, norm_r[1]*self._j_ref)[0] | python | def normalization(self):
""" The normalization
i.e., the intergral of the function over the normalization_range
"""
norm_r = self.normalization_range()
return quad(self, norm_r[0]*self._j_ref, norm_r[1]*self._j_ref)[0] | [
"def",
"normalization",
"(",
"self",
")",
":",
"norm_r",
"=",
"self",
".",
"normalization_range",
"(",
")",
"return",
"quad",
"(",
"self",
",",
"norm_r",
"[",
"0",
"]",
"*",
"self",
".",
"_j_ref",
",",
"norm_r",
"[",
"1",
"]",
"*",
"self",
".",
"_j... | The normalization
i.e., the intergral of the function over the normalization_range | [
"The",
"normalization",
"i",
".",
"e",
".",
"the",
"intergral",
"of",
"the",
"function",
"over",
"the",
"normalization_range"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L186-L191 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior.init_return | def init_return(self, ret_type):
"""Specify the return type.
Note that this will also construct the
'~fermipy.castro.Interpolator' object
for the requested return type.
"""
if self._ret_type == ret_type:
return
if ret_type == "straight":
... | python | def init_return(self, ret_type):
"""Specify the return type.
Note that this will also construct the
'~fermipy.castro.Interpolator' object
for the requested return type.
"""
if self._ret_type == ret_type:
return
if ret_type == "straight":
... | [
"def",
"init_return",
"(",
"self",
",",
"ret_type",
")",
":",
"if",
"self",
".",
"_ret_type",
"==",
"ret_type",
":",
"return",
"if",
"ret_type",
"==",
"\"straight\"",
":",
"self",
".",
"_interp",
"=",
"self",
".",
"_lnlfn",
".",
"interp",
"if",
"ret_type... | Specify the return type.
Note that this will also construct the
'~fermipy.castro.Interpolator' object
for the requested return type. | [
"Specify",
"the",
"return",
"type",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L431-L455 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior.clear_cached_values | def clear_cached_values(self):
"""Removes all of the cached values and interpolators
"""
self._prof_interp = None
self._prof_y = None
self._prof_z = None
self._marg_interp = None
self._marg_z = None
self._post = None
self._post_interp = None
... | python | def clear_cached_values(self):
"""Removes all of the cached values and interpolators
"""
self._prof_interp = None
self._prof_y = None
self._prof_z = None
self._marg_interp = None
self._marg_z = None
self._post = None
self._post_interp = None
... | [
"def",
"clear_cached_values",
"(",
"self",
")",
":",
"self",
".",
"_prof_interp",
"=",
"None",
"self",
".",
"_prof_y",
"=",
"None",
"self",
".",
"_prof_z",
"=",
"None",
"self",
".",
"_marg_interp",
"=",
"None",
"self",
".",
"_marg_z",
"=",
"None",
"self"... | Removes all of the cached values and interpolators | [
"Removes",
"all",
"of",
"the",
"cached",
"values",
"and",
"interpolators"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L457-L468 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior.like | def like(self, x, y):
"""Evaluate the 2-D likelihood in the x/y parameter space.
The dimension of the two input arrays should be the same.
Parameters
----------
x : array_like
Array of coordinates in the `x` parameter.
y : array_like
Arra... | python | def like(self, x, y):
"""Evaluate the 2-D likelihood in the x/y parameter space.
The dimension of the two input arrays should be the same.
Parameters
----------
x : array_like
Array of coordinates in the `x` parameter.
y : array_like
Arra... | [
"def",
"like",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"# This is the negative log-likelihood",
"z",
"=",
"self",
".",
"_lnlfn",
".",
"interp",
"(",
"x",
"*",
"y",
")",
"return",
"np",
".",
"exp",
"(",
"-",
"z",
")",
"*",
"self",
".",
"_nuis_pdf... | Evaluate the 2-D likelihood in the x/y parameter space.
The dimension of the two input arrays should be the same.
Parameters
----------
x : array_like
Array of coordinates in the `x` parameter.
y : array_like
Array of coordinates in the `y` nuisa... | [
"Evaluate",
"the",
"2",
"-",
"D",
"likelihood",
"in",
"the",
"x",
"/",
"y",
"parameter",
"space",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L470-L485 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior.loglike | def loglike(self, x, y):
"""Evaluate the 2-D log-likelihood in the x/y parameter space.
The dimension of the two input arrays should be the same.
Parameters
----------
x : array_like
Array of coordinates in the `x` parameter.
y : array_like
... | python | def loglike(self, x, y):
"""Evaluate the 2-D log-likelihood in the x/y parameter space.
The dimension of the two input arrays should be the same.
Parameters
----------
x : array_like
Array of coordinates in the `x` parameter.
y : array_like
... | [
"def",
"loglike",
"(",
"self",
",",
"x",
",",
"y",
")",
":",
"nuis",
"=",
"self",
".",
"_nuis_pdf",
"(",
"y",
")",
"log_nuis",
"=",
"np",
".",
"where",
"(",
"nuis",
">",
"0.",
",",
"np",
".",
"log",
"(",
"nuis",
")",
",",
"-",
"1e2",
")",
"... | Evaluate the 2-D log-likelihood in the x/y parameter space.
The dimension of the two input arrays should be the same.
Parameters
----------
x : array_like
Array of coordinates in the `x` parameter.
y : array_like
Array of coordinates in the `y` n... | [
"Evaluate",
"the",
"2",
"-",
"D",
"log",
"-",
"likelihood",
"in",
"the",
"x",
"/",
"y",
"parameter",
"space",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L487-L505 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior.profile_loglike | def profile_loglike(self, x):
"""Profile log-likelihood.
Returns ``L_prof(x,y=y_min|z')`` : where y_min is the
value of y that minimizes
L for a given x.
This will used the cached '~fermipy.castro.Interp... | python | def profile_loglike(self, x):
"""Profile log-likelihood.
Returns ``L_prof(x,y=y_min|z')`` : where y_min is the
value of y that minimizes
L for a given x.
This will used the cached '~fermipy.castro.Interp... | [
"def",
"profile_loglike",
"(",
"self",
",",
"x",
")",
":",
"if",
"self",
".",
"_prof_interp",
"is",
"None",
":",
"# This calculates values and caches the spline",
"return",
"self",
".",
"_profile_loglike",
"(",
"x",
")",
"[",
"1",
"]",
"x",
"=",
"np",
".",
... | Profile log-likelihood.
Returns ``L_prof(x,y=y_min|z')`` : where y_min is the
value of y that minimizes
L for a given x.
This will used the cached '~fermipy.castro.Interpolator' object
if possible, and ... | [
"Profile",
"log",
"-",
"likelihood",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L512-L527 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior.marginal_loglike | def marginal_loglike(self, x):
"""Marginal log-likelihood.
Returns ``L_marg(x) = \int L(x,y|z') L(y) dy``
This will used the cached '~fermipy.castro.Interpolator'
object if possible, and construct it if needed.
"""
if self._marg_interp is None:
# This calcu... | python | def marginal_loglike(self, x):
"""Marginal log-likelihood.
Returns ``L_marg(x) = \int L(x,y|z') L(y) dy``
This will used the cached '~fermipy.castro.Interpolator'
object if possible, and construct it if needed.
"""
if self._marg_interp is None:
# This calcu... | [
"def",
"marginal_loglike",
"(",
"self",
",",
"x",
")",
":",
"if",
"self",
".",
"_marg_interp",
"is",
"None",
":",
"# This calculates values and caches the spline",
"return",
"self",
".",
"_marginal_loglike",
"(",
"x",
")",
"x",
"=",
"np",
".",
"array",
"(",
... | Marginal log-likelihood.
Returns ``L_marg(x) = \int L(x,y|z') L(y) dy``
This will used the cached '~fermipy.castro.Interpolator'
object if possible, and construct it if needed. | [
"Marginal",
"log",
"-",
"likelihood",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L529-L542 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior.posterior | def posterior(self, x):
"""Posterior function.
Returns ``P(x) = \int L(x,y|z') L(y) dy / \int L(x,y|z') L(y) dx dy``
This will used the cached '~fermipy.castro.Interpolator'
object if possible, and construct it if needed.
"""
if self._post is None:
return ... | python | def posterior(self, x):
"""Posterior function.
Returns ``P(x) = \int L(x,y|z') L(y) dy / \int L(x,y|z') L(y) dx dy``
This will used the cached '~fermipy.castro.Interpolator'
object if possible, and construct it if needed.
"""
if self._post is None:
return ... | [
"def",
"posterior",
"(",
"self",
",",
"x",
")",
":",
"if",
"self",
".",
"_post",
"is",
"None",
":",
"return",
"self",
".",
"_posterior",
"(",
"x",
")",
"x",
"=",
"np",
".",
"array",
"(",
"x",
",",
"ndmin",
"=",
"1",
")",
"return",
"self",
".",
... | Posterior function.
Returns ``P(x) = \int L(x,y|z') L(y) dy / \int L(x,y|z') L(y) dx dy``
This will used the cached '~fermipy.castro.Interpolator'
object if possible, and construct it if needed. | [
"Posterior",
"function",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L544-L555 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior._profile_loglike | def _profile_loglike(self, x):
"""Internal function to calculate and cache the profile likelihood
"""
x = np.array(x, ndmin=1)
z = []
y = []
for xtmp in x:
def fn(t): return -self.loglike(xtmp, t)
ytmp = opt.fmin(fn, 1.0, disp=False)[0]
... | python | def _profile_loglike(self, x):
"""Internal function to calculate and cache the profile likelihood
"""
x = np.array(x, ndmin=1)
z = []
y = []
for xtmp in x:
def fn(t): return -self.loglike(xtmp, t)
ytmp = opt.fmin(fn, 1.0, disp=False)[0]
... | [
"def",
"_profile_loglike",
"(",
"self",
",",
"x",
")",
":",
"x",
"=",
"np",
".",
"array",
"(",
"x",
",",
"ndmin",
"=",
"1",
")",
"z",
"=",
"[",
"]",
"y",
"=",
"[",
"]",
"for",
"xtmp",
"in",
"x",
":",
"def",
"fn",
"(",
"t",
")",
":",
"retu... | Internal function to calculate and cache the profile likelihood | [
"Internal",
"function",
"to",
"calculate",
"and",
"cache",
"the",
"profile",
"likelihood"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L557-L576 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior._profile_loglike_spline | def _profile_loglike_spline(self, x):
"""Internal function to calculate and cache the profile likelihood
"""
z = []
y = []
yv = self._nuis_pdf.profile_bins()
nuis_vals = self._nuis_pdf.log_value(yv) - self._nuis_log_norm
for xtmp in x:
zv = -1. * self... | python | def _profile_loglike_spline(self, x):
"""Internal function to calculate and cache the profile likelihood
"""
z = []
y = []
yv = self._nuis_pdf.profile_bins()
nuis_vals = self._nuis_pdf.log_value(yv) - self._nuis_log_norm
for xtmp in x:
zv = -1. * self... | [
"def",
"_profile_loglike_spline",
"(",
"self",
",",
"x",
")",
":",
"z",
"=",
"[",
"]",
"y",
"=",
"[",
"]",
"yv",
"=",
"self",
".",
"_nuis_pdf",
".",
"profile_bins",
"(",
")",
"nuis_vals",
"=",
"self",
".",
"_nuis_pdf",
".",
"log_value",
"(",
"yv",
... | Internal function to calculate and cache the profile likelihood | [
"Internal",
"function",
"to",
"calculate",
"and",
"cache",
"the",
"profile",
"likelihood"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L578-L606 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior._marginal_loglike | def _marginal_loglike(self, x):
"""Internal function to calculate and cache the marginal likelihood
"""
yedge = self._nuis_pdf.marginalization_bins()
yw = yedge[1:] - yedge[:-1]
yc = 0.5 * (yedge[1:] + yedge[:-1])
s = self.like(x[:, np.newaxis], yc[np.newaxis, :])
... | python | def _marginal_loglike(self, x):
"""Internal function to calculate and cache the marginal likelihood
"""
yedge = self._nuis_pdf.marginalization_bins()
yw = yedge[1:] - yedge[:-1]
yc = 0.5 * (yedge[1:] + yedge[:-1])
s = self.like(x[:, np.newaxis], yc[np.newaxis, :])
... | [
"def",
"_marginal_loglike",
"(",
"self",
",",
"x",
")",
":",
"yedge",
"=",
"self",
".",
"_nuis_pdf",
".",
"marginalization_bins",
"(",
")",
"yw",
"=",
"yedge",
"[",
"1",
":",
"]",
"-",
"yedge",
"[",
":",
"-",
"1",
"]",
"yc",
"=",
"0.5",
"*",
"(",... | Internal function to calculate and cache the marginal likelihood | [
"Internal",
"function",
"to",
"calculate",
"and",
"cache",
"the",
"marginal",
"likelihood"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L608-L630 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior._posterior | def _posterior(self, x):
"""Internal function to calculate and cache the posterior
"""
yedge = self._nuis_pdf.marginalization_bins()
yc = 0.5 * (yedge[1:] + yedge[:-1])
yw = yedge[1:] - yedge[:-1]
like_array = self.like(x[:, np.newaxis], yc[np.newaxis, :]) * yw
l... | python | def _posterior(self, x):
"""Internal function to calculate and cache the posterior
"""
yedge = self._nuis_pdf.marginalization_bins()
yc = 0.5 * (yedge[1:] + yedge[:-1])
yw = yedge[1:] - yedge[:-1]
like_array = self.like(x[:, np.newaxis], yc[np.newaxis, :]) * yw
l... | [
"def",
"_posterior",
"(",
"self",
",",
"x",
")",
":",
"yedge",
"=",
"self",
".",
"_nuis_pdf",
".",
"marginalization_bins",
"(",
")",
"yc",
"=",
"0.5",
"*",
"(",
"yedge",
"[",
"1",
":",
"]",
"+",
"yedge",
"[",
":",
"-",
"1",
"]",
")",
"yw",
"=",... | Internal function to calculate and cache the posterior | [
"Internal",
"function",
"to",
"calculate",
"and",
"cache",
"the",
"posterior"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L632-L644 |
fermiPy/fermipy | fermipy/stats_utils.py | LnLFn_norm_prior._compute_mle | def _compute_mle(self):
"""Maximum likelihood estimator.
"""
xmax = self._lnlfn.interp.xmax
x0 = max(self._lnlfn.mle(), xmax * 1e-5)
ret = opt.fmin(lambda x: np.where(
xmax > x > 0, -self(x), np.inf), x0, disp=False)
mle = float(ret[0])
return mle | python | def _compute_mle(self):
"""Maximum likelihood estimator.
"""
xmax = self._lnlfn.interp.xmax
x0 = max(self._lnlfn.mle(), xmax * 1e-5)
ret = opt.fmin(lambda x: np.where(
xmax > x > 0, -self(x), np.inf), x0, disp=False)
mle = float(ret[0])
return mle | [
"def",
"_compute_mle",
"(",
"self",
")",
":",
"xmax",
"=",
"self",
".",
"_lnlfn",
".",
"interp",
".",
"xmax",
"x0",
"=",
"max",
"(",
"self",
".",
"_lnlfn",
".",
"mle",
"(",
")",
",",
"xmax",
"*",
"1e-5",
")",
"ret",
"=",
"opt",
".",
"fmin",
"("... | Maximum likelihood estimator. | [
"Maximum",
"likelihood",
"estimator",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/stats_utils.py#L656-L664 |
fermiPy/fermipy | fermipy/diffuse/binning.py | Component.build_from_energy_dict | def build_from_energy_dict(cls, ebin_name, input_dict):
""" Build a list of components from a dictionary for a single energy range
"""
psf_types = input_dict.pop('psf_types')
output_list = []
for psf_type, val_dict in sorted(psf_types.items()):
fulldict = input_dict.c... | python | def build_from_energy_dict(cls, ebin_name, input_dict):
""" Build a list of components from a dictionary for a single energy range
"""
psf_types = input_dict.pop('psf_types')
output_list = []
for psf_type, val_dict in sorted(psf_types.items()):
fulldict = input_dict.c... | [
"def",
"build_from_energy_dict",
"(",
"cls",
",",
"ebin_name",
",",
"input_dict",
")",
":",
"psf_types",
"=",
"input_dict",
".",
"pop",
"(",
"'psf_types'",
")",
"output_list",
"=",
"[",
"]",
"for",
"psf_type",
",",
"val_dict",
"in",
"sorted",
"(",
"psf_types... | Build a list of components from a dictionary for a single energy range | [
"Build",
"a",
"list",
"of",
"components",
"from",
"a",
"dictionary",
"for",
"a",
"single",
"energy",
"range"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/binning.py#L88-L100 |
fermiPy/fermipy | fermipy/diffuse/binning.py | Component.build_from_yamlstr | def build_from_yamlstr(cls, yamlstr):
""" Build a list of components from a yaml string
"""
top_dict = yaml.safe_load(yamlstr)
coordsys = top_dict.pop('coordsys')
output_list = []
for e_key, e_dict in sorted(top_dict.items()):
if e_key == 'coordsys':
... | python | def build_from_yamlstr(cls, yamlstr):
""" Build a list of components from a yaml string
"""
top_dict = yaml.safe_load(yamlstr)
coordsys = top_dict.pop('coordsys')
output_list = []
for e_key, e_dict in sorted(top_dict.items()):
if e_key == 'coordsys':
... | [
"def",
"build_from_yamlstr",
"(",
"cls",
",",
"yamlstr",
")",
":",
"top_dict",
"=",
"yaml",
".",
"safe_load",
"(",
"yamlstr",
")",
"coordsys",
"=",
"top_dict",
".",
"pop",
"(",
"'coordsys'",
")",
"output_list",
"=",
"[",
"]",
"for",
"e_key",
",",
"e_dict... | Build a list of components from a yaml string | [
"Build",
"a",
"list",
"of",
"components",
"from",
"a",
"yaml",
"string"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/binning.py#L103-L115 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._match_cubes | def _match_cubes(ccube_clean, ccube_dirty,
bexpcube_clean, bexpcube_dirty,
hpx_order):
""" Match the HEALPIX scheme and order of all the input cubes
return a dictionary of cubes with the same HEALPIX scheme and order
"""
if hpx_order == ccube_cl... | python | def _match_cubes(ccube_clean, ccube_dirty,
bexpcube_clean, bexpcube_dirty,
hpx_order):
""" Match the HEALPIX scheme and order of all the input cubes
return a dictionary of cubes with the same HEALPIX scheme and order
"""
if hpx_order == ccube_cl... | [
"def",
"_match_cubes",
"(",
"ccube_clean",
",",
"ccube_dirty",
",",
"bexpcube_clean",
",",
"bexpcube_dirty",
",",
"hpx_order",
")",
":",
"if",
"hpx_order",
"==",
"ccube_clean",
".",
"hpx",
".",
"order",
":",
"ccube_clean_at_order",
"=",
"ccube_clean",
"else",
":... | Match the HEALPIX scheme and order of all the input cubes
return a dictionary of cubes with the same HEALPIX scheme and order | [
"Match",
"the",
"HEALPIX",
"scheme",
"and",
"order",
"of",
"all",
"the",
"input",
"cubes"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L62-L102 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._compute_intensity | def _compute_intensity(ccube, bexpcube):
""" Compute the intensity map
"""
bexp_data = np.sqrt(bexpcube.data[0:-1, 0:] * bexpcube.data[1:, 0:])
intensity_data = ccube.data / bexp_data
intensity_map = HpxMap(intensity_data, ccube.hpx)
return intensity_map | python | def _compute_intensity(ccube, bexpcube):
""" Compute the intensity map
"""
bexp_data = np.sqrt(bexpcube.data[0:-1, 0:] * bexpcube.data[1:, 0:])
intensity_data = ccube.data / bexp_data
intensity_map = HpxMap(intensity_data, ccube.hpx)
return intensity_map | [
"def",
"_compute_intensity",
"(",
"ccube",
",",
"bexpcube",
")",
":",
"bexp_data",
"=",
"np",
".",
"sqrt",
"(",
"bexpcube",
".",
"data",
"[",
"0",
":",
"-",
"1",
",",
"0",
":",
"]",
"*",
"bexpcube",
".",
"data",
"[",
"1",
":",
",",
"0",
":",
"]... | Compute the intensity map | [
"Compute",
"the",
"intensity",
"map"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L105-L111 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._compute_mean | def _compute_mean(map1, map2):
""" Make a map that is the mean of two maps
"""
data = (map1.data + map2.data) / 2.
return HpxMap(data, map1.hpx) | python | def _compute_mean(map1, map2):
""" Make a map that is the mean of two maps
"""
data = (map1.data + map2.data) / 2.
return HpxMap(data, map1.hpx) | [
"def",
"_compute_mean",
"(",
"map1",
",",
"map2",
")",
":",
"data",
"=",
"(",
"map1",
".",
"data",
"+",
"map2",
".",
"data",
")",
"/",
"2.",
"return",
"HpxMap",
"(",
"data",
",",
"map1",
".",
"hpx",
")"
] | Make a map that is the mean of two maps | [
"Make",
"a",
"map",
"that",
"is",
"the",
"mean",
"of",
"two",
"maps"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L114-L118 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._compute_ratio | def _compute_ratio(top, bot):
""" Make a map that is the ratio of two maps
"""
data = np.where(bot.data > 0, top.data / bot.data, 0.)
return HpxMap(data, top.hpx) | python | def _compute_ratio(top, bot):
""" Make a map that is the ratio of two maps
"""
data = np.where(bot.data > 0, top.data / bot.data, 0.)
return HpxMap(data, top.hpx) | [
"def",
"_compute_ratio",
"(",
"top",
",",
"bot",
")",
":",
"data",
"=",
"np",
".",
"where",
"(",
"bot",
".",
"data",
">",
"0",
",",
"top",
".",
"data",
"/",
"bot",
".",
"data",
",",
"0.",
")",
"return",
"HpxMap",
"(",
"data",
",",
"top",
".",
... | Make a map that is the ratio of two maps | [
"Make",
"a",
"map",
"that",
"is",
"the",
"ratio",
"of",
"two",
"maps"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L121-L125 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._compute_diff | def _compute_diff(map1, map2):
""" Make a map that is the difference of two maps
"""
data = map1.data - map2.data
return HpxMap(data, map1.hpx) | python | def _compute_diff(map1, map2):
""" Make a map that is the difference of two maps
"""
data = map1.data - map2.data
return HpxMap(data, map1.hpx) | [
"def",
"_compute_diff",
"(",
"map1",
",",
"map2",
")",
":",
"data",
"=",
"map1",
".",
"data",
"-",
"map2",
".",
"data",
"return",
"HpxMap",
"(",
"data",
",",
"map1",
".",
"hpx",
")"
] | Make a map that is the difference of two maps | [
"Make",
"a",
"map",
"that",
"is",
"the",
"difference",
"of",
"two",
"maps"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L128-L132 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._compute_product | def _compute_product(map1, map2):
""" Make a map that is the product of two maps
"""
data = map1.data * map2.data
return HpxMap(data, map1.hpx) | python | def _compute_product(map1, map2):
""" Make a map that is the product of two maps
"""
data = map1.data * map2.data
return HpxMap(data, map1.hpx) | [
"def",
"_compute_product",
"(",
"map1",
",",
"map2",
")",
":",
"data",
"=",
"map1",
".",
"data",
"*",
"map2",
".",
"data",
"return",
"HpxMap",
"(",
"data",
",",
"map1",
".",
"hpx",
")"
] | Make a map that is the product of two maps | [
"Make",
"a",
"map",
"that",
"is",
"the",
"product",
"of",
"two",
"maps"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L135-L139 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._compute_counts_from_intensity | def _compute_counts_from_intensity(intensity, bexpcube):
""" Make the counts map from the intensity
"""
data = intensity.data * np.sqrt(bexpcube.data[1:] * bexpcube.data[0:-1])
return HpxMap(data, intensity.hpx) | python | def _compute_counts_from_intensity(intensity, bexpcube):
""" Make the counts map from the intensity
"""
data = intensity.data * np.sqrt(bexpcube.data[1:] * bexpcube.data[0:-1])
return HpxMap(data, intensity.hpx) | [
"def",
"_compute_counts_from_intensity",
"(",
"intensity",
",",
"bexpcube",
")",
":",
"data",
"=",
"intensity",
".",
"data",
"*",
"np",
".",
"sqrt",
"(",
"bexpcube",
".",
"data",
"[",
"1",
":",
"]",
"*",
"bexpcube",
".",
"data",
"[",
"0",
":",
"-",
"... | Make the counts map from the intensity | [
"Make",
"the",
"counts",
"map",
"from",
"the",
"intensity"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L142-L146 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._compute_counts_from_model | def _compute_counts_from_model(model, bexpcube):
""" Make the counts maps from teh mdoe
"""
data = model.data * bexpcube.data
ebins = model.hpx.ebins
ratio = ebins[1:] / ebins[0:-1]
half_log_ratio = np.log(ratio) / 2.
int_map = ((data[0:-1].T * ebins[0:-1]) + (dat... | python | def _compute_counts_from_model(model, bexpcube):
""" Make the counts maps from teh mdoe
"""
data = model.data * bexpcube.data
ebins = model.hpx.ebins
ratio = ebins[1:] / ebins[0:-1]
half_log_ratio = np.log(ratio) / 2.
int_map = ((data[0:-1].T * ebins[0:-1]) + (dat... | [
"def",
"_compute_counts_from_model",
"(",
"model",
",",
"bexpcube",
")",
":",
"data",
"=",
"model",
".",
"data",
"*",
"bexpcube",
".",
"data",
"ebins",
"=",
"model",
".",
"hpx",
".",
"ebins",
"ratio",
"=",
"ebins",
"[",
"1",
":",
"]",
"/",
"ebins",
"... | Make the counts maps from teh mdoe | [
"Make",
"the",
"counts",
"maps",
"from",
"teh",
"mdoe"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L149-L157 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._make_bright_pixel_mask | def _make_bright_pixel_mask(intensity_mean, mask_factor=5.0):
""" Make of mask of all the brightest pixels """
mask = np.zeros((intensity_mean.data.shape), bool)
nebins = len(intensity_mean.data)
sum_intensity = intensity_mean.data.sum(0)
mean_intensity = sum_intensity.mean()
... | python | def _make_bright_pixel_mask(intensity_mean, mask_factor=5.0):
""" Make of mask of all the brightest pixels """
mask = np.zeros((intensity_mean.data.shape), bool)
nebins = len(intensity_mean.data)
sum_intensity = intensity_mean.data.sum(0)
mean_intensity = sum_intensity.mean()
... | [
"def",
"_make_bright_pixel_mask",
"(",
"intensity_mean",
",",
"mask_factor",
"=",
"5.0",
")",
":",
"mask",
"=",
"np",
".",
"zeros",
"(",
"(",
"intensity_mean",
".",
"data",
".",
"shape",
")",
",",
"bool",
")",
"nebins",
"=",
"len",
"(",
"intensity_mean",
... | Make of mask of all the brightest pixels | [
"Make",
"of",
"mask",
"of",
"all",
"the",
"brightest",
"pixels"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L160-L168 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._get_aeff_corrections | def _get_aeff_corrections(intensity_ratio, mask):
""" Compute a correction for the effective area from the brighter pixesl
"""
nebins = len(intensity_ratio.data)
aeff_corrections = np.zeros((nebins))
for i in range(nebins):
bright_pixels_intensity = intensity_ratio.da... | python | def _get_aeff_corrections(intensity_ratio, mask):
""" Compute a correction for the effective area from the brighter pixesl
"""
nebins = len(intensity_ratio.data)
aeff_corrections = np.zeros((nebins))
for i in range(nebins):
bright_pixels_intensity = intensity_ratio.da... | [
"def",
"_get_aeff_corrections",
"(",
"intensity_ratio",
",",
"mask",
")",
":",
"nebins",
"=",
"len",
"(",
"intensity_ratio",
".",
"data",
")",
"aeff_corrections",
"=",
"np",
".",
"zeros",
"(",
"(",
"nebins",
")",
")",
"for",
"i",
"in",
"range",
"(",
"neb... | Compute a correction for the effective area from the brighter pixesl | [
"Compute",
"a",
"correction",
"for",
"the",
"effective",
"area",
"from",
"the",
"brighter",
"pixesl"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L171-L182 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._apply_aeff_corrections | def _apply_aeff_corrections(intensity_map, aeff_corrections):
""" Multipy a map by the effective area correction
"""
data = aeff_corrections * intensity_map.data.T
return HpxMap(data.T, intensity_map.hpx) | python | def _apply_aeff_corrections(intensity_map, aeff_corrections):
""" Multipy a map by the effective area correction
"""
data = aeff_corrections * intensity_map.data.T
return HpxMap(data.T, intensity_map.hpx) | [
"def",
"_apply_aeff_corrections",
"(",
"intensity_map",
",",
"aeff_corrections",
")",
":",
"data",
"=",
"aeff_corrections",
"*",
"intensity_map",
".",
"data",
".",
"T",
"return",
"HpxMap",
"(",
"data",
".",
"T",
",",
"intensity_map",
".",
"hpx",
")"
] | Multipy a map by the effective area correction | [
"Multipy",
"a",
"map",
"by",
"the",
"effective",
"area",
"correction"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L185-L189 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._fill_masked_intensity_resid | def _fill_masked_intensity_resid(intensity_resid, bright_pixel_mask):
""" Fill the pixels used to compute the effective area correction with the mean intensity
"""
filled_intensity = np.zeros((intensity_resid.data.shape))
nebins = len(intensity_resid.data)
for i in range(nebins):... | python | def _fill_masked_intensity_resid(intensity_resid, bright_pixel_mask):
""" Fill the pixels used to compute the effective area correction with the mean intensity
"""
filled_intensity = np.zeros((intensity_resid.data.shape))
nebins = len(intensity_resid.data)
for i in range(nebins):... | [
"def",
"_fill_masked_intensity_resid",
"(",
"intensity_resid",
",",
"bright_pixel_mask",
")",
":",
"filled_intensity",
"=",
"np",
".",
"zeros",
"(",
"(",
"intensity_resid",
".",
"data",
".",
"shape",
")",
")",
"nebins",
"=",
"len",
"(",
"intensity_resid",
".",
... | Fill the pixels used to compute the effective area correction with the mean intensity | [
"Fill",
"the",
"pixels",
"used",
"to",
"compute",
"the",
"effective",
"area",
"correction",
"with",
"the",
"mean",
"intensity"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L192-L202 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._smooth_hpx_map | def _smooth_hpx_map(hpx_map, sigma):
""" Smooth a healpix map using a Gaussian
"""
if hpx_map.hpx.ordering == "NESTED":
ring_map = hpx_map.swap_scheme()
else:
ring_map = hpx_map
ring_data = ring_map.data.copy()
nebins = len(hpx_map.data)
sm... | python | def _smooth_hpx_map(hpx_map, sigma):
""" Smooth a healpix map using a Gaussian
"""
if hpx_map.hpx.ordering == "NESTED":
ring_map = hpx_map.swap_scheme()
else:
ring_map = hpx_map
ring_data = ring_map.data.copy()
nebins = len(hpx_map.data)
sm... | [
"def",
"_smooth_hpx_map",
"(",
"hpx_map",
",",
"sigma",
")",
":",
"if",
"hpx_map",
".",
"hpx",
".",
"ordering",
"==",
"\"NESTED\"",
":",
"ring_map",
"=",
"hpx_map",
".",
"swap_scheme",
"(",
")",
"else",
":",
"ring_map",
"=",
"hpx_map",
"ring_data",
"=",
... | Smooth a healpix map using a Gaussian | [
"Smooth",
"a",
"healpix",
"map",
"using",
"a",
"Gaussian"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L205-L223 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._intergral_to_differential | def _intergral_to_differential(hpx_map, gamma=-2.0):
""" Convert integral quantity to differential quantity
Here we are assuming the spectrum is a powerlaw with index gamma and we
are using log-log-quadrature to compute the integral quantities.
"""
nebins = len(hpx_map.data)
... | python | def _intergral_to_differential(hpx_map, gamma=-2.0):
""" Convert integral quantity to differential quantity
Here we are assuming the spectrum is a powerlaw with index gamma and we
are using log-log-quadrature to compute the integral quantities.
"""
nebins = len(hpx_map.data)
... | [
"def",
"_intergral_to_differential",
"(",
"hpx_map",
",",
"gamma",
"=",
"-",
"2.0",
")",
":",
"nebins",
"=",
"len",
"(",
"hpx_map",
".",
"data",
")",
"diff_map",
"=",
"np",
".",
"zeros",
"(",
"(",
"nebins",
"+",
"1",
",",
"hpx_map",
".",
"hpx",
".",
... | Convert integral quantity to differential quantity
Here we are assuming the spectrum is a powerlaw with index gamma and we
are using log-log-quadrature to compute the integral quantities. | [
"Convert",
"integral",
"quantity",
"to",
"differential",
"quantity"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L226-L244 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR._differential_to_integral | def _differential_to_integral(hpx_map):
""" Convert a differential map to an integral map
Here we are using log-log-quadrature to compute the integral quantities.
"""
ebins = hpx_map.hpx.ebins
ratio = ebins[1:] / ebins[0:-1]
half_log_ratio = np.log(ratio) / 2.
in... | python | def _differential_to_integral(hpx_map):
""" Convert a differential map to an integral map
Here we are using log-log-quadrature to compute the integral quantities.
"""
ebins = hpx_map.hpx.ebins
ratio = ebins[1:] / ebins[0:-1]
half_log_ratio = np.log(ratio) / 2.
in... | [
"def",
"_differential_to_integral",
"(",
"hpx_map",
")",
":",
"ebins",
"=",
"hpx_map",
".",
"hpx",
".",
"ebins",
"ratio",
"=",
"ebins",
"[",
"1",
":",
"]",
"/",
"ebins",
"[",
"0",
":",
"-",
"1",
"]",
"half_log_ratio",
"=",
"np",
".",
"log",
"(",
"r... | Convert a differential map to an integral map
Here we are using log-log-quadrature to compute the integral quantities. | [
"Convert",
"a",
"differential",
"map",
"to",
"an",
"integral",
"map"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L247-L257 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR.run_analysis | def run_analysis(self, argv):
"""Run this analysis"""
args = self._parser.parse_args(argv)
# Read the input maps
ccube_dirty = HpxMap.create_from_fits(args.ccube_dirty, hdu='SKYMAP')
bexpcube_dirty = HpxMap.create_from_fits(args.bexpcube_dirty, hdu='HPXEXPOSURES')
ccube_... | python | def run_analysis(self, argv):
"""Run this analysis"""
args = self._parser.parse_args(argv)
# Read the input maps
ccube_dirty = HpxMap.create_from_fits(args.ccube_dirty, hdu='SKYMAP')
bexpcube_dirty = HpxMap.create_from_fits(args.bexpcube_dirty, hdu='HPXEXPOSURES')
ccube_... | [
"def",
"run_analysis",
"(",
"self",
",",
"argv",
")",
":",
"args",
"=",
"self",
".",
"_parser",
".",
"parse_args",
"(",
"argv",
")",
"# Read the input maps",
"ccube_dirty",
"=",
"HpxMap",
".",
"create_from_fits",
"(",
"args",
".",
"ccube_dirty",
",",
"hdu",
... | Run this analysis | [
"Run",
"this",
"analysis"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/residual_cr.py#L259-L352 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCR_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'])
NAME_FACTORY_CLEAN.update_base_dict(args['data'])
NAME_FACTORY_DIRTY.u... | 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'])
NAME_FACTORY_CLEAN.update_base_dict(args['data'])
NAME_FACTORY_DIRTY.u... | [
"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/residual_cr.py#L378-L415 |
fermiPy/fermipy | fermipy/diffuse/residual_cr.py | ResidualCRChain._map_arguments | def _map_arguments(self, args):
"""Map from the top-level arguments to the arguments provided to
the indiviudal links """
config_yaml = args['config']
config_dict = load_yaml(config_yaml)
data = config_dict.get('data')
comp = config_dict.get('comp')
dry_run = ar... | python | def _map_arguments(self, args):
"""Map from the top-level arguments to the arguments provided to
the indiviudal links """
config_yaml = args['config']
config_dict = load_yaml(config_yaml)
data = config_dict.get('data')
comp = config_dict.get('comp')
dry_run = ar... | [
"def",
"_map_arguments",
"(",
"self",
",",
"args",
")",
":",
"config_yaml",
"=",
"args",
"[",
"'config'",
"]",
"config_dict",
"=",
"load_yaml",
"(",
"config_yaml",
")",
"data",
"=",
"config_dict",
".",
"get",
"(",
"'data'",
")",
"comp",
"=",
"config_dict",... | 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/residual_cr.py#L445-L477 |
fermiPy/fermipy | fermipy/skymap.py | coadd_maps | def coadd_maps(geom, maps, preserve_counts=True):
"""Coadd a sequence of `~gammapy.maps.Map` objects."""
# FIXME: This functionality should be built into the Map.coadd method
map_out = gammapy.maps.Map.from_geom(geom)
for m in maps:
m_tmp = m
if isinstance(m, gammapy.maps.HpxNDMap):
... | python | def coadd_maps(geom, maps, preserve_counts=True):
"""Coadd a sequence of `~gammapy.maps.Map` objects."""
# FIXME: This functionality should be built into the Map.coadd method
map_out = gammapy.maps.Map.from_geom(geom)
for m in maps:
m_tmp = m
if isinstance(m, gammapy.maps.HpxNDMap):
... | [
"def",
"coadd_maps",
"(",
"geom",
",",
"maps",
",",
"preserve_counts",
"=",
"True",
")",
":",
"# FIXME: This functionality should be built into the Map.coadd method",
"map_out",
"=",
"gammapy",
".",
"maps",
".",
"Map",
".",
"from_geom",
"(",
"geom",
")",
"for",
"m... | Coadd a sequence of `~gammapy.maps.Map` objects. | [
"Coadd",
"a",
"sequence",
"of",
"~gammapy",
".",
"maps",
".",
"Map",
"objects",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/skymap.py#L21-L34 |
fermiPy/fermipy | fermipy/skymap.py | Map.sum_over_energy | def sum_over_energy(self):
""" Reduce a 3D counts cube to a 2D counts map
"""
# Note that the array is using the opposite convention from WCS
# so we sum over axis 0 in the array, but drop axis 2 in the WCS object
return Map(np.sum(self.counts, axis=0), self.wcs.dropaxis(2)) | python | def sum_over_energy(self):
""" Reduce a 3D counts cube to a 2D counts map
"""
# Note that the array is using the opposite convention from WCS
# so we sum over axis 0 in the array, but drop axis 2 in the WCS object
return Map(np.sum(self.counts, axis=0), self.wcs.dropaxis(2)) | [
"def",
"sum_over_energy",
"(",
"self",
")",
":",
"# Note that the array is using the opposite convention from WCS",
"# so we sum over axis 0 in the array, but drop axis 2 in the WCS object",
"return",
"Map",
"(",
"np",
".",
"sum",
"(",
"self",
".",
"counts",
",",
"axis",
"=",... | Reduce a 3D counts cube to a 2D counts map | [
"Reduce",
"a",
"3D",
"counts",
"cube",
"to",
"a",
"2D",
"counts",
"map"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/skymap.py#L252-L257 |
fermiPy/fermipy | fermipy/skymap.py | Map.xypix_to_ipix | def xypix_to_ipix(self, xypix, colwise=False):
"""Return the flattened pixel indices from an array multi-dimensional
pixel indices.
Parameters
----------
xypix : list
List of pixel indices in the order (LON,LAT,ENERGY).
colwise : bool
Use column-... | python | def xypix_to_ipix(self, xypix, colwise=False):
"""Return the flattened pixel indices from an array multi-dimensional
pixel indices.
Parameters
----------
xypix : list
List of pixel indices in the order (LON,LAT,ENERGY).
colwise : bool
Use column-... | [
"def",
"xypix_to_ipix",
"(",
"self",
",",
"xypix",
",",
"colwise",
"=",
"False",
")",
":",
"return",
"np",
".",
"ravel_multi_index",
"(",
"xypix",
",",
"self",
".",
"npix",
",",
"order",
"=",
"'F'",
"if",
"colwise",
"else",
"'C'",
",",
"mode",
"=",
"... | Return the flattened pixel indices from an array multi-dimensional
pixel indices.
Parameters
----------
xypix : list
List of pixel indices in the order (LON,LAT,ENERGY).
colwise : bool
Use column-wise pixel indexing. | [
"Return",
"the",
"flattened",
"pixel",
"indices",
"from",
"an",
"array",
"multi",
"-",
"dimensional",
"pixel",
"indices",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/skymap.py#L259-L273 |
fermiPy/fermipy | fermipy/skymap.py | Map.ipix_to_xypix | def ipix_to_xypix(self, ipix, colwise=False):
"""Return array multi-dimensional pixel indices from flattened index.
Parameters
----------
colwise : bool
Use column-wise pixel indexing.
"""
return np.unravel_index(ipix, self.npix,
... | python | def ipix_to_xypix(self, ipix, colwise=False):
"""Return array multi-dimensional pixel indices from flattened index.
Parameters
----------
colwise : bool
Use column-wise pixel indexing.
"""
return np.unravel_index(ipix, self.npix,
... | [
"def",
"ipix_to_xypix",
"(",
"self",
",",
"ipix",
",",
"colwise",
"=",
"False",
")",
":",
"return",
"np",
".",
"unravel_index",
"(",
"ipix",
",",
"self",
".",
"npix",
",",
"order",
"=",
"'F'",
"if",
"colwise",
"else",
"'C'",
")"
] | Return array multi-dimensional pixel indices from flattened index.
Parameters
----------
colwise : bool
Use column-wise pixel indexing. | [
"Return",
"array",
"multi",
"-",
"dimensional",
"pixel",
"indices",
"from",
"flattened",
"index",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/skymap.py#L275-L284 |
fermiPy/fermipy | fermipy/skymap.py | Map.ipix_swap_axes | def ipix_swap_axes(self, ipix, colwise=False):
""" Return the transposed pixel index from the pixel xy coordinates
if colwise is True (False) this assumes the original index was
in column wise scheme
"""
xy = self.ipix_to_xypix(ipix, colwise)
return self.xypix_to_ipix(xy... | python | def ipix_swap_axes(self, ipix, colwise=False):
""" Return the transposed pixel index from the pixel xy coordinates
if colwise is True (False) this assumes the original index was
in column wise scheme
"""
xy = self.ipix_to_xypix(ipix, colwise)
return self.xypix_to_ipix(xy... | [
"def",
"ipix_swap_axes",
"(",
"self",
",",
"ipix",
",",
"colwise",
"=",
"False",
")",
":",
"xy",
"=",
"self",
".",
"ipix_to_xypix",
"(",
"ipix",
",",
"colwise",
")",
"return",
"self",
".",
"xypix_to_ipix",
"(",
"xy",
",",
"not",
"colwise",
")"
] | Return the transposed pixel index from the pixel xy coordinates
if colwise is True (False) this assumes the original index was
in column wise scheme | [
"Return",
"the",
"transposed",
"pixel",
"index",
"from",
"the",
"pixel",
"xy",
"coordinates"
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/skymap.py#L286-L293 |
fermiPy/fermipy | fermipy/skymap.py | Map.get_pixel_skydirs | def get_pixel_skydirs(self):
"""Get a list of sky coordinates for the centers of every pixel.
"""
xpix = np.linspace(0, self.npix[0] - 1., self.npix[0])
ypix = np.linspace(0, self.npix[1] - 1., self.npix[1])
xypix = np.meshgrid(xpix, ypix, indexing='ij')
return SkyCoord... | python | def get_pixel_skydirs(self):
"""Get a list of sky coordinates for the centers of every pixel.
"""
xpix = np.linspace(0, self.npix[0] - 1., self.npix[0])
ypix = np.linspace(0, self.npix[1] - 1., self.npix[1])
xypix = np.meshgrid(xpix, ypix, indexing='ij')
return SkyCoord... | [
"def",
"get_pixel_skydirs",
"(",
"self",
")",
":",
"xpix",
"=",
"np",
".",
"linspace",
"(",
"0",
",",
"self",
".",
"npix",
"[",
"0",
"]",
"-",
"1.",
",",
"self",
".",
"npix",
"[",
"0",
"]",
")",
"ypix",
"=",
"np",
".",
"linspace",
"(",
"0",
"... | Get a list of sky coordinates for the centers of every pixel. | [
"Get",
"a",
"list",
"of",
"sky",
"coordinates",
"for",
"the",
"centers",
"of",
"every",
"pixel",
"."
] | train | https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/skymap.py#L295-L304 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.