repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.sourcekey
def sourcekey(self, **kwargs): """ Return a key that specifies the name and version of a source or component """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) try: return NameFactory.sourcekey_format.f...
python
def sourcekey(self, **kwargs): """ Return a key that specifies the name and version of a source or component """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) try: return NameFactory.sourcekey_format.f...
[ "def", "sourcekey", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "self", ".", "_replace_none", "(", "kwargs_copy", ")", "try", "...
Return a key that specifies the name and version of a source or component
[ "Return", "a", "key", "that", "specifies", "the", "name", "and", "version", "of", "a", "source", "or", "component" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L189-L198
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.galprop_gasmap
def galprop_gasmap(self, **kwargs): """ return the file name for Galprop input gasmaps """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.galprop_gasmap_format.format(**kwargs_copy) ...
python
def galprop_gasmap(self, **kwargs): """ return the file name for Galprop input gasmaps """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.galprop_gasmap_format.format(**kwargs_copy) ...
[ "def", "galprop_gasmap", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "self", ".", "_replace_none", "(", "kwargs_copy", ")", "loca...
return the file name for Galprop input gasmaps
[ "return", "the", "file", "name", "for", "Galprop", "input", "gasmaps" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L235-L244
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.merged_gasmap
def merged_gasmap(self, **kwargs): """ return the file name for Galprop merged gasmaps """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.merged_gasmap_format.format(**kwargs_copy) i...
python
def merged_gasmap(self, **kwargs): """ return the file name for Galprop merged gasmaps """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.merged_gasmap_format.format(**kwargs_copy) i...
[ "def", "merged_gasmap", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "self", ".", "_replace_none", "(", "kwargs_copy", ")", "local...
return the file name for Galprop merged gasmaps
[ "return", "the", "file", "name", "for", "Galprop", "merged", "gasmaps" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L246-L255
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.diffuse_template
def diffuse_template(self, **kwargs): """ return the file name for other diffuse map templates """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.diffuse_template_format.format(**kwargs_copy...
python
def diffuse_template(self, **kwargs): """ return the file name for other diffuse map templates """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.diffuse_template_format.format(**kwargs_copy...
[ "def", "diffuse_template", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "self", ".", "_replace_none", "(", "kwargs_copy", ")", "lo...
return the file name for other diffuse map templates
[ "return", "the", "file", "name", "for", "other", "diffuse", "map", "templates" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L257-L266
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.spectral_template
def spectral_template(self, **kwargs): """ return the file name for spectral templates """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) localpath = NameFactory.spectral_template_format.format(**kwargs_copy) if kwargs.get('fullpath', False): ...
python
def spectral_template(self, **kwargs): """ return the file name for spectral templates """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) localpath = NameFactory.spectral_template_format.format(**kwargs_copy) if kwargs.get('fullpath', False): ...
[ "def", "spectral_template", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "localpath", "=", "NameFactory", ".", "spectral_template_form...
return the file name for spectral templates
[ "return", "the", "file", "name", "for", "spectral", "templates" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L268-L276
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.srcmdl_xml
def srcmdl_xml(self, **kwargs): """ return the file name for source model xml files """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) localpath = NameFactory.srcmdl_xml_format.format(**kwargs_copy) if kwargs.get('fullpath', False): return se...
python
def srcmdl_xml(self, **kwargs): """ return the file name for source model xml files """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) localpath = NameFactory.srcmdl_xml_format.format(**kwargs_copy) if kwargs.get('fullpath', False): return se...
[ "def", "srcmdl_xml", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "localpath", "=", "NameFactory", ".", "srcmdl_xml_format", ".", ...
return the file name for source model xml files
[ "return", "the", "file", "name", "for", "source", "model", "xml", "files" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L278-L286
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.nested_srcmdl_xml
def nested_srcmdl_xml(self, **kwargs): """ return the file name for source model xml files of nested sources """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.nested_srcmdl_xml_format.forma...
python
def nested_srcmdl_xml(self, **kwargs): """ return the file name for source model xml files of nested sources """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.nested_srcmdl_xml_format.forma...
[ "def", "nested_srcmdl_xml", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "self", ".", "_replace_none", "(", "kwargs_copy", ")", "l...
return the file name for source model xml files of nested sources
[ "return", "the", "file", "name", "for", "source", "model", "xml", "files", "of", "nested", "sources" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L288-L297
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.ft1file
def ft1file(self, **kwargs): """ return the name of the input ft1 file list """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) self._replace_none(kwargs_copy) localpat...
python
def ft1file(self, **kwargs): """ return the name of the input ft1 file list """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) self._replace_none(kwargs_copy) localpat...
[ "def", "ft1file", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "kwargs_copy", "[", "'dataset'", "]", "=", "kwargs", ".", "get", ...
return the name of the input ft1 file list
[ "return", "the", "name", "of", "the", "input", "ft1", "file", "list" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L299-L309
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.ft2file
def ft2file(self, **kwargs): """ return the name of the input ft2 file list """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['data_time'] = kwargs.get( 'data_time', self.dataset(**kwargs)) self._replace_none(kwargs_copy) ...
python
def ft2file(self, **kwargs): """ return the name of the input ft2 file list """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['data_time'] = kwargs.get( 'data_time', self.dataset(**kwargs)) self._replace_none(kwargs_copy) ...
[ "def", "ft2file", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "kwargs_copy", "[", "'data_time'", "]", "=", "kwargs", ".", "get"...
return the name of the input ft2 file list
[ "return", "the", "name", "of", "the", "input", "ft2", "file", "list" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L311-L322
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.ccube
def ccube(self, **kwargs): """ return the name of a counts cube file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] = kwargs.get( 'component',...
python
def ccube(self, **kwargs): """ return the name of a counts cube file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] = kwargs.get( 'component',...
[ "def", "ccube", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "kwargs_copy", "[", "'dataset'", "]", "=", "kwargs", ".", "get", ...
return the name of a counts cube file
[ "return", "the", "name", "of", "a", "counts", "cube", "file" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L363-L374
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.mcube
def mcube(self, **kwargs): """ return the name of a model cube file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] = kwargs.get( 'component', ...
python
def mcube(self, **kwargs): """ return the name of a model cube file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] = kwargs.get( 'component', ...
[ "def", "mcube", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "kwargs_copy", "[", "'dataset'", "]", "=", "kwargs", ".", "get", ...
return the name of a model cube file
[ "return", "the", "name", "of", "a", "model", "cube", "file" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L404-L416
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.angprofile
def angprofile(self, **kwargs): """ return the file name for sun or moon angular profiles """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.angprofile_format.format(**kwargs_copy) i...
python
def angprofile(self, **kwargs): """ return the file name for sun or moon angular profiles """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.angprofile_format.format(**kwargs_copy) i...
[ "def", "angprofile", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "self", ".", "_replace_none", "(", "kwargs_copy", ")", "localpat...
return the file name for sun or moon angular profiles
[ "return", "the", "file", "name", "for", "sun", "or", "moon", "angular", "profiles" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L470-L479
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.template_sunmoon
def template_sunmoon(self, **kwargs): """ return the file name for sun or moon template files """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] = kwargs.get(...
python
def template_sunmoon(self, **kwargs): """ return the file name for sun or moon template files """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] = kwargs.get(...
[ "def", "template_sunmoon", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "kwargs_copy", "[", "'dataset'", "]", "=", "kwargs", ".", ...
return the file name for sun or moon template files
[ "return", "the", "file", "name", "for", "sun", "or", "moon", "template", "files" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L481-L493
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.residual_cr
def residual_cr(self, **kwargs): """Return the name of the residual CR analysis output files""" kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] = kwargs.get( ...
python
def residual_cr(self, **kwargs): """Return the name of the residual CR analysis output files""" kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] = kwargs.get( ...
[ "def", "residual_cr", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "kwargs_copy", "[", "'dataset'", "]", "=", "kwargs", ".", "ge...
Return the name of the residual CR analysis output files
[ "Return", "the", "name", "of", "the", "residual", "CR", "analysis", "output", "files" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L495-L505
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.galprop_rings_yaml
def galprop_rings_yaml(self, **kwargs): """ return the name of a galprop rings merging yaml file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.galprop_rings_yaml_format.format(**kwargs_...
python
def galprop_rings_yaml(self, **kwargs): """ return the name of a galprop rings merging yaml file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.galprop_rings_yaml_format.format(**kwargs_...
[ "def", "galprop_rings_yaml", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "self", ".", "_replace_none", "(", "kwargs_copy", ")", "...
return the name of a galprop rings merging yaml file
[ "return", "the", "name", "of", "a", "galprop", "rings", "merging", "yaml", "file" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L507-L516
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.catalog_split_yaml
def catalog_split_yaml(self, **kwargs): """ return the name of a catalog split yaml file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.catalog_split_yaml_format.format(**kwargs_copy) ...
python
def catalog_split_yaml(self, **kwargs): """ return the name of a catalog split yaml file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.catalog_split_yaml_format.format(**kwargs_copy) ...
[ "def", "catalog_split_yaml", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "self", ".", "_replace_none", "(", "kwargs_copy", ")", "...
return the name of a catalog split yaml file
[ "return", "the", "name", "of", "a", "catalog", "split", "yaml", "file" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L518-L527
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.model_yaml
def model_yaml(self, **kwargs): """ return the name of a model yaml file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.model_yaml_format.format(**kwargs_copy) if kwargs.get('ful...
python
def model_yaml(self, **kwargs): """ return the name of a model yaml file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) localpath = NameFactory.model_yaml_format.format(**kwargs_copy) if kwargs.get('ful...
[ "def", "model_yaml", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "self", ".", "_replace_none", "(", "kwargs_copy", ")", "localpat...
return the name of a model yaml file
[ "return", "the", "name", "of", "a", "model", "yaml", "file" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L529-L538
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.fullpath
def fullpath(self, **kwargs): """Return a full path name for a given file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) return NameFactory.fullpath_format.format(**kwargs_copy)
python
def fullpath(self, **kwargs): """Return a full path name for a given file """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) self._replace_none(kwargs_copy) return NameFactory.fullpath_format.format(**kwargs_copy)
[ "def", "fullpath", "(", "self", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "self", ".", "_replace_none", "(", "kwargs_copy", ")", "return", ...
Return a full path name for a given file
[ "Return", "a", "full", "path", "name", "for", "a", "given", "file" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L586-L592
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.generic
def generic(self, input_string, **kwargs): """ return a generic filename for a given dataset and component """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] ...
python
def generic(self, input_string, **kwargs): """ return a generic filename for a given dataset and component """ kwargs_copy = self.base_dict.copy() kwargs_copy.update(**kwargs) kwargs_copy['dataset'] = kwargs.get('dataset', self.dataset(**kwargs)) kwargs_copy['component'] ...
[ "def", "generic", "(", "self", ",", "input_string", ",", "**", "kwargs", ")", ":", "kwargs_copy", "=", "self", ".", "base_dict", ".", "copy", "(", ")", "kwargs_copy", ".", "update", "(", "**", "kwargs", ")", "kwargs_copy", "[", "'dataset'", "]", "=", "...
return a generic filename for a given dataset and component
[ "return", "a", "generic", "filename", "for", "a", "given", "dataset", "and", "component" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L594-L603
train
fermiPy/fermipy
fermipy/diffuse/name_policy.py
NameFactory.make_filenames
def make_filenames(self, **kwargs): """ Make a dictionary of filenames for various types """ out_dict = dict(ft1file=self.ft1file(**kwargs), ltcube=self.ltcube(**kwargs), ccube=self.ccube(**kwargs), bexpcube=self.bexpcube(**...
python
def make_filenames(self, **kwargs): """ Make a dictionary of filenames for various types """ out_dict = dict(ft1file=self.ft1file(**kwargs), ltcube=self.ltcube(**kwargs), ccube=self.ccube(**kwargs), bexpcube=self.bexpcube(**...
[ "def", "make_filenames", "(", "self", ",", "**", "kwargs", ")", ":", "out_dict", "=", "dict", "(", "ft1file", "=", "self", ".", "ft1file", "(", "**", "kwargs", ")", ",", "ltcube", "=", "self", ".", "ltcube", "(", "**", "kwargs", ")", ",", "ccube", ...
Make a dictionary of filenames for various types
[ "Make", "a", "dictionary", "of", "filenames", "for", "various", "types" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/name_policy.py#L605-L614
train
fermiPy/fermipy
fermipy/gtutils.py
create_spectrum_from_dict
def create_spectrum_from_dict(spectrum_type, spectral_pars, fn=None): """Create a Function object from a parameter dictionary. Parameters ---------- spectrum_type : str String identifying the spectrum type (e.g. PowerLaw). spectral_pars : dict Dictionary of spectral parameters. ...
python
def create_spectrum_from_dict(spectrum_type, spectral_pars, fn=None): """Create a Function object from a parameter dictionary. Parameters ---------- spectrum_type : str String identifying the spectrum type (e.g. PowerLaw). spectral_pars : dict Dictionary of spectral parameters. ...
[ "def", "create_spectrum_from_dict", "(", "spectrum_type", ",", "spectral_pars", ",", "fn", "=", "None", ")", ":", "if", "fn", "is", "None", ":", "fn", "=", "pyLike", ".", "SourceFactory_funcFactory", "(", ")", ".", "create", "(", "str", "(", "spectrum_type",...
Create a Function object from a parameter dictionary. Parameters ---------- spectrum_type : str String identifying the spectrum type (e.g. PowerLaw). spectral_pars : dict Dictionary of spectral parameters.
[ "Create", "a", "Function", "object", "from", "a", "parameter", "dictionary", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtutils.py#L208-L248
train
fermiPy/fermipy
fermipy/gtutils.py
get_priors
def get_priors(like): """Extract priors from a likelihood object.""" npar = len(like.params()) vals = np.ones(npar) errs = np.ones(npar) has_prior = np.array([False] * npar) for i, p in enumerate(like.params()): prior = like[i].log_prior() if prior is None: conti...
python
def get_priors(like): """Extract priors from a likelihood object.""" npar = len(like.params()) vals = np.ones(npar) errs = np.ones(npar) has_prior = np.array([False] * npar) for i, p in enumerate(like.params()): prior = like[i].log_prior() if prior is None: conti...
[ "def", "get_priors", "(", "like", ")", ":", "npar", "=", "len", "(", "like", ".", "params", "(", ")", ")", "vals", "=", "np", ".", "ones", "(", "npar", ")", "errs", "=", "np", ".", "ones", "(", "npar", ")", "has_prior", "=", "np", ".", "array",...
Extract priors from a likelihood object.
[ "Extract", "priors", "from", "a", "likelihood", "object", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtutils.py#L367-L402
train
fermiPy/fermipy
fermipy/gtutils.py
get_source_pars
def get_source_pars(src): """Extract the parameters associated with a pyLikelihood Source object. """ fnmap = src.getSrcFuncs() keys = fnmap.keys() if 'Position' in keys: ppars = get_function_pars(src.getSrcFuncs()[str('Position')]) elif 'SpatialDist' in keys: ppars = get_fun...
python
def get_source_pars(src): """Extract the parameters associated with a pyLikelihood Source object. """ fnmap = src.getSrcFuncs() keys = fnmap.keys() if 'Position' in keys: ppars = get_function_pars(src.getSrcFuncs()[str('Position')]) elif 'SpatialDist' in keys: ppars = get_fun...
[ "def", "get_source_pars", "(", "src", ")", ":", "fnmap", "=", "src", ".", "getSrcFuncs", "(", ")", "keys", "=", "fnmap", ".", "keys", "(", ")", "if", "'Position'", "in", "keys", ":", "ppars", "=", "get_function_pars", "(", "src", ".", "getSrcFuncs", "(...
Extract the parameters associated with a pyLikelihood Source object.
[ "Extract", "the", "parameters", "associated", "with", "a", "pyLikelihood", "Source", "object", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtutils.py#L405-L434
train
fermiPy/fermipy
fermipy/gtutils.py
SummedLikelihood.nFreeParams
def nFreeParams(self): """Count the number of free parameters in the active model.""" nF = 0 pars = self.params() for par in pars: if par.isFree(): nF += 1 return nF
python
def nFreeParams(self): """Count the number of free parameters in the active model.""" nF = 0 pars = self.params() for par in pars: if par.isFree(): nF += 1 return nF
[ "def", "nFreeParams", "(", "self", ")", ":", "nF", "=", "0", "pars", "=", "self", ".", "params", "(", ")", "for", "par", "in", "pars", ":", "if", "par", ".", "isFree", "(", ")", ":", "nF", "+=", "1", "return", "nF" ]
Count the number of free parameters in the active model.
[ "Count", "the", "number", "of", "free", "parameters", "in", "the", "active", "model", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtutils.py#L490-L497
train
fermiPy/fermipy
fermipy/gtutils.py
BinnedAnalysis.Ts2
def Ts2(self, srcName, reoptimize=False, approx=True, tol=None, MaxIterations=10, verbosity=0): """Computes the TS value for a source indicated by "srcName." If "reoptimize=True" is selected this function will reoptimize the model up to "MaxIterations" given the tolerance "tol" ...
python
def Ts2(self, srcName, reoptimize=False, approx=True, tol=None, MaxIterations=10, verbosity=0): """Computes the TS value for a source indicated by "srcName." If "reoptimize=True" is selected this function will reoptimize the model up to "MaxIterations" given the tolerance "tol" ...
[ "def", "Ts2", "(", "self", ",", "srcName", ",", "reoptimize", "=", "False", ",", "approx", "=", "True", ",", "tol", "=", "None", ",", "MaxIterations", "=", "10", ",", "verbosity", "=", "0", ")", ":", "saved_state", "=", "LikelihoodState", "(", "self", ...
Computes the TS value for a source indicated by "srcName." If "reoptimize=True" is selected this function will reoptimize the model up to "MaxIterations" given the tolerance "tol" (default is the tolerance selected for the overall fit). If "appox=True" is selected (the default) it will...
[ "Computes", "the", "TS", "value", "for", "a", "source", "indicated", "by", "srcName", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/gtutils.py#L658-L715
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather._make_scatter_logfile_name
def _make_scatter_logfile_name(cls, key, linkname, job_config): """Hook to inster the name of a logfile into the input config """ logfile = job_config.get('logfile', "%s_%s_%s.log" % (cls.default_prefix_logfile, linkname, key)) job_config['logfile'] = logfile
python
def _make_scatter_logfile_name(cls, key, linkname, job_config): """Hook to inster the name of a logfile into the input config """ logfile = job_config.get('logfile', "%s_%s_%s.log" % (cls.default_prefix_logfile, linkname, key)) job_config['logfile'] = logfile
[ "def", "_make_scatter_logfile_name", "(", "cls", ",", "key", ",", "linkname", ",", "job_config", ")", ":", "logfile", "=", "job_config", ".", "get", "(", "'logfile'", ",", "\"%s_%s_%s.log\"", "%", "(", "cls", ".", "default_prefix_logfile", ",", "linkname", ","...
Hook to inster the name of a logfile into the input config
[ "Hook", "to", "inster", "the", "name", "of", "a", "logfile", "into", "the", "input", "config" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L97-L101
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather.create
def create(cls, **kwargs): """Build and return a `ScatterGather` object """ linkname = kwargs.setdefault('linkname', cls.clientclass.linkname_default) # Don't use setdefault b/c we don't want to build a JobArchive # Unless it is needed job_archive = kwargs.get('job_archive', None...
python
def create(cls, **kwargs): """Build and return a `ScatterGather` object """ linkname = kwargs.setdefault('linkname', cls.clientclass.linkname_default) # Don't use setdefault b/c we don't want to build a JobArchive # Unless it is needed job_archive = kwargs.get('job_archive', None...
[ "def", "create", "(", "cls", ",", "**", "kwargs", ")", ":", "linkname", "=", "kwargs", ".", "setdefault", "(", "'linkname'", ",", "cls", ".", "clientclass", ".", "linkname_default", ")", "job_archive", "=", "kwargs", ".", "get", "(", "'job_archive'", ",", ...
Build and return a `ScatterGather` object
[ "Build", "and", "return", "a", "ScatterGather", "object" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L104-L119
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather._check_link_completion
def _check_link_completion(self, link, fail_pending=False, fail_running=False): """Internal function to check the completion of all the dispatched jobs Returns ------- status_vect : `JobStatusVector` Vector that summarize the number of jobs in various states. """ ...
python
def _check_link_completion(self, link, fail_pending=False, fail_running=False): """Internal function to check the completion of all the dispatched jobs Returns ------- status_vect : `JobStatusVector` Vector that summarize the number of jobs in various states. """ ...
[ "def", "_check_link_completion", "(", "self", ",", "link", ",", "fail_pending", "=", "False", ",", "fail_running", "=", "False", ")", ":", "status_vect", "=", "JobStatusVector", "(", ")", "for", "job_key", ",", "job_details", "in", "link", ".", "jobs", ".", ...
Internal function to check the completion of all the dispatched jobs Returns ------- status_vect : `JobStatusVector` Vector that summarize the number of jobs in various states.
[ "Internal", "function", "to", "check", "the", "completion", "of", "all", "the", "dispatched", "jobs" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L147-L177
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather._build_job_dict
def _build_job_dict(self): """Build a dictionary of `JobDetails` objects for the internal `Link`""" if self.args['dry_run']: status = JobStatus.unknown else: status = JobStatus.not_ready base_config = self.scatter_link.args for jobkey, job_config in sort...
python
def _build_job_dict(self): """Build a dictionary of `JobDetails` objects for the internal `Link`""" if self.args['dry_run']: status = JobStatus.unknown else: status = JobStatus.not_ready base_config = self.scatter_link.args for jobkey, job_config in sort...
[ "def", "_build_job_dict", "(", "self", ")", ":", "if", "self", ".", "args", "[", "'dry_run'", "]", ":", "status", "=", "JobStatus", ".", "unknown", "else", ":", "status", "=", "JobStatus", ".", "not_ready", "base_config", "=", "self", ".", "scatter_link", ...
Build a dictionary of `JobDetails` objects for the internal `Link`
[ "Build", "a", "dictionary", "of", "JobDetails", "objects", "for", "the", "internal", "Link" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L179-L197
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather._invoke
def _invoke(self, argv, stream=sys.stdout, resubmit_failed=False): """Invoke this object to preform a particular action Parameters ---------- argv : list List of command line arguments, passed to helper classes stream : `file` Stream that this function ...
python
def _invoke(self, argv, stream=sys.stdout, resubmit_failed=False): """Invoke this object to preform a particular action Parameters ---------- argv : list List of command line arguments, passed to helper classes stream : `file` Stream that this function ...
[ "def", "_invoke", "(", "self", ",", "argv", ",", "stream", "=", "sys", ".", "stdout", ",", "resubmit_failed", "=", "False", ")", ":", "args", "=", "self", ".", "_run_argparser", "(", "argv", ")", "if", "args", ".", "action", "not", "in", "ACTIONS", "...
Invoke this object to preform a particular action Parameters ---------- argv : list List of command line arguments, passed to helper classes stream : `file` Stream that this function will print to, must have 'write' function. resubmit_faile...
[ "Invoke", "this", "object", "to", "preform", "a", "particular", "action" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L230-L277
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather.update_args
def update_args(self, override_args): """Update the arguments used to invoke the application Note that this will also update the dictionary of input and output files Parameters ---------- override_args : dict dictionary of arguments to override the current values ...
python
def update_args(self, override_args): """Update the arguments used to invoke the application Note that this will also update the dictionary of input and output files Parameters ---------- override_args : dict dictionary of arguments to override the current values ...
[ "def", "update_args", "(", "self", ",", "override_args", ")", ":", "self", ".", "args", "=", "extract_arguments", "(", "override_args", ",", "self", ".", "args", ")", "self", ".", "_job_configs", "=", "self", ".", "build_job_configs", "(", "self", ".", "ar...
Update the arguments used to invoke the application Note that this will also update the dictionary of input and output files Parameters ---------- override_args : dict dictionary of arguments to override the current values
[ "Update", "the", "arguments", "used", "to", "invoke", "the", "application" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L279-L294
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather.clear_jobs
def clear_jobs(self, recursive=True): """Clear the self.jobs dictionary that contains information about jobs associated with this `ScatterGather` If recursive is True this will include jobs from all internal `Link` """ if recursive: self._scatter_link.clear_jobs(recu...
python
def clear_jobs(self, recursive=True): """Clear the self.jobs dictionary that contains information about jobs associated with this `ScatterGather` If recursive is True this will include jobs from all internal `Link` """ if recursive: self._scatter_link.clear_jobs(recu...
[ "def", "clear_jobs", "(", "self", ",", "recursive", "=", "True", ")", ":", "if", "recursive", ":", "self", ".", "_scatter_link", ".", "clear_jobs", "(", "recursive", ")", "self", ".", "jobs", ".", "clear", "(", ")" ]
Clear the self.jobs dictionary that contains information about jobs associated with this `ScatterGather` If recursive is True this will include jobs from all internal `Link`
[ "Clear", "the", "self", ".", "jobs", "dictionary", "that", "contains", "information", "about", "jobs", "associated", "with", "this", "ScatterGather" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L296-L304
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather.check_status
def check_status(self, stream=sys.stdout, check_once=False, fail_pending=False, fail_running=False, no_wait=False, do_print=True, write_status=False): """Loop to check on the status of all the jobs in job dict. Paramete...
python
def check_status(self, stream=sys.stdout, check_once=False, fail_pending=False, fail_running=False, no_wait=False, do_print=True, write_status=False): """Loop to check on the status of all the jobs in job dict. Paramete...
[ "def", "check_status", "(", "self", ",", "stream", "=", "sys", ".", "stdout", ",", "check_once", "=", "False", ",", "fail_pending", "=", "False", ",", "fail_running", "=", "False", ",", "no_wait", "=", "False", ",", "do_print", "=", "True", ",", "write_s...
Loop to check on the status of all the jobs in job dict. Parameters ----------- stream : `file` Stream that this function will print to, Must have 'write' function. check_once : bool Check status once and exit loop. fail_pending : `bool` ...
[ "Loop", "to", "check", "on", "the", "status", "of", "all", "the", "jobs", "in", "job", "dict", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L318-L418
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather.run_jobs
def run_jobs(self, stream=sys.stdout, resubmit_failed=False): """Function to dipatch jobs and collect results Parameters ----------- stream : `file` Stream that this function will print to, Must have 'write' function. resubmit_failed : bool R...
python
def run_jobs(self, stream=sys.stdout, resubmit_failed=False): """Function to dipatch jobs and collect results Parameters ----------- stream : `file` Stream that this function will print to, Must have 'write' function. resubmit_failed : bool R...
[ "def", "run_jobs", "(", "self", ",", "stream", "=", "sys", ".", "stdout", ",", "resubmit_failed", "=", "False", ")", ":", "self", ".", "_build_job_dict", "(", ")", "self", ".", "_interface", ".", "_dry_run", "=", "self", ".", "args", "[", "'dry_run'", ...
Function to dipatch jobs and collect results Parameters ----------- stream : `file` Stream that this function will print to, Must have 'write' function. resubmit_failed : bool Resubmit failed jobs. Returns ------- status_vect...
[ "Function", "to", "dipatch", "jobs", "and", "collect", "results" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L420-L457
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather.resubmit
def resubmit(self, stream=sys.stdout, fail_running=False, resubmit_failed=False): """Function to resubmit failed jobs and collect results Parameters ----------- stream : `file` Stream that this function will print to, Must have 'write' function. fail_run...
python
def resubmit(self, stream=sys.stdout, fail_running=False, resubmit_failed=False): """Function to resubmit failed jobs and collect results Parameters ----------- stream : `file` Stream that this function will print to, Must have 'write' function. fail_run...
[ "def", "resubmit", "(", "self", ",", "stream", "=", "sys", ".", "stdout", ",", "fail_running", "=", "False", ",", "resubmit_failed", "=", "False", ")", ":", "self", ".", "_build_job_dict", "(", ")", "status_vect", "=", "self", ".", "check_status", "(", "...
Function to resubmit failed jobs and collect results Parameters ----------- stream : `file` Stream that this function will print to, Must have 'write' function. fail_running : `bool` If True, consider running jobs as failed resubmit_failed :...
[ "Function", "to", "resubmit", "failed", "jobs", "and", "collect", "results" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L459-L509
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather.clean_jobs
def clean_jobs(self, recursive=False): """Clean up all the jobs associated with this object. If recursive is True this also clean jobs dispatch by this object.""" self._interface.clean_jobs(self.scatter_link, clean_all=recursive)
python
def clean_jobs(self, recursive=False): """Clean up all the jobs associated with this object. If recursive is True this also clean jobs dispatch by this object.""" self._interface.clean_jobs(self.scatter_link, clean_all=recursive)
[ "def", "clean_jobs", "(", "self", ",", "recursive", "=", "False", ")", ":", "self", ".", "_interface", ".", "clean_jobs", "(", "self", ".", "scatter_link", ",", "clean_all", "=", "recursive", ")" ]
Clean up all the jobs associated with this object. If recursive is True this also clean jobs dispatch by this object.
[ "Clean", "up", "all", "the", "jobs", "associated", "with", "this", "object", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L511-L517
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather.print_update
def print_update(self, stream=sys.stdout, job_stats=None): """Print an update about the current number of jobs running """ if job_stats is None: job_stats = JobStatusVector() job_det_list = [] job_det_list += self._scatter_link.jobs.values() for job_dets ...
python
def print_update(self, stream=sys.stdout, job_stats=None): """Print an update about the current number of jobs running """ if job_stats is None: job_stats = JobStatusVector() job_det_list = [] job_det_list += self._scatter_link.jobs.values() for job_dets ...
[ "def", "print_update", "(", "self", ",", "stream", "=", "sys", ".", "stdout", ",", "job_stats", "=", "None", ")", ":", "if", "job_stats", "is", "None", ":", "job_stats", "=", "JobStatusVector", "(", ")", "job_det_list", "=", "[", "]", "job_det_list", "+=...
Print an update about the current number of jobs running
[ "Print", "an", "update", "about", "the", "current", "number", "of", "jobs", "running" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L566-L585
train
fermiPy/fermipy
fermipy/jobs/scatter_gather.py
ScatterGather.print_failed
def print_failed(self, stream=sys.stderr): """Print list of the failed jobs """ for job_key, job_details in sorted(self.scatter_link.jobs.items()): if job_details.status == JobStatus.failed: stream.write("Failed job %s\n log = %s\n" % (job_key, j...
python
def print_failed(self, stream=sys.stderr): """Print list of the failed jobs """ for job_key, job_details in sorted(self.scatter_link.jobs.items()): if job_details.status == JobStatus.failed: stream.write("Failed job %s\n log = %s\n" % (job_key, j...
[ "def", "print_failed", "(", "self", ",", "stream", "=", "sys", ".", "stderr", ")", ":", "for", "job_key", ",", "job_details", "in", "sorted", "(", "self", ".", "scatter_link", ".", "jobs", ".", "items", "(", ")", ")", ":", "if", "job_details", ".", "...
Print list of the failed jobs
[ "Print", "list", "of", "the", "failed", "jobs" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/scatter_gather.py#L587-L592
train
fermiPy/fermipy
fermipy/scripts/collect_sources.py
read_sources_from_numpy_file
def read_sources_from_numpy_file(npfile): """ Open a numpy pickle file and read all the new sources into a dictionary Parameters ---------- npfile : file name The input numpy pickle file Returns ------- tab : `~astropy.table.Table` """ srcs = np.load(npfile).flat[0]['sources...
python
def read_sources_from_numpy_file(npfile): """ Open a numpy pickle file and read all the new sources into a dictionary Parameters ---------- npfile : file name The input numpy pickle file Returns ------- tab : `~astropy.table.Table` """ srcs = np.load(npfile).flat[0]['sources...
[ "def", "read_sources_from_numpy_file", "(", "npfile", ")", ":", "srcs", "=", "np", ".", "load", "(", "npfile", ")", ".", "flat", "[", "0", "]", "[", "'sources'", "]", "roi", "=", "ROIModel", "(", ")", "roi", ".", "load_sources", "(", "srcs", ".", "va...
Open a numpy pickle file and read all the new sources into a dictionary Parameters ---------- npfile : file name The input numpy pickle file Returns ------- tab : `~astropy.table.Table`
[ "Open", "a", "numpy", "pickle", "file", "and", "read", "all", "the", "new", "sources", "into", "a", "dictionary" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/scripts/collect_sources.py#L11-L27
train
fermiPy/fermipy
fermipy/scripts/collect_sources.py
read_sources_from_yaml_file
def read_sources_from_yaml_file(yamlfile): """ Open a yaml file and read all the new sources into a dictionary Parameters ---------- yaml : file name The input yaml file Returns ------- tab : `~astropy.table.Table` """ f = open(yamlfile) dd = yaml.load(f) srcs = dd['...
python
def read_sources_from_yaml_file(yamlfile): """ Open a yaml file and read all the new sources into a dictionary Parameters ---------- yaml : file name The input yaml file Returns ------- tab : `~astropy.table.Table` """ f = open(yamlfile) dd = yaml.load(f) srcs = dd['...
[ "def", "read_sources_from_yaml_file", "(", "yamlfile", ")", ":", "f", "=", "open", "(", "yamlfile", ")", "dd", "=", "yaml", ".", "load", "(", "f", ")", "srcs", "=", "dd", "[", "'sources'", "]", "f", ".", "close", "(", ")", "roi", "=", "ROIModel", "...
Open a yaml file and read all the new sources into a dictionary Parameters ---------- yaml : file name The input yaml file Returns ------- tab : `~astropy.table.Table`
[ "Open", "a", "yaml", "file", "and", "read", "all", "the", "new", "sources", "into", "a", "dictionary" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/scripts/collect_sources.py#L30-L48
train
fermiPy/fermipy
fermipy/scripts/collect_sources.py
merge_source_tables
def merge_source_tables(src_tab, tab, all_sources=False, prefix="", suffix="", roi_idx=None): """Append the sources in a table into another table. Parameters ---------- src_tab : `~astropy.table.Table` Master source table that will be appended with the sources in ...
python
def merge_source_tables(src_tab, tab, all_sources=False, prefix="", suffix="", roi_idx=None): """Append the sources in a table into another table. Parameters ---------- src_tab : `~astropy.table.Table` Master source table that will be appended with the sources in ...
[ "def", "merge_source_tables", "(", "src_tab", ",", "tab", ",", "all_sources", "=", "False", ",", "prefix", "=", "\"\"", ",", "suffix", "=", "\"\"", ",", "roi_idx", "=", "None", ")", ":", "if", "roi_idx", "is", "not", "None", "and", "'roi'", "not", "in"...
Append the sources in a table into another table. Parameters ---------- src_tab : `~astropy.table.Table` Master source table that will be appended with the sources in ``tab``. tab : `~astropy.table.Table` Table to be merged into ``src_tab``. all_sources : bool If ...
[ "Append", "the", "sources", "in", "a", "table", "into", "another", "table", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/scripts/collect_sources.py#L51-L98
train
fermiPy/fermipy
fermipy/ltcube.py
fill_livetime_hist
def fill_livetime_hist(skydir, tab_sc, tab_gti, zmax, costh_edges): """Generate a sequence of livetime distributions at the sky positions given by ``skydir``. The output of the method are two NxM arrays containing a sequence of histograms for N sky positions and M incidence angle bins where the bin edg...
python
def fill_livetime_hist(skydir, tab_sc, tab_gti, zmax, costh_edges): """Generate a sequence of livetime distributions at the sky positions given by ``skydir``. The output of the method are two NxM arrays containing a sequence of histograms for N sky positions and M incidence angle bins where the bin edg...
[ "def", "fill_livetime_hist", "(", "skydir", ",", "tab_sc", ",", "tab_gti", ",", "zmax", ",", "costh_edges", ")", ":", "if", "len", "(", "tab_gti", ")", "==", "0", ":", "shape", "=", "(", "len", "(", "costh_edges", ")", "-", "1", ",", "len", "(", "s...
Generate a sequence of livetime distributions at the sky positions given by ``skydir``. The output of the method are two NxM arrays containing a sequence of histograms for N sky positions and M incidence angle bins where the bin edges are defined by ``costh_edges``. This method uses the same algorithm...
[ "Generate", "a", "sequence", "of", "livetime", "distributions", "at", "the", "sky", "positions", "given", "by", "skydir", ".", "The", "output", "of", "the", "method", "are", "two", "NxM", "arrays", "containing", "a", "sequence", "of", "histograms", "for", "N...
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/ltcube.py#L20-L108
train
fermiPy/fermipy
fermipy/ltcube.py
LTCube.create
def create(cls, ltfile): """Create a livetime cube from a single file or list of files.""" if not re.search('\.txt?', ltfile) is None: files = np.loadtxt(ltfile, unpack=True, dtype='str') elif not isinstance(ltfile, list): files = glob.glob(ltfile) ltc =...
python
def create(cls, ltfile): """Create a livetime cube from a single file or list of files.""" if not re.search('\.txt?', ltfile) is None: files = np.loadtxt(ltfile, unpack=True, dtype='str') elif not isinstance(ltfile, list): files = glob.glob(ltfile) ltc =...
[ "def", "create", "(", "cls", ",", "ltfile", ")", ":", "if", "not", "re", ".", "search", "(", "'\\.txt?'", ",", "ltfile", ")", "is", "None", ":", "files", "=", "np", ".", "loadtxt", "(", "ltfile", ",", "unpack", "=", "True", ",", "dtype", "=", "'s...
Create a livetime cube from a single file or list of files.
[ "Create", "a", "livetime", "cube", "from", "a", "single", "file", "or", "list", "of", "files", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/ltcube.py#L183-L196
train
fermiPy/fermipy
fermipy/ltcube.py
LTCube.create_empty
def create_empty(cls, tstart, tstop, fill=0.0, nside=64): """Create an empty livetime cube.""" cth_edges = np.linspace(0, 1.0, 41) domega = utils.edge_to_width(cth_edges) * 2.0 * np.pi hpx = HPX(nside, True, 'CEL', ebins=cth_edges) data = np.ones((len(cth_edges) - 1, hpx.npix)) *...
python
def create_empty(cls, tstart, tstop, fill=0.0, nside=64): """Create an empty livetime cube.""" cth_edges = np.linspace(0, 1.0, 41) domega = utils.edge_to_width(cth_edges) * 2.0 * np.pi hpx = HPX(nside, True, 'CEL', ebins=cth_edges) data = np.ones((len(cth_edges) - 1, hpx.npix)) *...
[ "def", "create_empty", "(", "cls", ",", "tstart", ",", "tstop", ",", "fill", "=", "0.0", ",", "nside", "=", "64", ")", ":", "cth_edges", "=", "np", ".", "linspace", "(", "0", ",", "1.0", ",", "41", ")", "domega", "=", "utils", ".", "edge_to_width",...
Create an empty livetime cube.
[ "Create", "an", "empty", "livetime", "cube", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/ltcube.py#L239-L245
train
fermiPy/fermipy
fermipy/ltcube.py
LTCube.create_skydir_ltcube
def create_skydir_ltcube(self, skydir, tab_sc, tab_gti, zmax): """Create a new livetime cube by scaling this one by the observing profile ratio in the direction ``skydir``. This method can be used to generate an approximate livetime cube that is accurate in the vicinity of ``skydir``. ...
python
def create_skydir_ltcube(self, skydir, tab_sc, tab_gti, zmax): """Create a new livetime cube by scaling this one by the observing profile ratio in the direction ``skydir``. This method can be used to generate an approximate livetime cube that is accurate in the vicinity of ``skydir``. ...
[ "def", "create_skydir_ltcube", "(", "self", ",", "skydir", ",", "tab_sc", ",", "tab_gti", ",", "zmax", ")", ":", "skydir", "=", "SkyCoord", "(", "np", ".", "array", "(", "[", "skydir", ".", "ra", ".", "deg", "]", ")", ",", "np", ".", "array", "(", ...
Create a new livetime cube by scaling this one by the observing profile ratio in the direction ``skydir``. This method can be used to generate an approximate livetime cube that is accurate in the vicinity of ``skydir``. Parameters ---------- skydir : `~astropy.coordina...
[ "Create", "a", "new", "livetime", "cube", "by", "scaling", "this", "one", "by", "the", "observing", "profile", "ratio", "in", "the", "direction", "skydir", ".", "This", "method", "can", "be", "used", "to", "generate", "an", "approximate", "livetime", "cube",...
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/ltcube.py#L341-L380
train
fermiPy/fermipy
fermipy/ltcube.py
LTCube.write
def write(self, outfile): """Write the livetime cube to a FITS file.""" hdu_pri = fits.PrimaryHDU() hdu_exp = self._create_exp_hdu(self.data) hdu_exp.name = 'EXPOSURE' hdu_exp_wt = self._create_exp_hdu(self._data_wt) hdu_exp_wt.name = 'WEIGHTED_EXPOSURE' cols =...
python
def write(self, outfile): """Write the livetime cube to a FITS file.""" hdu_pri = fits.PrimaryHDU() hdu_exp = self._create_exp_hdu(self.data) hdu_exp.name = 'EXPOSURE' hdu_exp_wt = self._create_exp_hdu(self._data_wt) hdu_exp_wt.name = 'WEIGHTED_EXPOSURE' cols =...
[ "def", "write", "(", "self", ",", "outfile", ")", ":", "hdu_pri", "=", "fits", ".", "PrimaryHDU", "(", ")", "hdu_exp", "=", "self", ".", "_create_exp_hdu", "(", "self", ".", "data", ")", "hdu_exp", ".", "name", "=", "'EXPOSURE'", "hdu_exp_wt", "=", "se...
Write the livetime cube to a FITS file.
[ "Write", "the", "livetime", "cube", "to", "a", "FITS", "file", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/ltcube.py#L407-L435
train
fermiPy/fermipy
fermipy/plotting.py
make_cube_slice
def make_cube_slice(map_in, loge_bounds): """Extract a slice from a map cube object. """ # FIXME: This functionality should be moved into a slice method of # gammapy.maps axis = map_in.geom.axes[0] i0 = utils.val_to_edge(axis.edges, 10**loge_bounds[0])[0] i1 = utils.val_to_edge(axis.edges, 1...
python
def make_cube_slice(map_in, loge_bounds): """Extract a slice from a map cube object. """ # FIXME: This functionality should be moved into a slice method of # gammapy.maps axis = map_in.geom.axes[0] i0 = utils.val_to_edge(axis.edges, 10**loge_bounds[0])[0] i1 = utils.val_to_edge(axis.edges, 1...
[ "def", "make_cube_slice", "(", "map_in", ",", "loge_bounds", ")", ":", "axis", "=", "map_in", ".", "geom", ".", "axes", "[", "0", "]", "i0", "=", "utils", ".", "val_to_edge", "(", "axis", ".", "edges", ",", "10", "**", "loge_bounds", "[", "0", "]", ...
Extract a slice from a map cube object.
[ "Extract", "a", "slice", "from", "a", "map", "cube", "object", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/plotting.py#L343-L355
train
fermiPy/fermipy
fermipy/plotting.py
SEDPlotter.plot_sed
def plot_sed(sed, showlnl=False, **kwargs): """Render a plot of a spectral energy distribution. Parameters ---------- showlnl : bool Overlay a map of the delta-loglikelihood values vs. flux in each energy bin. cmap : str Color...
python
def plot_sed(sed, showlnl=False, **kwargs): """Render a plot of a spectral energy distribution. Parameters ---------- showlnl : bool Overlay a map of the delta-loglikelihood values vs. flux in each energy bin. cmap : str Color...
[ "def", "plot_sed", "(", "sed", ",", "showlnl", "=", "False", ",", "**", "kwargs", ")", ":", "ax", "=", "kwargs", ".", "pop", "(", "'ax'", ",", "plt", ".", "gca", "(", ")", ")", "cmap", "=", "kwargs", ".", "get", "(", "'cmap'", ",", "'BuGn'", ")...
Render a plot of a spectral energy distribution. Parameters ---------- showlnl : bool Overlay a map of the delta-loglikelihood values vs. flux in each energy bin. cmap : str Colormap that will be used for the delta-loglikelihood ...
[ "Render", "a", "plot", "of", "a", "spectral", "energy", "distribution", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/plotting.py#L815-L855
train
fermiPy/fermipy
fermipy/plotting.py
AnalysisPlotter.run
def run(self, gta, mcube_map, **kwargs): """Make all plots.""" prefix = kwargs.get('prefix', 'test') format = kwargs.get('format', self.config['format']) loge_bounds = [None] + self.config['loge_bounds'] for x in loge_bounds: self.make_roi_plots(gta, mcube_map, loge...
python
def run(self, gta, mcube_map, **kwargs): """Make all plots.""" prefix = kwargs.get('prefix', 'test') format = kwargs.get('format', self.config['format']) loge_bounds = [None] + self.config['loge_bounds'] for x in loge_bounds: self.make_roi_plots(gta, mcube_map, loge...
[ "def", "run", "(", "self", ",", "gta", ",", "mcube_map", ",", "**", "kwargs", ")", ":", "prefix", "=", "kwargs", ".", "get", "(", "'prefix'", ",", "'test'", ")", "format", "=", "kwargs", ".", "get", "(", "'format'", ",", "self", ".", "config", "[",...
Make all plots.
[ "Make", "all", "plots", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/plotting.py#L924-L941
train
fermiPy/fermipy
fermipy/plotting.py
AnalysisPlotter._plot_extension
def _plot_extension(self, gta, prefix, src, loge_bounds=None, **kwargs): """Utility function for generating diagnostic plots for the extension analysis.""" # format = kwargs.get('format', self.config['plotting']['format']) if loge_bounds is None: loge_bounds = (self.energie...
python
def _plot_extension(self, gta, prefix, src, loge_bounds=None, **kwargs): """Utility function for generating diagnostic plots for the extension analysis.""" # format = kwargs.get('format', self.config['plotting']['format']) if loge_bounds is None: loge_bounds = (self.energie...
[ "def", "_plot_extension", "(", "self", ",", "gta", ",", "prefix", ",", "src", ",", "loge_bounds", "=", "None", ",", "**", "kwargs", ")", ":", "if", "loge_bounds", "is", "None", ":", "loge_bounds", "=", "(", "self", ".", "energies", "[", "0", "]", ","...
Utility function for generating diagnostic plots for the extension analysis.
[ "Utility", "function", "for", "generating", "diagnostic", "plots", "for", "the", "extension", "analysis", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/plotting.py#L1538-L1600
train
fermiPy/fermipy
fermipy/jobs/gtlink.py
extract_parameters
def extract_parameters(pil, keys=None): """Extract and return parameter names and values from a pil object Parameters ---------- pil : `Pil` object keys : list List of parameter names, if None, extact all parameters Returns ------- out_dict : dict Dictionary with par...
python
def extract_parameters(pil, keys=None): """Extract and return parameter names and values from a pil object Parameters ---------- pil : `Pil` object keys : list List of parameter names, if None, extact all parameters Returns ------- out_dict : dict Dictionary with par...
[ "def", "extract_parameters", "(", "pil", ",", "keys", "=", "None", ")", ":", "out_dict", "=", "{", "}", "if", "keys", "is", "None", ":", "keys", "=", "pil", ".", "keys", "(", ")", "for", "key", "in", "keys", ":", "try", ":", "out_dict", "[", "key...
Extract and return parameter names and values from a pil object Parameters ---------- pil : `Pil` object keys : list List of parameter names, if None, extact all parameters Returns ------- out_dict : dict Dictionary with parameter name, value pairs
[ "Extract", "and", "return", "parameter", "names", "and", "values", "from", "a", "pil", "object" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/gtlink.py#L14-L39
train
fermiPy/fermipy
fermipy/jobs/gtlink.py
update_gtapp
def update_gtapp(gtapp, **kwargs): """Update the parameters of the object that can run ScienceTools applications Parameters ---------- gtapp : `GtApp.GtApp` Object that will run the application in question kwargs : arguments used to invoke the application """ for key, val in kwar...
python
def update_gtapp(gtapp, **kwargs): """Update the parameters of the object that can run ScienceTools applications Parameters ---------- gtapp : `GtApp.GtApp` Object that will run the application in question kwargs : arguments used to invoke the application """ for key, val in kwar...
[ "def", "update_gtapp", "(", "gtapp", ",", "**", "kwargs", ")", ":", "for", "key", ",", "val", "in", "kwargs", ".", "items", "(", ")", ":", "if", "key", "in", "[", "'pfiles'", ",", "'scratch'", "]", ":", "continue", "if", "val", "is", "None", ":", ...
Update the parameters of the object that can run ScienceTools applications Parameters ---------- gtapp : `GtApp.GtApp` Object that will run the application in question kwargs : arguments used to invoke the application
[ "Update", "the", "parameters", "of", "the", "object", "that", "can", "run", "ScienceTools", "applications" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/gtlink.py#L42-L64
train
fermiPy/fermipy
fermipy/jobs/gtlink.py
build_gtapp
def build_gtapp(appname, dry_run, **kwargs): """Build an object that can run ScienceTools application Parameters ---------- appname : str Name of the application (e.g., gtbin) dry_run : bool Print command but do not run it kwargs : arguments used to invoke the application ...
python
def build_gtapp(appname, dry_run, **kwargs): """Build an object that can run ScienceTools application Parameters ---------- appname : str Name of the application (e.g., gtbin) dry_run : bool Print command but do not run it kwargs : arguments used to invoke the application ...
[ "def", "build_gtapp", "(", "appname", ",", "dry_run", ",", "**", "kwargs", ")", ":", "pfiles_orig", "=", "_set_pfiles", "(", "dry_run", ",", "**", "kwargs", ")", "gtapp", "=", "GtApp", ".", "GtApp", "(", "appname", ")", "update_gtapp", "(", "gtapp", ",",...
Build an object that can run ScienceTools application Parameters ---------- appname : str Name of the application (e.g., gtbin) dry_run : bool Print command but do not run it kwargs : arguments used to invoke the application Returns `GtApp.GtApp` object that will run the appl...
[ "Build", "an", "object", "that", "can", "run", "ScienceTools", "application" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/gtlink.py#L116-L135
train
fermiPy/fermipy
fermipy/jobs/gtlink.py
run_gtapp
def run_gtapp(gtapp, stream, dry_run, **kwargs): """Runs one on the ScienceTools apps Taken from fermipy.gtanalysis.run_gtapp by Matt Wood Parameters ---------- gtapp : `GtApp.GtApp` object The application (e.g., gtbin) stream : stream object Must have 'write' function d...
python
def run_gtapp(gtapp, stream, dry_run, **kwargs): """Runs one on the ScienceTools apps Taken from fermipy.gtanalysis.run_gtapp by Matt Wood Parameters ---------- gtapp : `GtApp.GtApp` object The application (e.g., gtbin) stream : stream object Must have 'write' function d...
[ "def", "run_gtapp", "(", "gtapp", ",", "stream", ",", "dry_run", ",", "**", "kwargs", ")", ":", "if", "stream", "is", "None", ":", "stream", "=", "sys", ".", "stdout", "pfiles_orig", "=", "_set_pfiles", "(", "dry_run", ",", "**", "kwargs", ")", "update...
Runs one on the ScienceTools apps Taken from fermipy.gtanalysis.run_gtapp by Matt Wood Parameters ---------- gtapp : `GtApp.GtApp` object The application (e.g., gtbin) stream : stream object Must have 'write' function dry_run : bool Print command but do not run it ...
[ "Runs", "one", "on", "the", "ScienceTools", "apps" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/gtlink.py#L138-L180
train
fermiPy/fermipy
fermipy/diffuse/gt_assemble_model.py
InitModel.run_analysis
def run_analysis(self, argv): """ Build the manifest for all the models """ args = self._parser.parse_args(argv) components = Component.build_from_yamlfile(args.comp) NAME_FACTORY.update_base_dict(args.data) model_dict = make_library(**args.__dict__) model_manager...
python
def run_analysis(self, argv): """ Build the manifest for all the models """ args = self._parser.parse_args(argv) components = Component.build_from_yamlfile(args.comp) NAME_FACTORY.update_base_dict(args.data) model_dict = make_library(**args.__dict__) model_manager...
[ "def", "run_analysis", "(", "self", ",", "argv", ")", ":", "args", "=", "self", ".", "_parser", ".", "parse_args", "(", "argv", ")", "components", "=", "Component", ".", "build_from_yamlfile", "(", "args", ".", "comp", ")", "NAME_FACTORY", ".", "update_bas...
Build the manifest for all the models
[ "Build", "the", "manifest", "for", "all", "the", "models" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_assemble_model.py#L46-L61
train
fermiPy/fermipy
fermipy/diffuse/gt_assemble_model.py
AssembleModel.copy_ccube
def copy_ccube(ccube, outsrcmap, hpx_order): """Copy a counts cube into outsrcmap file reducing the HEALPix order to hpx_order if needed. """ sys.stdout.write(" Copying counts cube from %s to %s\n" % (ccube, outsrcmap)) try: hdulist_in = fits.open(ccube) exce...
python
def copy_ccube(ccube, outsrcmap, hpx_order): """Copy a counts cube into outsrcmap file reducing the HEALPix order to hpx_order if needed. """ sys.stdout.write(" Copying counts cube from %s to %s\n" % (ccube, outsrcmap)) try: hdulist_in = fits.open(ccube) exce...
[ "def", "copy_ccube", "(", "ccube", ",", "outsrcmap", ",", "hpx_order", ")", ":", "sys", ".", "stdout", ".", "write", "(", "\" Copying counts cube from %s to %s\\n\"", "%", "(", "ccube", ",", "outsrcmap", ")", ")", "try", ":", "hdulist_in", "=", "fits", ".",...
Copy a counts cube into outsrcmap file reducing the HEALPix order to hpx_order if needed.
[ "Copy", "a", "counts", "cube", "into", "outsrcmap", "file", "reducing", "the", "HEALPix", "order", "to", "hpx_order", "if", "needed", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_assemble_model.py#L79-L104
train
fermiPy/fermipy
fermipy/diffuse/gt_assemble_model.py
AssembleModel.append_hdus
def append_hdus(hdulist, srcmap_file, source_names, hpx_order): """Append HEALPix maps to a list Parameters ---------- hdulist : list The list being appended to srcmap_file : str Path to the file containing the HDUs source_names : list of str ...
python
def append_hdus(hdulist, srcmap_file, source_names, hpx_order): """Append HEALPix maps to a list Parameters ---------- hdulist : list The list being appended to srcmap_file : str Path to the file containing the HDUs source_names : list of str ...
[ "def", "append_hdus", "(", "hdulist", ",", "srcmap_file", ",", "source_names", ",", "hpx_order", ")", ":", "sys", ".", "stdout", ".", "write", "(", "\" Extracting %i sources from %s\"", "%", "(", "len", "(", "source_names", ")", ",", "srcmap_file", ")", ")", ...
Append HEALPix maps to a list Parameters ---------- hdulist : list The list being appended to srcmap_file : str Path to the file containing the HDUs source_names : list of str Names of the sources to extract from srcmap_file hpx_order...
[ "Append", "HEALPix", "maps", "to", "a", "list" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_assemble_model.py#L113-L156
train
fermiPy/fermipy
fermipy/diffuse/gt_assemble_model.py
AssembleModel.assemble_component
def assemble_component(compname, compinfo, hpx_order): """Assemble the source map file for one binning component Parameters ---------- compname : str The key for this component (e.g., E0_PSF3) compinfo : dict Information about this component hpx_...
python
def assemble_component(compname, compinfo, hpx_order): """Assemble the source map file for one binning component Parameters ---------- compname : str The key for this component (e.g., E0_PSF3) compinfo : dict Information about this component hpx_...
[ "def", "assemble_component", "(", "compname", ",", "compinfo", ",", "hpx_order", ")", ":", "sys", ".", "stdout", ".", "write", "(", "\"Working on component %s\\n\"", "%", "compname", ")", "ccube", "=", "compinfo", "[", "'ccube'", "]", "outsrcmap", "=", "compin...
Assemble the source map file for one binning component Parameters ---------- compname : str The key for this component (e.g., E0_PSF3) compinfo : dict Information about this component hpx_order : int Maximum order for maps
[ "Assemble", "the", "source", "map", "file", "for", "one", "binning", "component" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_assemble_model.py#L159-L187
train
fermiPy/fermipy
fermipy/diffuse/gt_assemble_model.py
AssembleModel.run_analysis
def run_analysis(self, argv): """Assemble the source map file for one binning component FIXME """ args = self._parser.parse_args(argv) manifest = yaml.safe_load(open(args.input)) compname = args.compname value = manifest[compname] self.assemble_component(...
python
def run_analysis(self, argv): """Assemble the source map file for one binning component FIXME """ args = self._parser.parse_args(argv) manifest = yaml.safe_load(open(args.input)) compname = args.compname value = manifest[compname] self.assemble_component(...
[ "def", "run_analysis", "(", "self", ",", "argv", ")", ":", "args", "=", "self", ".", "_parser", ".", "parse_args", "(", "argv", ")", "manifest", "=", "yaml", ".", "safe_load", "(", "open", "(", "args", ".", "input", ")", ")", "compname", "=", "args",...
Assemble the source map file for one binning component FIXME
[ "Assemble", "the", "source", "map", "file", "for", "one", "binning", "component", "FIXME" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_assemble_model.py#L189-L198
train
jim-easterbrook/pywws
src/pywws/weatherstation.py
CUSBDrive.read_block
def read_block(self, address): """Read 32 bytes from the weather station. If the read fails for any reason, :obj:`None` is returned. :param address: address to read from. :type address: int :return: the data from the weather station. :rtype: list(int) """ ...
python
def read_block(self, address): """Read 32 bytes from the weather station. If the read fails for any reason, :obj:`None` is returned. :param address: address to read from. :type address: int :return: the data from the weather station. :rtype: list(int) """ ...
[ "def", "read_block", "(", "self", ",", "address", ")", ":", "buf", "=", "[", "self", ".", "ReadCommand", ",", "address", "//", "256", ",", "address", "%", "256", ",", "self", ".", "EndMark", ",", "self", ".", "ReadCommand", ",", "address", "//", "256...
Read 32 bytes from the weather station. If the read fails for any reason, :obj:`None` is returned. :param address: address to read from. :type address: int :return: the data from the weather station. :rtype: list(int)
[ "Read", "32", "bytes", "from", "the", "weather", "station", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/weatherstation.py#L325-L351
train
jim-easterbrook/pywws
src/pywws/weatherstation.py
CUSBDrive.write_byte
def write_byte(self, address, data): """Write a single byte to the weather station. :param address: address to write to. :type address: int :param data: the value to write. :type data: int :return: success status. :rtype: bool """ buf = [ ...
python
def write_byte(self, address, data): """Write a single byte to the weather station. :param address: address to write to. :type address: int :param data: the value to write. :type data: int :return: success status. :rtype: bool """ buf = [ ...
[ "def", "write_byte", "(", "self", ",", "address", ",", "data", ")", ":", "buf", "=", "[", "self", ".", "WriteCommandWord", ",", "address", "//", "256", ",", "address", "%", "256", ",", "self", ".", "EndMark", ",", "self", ".", "WriteCommandWord", ",", ...
Write a single byte to the weather station. :param address: address to write to. :type address: int :param data: the value to write. :type data: int :return: success status. :rtype: bool
[ "Write", "a", "single", "byte", "to", "the", "weather", "station", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/weatherstation.py#L353-L387
train
jim-easterbrook/pywws
src/pywws/weatherstation.py
WeatherStation.inc_ptr
def inc_ptr(self, ptr): """Get next circular buffer data pointer.""" result = ptr + self.reading_len[self.ws_type] if result >= 0x10000: result = self.data_start return result
python
def inc_ptr(self, ptr): """Get next circular buffer data pointer.""" result = ptr + self.reading_len[self.ws_type] if result >= 0x10000: result = self.data_start return result
[ "def", "inc_ptr", "(", "self", ",", "ptr", ")", ":", "result", "=", "ptr", "+", "self", ".", "reading_len", "[", "self", ".", "ws_type", "]", "if", "result", ">=", "0x10000", ":", "result", "=", "self", ".", "data_start", "return", "result" ]
Get next circular buffer data pointer.
[ "Get", "next", "circular", "buffer", "data", "pointer", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/weatherstation.py#L658-L663
train
jim-easterbrook/pywws
src/pywws/weatherstation.py
WeatherStation.dec_ptr
def dec_ptr(self, ptr): """Get previous circular buffer data pointer.""" result = ptr - self.reading_len[self.ws_type] if result < self.data_start: result = 0x10000 - self.reading_len[self.ws_type] return result
python
def dec_ptr(self, ptr): """Get previous circular buffer data pointer.""" result = ptr - self.reading_len[self.ws_type] if result < self.data_start: result = 0x10000 - self.reading_len[self.ws_type] return result
[ "def", "dec_ptr", "(", "self", ",", "ptr", ")", ":", "result", "=", "ptr", "-", "self", ".", "reading_len", "[", "self", ".", "ws_type", "]", "if", "result", "<", "self", ".", "data_start", ":", "result", "=", "0x10000", "-", "self", ".", "reading_le...
Get previous circular buffer data pointer.
[ "Get", "previous", "circular", "buffer", "data", "pointer", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/weatherstation.py#L665-L670
train
jim-easterbrook/pywws
src/pywws/weatherstation.py
WeatherStation.get_raw_data
def get_raw_data(self, ptr, unbuffered=False): """Get raw data from circular buffer. If unbuffered is false then a cached value that was obtained earlier may be returned.""" if unbuffered: self._data_pos = None # round down ptr to a 'block boundary' idx = ptr...
python
def get_raw_data(self, ptr, unbuffered=False): """Get raw data from circular buffer. If unbuffered is false then a cached value that was obtained earlier may be returned.""" if unbuffered: self._data_pos = None # round down ptr to a 'block boundary' idx = ptr...
[ "def", "get_raw_data", "(", "self", ",", "ptr", ",", "unbuffered", "=", "False", ")", ":", "if", "unbuffered", ":", "self", ".", "_data_pos", "=", "None", "idx", "=", "ptr", "-", "(", "ptr", "%", "0x20", ")", "ptr", "-=", "idx", "count", "=", "self...
Get raw data from circular buffer. If unbuffered is false then a cached value that was obtained earlier may be returned.
[ "Get", "raw", "data", "from", "circular", "buffer", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/weatherstation.py#L672-L702
train
jim-easterbrook/pywws
src/pywws/weatherstation.py
WeatherStation.get_data
def get_data(self, ptr, unbuffered=False): """Get decoded data from circular buffer. If unbuffered is false then a cached value that was obtained earlier may be returned.""" result = _decode(self.get_raw_data(ptr, unbuffered), self._reading_format[self.ws_type])...
python
def get_data(self, ptr, unbuffered=False): """Get decoded data from circular buffer. If unbuffered is false then a cached value that was obtained earlier may be returned.""" result = _decode(self.get_raw_data(ptr, unbuffered), self._reading_format[self.ws_type])...
[ "def", "get_data", "(", "self", ",", "ptr", ",", "unbuffered", "=", "False", ")", ":", "result", "=", "_decode", "(", "self", ".", "get_raw_data", "(", "ptr", ",", "unbuffered", ")", ",", "self", ".", "_reading_format", "[", "self", ".", "ws_type", "]"...
Get decoded data from circular buffer. If unbuffered is false then a cached value that was obtained earlier may be returned.
[ "Get", "decoded", "data", "from", "circular", "buffer", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/weatherstation.py#L704-L711
train
jim-easterbrook/pywws
src/pywws/weatherstation.py
WeatherStation.current_pos
def current_pos(self): """Get circular buffer location where current data is being written.""" new_ptr = _decode( self._read_fixed_block(0x0020), self.lo_fix_format['current_pos']) if new_ptr == self._current_ptr: return self._current_ptr if self._current_ptr and ...
python
def current_pos(self): """Get circular buffer location where current data is being written.""" new_ptr = _decode( self._read_fixed_block(0x0020), self.lo_fix_format['current_pos']) if new_ptr == self._current_ptr: return self._current_ptr if self._current_ptr and ...
[ "def", "current_pos", "(", "self", ")", ":", "new_ptr", "=", "_decode", "(", "self", ".", "_read_fixed_block", "(", "0x0020", ")", ",", "self", ".", "lo_fix_format", "[", "'current_pos'", "]", ")", "if", "new_ptr", "==", "self", ".", "_current_ptr", ":", ...
Get circular buffer location where current data is being written.
[ "Get", "circular", "buffer", "location", "where", "current", "data", "is", "being", "written", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/weatherstation.py#L713-L723
train
jim-easterbrook/pywws
src/pywws/device_pyusb.py
USBDevice._find_device
def _find_device(self, idVendor, idProduct): """Find a USB device by product and vendor id.""" for bus in usb.busses(): for device in bus.devices: if (device.idVendor == idVendor and device.idProduct == idProduct): return device ...
python
def _find_device(self, idVendor, idProduct): """Find a USB device by product and vendor id.""" for bus in usb.busses(): for device in bus.devices: if (device.idVendor == idVendor and device.idProduct == idProduct): return device ...
[ "def", "_find_device", "(", "self", ",", "idVendor", ",", "idProduct", ")", ":", "for", "bus", "in", "usb", ".", "busses", "(", ")", ":", "for", "device", "in", "bus", ".", "devices", ":", "if", "(", "device", ".", "idVendor", "==", "idVendor", "and"...
Find a USB device by product and vendor id.
[ "Find", "a", "USB", "device", "by", "product", "and", "vendor", "id", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/device_pyusb.py#L106-L113
train
jim-easterbrook/pywws
src/pywws/sqlite3data.py
_adapt_WSDateTime
def _adapt_WSDateTime(dt): """Return unix timestamp of the datetime like input. If conversion overflows high, return sint64_max , if underflows, return 0 """ try: ts = int( (dt.replace(tzinfo=pytz.utc) - datetime(1970,1,1,tzinfo=pytz.utc) ).total_seconds()...
python
def _adapt_WSDateTime(dt): """Return unix timestamp of the datetime like input. If conversion overflows high, return sint64_max , if underflows, return 0 """ try: ts = int( (dt.replace(tzinfo=pytz.utc) - datetime(1970,1,1,tzinfo=pytz.utc) ).total_seconds()...
[ "def", "_adapt_WSDateTime", "(", "dt", ")", ":", "try", ":", "ts", "=", "int", "(", "(", "dt", ".", "replace", "(", "tzinfo", "=", "pytz", ".", "utc", ")", "-", "datetime", "(", "1970", ",", "1", ",", "1", ",", "tzinfo", "=", "pytz", ".", "utc"...
Return unix timestamp of the datetime like input. If conversion overflows high, return sint64_max , if underflows, return 0
[ "Return", "unix", "timestamp", "of", "the", "datetime", "like", "input", ".", "If", "conversion", "overflows", "high", "return", "sint64_max", "if", "underflows", "return", "0" ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/sqlite3data.py#L93-L109
train
jim-easterbrook/pywws
src/pywws/sqlite3data.py
CoreStore._predicate
def _predicate(self, i): """Given a valid datetime or slace, return the predicate portion of the SQL query, a boolean indicating whether multiple items are expected from the result, and a dictionary of parameters for the query """ if isinstance(i, slice): if i.step is...
python
def _predicate(self, i): """Given a valid datetime or slace, return the predicate portion of the SQL query, a boolean indicating whether multiple items are expected from the result, and a dictionary of parameters for the query """ if isinstance(i, slice): if i.step is...
[ "def", "_predicate", "(", "self", ",", "i", ")", ":", "if", "isinstance", "(", "i", ",", "slice", ")", ":", "if", "i", ".", "step", "is", "not", "None", ":", "raise", "TypeError", "(", "\"Slice step not permitted\"", ")", "if", "(", "(", "i", ".", ...
Given a valid datetime or slace, return the predicate portion of the SQL query, a boolean indicating whether multiple items are expected from the result, and a dictionary of parameters for the query
[ "Given", "a", "valid", "datetime", "or", "slace", "return", "the", "predicate", "portion", "of", "the", "SQL", "query", "a", "boolean", "indicating", "whether", "multiple", "items", "are", "expected", "from", "the", "result", "and", "a", "dictionary", "of", ...
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/sqlite3data.py#L282-L330
train
jim-easterbrook/pywws
src/pywws/localisation.py
set_locale
def set_locale(lang): """Set the 'locale' used by a program. This affects the entire application, changing the way dates, currencies and numbers are represented. It should not be called from a library routine that may be used in another program. The ``lang`` parameter can be any string that is rec...
python
def set_locale(lang): """Set the 'locale' used by a program. This affects the entire application, changing the way dates, currencies and numbers are represented. It should not be called from a library routine that may be used in another program. The ``lang`` parameter can be any string that is rec...
[ "def", "set_locale", "(", "lang", ")", ":", "lc", ",", "encoding", "=", "locale", ".", "getdefaultlocale", "(", ")", "try", ":", "if", "'.'", "in", "lang", ":", "locale", ".", "setlocale", "(", "locale", ".", "LC_ALL", ",", "lang", ")", "else", ":", ...
Set the 'locale' used by a program. This affects the entire application, changing the way dates, currencies and numbers are represented. It should not be called from a library routine that may be used in another program. The ``lang`` parameter can be any string that is recognised by ``locale.setlo...
[ "Set", "the", "locale", "used", "by", "a", "program", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/localisation.py#L141-L166
train
jim-easterbrook/pywws
src/pywws/localisation.py
set_application_language
def set_application_language(params): """Set the locale and translation for a pywws program. This function reads the language from the configuration file, then calls :func:`set_locale` and :func:`set_translation`. :param params: a :class:`pywws.storage.params` object. :type params: object ""...
python
def set_application_language(params): """Set the locale and translation for a pywws program. This function reads the language from the configuration file, then calls :func:`set_locale` and :func:`set_translation`. :param params: a :class:`pywws.storage.params` object. :type params: object ""...
[ "def", "set_application_language", "(", "params", ")", ":", "lang", "=", "params", ".", "get", "(", "'config'", ",", "'language'", ",", "None", ")", "if", "lang", ":", "set_locale", "(", "lang", ")", "set_translation", "(", "lang", ")" ]
Set the locale and translation for a pywws program. This function reads the language from the configuration file, then calls :func:`set_locale` and :func:`set_translation`. :param params: a :class:`pywws.storage.params` object. :type params: object
[ "Set", "the", "locale", "and", "translation", "for", "a", "pywws", "program", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/localisation.py#L210-L224
train
jim-easterbrook/pywws
src/pywws/storage.py
ParamStore.get
def get(self, section, option, default=None): """Get a parameter value and return a string. If default is specified and section or option are not defined in the file, they are created and set to default, which is then the return value. """ with self._lock: i...
python
def get(self, section, option, default=None): """Get a parameter value and return a string. If default is specified and section or option are not defined in the file, they are created and set to default, which is then the return value. """ with self._lock: i...
[ "def", "get", "(", "self", ",", "section", ",", "option", ",", "default", "=", "None", ")", ":", "with", "self", ".", "_lock", ":", "if", "not", "self", ".", "_config", ".", "has_option", "(", "section", ",", "option", ")", ":", "if", "default", "i...
Get a parameter value and return a string. If default is specified and section or option are not defined in the file, they are created and set to default, which is then the return value.
[ "Get", "a", "parameter", "value", "and", "return", "a", "string", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/storage.py#L107-L120
train
jim-easterbrook/pywws
src/pywws/storage.py
ParamStore.set
def set(self, section, option, value): """Set option in section to string value.""" with self._lock: self._set(section, option, value)
python
def set(self, section, option, value): """Set option in section to string value.""" with self._lock: self._set(section, option, value)
[ "def", "set", "(", "self", ",", "section", ",", "option", ",", "value", ")", ":", "with", "self", ".", "_lock", ":", "self", ".", "_set", "(", "section", ",", "option", ",", "value", ")" ]
Set option in section to string value.
[ "Set", "option", "in", "section", "to", "string", "value", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/storage.py#L128-L131
train
jim-easterbrook/pywws
src/pywws/storage.py
ParamStore.unset
def unset(self, section, option): """Remove option from section.""" with self._lock: if not self._config.has_section(section): return if self._config.has_option(section, option): self._config.remove_option(section, option) self._dir...
python
def unset(self, section, option): """Remove option from section.""" with self._lock: if not self._config.has_section(section): return if self._config.has_option(section, option): self._config.remove_option(section, option) self._dir...
[ "def", "unset", "(", "self", ",", "section", ",", "option", ")", ":", "with", "self", ".", "_lock", ":", "if", "not", "self", ".", "_config", ".", "has_section", "(", "section", ")", ":", "return", "if", "self", ".", "_config", ".", "has_option", "("...
Remove option from section.
[ "Remove", "option", "from", "section", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/storage.py#L142-L152
train
jim-easterbrook/pywws
src/pywws/service/__init__.py
ServiceBase.check_params
def check_params(self, *keys): """Ensure user has set required values in weather.ini. Normally the :py:data:`~ServiceBase.config` names with ``required`` set are checked, but if your uploader has a ``register`` method you may need to check for other data. :param str keys: the :...
python
def check_params(self, *keys): """Ensure user has set required values in weather.ini. Normally the :py:data:`~ServiceBase.config` names with ``required`` set are checked, but if your uploader has a ``register`` method you may need to check for other data. :param str keys: the :...
[ "def", "check_params", "(", "self", ",", "*", "keys", ")", ":", "for", "key", "in", "keys", ":", "if", "not", "self", ".", "params", "[", "key", "]", ":", "raise", "RuntimeError", "(", "'\"{}\" not set in weather.ini'", ".", "format", "(", "key", ")", ...
Ensure user has set required values in weather.ini. Normally the :py:data:`~ServiceBase.config` names with ``required`` set are checked, but if your uploader has a ``register`` method you may need to check for other data. :param str keys: the :py:data:`~ServiceBase.config` names to ...
[ "Ensure", "user", "has", "set", "required", "values", "in", "weather", ".", "ini", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/service/__init__.py#L134-L147
train
jim-easterbrook/pywws
src/pywws/datastoretransfer.py
monitor
def monitor(i): """Given an iterator, yields data from it but prints progress every 10,000 records""" count = 0 for x in i: count+=1 if count % 10000 == 0: logger.info("%d records so far, current record is %s", count, x["idx"]) yield x
python
def monitor(i): """Given an iterator, yields data from it but prints progress every 10,000 records""" count = 0 for x in i: count+=1 if count % 10000 == 0: logger.info("%d records so far, current record is %s", count, x["idx"]) yield x
[ "def", "monitor", "(", "i", ")", ":", "count", "=", "0", "for", "x", "in", "i", ":", "count", "+=", "1", "if", "count", "%", "10000", "==", "0", ":", "logger", ".", "info", "(", "\"%d records so far, current record is %s\"", ",", "count", ",", "x", "...
Given an iterator, yields data from it but prints progress every 10,000 records
[ "Given", "an", "iterator", "yields", "data", "from", "it", "but", "prints", "progress", "every", "10", "000", "records" ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/datastoretransfer.py#L37-L46
train
jim-easterbrook/pywws
src/pywws/process.py
calibrate_data
def calibrate_data(params, raw_data, calib_data): """'Calibrate' raw data, using a user-supplied function.""" start = calib_data.before(datetime.max) if start is None: start = datetime.min start = raw_data.after(start + SECOND) if start is None: return start del calib_data[start:...
python
def calibrate_data(params, raw_data, calib_data): """'Calibrate' raw data, using a user-supplied function.""" start = calib_data.before(datetime.max) if start is None: start = datetime.min start = raw_data.after(start + SECOND) if start is None: return start del calib_data[start:...
[ "def", "calibrate_data", "(", "params", ",", "raw_data", ",", "calib_data", ")", ":", "start", "=", "calib_data", ".", "before", "(", "datetime", ".", "max", ")", "if", "start", "is", "None", ":", "start", "=", "datetime", ".", "min", "start", "=", "ra...
Calibrate' raw data, using a user-supplied function.
[ "Calibrate", "raw", "data", "using", "a", "user", "-", "supplied", "function", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/process.py#L521-L548
train
jim-easterbrook/pywws
src/pywws/process.py
generate_hourly
def generate_hourly(calib_data, hourly_data, process_from): """Generate hourly summaries from calibrated data.""" start = hourly_data.before(datetime.max) if start is None: start = datetime.min start = calib_data.after(start + SECOND) if process_from: if start: start = mi...
python
def generate_hourly(calib_data, hourly_data, process_from): """Generate hourly summaries from calibrated data.""" start = hourly_data.before(datetime.max) if start is None: start = datetime.min start = calib_data.after(start + SECOND) if process_from: if start: start = mi...
[ "def", "generate_hourly", "(", "calib_data", ",", "hourly_data", ",", "process_from", ")", ":", "start", "=", "hourly_data", ".", "before", "(", "datetime", ".", "max", ")", "if", "start", "is", "None", ":", "start", "=", "datetime", ".", "min", "start", ...
Generate hourly summaries from calibrated data.
[ "Generate", "hourly", "summaries", "from", "calibrated", "data", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/process.py#L551-L622
train
jim-easterbrook/pywws
src/pywws/process.py
generate_daily
def generate_daily(day_end_hour, use_dst, calib_data, hourly_data, daily_data, process_from): """Generate daily summaries from calibrated and hourly data.""" start = daily_data.before(datetime.max) if start is None: start = datetime.min start = calib_data.after(start + SECOND)...
python
def generate_daily(day_end_hour, use_dst, calib_data, hourly_data, daily_data, process_from): """Generate daily summaries from calibrated and hourly data.""" start = daily_data.before(datetime.max) if start is None: start = datetime.min start = calib_data.after(start + SECOND)...
[ "def", "generate_daily", "(", "day_end_hour", ",", "use_dst", ",", "calib_data", ",", "hourly_data", ",", "daily_data", ",", "process_from", ")", ":", "start", "=", "daily_data", ".", "before", "(", "datetime", ".", "max", ")", "if", "start", "is", "None", ...
Generate daily summaries from calibrated and hourly data.
[ "Generate", "daily", "summaries", "from", "calibrated", "and", "hourly", "data", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/process.py#L625-L671
train
jim-easterbrook/pywws
src/pywws/process.py
generate_monthly
def generate_monthly(rain_day_threshold, day_end_hour, use_dst, daily_data, monthly_data, process_from): """Generate monthly summaries from daily data.""" start = monthly_data.before(datetime.max) if start is None: start = datetime.min start = daily_data.after(start + SECOND...
python
def generate_monthly(rain_day_threshold, day_end_hour, use_dst, daily_data, monthly_data, process_from): """Generate monthly summaries from daily data.""" start = monthly_data.before(datetime.max) if start is None: start = datetime.min start = daily_data.after(start + SECOND...
[ "def", "generate_monthly", "(", "rain_day_threshold", ",", "day_end_hour", ",", "use_dst", ",", "daily_data", ",", "monthly_data", ",", "process_from", ")", ":", "start", "=", "monthly_data", ".", "before", "(", "datetime", ".", "max", ")", "if", "start", "is"...
Generate monthly summaries from daily data.
[ "Generate", "monthly", "summaries", "from", "daily", "data", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/process.py#L674-L728
train
jim-easterbrook/pywws
src/pywws/process.py
process_data
def process_data(context): """Generate summaries from raw weather station data. The meteorological day end (typically 2100 or 0900 local time) is set in the preferences file ``weather.ini``. The default value is 2100 (2200 during DST), following the historical convention for weather station reading...
python
def process_data(context): """Generate summaries from raw weather station data. The meteorological day end (typically 2100 or 0900 local time) is set in the preferences file ``weather.ini``. The default value is 2100 (2200 during DST), following the historical convention for weather station reading...
[ "def", "process_data", "(", "context", ")", ":", "logger", ".", "info", "(", "'Generating summary data'", ")", "last_raw", "=", "context", ".", "raw_data", ".", "before", "(", "datetime", ".", "max", ")", "if", "last_raw", "is", "None", ":", "raise", "IOEr...
Generate summaries from raw weather station data. The meteorological day end (typically 2100 or 0900 local time) is set in the preferences file ``weather.ini``. The default value is 2100 (2200 during DST), following the historical convention for weather station readings.
[ "Generate", "summaries", "from", "raw", "weather", "station", "data", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/process.py#L739-L768
train
jim-easterbrook/pywws
src/pywws/filedata.py
CoreStore.before
def before(self, idx): """Return datetime of newest existing data record whose datetime is < idx. Might not even be in the same year! If no such record exists, return None.""" if not isinstance(idx, datetime): raise TypeError("'%s' is not %s" % (idx, datetime)) ...
python
def before(self, idx): """Return datetime of newest existing data record whose datetime is < idx. Might not even be in the same year! If no such record exists, return None.""" if not isinstance(idx, datetime): raise TypeError("'%s' is not %s" % (idx, datetime)) ...
[ "def", "before", "(", "self", ",", "idx", ")", ":", "if", "not", "isinstance", "(", "idx", ",", "datetime", ")", ":", "raise", "TypeError", "(", "\"'%s' is not %s\"", "%", "(", "idx", ",", "datetime", ")", ")", "day", "=", "min", "(", "idx", ".", "...
Return datetime of newest existing data record whose datetime is < idx. Might not even be in the same year! If no such record exists, return None.
[ "Return", "datetime", "of", "newest", "existing", "data", "record", "whose", "datetime", "is", "<", "idx", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/filedata.py#L282-L298
train
jim-easterbrook/pywws
src/pywws/filedata.py
CoreStore.after
def after(self, idx): """Return datetime of oldest existing data record whose datetime is >= idx. Might not even be in the same year! If no such record exists, return None.""" if not isinstance(idx, datetime): raise TypeError("'%s' is not %s" % (idx, datetime)) ...
python
def after(self, idx): """Return datetime of oldest existing data record whose datetime is >= idx. Might not even be in the same year! If no such record exists, return None.""" if not isinstance(idx, datetime): raise TypeError("'%s' is not %s" % (idx, datetime)) ...
[ "def", "after", "(", "self", ",", "idx", ")", ":", "if", "not", "isinstance", "(", "idx", ",", "datetime", ")", ":", "raise", "TypeError", "(", "\"'%s' is not %s\"", "%", "(", "idx", ",", "datetime", ")", ")", "day", "=", "max", "(", "idx", ".", "d...
Return datetime of oldest existing data record whose datetime is >= idx. Might not even be in the same year! If no such record exists, return None.
[ "Return", "datetime", "of", "oldest", "existing", "data", "record", "whose", "datetime", "is", ">", "=", "idx", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/filedata.py#L300-L316
train
jim-easterbrook/pywws
src/pywws/filedata.py
CoreStore.nearest
def nearest(self, idx): """Return datetime of record whose datetime is nearest idx.""" hi = self.after(idx) lo = self.before(idx) if hi is None: return lo if lo is None: return hi if abs(hi - idx) < abs(lo - idx): return hi retu...
python
def nearest(self, idx): """Return datetime of record whose datetime is nearest idx.""" hi = self.after(idx) lo = self.before(idx) if hi is None: return lo if lo is None: return hi if abs(hi - idx) < abs(lo - idx): return hi retu...
[ "def", "nearest", "(", "self", ",", "idx", ")", ":", "hi", "=", "self", ".", "after", "(", "idx", ")", "lo", "=", "self", ".", "before", "(", "idx", ")", "if", "hi", "is", "None", ":", "return", "lo", "if", "lo", "is", "None", ":", "return", ...
Return datetime of record whose datetime is nearest idx.
[ "Return", "datetime", "of", "record", "whose", "datetime", "is", "nearest", "idx", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/filedata.py#L318-L328
train
jim-easterbrook/pywws
src/pywws/filedata.py
CoreStore.clear
def clear(self): """Clears all data from the data store permanently""" for root, dirs, files in os.walk(self._root_dir, topdown=False): for file in files: os.unlink(os.path.join(root, file)) os.rmdir(root) # Get the root dir back and re-initialise to start...
python
def clear(self): """Clears all data from the data store permanently""" for root, dirs, files in os.walk(self._root_dir, topdown=False): for file in files: os.unlink(os.path.join(root, file)) os.rmdir(root) # Get the root dir back and re-initialise to start...
[ "def", "clear", "(", "self", ")", ":", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "self", ".", "_root_dir", ",", "topdown", "=", "False", ")", ":", "for", "file", "in", "files", ":", "os", ".", "unlink", "(", "os", ...
Clears all data from the data store permanently
[ "Clears", "all", "data", "from", "the", "data", "store", "permanently" ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/filedata.py#L427-L436
train
jim-easterbrook/pywws
src/pywws/conversions.py
pressure_trend_text
def pressure_trend_text(trend): """Convert pressure trend to a string, as used by the UK met office. """ _ = pywws.localisation.translation.ugettext if trend > 6.0: return _(u'rising very rapidly') elif trend > 3.5: return _(u'rising quickly') elif trend > 1.5: retur...
python
def pressure_trend_text(trend): """Convert pressure trend to a string, as used by the UK met office. """ _ = pywws.localisation.translation.ugettext if trend > 6.0: return _(u'rising very rapidly') elif trend > 3.5: return _(u'rising quickly') elif trend > 1.5: retur...
[ "def", "pressure_trend_text", "(", "trend", ")", ":", "_", "=", "pywws", ".", "localisation", ".", "translation", ".", "ugettext", "if", "trend", ">", "6.0", ":", "return", "_", "(", "u'rising very rapidly'", ")", "elif", "trend", ">", "3.5", ":", "return"...
Convert pressure trend to a string, as used by the UK met office.
[ "Convert", "pressure", "trend", "to", "a", "string", "as", "used", "by", "the", "UK", "met", "office", "." ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L50-L72
train
jim-easterbrook/pywws
src/pywws/conversions.py
winddir_text
def winddir_text(pts): "Convert wind direction from 0..15 to compass point text" global _winddir_text_array if pts is None: return None if not isinstance(pts, int): pts = int(pts + 0.5) % 16 if not _winddir_text_array: _ = pywws.localisation.translation.ugettext _wind...
python
def winddir_text(pts): "Convert wind direction from 0..15 to compass point text" global _winddir_text_array if pts is None: return None if not isinstance(pts, int): pts = int(pts + 0.5) % 16 if not _winddir_text_array: _ = pywws.localisation.translation.ugettext _wind...
[ "def", "winddir_text", "(", "pts", ")", ":", "\"Convert wind direction from 0..15 to compass point text\"", "global", "_winddir_text_array", "if", "pts", "is", "None", ":", "return", "None", "if", "not", "isinstance", "(", "pts", ",", "int", ")", ":", "pts", "=", ...
Convert wind direction from 0..15 to compass point text
[ "Convert", "wind", "direction", "from", "0", "..", "15", "to", "compass", "point", "text" ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L149-L164
train
jim-easterbrook/pywws
src/pywws/conversions.py
wind_bft
def wind_bft(ms): "Convert wind from metres per second to Beaufort scale" if ms is None: return None for bft in range(len(_bft_threshold)): if ms < _bft_threshold[bft]: return bft return len(_bft_threshold)
python
def wind_bft(ms): "Convert wind from metres per second to Beaufort scale" if ms is None: return None for bft in range(len(_bft_threshold)): if ms < _bft_threshold[bft]: return bft return len(_bft_threshold)
[ "def", "wind_bft", "(", "ms", ")", ":", "\"Convert wind from metres per second to Beaufort scale\"", "if", "ms", "is", "None", ":", "return", "None", "for", "bft", "in", "range", "(", "len", "(", "_bft_threshold", ")", ")", ":", "if", "ms", "<", "_bft_threshol...
Convert wind from metres per second to Beaufort scale
[ "Convert", "wind", "from", "metres", "per", "second", "to", "Beaufort", "scale" ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L181-L188
train
jim-easterbrook/pywws
src/pywws/conversions.py
cadhumidex
def cadhumidex(temp, humidity): "Calculate Humidity Index as per Canadian Weather Standards" if temp is None or humidity is None: return None # Formulas are adapted to not use e^(...) with no appreciable # change in accuracy (0.0227%) saturation_pressure = (6.112 * (10.0**(7.5 * temp / (237....
python
def cadhumidex(temp, humidity): "Calculate Humidity Index as per Canadian Weather Standards" if temp is None or humidity is None: return None # Formulas are adapted to not use e^(...) with no appreciable # change in accuracy (0.0227%) saturation_pressure = (6.112 * (10.0**(7.5 * temp / (237....
[ "def", "cadhumidex", "(", "temp", ",", "humidity", ")", ":", "\"Calculate Humidity Index as per Canadian Weather Standards\"", "if", "temp", "is", "None", "or", "humidity", "is", "None", ":", "return", "None", "saturation_pressure", "=", "(", "6.112", "*", "(", "1...
Calculate Humidity Index as per Canadian Weather Standards
[ "Calculate", "Humidity", "Index", "as", "per", "Canadian", "Weather", "Standards" ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L202-L210
train
jim-easterbrook/pywws
src/pywws/conversions.py
usaheatindex
def usaheatindex(temp, humidity, dew=None): """Calculate Heat Index as per USA National Weather Service Standards See http://en.wikipedia.org/wiki/Heat_index, formula 1. The formula is not valid for T < 26.7C, Dew Point < 12C, or RH < 40% """ if temp is None or humidity is None: return Non...
python
def usaheatindex(temp, humidity, dew=None): """Calculate Heat Index as per USA National Weather Service Standards See http://en.wikipedia.org/wiki/Heat_index, formula 1. The formula is not valid for T < 26.7C, Dew Point < 12C, or RH < 40% """ if temp is None or humidity is None: return Non...
[ "def", "usaheatindex", "(", "temp", ",", "humidity", ",", "dew", "=", "None", ")", ":", "if", "temp", "is", "None", "or", "humidity", "is", "None", ":", "return", "None", "if", "dew", "is", "None", ":", "dew", "=", "dew_point", "(", "temp", ",", "h...
Calculate Heat Index as per USA National Weather Service Standards See http://en.wikipedia.org/wiki/Heat_index, formula 1. The formula is not valid for T < 26.7C, Dew Point < 12C, or RH < 40%
[ "Calculate", "Heat", "Index", "as", "per", "USA", "National", "Weather", "Service", "Standards" ]
4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c
https://github.com/jim-easterbrook/pywws/blob/4e4d74cee5a3ac5bf42286feaa251cd2ffcaf02c/src/pywws/conversions.py#L212-L238
train
ppaquette/gym-pull
gym_pull/package/manager.py
PackageManager.load_user_envs
def load_user_envs(self): """ Loads downloaded user envs from filesystem cache on `import gym` """ installed_packages = self._list_packages() # Tagging core envs gym_package = 'gym ({})'.format(installed_packages['gym']) if 'gym' in installed_packages else 'gym' core_specs = reg...
python
def load_user_envs(self): """ Loads downloaded user envs from filesystem cache on `import gym` """ installed_packages = self._list_packages() # Tagging core envs gym_package = 'gym ({})'.format(installed_packages['gym']) if 'gym' in installed_packages else 'gym' core_specs = reg...
[ "def", "load_user_envs", "(", "self", ")", ":", "installed_packages", "=", "self", ".", "_list_packages", "(", ")", "gym_package", "=", "'gym ({})'", ".", "format", "(", "installed_packages", "[", "'gym'", "]", ")", "if", "'gym'", "in", "installed_packages", "...
Loads downloaded user envs from filesystem cache on `import gym`
[ "Loads", "downloaded", "user", "envs", "from", "filesystem", "cache", "on", "import", "gym" ]
5b2797fd081ba5be26544983d1eba764e6d9f73b
https://github.com/ppaquette/gym-pull/blob/5b2797fd081ba5be26544983d1eba764e6d9f73b/gym_pull/package/manager.py#L31-L53
train
ppaquette/gym-pull
gym_pull/envs/registration.py
EnvSpec.make
def make(self): """Instantiates an instance of the environment with appropriate kwargs""" if self._entry_point is None: raise error.Error('Attempting to make deprecated env {}. (HINT: is there a newer registered version of this env?)'.format(self.id)) cls = load(self._entry_point) ...
python
def make(self): """Instantiates an instance of the environment with appropriate kwargs""" if self._entry_point is None: raise error.Error('Attempting to make deprecated env {}. (HINT: is there a newer registered version of this env?)'.format(self.id)) cls = load(self._entry_point) ...
[ "def", "make", "(", "self", ")", ":", "if", "self", ".", "_entry_point", "is", "None", ":", "raise", "error", ".", "Error", "(", "'Attempting to make deprecated env {}. (HINT: is there a newer registered version of this env?)'", ".", "format", "(", "self", ".", "id", ...
Instantiates an instance of the environment with appropriate kwargs
[ "Instantiates", "an", "instance", "of", "the", "environment", "with", "appropriate", "kwargs" ]
5b2797fd081ba5be26544983d1eba764e6d9f73b
https://github.com/ppaquette/gym-pull/blob/5b2797fd081ba5be26544983d1eba764e6d9f73b/gym_pull/envs/registration.py#L63-L75
train
jingw/pyhdfs
pyhdfs.py
HdfsClient._record_last_active
def _record_last_active(self, host): """Put host first in our host list, so we try it first next time The implementation of get_active_namenode relies on this reordering. """ if host in self.hosts: # this check is for when user passes a host at request time # Keep this thre...
python
def _record_last_active(self, host): """Put host first in our host list, so we try it first next time The implementation of get_active_namenode relies on this reordering. """ if host in self.hosts: # this check is for when user passes a host at request time # Keep this thre...
[ "def", "_record_last_active", "(", "self", ",", "host", ")", ":", "if", "host", "in", "self", ".", "hosts", ":", "self", ".", "hosts", "=", "[", "host", "]", "+", "[", "h", "for", "h", "in", "self", ".", "hosts", "if", "h", "!=", "host", "]", "...
Put host first in our host list, so we try it first next time The implementation of get_active_namenode relies on this reordering.
[ "Put", "host", "first", "in", "our", "host", "list", "so", "we", "try", "it", "first", "next", "time" ]
b382b34f7cb28b41559f5be73102beb1732cd933
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L342-L350
train
jingw/pyhdfs
pyhdfs.py
HdfsClient._request
def _request(self, method, path, op, expected_status=httplib.OK, **kwargs): """Make a WebHDFS request against the NameNodes This function handles NameNode failover and error checking. All kwargs are passed as query params to the WebHDFS server. """ hosts, path = self._parse_path...
python
def _request(self, method, path, op, expected_status=httplib.OK, **kwargs): """Make a WebHDFS request against the NameNodes This function handles NameNode failover and error checking. All kwargs are passed as query params to the WebHDFS server. """ hosts, path = self._parse_path...
[ "def", "_request", "(", "self", ",", "method", ",", "path", ",", "op", ",", "expected_status", "=", "httplib", ".", "OK", ",", "**", "kwargs", ")", ":", "hosts", ",", "path", "=", "self", ".", "_parse_path", "(", "path", ")", "_transform_user_name_key", ...
Make a WebHDFS request against the NameNodes This function handles NameNode failover and error checking. All kwargs are passed as query params to the WebHDFS server.
[ "Make", "a", "WebHDFS", "request", "against", "the", "NameNodes" ]
b382b34f7cb28b41559f5be73102beb1732cd933
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L352-L391
train
jingw/pyhdfs
pyhdfs.py
HdfsClient.create
def create(self, path, data, **kwargs): """Create a file at the given path. :param data: ``bytes`` or a ``file``-like object to upload :param overwrite: If a file already exists, should it be overwritten? :type overwrite: bool :param blocksize: The block size of a file. ...
python
def create(self, path, data, **kwargs): """Create a file at the given path. :param data: ``bytes`` or a ``file``-like object to upload :param overwrite: If a file already exists, should it be overwritten? :type overwrite: bool :param blocksize: The block size of a file. ...
[ "def", "create", "(", "self", ",", "path", ",", "data", ",", "**", "kwargs", ")", ":", "metadata_response", "=", "self", ".", "_put", "(", "path", ",", "'CREATE'", ",", "expected_status", "=", "httplib", ".", "TEMPORARY_REDIRECT", ",", "**", "kwargs", ")...
Create a file at the given path. :param data: ``bytes`` or a ``file``-like object to upload :param overwrite: If a file already exists, should it be overwritten? :type overwrite: bool :param blocksize: The block size of a file. :type blocksize: long :param replication: T...
[ "Create", "a", "file", "at", "the", "given", "path", "." ]
b382b34f7cb28b41559f5be73102beb1732cd933
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L409-L431
train
jingw/pyhdfs
pyhdfs.py
HdfsClient.append
def append(self, path, data, **kwargs): """Append to the given file. :param data: ``bytes`` or a ``file``-like object :param buffersize: The size of the buffer used in transferring data. :type buffersize: int """ metadata_response = self._post( path, 'APPEND'...
python
def append(self, path, data, **kwargs): """Append to the given file. :param data: ``bytes`` or a ``file``-like object :param buffersize: The size of the buffer used in transferring data. :type buffersize: int """ metadata_response = self._post( path, 'APPEND'...
[ "def", "append", "(", "self", ",", "path", ",", "data", ",", "**", "kwargs", ")", ":", "metadata_response", "=", "self", ".", "_post", "(", "path", ",", "'APPEND'", ",", "expected_status", "=", "httplib", ".", "TEMPORARY_REDIRECT", ",", "**", "kwargs", "...
Append to the given file. :param data: ``bytes`` or a ``file``-like object :param buffersize: The size of the buffer used in transferring data. :type buffersize: int
[ "Append", "to", "the", "given", "file", "." ]
b382b34f7cb28b41559f5be73102beb1732cd933
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L433-L445
train
jingw/pyhdfs
pyhdfs.py
HdfsClient.concat
def concat(self, target, sources, **kwargs): """Concat existing files together. For preconditions, see https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/filesystem/filesystem.html#void_concatPath_p_Path_sources :param target: the path to the target destination. ...
python
def concat(self, target, sources, **kwargs): """Concat existing files together. For preconditions, see https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/filesystem/filesystem.html#void_concatPath_p_Path_sources :param target: the path to the target destination. ...
[ "def", "concat", "(", "self", ",", "target", ",", "sources", ",", "**", "kwargs", ")", ":", "if", "isinstance", "(", "sources", ",", "basestring", ")", ":", "raise", "ValueError", "(", "\"sources should be a list\"", ")", "if", "any", "(", "','", "in", "...
Concat existing files together. For preconditions, see https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/filesystem/filesystem.html#void_concatPath_p_Path_sources :param target: the path to the target destination. :param sources: the paths to the sources to use f...
[ "Concat", "existing", "files", "together", "." ]
b382b34f7cb28b41559f5be73102beb1732cd933
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L447-L462
train
jingw/pyhdfs
pyhdfs.py
HdfsClient.open
def open(self, path, **kwargs): """Return a file-like object for reading the given HDFS path. :param offset: The starting byte position. :type offset: long :param length: The number of bytes to be processed. :type length: long :param buffersize: The size of the buffer us...
python
def open(self, path, **kwargs): """Return a file-like object for reading the given HDFS path. :param offset: The starting byte position. :type offset: long :param length: The number of bytes to be processed. :type length: long :param buffersize: The size of the buffer us...
[ "def", "open", "(", "self", ",", "path", ",", "**", "kwargs", ")", ":", "metadata_response", "=", "self", ".", "_get", "(", "path", ",", "'OPEN'", ",", "expected_status", "=", "httplib", ".", "TEMPORARY_REDIRECT", ",", "**", "kwargs", ")", "data_response",...
Return a file-like object for reading the given HDFS path. :param offset: The starting byte position. :type offset: long :param length: The number of bytes to be processed. :type length: long :param buffersize: The size of the buffer used in transferring data. :type buff...
[ "Return", "a", "file", "-", "like", "object", "for", "reading", "the", "given", "HDFS", "path", "." ]
b382b34f7cb28b41559f5be73102beb1732cd933
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L464-L480
train
jingw/pyhdfs
pyhdfs.py
HdfsClient.create_symlink
def create_symlink(self, link, destination, **kwargs): """Create a symbolic link at ``link`` pointing to ``destination``. :param link: the path to be created that points to target :param destination: the target of the symbolic link :param createParent: If the parent directories do not e...
python
def create_symlink(self, link, destination, **kwargs): """Create a symbolic link at ``link`` pointing to ``destination``. :param link: the path to be created that points to target :param destination: the target of the symbolic link :param createParent: If the parent directories do not e...
[ "def", "create_symlink", "(", "self", ",", "link", ",", "destination", ",", "**", "kwargs", ")", ":", "response", "=", "self", ".", "_put", "(", "link", ",", "'CREATESYMLINK'", ",", "destination", "=", "destination", ",", "**", "kwargs", ")", "assert", "...
Create a symbolic link at ``link`` pointing to ``destination``. :param link: the path to be created that points to target :param destination: the target of the symbolic link :param createParent: If the parent directories do not exist, should they be created? :type createParent: bool ...
[ "Create", "a", "symbolic", "link", "at", "link", "pointing", "to", "destination", "." ]
b382b34f7cb28b41559f5be73102beb1732cd933
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L496-L507
train
jingw/pyhdfs
pyhdfs.py
HdfsClient.rename
def rename(self, path, destination, **kwargs): """Renames Path src to Path dst. :returns: true if rename is successful :rtype: bool """ return _json(self._put(path, 'RENAME', destination=destination, **kwargs))['boolean']
python
def rename(self, path, destination, **kwargs): """Renames Path src to Path dst. :returns: true if rename is successful :rtype: bool """ return _json(self._put(path, 'RENAME', destination=destination, **kwargs))['boolean']
[ "def", "rename", "(", "self", ",", "path", ",", "destination", ",", "**", "kwargs", ")", ":", "return", "_json", "(", "self", ".", "_put", "(", "path", ",", "'RENAME'", ",", "destination", "=", "destination", ",", "**", "kwargs", ")", ")", "[", "'boo...
Renames Path src to Path dst. :returns: true if rename is successful :rtype: bool
[ "Renames", "Path", "src", "to", "Path", "dst", "." ]
b382b34f7cb28b41559f5be73102beb1732cd933
https://github.com/jingw/pyhdfs/blob/b382b34f7cb28b41559f5be73102beb1732cd933/pyhdfs.py#L509-L515
train