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/catalog_src_manager.py
make_catalog_comp_dict
def make_catalog_comp_dict(**kwargs): """Build and return the information about the catalog components """ library_yamlfile = kwargs.pop('library', 'models/library.yaml') csm = kwargs.pop('CatalogSourceManager', CatalogSourceManager(**kwargs)) if library_yamlfile is None or library_yamlfile == 'None...
python
def make_catalog_comp_dict(**kwargs): """Build and return the information about the catalog components """ library_yamlfile = kwargs.pop('library', 'models/library.yaml') csm = kwargs.pop('CatalogSourceManager', CatalogSourceManager(**kwargs)) if library_yamlfile is None or library_yamlfile == 'None...
[ "def", "make_catalog_comp_dict", "(", "**", "kwargs", ")", ":", "library_yamlfile", "=", "kwargs", ".", "pop", "(", "'library'", ",", "'models/library.yaml'", ")", "csm", "=", "kwargs", ".", "pop", "(", "'CatalogSourceManager'", ",", "CatalogSourceManager", "(", ...
Build and return the information about the catalog components
[ "Build", "and", "return", "the", "information", "about", "the", "catalog", "components" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/catalog_src_manager.py#L256-L268
train
fermiPy/fermipy
fermipy/diffuse/catalog_src_manager.py
CatalogSourceManager.read_catalog_info_yaml
def read_catalog_info_yaml(self, splitkey): """ Read the yaml file for a particular split key """ catalog_info_yaml = self._name_factory.catalog_split_yaml(sourcekey=splitkey, fullpath=True) yaml_dict = yaml.safe_load(open...
python
def read_catalog_info_yaml(self, splitkey): """ Read the yaml file for a particular split key """ catalog_info_yaml = self._name_factory.catalog_split_yaml(sourcekey=splitkey, fullpath=True) yaml_dict = yaml.safe_load(open...
[ "def", "read_catalog_info_yaml", "(", "self", ",", "splitkey", ")", ":", "catalog_info_yaml", "=", "self", ".", "_name_factory", ".", "catalog_split_yaml", "(", "sourcekey", "=", "splitkey", ",", "fullpath", "=", "True", ")", "yaml_dict", "=", "yaml", ".", "sa...
Read the yaml file for a particular split key
[ "Read", "the", "yaml", "file", "for", "a", "particular", "split", "key" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/catalog_src_manager.py#L101-L110
train
fermiPy/fermipy
fermipy/diffuse/catalog_src_manager.py
CatalogSourceManager.build_catalog_info
def build_catalog_info(self, catalog_info): """ Build a CatalogInfo object """ cat = SourceFactory.build_catalog(**catalog_info) catalog_info['catalog'] = cat # catalog_info['catalog_table'] = # Table.read(catalog_info['catalog_file']) catalog_info['catalog_table'] = c...
python
def build_catalog_info(self, catalog_info): """ Build a CatalogInfo object """ cat = SourceFactory.build_catalog(**catalog_info) catalog_info['catalog'] = cat # catalog_info['catalog_table'] = # Table.read(catalog_info['catalog_file']) catalog_info['catalog_table'] = c...
[ "def", "build_catalog_info", "(", "self", ",", "catalog_info", ")", ":", "cat", "=", "SourceFactory", ".", "build_catalog", "(", "**", "catalog_info", ")", "catalog_info", "[", "'catalog'", "]", "=", "cat", "catalog_info", "[", "'catalog_table'", "]", "=", "ca...
Build a CatalogInfo object
[ "Build", "a", "CatalogInfo", "object" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/catalog_src_manager.py#L112-L123
train
fermiPy/fermipy
fermipy/diffuse/catalog_src_manager.py
CatalogSourceManager.catalog_components
def catalog_components(self, catalog_name, split_ver): """ Return the set of merged components for a particular split key """ return sorted(self._split_comp_info_dicts["%s_%s" % (catalog_name, split_ver)].keys())
python
def catalog_components(self, catalog_name, split_ver): """ Return the set of merged components for a particular split key """ return sorted(self._split_comp_info_dicts["%s_%s" % (catalog_name, split_ver)].keys())
[ "def", "catalog_components", "(", "self", ",", "catalog_name", ",", "split_ver", ")", ":", "return", "sorted", "(", "self", ".", "_split_comp_info_dicts", "[", "\"%s_%s\"", "%", "(", "catalog_name", ",", "split_ver", ")", "]", ".", "keys", "(", ")", ")" ]
Return the set of merged components for a particular split key
[ "Return", "the", "set", "of", "merged", "components", "for", "a", "particular", "split", "key" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/catalog_src_manager.py#L141-L143
train
fermiPy/fermipy
fermipy/diffuse/catalog_src_manager.py
CatalogSourceManager.split_comp_info
def split_comp_info(self, catalog_name, split_ver, split_key): """ Return the info for a particular split key """ return self._split_comp_info_dicts["%s_%s" % (catalog_name, split_ver)][split_key]
python
def split_comp_info(self, catalog_name, split_ver, split_key): """ Return the info for a particular split key """ return self._split_comp_info_dicts["%s_%s" % (catalog_name, split_ver)][split_key]
[ "def", "split_comp_info", "(", "self", ",", "catalog_name", ",", "split_ver", ",", "split_key", ")", ":", "return", "self", ".", "_split_comp_info_dicts", "[", "\"%s_%s\"", "%", "(", "catalog_name", ",", "split_ver", ")", "]", "[", "split_key", "]" ]
Return the info for a particular split key
[ "Return", "the", "info", "for", "a", "particular", "split", "key" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/catalog_src_manager.py#L145-L147
train
fermiPy/fermipy
fermipy/diffuse/catalog_src_manager.py
CatalogSourceManager.make_catalog_comp_info_dict
def make_catalog_comp_info_dict(self, catalog_sources): """ Make the information about the catalog components Parameters ---------- catalog_sources : dict Dictionary with catalog source defintions Returns ------- catalog_ret_dict : dict ...
python
def make_catalog_comp_info_dict(self, catalog_sources): """ Make the information about the catalog components Parameters ---------- catalog_sources : dict Dictionary with catalog source defintions Returns ------- catalog_ret_dict : dict ...
[ "def", "make_catalog_comp_info_dict", "(", "self", ",", "catalog_sources", ")", ":", "catalog_ret_dict", "=", "{", "}", "split_ret_dict", "=", "{", "}", "for", "key", ",", "value", "in", "catalog_sources", ".", "items", "(", ")", ":", "if", "value", "is", ...
Make the information about the catalog components Parameters ---------- catalog_sources : dict Dictionary with catalog source defintions Returns ------- catalog_ret_dict : dict Dictionary mapping catalog_name to `model_component.CatalogInfo` ...
[ "Make", "the", "information", "about", "the", "catalog", "components" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/catalog_src_manager.py#L185-L253
train
fermiPy/fermipy
fermipy/tsmap.py
extract_images_from_tscube
def extract_images_from_tscube(infile, outfile): """ Extract data from table HDUs in TSCube file and convert them to FITS images """ inhdulist = fits.open(infile) wcs = pywcs.WCS(inhdulist[0].header) map_shape = inhdulist[0].data.shape t_eng = Table.read(infile, "EBOUNDS") t_scan = Table.re...
python
def extract_images_from_tscube(infile, outfile): """ Extract data from table HDUs in TSCube file and convert them to FITS images """ inhdulist = fits.open(infile) wcs = pywcs.WCS(inhdulist[0].header) map_shape = inhdulist[0].data.shape t_eng = Table.read(infile, "EBOUNDS") t_scan = Table.re...
[ "def", "extract_images_from_tscube", "(", "infile", ",", "outfile", ")", ":", "inhdulist", "=", "fits", ".", "open", "(", "infile", ")", "wcs", "=", "pywcs", ".", "WCS", "(", "inhdulist", "[", "0", "]", ".", "header", ")", "map_shape", "=", "inhdulist", ...
Extract data from table HDUs in TSCube file and convert them to FITS images
[ "Extract", "data", "from", "table", "HDUs", "in", "TSCube", "file", "and", "convert", "them", "to", "FITS", "images" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/tsmap.py#L35-L74
train
fermiPy/fermipy
fermipy/tsmap.py
truncate_array
def truncate_array(array1, array2, position): """Truncate array1 by finding the overlap with array2 when the array1 center is located at the given position in array2.""" slices = [] for i in range(array1.ndim): xmin = 0 xmax = array1.shape[i] dxlo = array1.shape[i] // 2 ...
python
def truncate_array(array1, array2, position): """Truncate array1 by finding the overlap with array2 when the array1 center is located at the given position in array2.""" slices = [] for i in range(array1.ndim): xmin = 0 xmax = array1.shape[i] dxlo = array1.shape[i] // 2 ...
[ "def", "truncate_array", "(", "array1", ",", "array2", ",", "position", ")", ":", "slices", "=", "[", "]", "for", "i", "in", "range", "(", "array1", ".", "ndim", ")", ":", "xmin", "=", "0", "xmax", "=", "array1", ".", "shape", "[", "i", "]", "dxl...
Truncate array1 by finding the overlap with array2 when the array1 center is located at the given position in array2.
[ "Truncate", "array1", "by", "finding", "the", "overlap", "with", "array2", "when", "the", "array1", "center", "is", "located", "at", "the", "given", "position", "in", "array2", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/tsmap.py#L265-L283
train
fermiPy/fermipy
fermipy/tsmap.py
_sum_wrapper
def _sum_wrapper(fn): """ Wrapper to perform row-wise aggregation of list arguments and pass them to a function. The return value of the function is summed over the argument groups. Non-list arguments will be automatically cast to a list. """ def wrapper(*args, **kwargs): v = 0 ...
python
def _sum_wrapper(fn): """ Wrapper to perform row-wise aggregation of list arguments and pass them to a function. The return value of the function is summed over the argument groups. Non-list arguments will be automatically cast to a list. """ def wrapper(*args, **kwargs): v = 0 ...
[ "def", "_sum_wrapper", "(", "fn", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "v", "=", "0", "new_args", "=", "_cast_args_to_list", "(", "args", ")", "for", "arg", "in", "zip", "(", "*", "new_args", ")", ":", "v", ...
Wrapper to perform row-wise aggregation of list arguments and pass them to a function. The return value of the function is summed over the argument groups. Non-list arguments will be automatically cast to a list.
[ "Wrapper", "to", "perform", "row", "-", "wise", "aggregation", "of", "list", "arguments", "and", "pass", "them", "to", "a", "function", ".", "The", "return", "value", "of", "the", "function", "is", "summed", "over", "the", "argument", "groups", ".", "Non",...
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/tsmap.py#L325-L340
train
fermiPy/fermipy
fermipy/tsmap.py
_amplitude_bounds
def _amplitude_bounds(counts, bkg, model): """ Compute bounds for the root of `_f_cash_root_cython`. Parameters ---------- counts : `~numpy.ndarray` Count map. bkg : `~numpy.ndarray` Background map. model : `~numpy.ndarray` Source template (multiplied with exposure)....
python
def _amplitude_bounds(counts, bkg, model): """ Compute bounds for the root of `_f_cash_root_cython`. Parameters ---------- counts : `~numpy.ndarray` Count map. bkg : `~numpy.ndarray` Background map. model : `~numpy.ndarray` Source template (multiplied with exposure)....
[ "def", "_amplitude_bounds", "(", "counts", ",", "bkg", ",", "model", ")", ":", "if", "isinstance", "(", "counts", ",", "list", ")", ":", "counts", "=", "np", ".", "concatenate", "(", "[", "t", ".", "flat", "for", "t", "in", "counts", "]", ")", "bkg...
Compute bounds for the root of `_f_cash_root_cython`. Parameters ---------- counts : `~numpy.ndarray` Count map. bkg : `~numpy.ndarray` Background map. model : `~numpy.ndarray` Source template (multiplied with exposure).
[ "Compute", "bounds", "for", "the", "root", "of", "_f_cash_root_cython", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/tsmap.py#L358-L387
train
fermiPy/fermipy
fermipy/tsmap.py
_root_amplitude_brentq
def _root_amplitude_brentq(counts, bkg, model, root_fn=_f_cash_root): """Fit amplitude by finding roots using Brent algorithm. See Appendix A Stewart (2009). Parameters ---------- counts : `~numpy.ndarray` Slice of count map. bkg : `~numpy.ndarray` Slice of background map. ...
python
def _root_amplitude_brentq(counts, bkg, model, root_fn=_f_cash_root): """Fit amplitude by finding roots using Brent algorithm. See Appendix A Stewart (2009). Parameters ---------- counts : `~numpy.ndarray` Slice of count map. bkg : `~numpy.ndarray` Slice of background map. ...
[ "def", "_root_amplitude_brentq", "(", "counts", ",", "bkg", ",", "model", ",", "root_fn", "=", "_f_cash_root", ")", ":", "amplitude_min", ",", "amplitude_max", "=", "_amplitude_bounds", "(", "counts", ",", "bkg", ",", "model", ")", "if", "not", "np", ".", ...
Fit amplitude by finding roots using Brent algorithm. See Appendix A Stewart (2009). Parameters ---------- counts : `~numpy.ndarray` Slice of count map. bkg : `~numpy.ndarray` Slice of background map. model : `~numpy.ndarray` Model template to fit. Returns ----...
[ "Fit", "amplitude", "by", "finding", "roots", "using", "Brent", "algorithm", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/tsmap.py#L445-L486
train
fermiPy/fermipy
fermipy/tsmap.py
poisson_log_like
def poisson_log_like(counts, model): """Compute the Poisson log-likelihood function for the given counts and model arrays.""" loglike = np.array(model) m = counts > 0 loglike[m] -= counts[m] * np.log(model[m]) return loglike
python
def poisson_log_like(counts, model): """Compute the Poisson log-likelihood function for the given counts and model arrays.""" loglike = np.array(model) m = counts > 0 loglike[m] -= counts[m] * np.log(model[m]) return loglike
[ "def", "poisson_log_like", "(", "counts", ",", "model", ")", ":", "loglike", "=", "np", ".", "array", "(", "model", ")", "m", "=", "counts", ">", "0", "loglike", "[", "m", "]", "-=", "counts", "[", "m", "]", "*", "np", ".", "log", "(", "model", ...
Compute the Poisson log-likelihood function for the given counts and model arrays.
[ "Compute", "the", "Poisson", "log", "-", "likelihood", "function", "for", "the", "given", "counts", "and", "model", "arrays", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/tsmap.py#L489-L495
train
fermiPy/fermipy
fermipy/tsmap.py
f_cash
def f_cash(x, counts, bkg, model): """ Wrapper for cash statistics, that defines the model function. Parameters ---------- x : float Model amplitude. counts : `~numpy.ndarray` Count map slice, where model is defined. bkg : `~numpy.ndarray` Background map slice, where...
python
def f_cash(x, counts, bkg, model): """ Wrapper for cash statistics, that defines the model function. Parameters ---------- x : float Model amplitude. counts : `~numpy.ndarray` Count map slice, where model is defined. bkg : `~numpy.ndarray` Background map slice, where...
[ "def", "f_cash", "(", "x", ",", "counts", ",", "bkg", ",", "model", ")", ":", "return", "2.0", "*", "poisson_log_like", "(", "counts", ",", "bkg", "+", "x", "*", "model", ")" ]
Wrapper for cash statistics, that defines the model function. Parameters ---------- x : float Model amplitude. counts : `~numpy.ndarray` Count map slice, where model is defined. bkg : `~numpy.ndarray` Background map slice, where model is defined. model : `~numpy.ndarray`...
[ "Wrapper", "for", "cash", "statistics", "that", "defines", "the", "model", "function", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/tsmap.py#L507-L523
train
fermiPy/fermipy
fermipy/tsmap.py
_ts_value_newton
def _ts_value_newton(position, counts, bkg, model, C_0_map): """ Compute TS value at a given pixel position using the newton method. Parameters ---------- position : tuple Pixel position. counts : `~numpy.ndarray` Count map. bkg : `~numpy.ndarray` Background ma...
python
def _ts_value_newton(position, counts, bkg, model, C_0_map): """ Compute TS value at a given pixel position using the newton method. Parameters ---------- position : tuple Pixel position. counts : `~numpy.ndarray` Count map. bkg : `~numpy.ndarray` Background ma...
[ "def", "_ts_value_newton", "(", "position", ",", "counts", ",", "bkg", ",", "model", ",", "C_0_map", ")", ":", "extract_fn", "=", "_collect_wrapper", "(", "extract_large_array", ")", "truncate_fn", "=", "_collect_wrapper", "(", "extract_small_array", ")", "counts_...
Compute TS value at a given pixel position using the newton method. Parameters ---------- position : tuple Pixel position. counts : `~numpy.ndarray` Count map. bkg : `~numpy.ndarray` Background map. model : `~numpy.ndarray` Source model map. Returns ...
[ "Compute", "TS", "value", "at", "a", "given", "pixel", "position", "using", "the", "newton", "method", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/tsmap.py#L578-L643
train
fermiPy/fermipy
fermipy/tsmap.py
TSMapGenerator.tsmap
def tsmap(self, prefix='', **kwargs): """Generate a spatial TS map for a source component with properties defined by the `model` argument. The TS map will have the same geometry as the ROI. The output of this method is a dictionary containing `~fermipy.skymap.Map` objects with ...
python
def tsmap(self, prefix='', **kwargs): """Generate a spatial TS map for a source component with properties defined by the `model` argument. The TS map will have the same geometry as the ROI. The output of this method is a dictionary containing `~fermipy.skymap.Map` objects with ...
[ "def", "tsmap", "(", "self", ",", "prefix", "=", "''", ",", "**", "kwargs", ")", ":", "timer", "=", "Timer", ".", "create", "(", "start", "=", "True", ")", "schema", "=", "ConfigSchema", "(", "self", ".", "defaults", "[", "'tsmap'", "]", ")", "sche...
Generate a spatial TS map for a source component with properties defined by the `model` argument. The TS map will have the same geometry as the ROI. The output of this method is a dictionary containing `~fermipy.skymap.Map` objects with the TS and amplitude of the best-fit test source....
[ "Generate", "a", "spatial", "TS", "map", "for", "a", "source", "component", "with", "properties", "defined", "by", "the", "model", "argument", ".", "The", "TS", "map", "will", "have", "the", "same", "geometry", "as", "the", "ROI", ".", "The", "output", "...
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/tsmap.py#L650-L725
train
fermiPy/fermipy
fermipy/tsmap.py
TSCubeGenerator.tscube
def tscube(self, prefix='', **kwargs): """Generate a spatial TS map for a source component with properties defined by the `model` argument. This method uses the `gttscube` ST application for source fitting and will simultaneously fit the test source normalization as well as the...
python
def tscube(self, prefix='', **kwargs): """Generate a spatial TS map for a source component with properties defined by the `model` argument. This method uses the `gttscube` ST application for source fitting and will simultaneously fit the test source normalization as well as the...
[ "def", "tscube", "(", "self", ",", "prefix", "=", "''", ",", "**", "kwargs", ")", ":", "self", ".", "logger", ".", "info", "(", "'Generating TS cube'", ")", "schema", "=", "ConfigSchema", "(", "self", ".", "defaults", "[", "'tscube'", "]", ")", "schema...
Generate a spatial TS map for a source component with properties defined by the `model` argument. This method uses the `gttscube` ST application for source fitting and will simultaneously fit the test source normalization as well as the normalizations of any background components that a...
[ "Generate", "a", "spatial", "TS", "map", "for", "a", "source", "component", "with", "properties", "defined", "by", "the", "model", "argument", ".", "This", "method", "uses", "the", "gttscube", "ST", "application", "for", "source", "fitting", "and", "will", "...
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/tsmap.py#L945-L1024
train
fermiPy/fermipy
fermipy/irfs.py
compute_ps_counts
def compute_ps_counts(ebins, exp, psf, bkg, fn, egy_dim=0, spatial_model='PointSource', spatial_size=1E-3): """Calculate the observed signal and background counts given models for the exposure, background intensity, PSF, and source flux. Parameters ---------- ebins : `~numpy.n...
python
def compute_ps_counts(ebins, exp, psf, bkg, fn, egy_dim=0, spatial_model='PointSource', spatial_size=1E-3): """Calculate the observed signal and background counts given models for the exposure, background intensity, PSF, and source flux. Parameters ---------- ebins : `~numpy.n...
[ "def", "compute_ps_counts", "(", "ebins", ",", "exp", ",", "psf", ",", "bkg", ",", "fn", ",", "egy_dim", "=", "0", ",", "spatial_model", "=", "'PointSource'", ",", "spatial_size", "=", "1E-3", ")", ":", "ewidth", "=", "utils", ".", "edge_to_width", "(", ...
Calculate the observed signal and background counts given models for the exposure, background intensity, PSF, and source flux. Parameters ---------- ebins : `~numpy.ndarray` Array of energy bin edges. exp : `~numpy.ndarray` Model for exposure. psf : `~fermipy.irfs.PSFModel` ...
[ "Calculate", "the", "observed", "signal", "and", "background", "counts", "given", "models", "for", "the", "exposure", "background", "intensity", "PSF", "and", "source", "flux", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L100-L157
train
fermiPy/fermipy
fermipy/irfs.py
create_psf
def create_psf(event_class, event_type, dtheta, egy, cth): """Create an array of PSF response values versus energy and inclination angle. Parameters ---------- egy : `~numpy.ndarray` Energy in MeV. cth : `~numpy.ndarray` Cosine of the incidence angle. """ irf = create_...
python
def create_psf(event_class, event_type, dtheta, egy, cth): """Create an array of PSF response values versus energy and inclination angle. Parameters ---------- egy : `~numpy.ndarray` Energy in MeV. cth : `~numpy.ndarray` Cosine of the incidence angle. """ irf = create_...
[ "def", "create_psf", "(", "event_class", ",", "event_type", ",", "dtheta", ",", "egy", ",", "cth", ")", ":", "irf", "=", "create_irf", "(", "event_class", ",", "event_type", ")", "theta", "=", "np", ".", "degrees", "(", "np", ".", "arccos", "(", "cth",...
Create an array of PSF response values versus energy and inclination angle. Parameters ---------- egy : `~numpy.ndarray` Energy in MeV. cth : `~numpy.ndarray` Cosine of the incidence angle.
[ "Create", "an", "array", "of", "PSF", "response", "values", "versus", "energy", "and", "inclination", "angle", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L583-L604
train
fermiPy/fermipy
fermipy/irfs.py
create_edisp
def create_edisp(event_class, event_type, erec, egy, cth): """Create an array of energy response values versus energy and inclination angle. Parameters ---------- egy : `~numpy.ndarray` Energy in MeV. cth : `~numpy.ndarray` Cosine of the incidence angle. """ irf = crea...
python
def create_edisp(event_class, event_type, erec, egy, cth): """Create an array of energy response values versus energy and inclination angle. Parameters ---------- egy : `~numpy.ndarray` Energy in MeV. cth : `~numpy.ndarray` Cosine of the incidence angle. """ irf = crea...
[ "def", "create_edisp", "(", "event_class", ",", "event_type", ",", "erec", ",", "egy", ",", "cth", ")", ":", "irf", "=", "create_irf", "(", "event_class", ",", "event_type", ")", "theta", "=", "np", ".", "degrees", "(", "np", ".", "arccos", "(", "cth",...
Create an array of energy response values versus energy and inclination angle. Parameters ---------- egy : `~numpy.ndarray` Energy in MeV. cth : `~numpy.ndarray` Cosine of the incidence angle.
[ "Create", "an", "array", "of", "energy", "response", "values", "versus", "energy", "and", "inclination", "angle", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L607-L639
train
fermiPy/fermipy
fermipy/irfs.py
create_aeff
def create_aeff(event_class, event_type, egy, cth): """Create an array of effective areas versus energy and incidence angle. Binning in energy and incidence angle is controlled with the egy and cth input parameters. Parameters ---------- event_class : str Event class string (e.g. P8R2_...
python
def create_aeff(event_class, event_type, egy, cth): """Create an array of effective areas versus energy and incidence angle. Binning in energy and incidence angle is controlled with the egy and cth input parameters. Parameters ---------- event_class : str Event class string (e.g. P8R2_...
[ "def", "create_aeff", "(", "event_class", ",", "event_type", ",", "egy", ",", "cth", ")", ":", "irf", "=", "create_irf", "(", "event_class", ",", "event_type", ")", "irf", ".", "aeff", "(", ")", ".", "setPhiDependence", "(", "False", ")", "theta", "=", ...
Create an array of effective areas versus energy and incidence angle. Binning in energy and incidence angle is controlled with the egy and cth input parameters. Parameters ---------- event_class : str Event class string (e.g. P8R2_SOURCE_V6). event_type : list egy : array_like ...
[ "Create", "an", "array", "of", "effective", "areas", "versus", "energy", "and", "incidence", "angle", ".", "Binning", "in", "energy", "and", "incidence", "angle", "is", "controlled", "with", "the", "egy", "and", "cth", "input", "parameters", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L642-L673
train
fermiPy/fermipy
fermipy/irfs.py
calc_exp
def calc_exp(skydir, ltc, event_class, event_types, egy, cth_bins, npts=None): """Calculate the exposure on a 2D grid of energy and incidence angle. Parameters ---------- npts : int Number of points by which to sample the response in each incidence angle bin. If None t...
python
def calc_exp(skydir, ltc, event_class, event_types, egy, cth_bins, npts=None): """Calculate the exposure on a 2D grid of energy and incidence angle. Parameters ---------- npts : int Number of points by which to sample the response in each incidence angle bin. If None t...
[ "def", "calc_exp", "(", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "egy", ",", "cth_bins", ",", "npts", "=", "None", ")", ":", "if", "npts", "is", "None", ":", "npts", "=", "int", "(", "np", ".", "ceil", "(", "np", ".", "m...
Calculate the exposure on a 2D grid of energy and incidence angle. Parameters ---------- npts : int Number of points by which to sample the response in each incidence angle bin. If None then npts will be automatically set such that incidence angle is sampled on intervals of < ...
[ "Calculate", "the", "exposure", "on", "a", "2D", "grid", "of", "energy", "and", "incidence", "angle", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L676-L707
train
fermiPy/fermipy
fermipy/irfs.py
create_avg_rsp
def create_avg_rsp(rsp_fn, skydir, ltc, event_class, event_types, x, egy, cth_bins, npts=None): """Calculate the weighted response function. """ if npts is None: npts = int(np.ceil(np.max(cth_bins[1:] - cth_bins[:-1]) / 0.05)) wrsp = np.zeros((len(x), len(egy), len(cth_bins) ...
python
def create_avg_rsp(rsp_fn, skydir, ltc, event_class, event_types, x, egy, cth_bins, npts=None): """Calculate the weighted response function. """ if npts is None: npts = int(np.ceil(np.max(cth_bins[1:] - cth_bins[:-1]) / 0.05)) wrsp = np.zeros((len(x), len(egy), len(cth_bins) ...
[ "def", "create_avg_rsp", "(", "rsp_fn", ",", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "x", ",", "egy", ",", "cth_bins", ",", "npts", "=", "None", ")", ":", "if", "npts", "is", "None", ":", "npts", "=", "int", "(", "np", "....
Calculate the weighted response function.
[ "Calculate", "the", "weighted", "response", "function", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L710-L737
train
fermiPy/fermipy
fermipy/irfs.py
create_avg_psf
def create_avg_psf(skydir, ltc, event_class, event_types, dtheta, egy, cth_bins, npts=None): """Generate model for exposure-weighted PSF averaged over incidence angle. Parameters ---------- egy : `~numpy.ndarray` Energies in MeV. cth_bins : `~numpy.ndarray` B...
python
def create_avg_psf(skydir, ltc, event_class, event_types, dtheta, egy, cth_bins, npts=None): """Generate model for exposure-weighted PSF averaged over incidence angle. Parameters ---------- egy : `~numpy.ndarray` Energies in MeV. cth_bins : `~numpy.ndarray` B...
[ "def", "create_avg_psf", "(", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "dtheta", ",", "egy", ",", "cth_bins", ",", "npts", "=", "None", ")", ":", "return", "create_avg_rsp", "(", "create_psf", ",", "skydir", ",", "ltc", ",", "ev...
Generate model for exposure-weighted PSF averaged over incidence angle. Parameters ---------- egy : `~numpy.ndarray` Energies in MeV. cth_bins : `~numpy.ndarray` Bin edges in cosine of the incidence angle.
[ "Generate", "model", "for", "exposure", "-", "weighted", "PSF", "averaged", "over", "incidence", "angle", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L740-L756
train
fermiPy/fermipy
fermipy/irfs.py
create_avg_edisp
def create_avg_edisp(skydir, ltc, event_class, event_types, erec, egy, cth_bins, npts=None): """Generate model for exposure-weighted DRM averaged over incidence angle. Parameters ---------- egy : `~numpy.ndarray` True energies in MeV. cth_bins : `~numpy.ndarray` ...
python
def create_avg_edisp(skydir, ltc, event_class, event_types, erec, egy, cth_bins, npts=None): """Generate model for exposure-weighted DRM averaged over incidence angle. Parameters ---------- egy : `~numpy.ndarray` True energies in MeV. cth_bins : `~numpy.ndarray` ...
[ "def", "create_avg_edisp", "(", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "erec", ",", "egy", ",", "cth_bins", ",", "npts", "=", "None", ")", ":", "return", "create_avg_rsp", "(", "create_edisp", ",", "skydir", ",", "ltc", ",", "...
Generate model for exposure-weighted DRM averaged over incidence angle. Parameters ---------- egy : `~numpy.ndarray` True energies in MeV. cth_bins : `~numpy.ndarray` Bin edges in cosine of the incidence angle.
[ "Generate", "model", "for", "exposure", "-", "weighted", "DRM", "averaged", "over", "incidence", "angle", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L759-L774
train
fermiPy/fermipy
fermipy/irfs.py
create_wtd_psf
def create_wtd_psf(skydir, ltc, event_class, event_types, dtheta, egy_bins, cth_bins, fn, nbin=64, npts=1): """Create an exposure- and dispersion-weighted PSF model for a source with spectral parameterization ``fn``. The calculation performed by this method accounts for the influence of ...
python
def create_wtd_psf(skydir, ltc, event_class, event_types, dtheta, egy_bins, cth_bins, fn, nbin=64, npts=1): """Create an exposure- and dispersion-weighted PSF model for a source with spectral parameterization ``fn``. The calculation performed by this method accounts for the influence of ...
[ "def", "create_wtd_psf", "(", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "dtheta", ",", "egy_bins", ",", "cth_bins", ",", "fn", ",", "nbin", "=", "64", ",", "npts", "=", "1", ")", ":", "egy_bins", "=", "np", ".", "exp", "(", ...
Create an exposure- and dispersion-weighted PSF model for a source with spectral parameterization ``fn``. The calculation performed by this method accounts for the influence of energy dispersion on the PSF. Parameters ---------- dtheta : `~numpy.ndarray` egy_bins : `~numpy.ndarray` ...
[ "Create", "an", "exposure", "-", "and", "dispersion", "-", "weighted", "PSF", "model", "for", "a", "source", "with", "spectral", "parameterization", "fn", ".", "The", "calculation", "performed", "by", "this", "method", "accounts", "for", "the", "influence", "o...
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L777-L826
train
fermiPy/fermipy
fermipy/irfs.py
calc_drm
def calc_drm(skydir, ltc, event_class, event_types, egy_bins, cth_bins, nbin=64): """Calculate the detector response matrix.""" npts = int(np.ceil(128. / bins_per_dec(egy_bins))) egy_bins = np.exp(utils.split_bin_edges(np.log(egy_bins), npts)) etrue_bins = 10**np.linspace(1.0, 6.5, nbin * ...
python
def calc_drm(skydir, ltc, event_class, event_types, egy_bins, cth_bins, nbin=64): """Calculate the detector response matrix.""" npts = int(np.ceil(128. / bins_per_dec(egy_bins))) egy_bins = np.exp(utils.split_bin_edges(np.log(egy_bins), npts)) etrue_bins = 10**np.linspace(1.0, 6.5, nbin * ...
[ "def", "calc_drm", "(", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "egy_bins", ",", "cth_bins", ",", "nbin", "=", "64", ")", ":", "npts", "=", "int", "(", "np", ".", "ceil", "(", "128.", "/", "bins_per_dec", "(", "egy_bins", "...
Calculate the detector response matrix.
[ "Calculate", "the", "detector", "response", "matrix", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L829-L843
train
fermiPy/fermipy
fermipy/irfs.py
calc_counts
def calc_counts(skydir, ltc, event_class, event_types, egy_bins, cth_bins, fn, npts=1): """Calculate the expected counts vs. true energy and incidence angle for a source with spectral parameterization ``fn``. Parameters ---------- skydir : `~astropy.coordinate.SkyCoord` ltc : `...
python
def calc_counts(skydir, ltc, event_class, event_types, egy_bins, cth_bins, fn, npts=1): """Calculate the expected counts vs. true energy and incidence angle for a source with spectral parameterization ``fn``. Parameters ---------- skydir : `~astropy.coordinate.SkyCoord` ltc : `...
[ "def", "calc_counts", "(", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "egy_bins", ",", "cth_bins", ",", "fn", ",", "npts", "=", "1", ")", ":", "egy_bins", "=", "np", ".", "exp", "(", "utils", ".", "split_bin_edges", "(", "np", ...
Calculate the expected counts vs. true energy and incidence angle for a source with spectral parameterization ``fn``. Parameters ---------- skydir : `~astropy.coordinate.SkyCoord` ltc : `~fermipy.irfs.LTCube` egy_bins : `~numpy.ndarray` Bin edges in observed energy in MeV. cth_bi...
[ "Calculate", "the", "expected", "counts", "vs", ".", "true", "energy", "and", "incidence", "angle", "for", "a", "source", "with", "spectral", "parameterization", "fn", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L846-L873
train
fermiPy/fermipy
fermipy/irfs.py
calc_counts_edisp
def calc_counts_edisp(skydir, ltc, event_class, event_types, egy_bins, cth_bins, fn, nbin=16, npts=1): """Calculate the expected counts vs. observed energy and true incidence angle for a source with spectral parameterization ``fn``. Parameters ---------- skydir : `~astropy.coo...
python
def calc_counts_edisp(skydir, ltc, event_class, event_types, egy_bins, cth_bins, fn, nbin=16, npts=1): """Calculate the expected counts vs. observed energy and true incidence angle for a source with spectral parameterization ``fn``. Parameters ---------- skydir : `~astropy.coo...
[ "def", "calc_counts_edisp", "(", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "egy_bins", ",", "cth_bins", ",", "fn", ",", "nbin", "=", "16", ",", "npts", "=", "1", ")", ":", "egy_bins", "=", "np", ".", "exp", "(", "utils", ".",...
Calculate the expected counts vs. observed energy and true incidence angle for a source with spectral parameterization ``fn``. Parameters ---------- skydir : `~astropy.coordinate.SkyCoord` ltc : `~fermipy.irfs.LTCube` egy_bins : `~numpy.ndarray` Bin edges in observed energy in MeV. ...
[ "Calculate", "the", "expected", "counts", "vs", ".", "observed", "energy", "and", "true", "incidence", "angle", "for", "a", "source", "with", "spectral", "parameterization", "fn", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L876-L912
train
fermiPy/fermipy
fermipy/irfs.py
calc_wtd_exp
def calc_wtd_exp(skydir, ltc, event_class, event_types, egy_bins, cth_bins, fn, nbin=16): """Calculate the effective exposure. Parameters ---------- skydir : `~astropy.coordinates.SkyCoord` ltc : `~fermipy.irfs.LTCube` nbin : int Number of points per decade with w...
python
def calc_wtd_exp(skydir, ltc, event_class, event_types, egy_bins, cth_bins, fn, nbin=16): """Calculate the effective exposure. Parameters ---------- skydir : `~astropy.coordinates.SkyCoord` ltc : `~fermipy.irfs.LTCube` nbin : int Number of points per decade with w...
[ "def", "calc_wtd_exp", "(", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "egy_bins", ",", "cth_bins", ",", "fn", ",", "nbin", "=", "16", ")", ":", "cnts", "=", "calc_counts_edisp", "(", "skydir", ",", "ltc", ",", "event_class", ",",...
Calculate the effective exposure. Parameters ---------- skydir : `~astropy.coordinates.SkyCoord` ltc : `~fermipy.irfs.LTCube` nbin : int Number of points per decade with which to sample true energy.
[ "Calculate", "the", "effective", "exposure", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L915-L932
train
fermiPy/fermipy
fermipy/irfs.py
PSFModel.eval
def eval(self, ebin, dtheta, scale_fn=None): """Evaluate the PSF at the given energy bin index. Parameters ---------- ebin : int Index of energy bin. dtheta : array_like Array of angular separations in degrees. scale_fn : callable ...
python
def eval(self, ebin, dtheta, scale_fn=None): """Evaluate the PSF at the given energy bin index. Parameters ---------- ebin : int Index of energy bin. dtheta : array_like Array of angular separations in degrees. scale_fn : callable ...
[ "def", "eval", "(", "self", ",", "ebin", ",", "dtheta", ",", "scale_fn", "=", "None", ")", ":", "if", "scale_fn", "is", "None", "and", "self", ".", "scale_fn", "is", "not", "None", ":", "scale_fn", "=", "self", ".", "scale_fn", "if", "scale_fn", "is"...
Evaluate the PSF at the given energy bin index. Parameters ---------- ebin : int Index of energy bin. dtheta : array_like Array of angular separations in degrees. scale_fn : callable Function that evaluates the PSF scaling function. ...
[ "Evaluate", "the", "PSF", "at", "the", "given", "energy", "bin", "index", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L359-L385
train
fermiPy/fermipy
fermipy/irfs.py
PSFModel.interp
def interp(self, energies, dtheta, scale_fn=None): """Evaluate the PSF model at an array of energies and angular separations. Parameters ---------- energies : array_like Array of energies in MeV. dtheta : array_like Array of angular separations i...
python
def interp(self, energies, dtheta, scale_fn=None): """Evaluate the PSF model at an array of energies and angular separations. Parameters ---------- energies : array_like Array of energies in MeV. dtheta : array_like Array of angular separations i...
[ "def", "interp", "(", "self", ",", "energies", ",", "dtheta", ",", "scale_fn", "=", "None", ")", ":", "if", "scale_fn", "is", "None", "and", "self", ".", "scale_fn", ":", "scale_fn", "=", "self", ".", "scale_fn", "log_energies", "=", "np", ".", "log10"...
Evaluate the PSF model at an array of energies and angular separations. Parameters ---------- energies : array_like Array of energies in MeV. dtheta : array_like Array of angular separations in degrees. scale_fn : callable Fu...
[ "Evaluate", "the", "PSF", "model", "at", "an", "array", "of", "energies", "and", "angular", "separations", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L387-L417
train
fermiPy/fermipy
fermipy/irfs.py
PSFModel.interp_bin
def interp_bin(self, egy_bins, dtheta, scale_fn=None): """Evaluate the bin-averaged PSF model over the energy bins ``egy_bins``. Parameters ---------- egy_bins : array_like Energy bin edges in MeV. dtheta : array_like Array of angular separations in degr...
python
def interp_bin(self, egy_bins, dtheta, scale_fn=None): """Evaluate the bin-averaged PSF model over the energy bins ``egy_bins``. Parameters ---------- egy_bins : array_like Energy bin edges in MeV. dtheta : array_like Array of angular separations in degr...
[ "def", "interp_bin", "(", "self", ",", "egy_bins", ",", "dtheta", ",", "scale_fn", "=", "None", ")", ":", "npts", "=", "4", "egy_bins", "=", "np", ".", "exp", "(", "utils", ".", "split_bin_edges", "(", "np", ".", "log", "(", "egy_bins", ")", ",", "...
Evaluate the bin-averaged PSF model over the energy bins ``egy_bins``. Parameters ---------- egy_bins : array_like Energy bin edges in MeV. dtheta : array_like Array of angular separations in degrees. scale_fn : callable Function tha...
[ "Evaluate", "the", "bin", "-", "averaged", "PSF", "model", "over", "the", "energy", "bins", "egy_bins", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L419-L448
train
fermiPy/fermipy
fermipy/irfs.py
PSFModel.containment_angle
def containment_angle(self, energies=None, fraction=0.68, scale_fn=None): """Evaluate the PSF containment angle at a sequence of energies.""" if energies is None: energies = self.energies vals = self.interp(energies[np.newaxis, :], self.dtheta[:, np.newaxis], ...
python
def containment_angle(self, energies=None, fraction=0.68, scale_fn=None): """Evaluate the PSF containment angle at a sequence of energies.""" if energies is None: energies = self.energies vals = self.interp(energies[np.newaxis, :], self.dtheta[:, np.newaxis], ...
[ "def", "containment_angle", "(", "self", ",", "energies", "=", "None", ",", "fraction", "=", "0.68", ",", "scale_fn", "=", "None", ")", ":", "if", "energies", "is", "None", ":", "energies", "=", "self", ".", "energies", "vals", "=", "self", ".", "inter...
Evaluate the PSF containment angle at a sequence of energies.
[ "Evaluate", "the", "PSF", "containment", "angle", "at", "a", "sequence", "of", "energies", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L450-L459
train
fermiPy/fermipy
fermipy/irfs.py
PSFModel.containment_angle_bin
def containment_angle_bin(self, egy_bins, fraction=0.68, scale_fn=None): """Evaluate the PSF containment angle averaged over energy bins.""" vals = self.interp_bin(egy_bins, self.dtheta, scale_fn=scale_fn) dtheta = np.radians(self.dtheta[:, np.newaxis] * np.ones(vals.shape)) return self...
python
def containment_angle_bin(self, egy_bins, fraction=0.68, scale_fn=None): """Evaluate the PSF containment angle averaged over energy bins.""" vals = self.interp_bin(egy_bins, self.dtheta, scale_fn=scale_fn) dtheta = np.radians(self.dtheta[:, np.newaxis] * np.ones(vals.shape)) return self...
[ "def", "containment_angle_bin", "(", "self", ",", "egy_bins", ",", "fraction", "=", "0.68", ",", "scale_fn", "=", "None", ")", ":", "vals", "=", "self", ".", "interp_bin", "(", "egy_bins", ",", "self", ".", "dtheta", ",", "scale_fn", "=", "scale_fn", ")"...
Evaluate the PSF containment angle averaged over energy bins.
[ "Evaluate", "the", "PSF", "containment", "angle", "averaged", "over", "energy", "bins", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L461-L466
train
fermiPy/fermipy
fermipy/irfs.py
PSFModel.create
def create(cls, skydir, ltc, event_class, event_types, energies, cth_bins=None, ndtheta=500, use_edisp=False, fn=None, nbin=64): """Create a PSFModel object. This class can be used to evaluate the exposure-weighted PSF for a source with a given observing profile and energy distri...
python
def create(cls, skydir, ltc, event_class, event_types, energies, cth_bins=None, ndtheta=500, use_edisp=False, fn=None, nbin=64): """Create a PSFModel object. This class can be used to evaluate the exposure-weighted PSF for a source with a given observing profile and energy distri...
[ "def", "create", "(", "cls", ",", "skydir", ",", "ltc", ",", "event_class", ",", "event_types", ",", "energies", ",", "cth_bins", "=", "None", ",", "ndtheta", "=", "500", ",", "use_edisp", "=", "False", ",", "fn", "=", "None", ",", "nbin", "=", "64",...
Create a PSFModel object. This class can be used to evaluate the exposure-weighted PSF for a source with a given observing profile and energy distribution. Parameters ---------- skydir : `~astropy.coordinates.SkyCoord` ltc : `~fermipy.irfs.LTCube` energies : `...
[ "Create", "a", "PSFModel", "object", ".", "This", "class", "can", "be", "used", "to", "evaluate", "the", "exposure", "-", "weighted", "PSF", "for", "a", "source", "with", "a", "given", "observing", "profile", "and", "energy", "distribution", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/irfs.py#L514-L570
train
fermiPy/fermipy
fermipy/jobs/sys_interface.py
remove_file
def remove_file(filepath, dry_run=False): """Remove the file at filepath Catches exception if the file does not exist. If dry_run is True, print name of file to be removed, but do not remove it. """ if dry_run: sys.stdout.write("rm %s\n" % filepath) else: try: os.re...
python
def remove_file(filepath, dry_run=False): """Remove the file at filepath Catches exception if the file does not exist. If dry_run is True, print name of file to be removed, but do not remove it. """ if dry_run: sys.stdout.write("rm %s\n" % filepath) else: try: os.re...
[ "def", "remove_file", "(", "filepath", ",", "dry_run", "=", "False", ")", ":", "if", "dry_run", ":", "sys", ".", "stdout", ".", "write", "(", "\"rm %s\\n\"", "%", "filepath", ")", "else", ":", "try", ":", "os", ".", "remove", "(", "filepath", ")", "e...
Remove the file at filepath Catches exception if the file does not exist. If dry_run is True, print name of file to be removed, but do not remove it.
[ "Remove", "the", "file", "at", "filepath" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/sys_interface.py#L13-L26
train
fermiPy/fermipy
fermipy/jobs/sys_interface.py
clean_job
def clean_job(logfile, outfiles, dry_run=False): """Removes log file and files created by failed jobs. If dry_run is True, print name of files to be removed, but do not remove them. """ remove_file(logfile, dry_run) for outfile in outfiles.values(): remove_file(outfile, dry_run)
python
def clean_job(logfile, outfiles, dry_run=False): """Removes log file and files created by failed jobs. If dry_run is True, print name of files to be removed, but do not remove them. """ remove_file(logfile, dry_run) for outfile in outfiles.values(): remove_file(outfile, dry_run)
[ "def", "clean_job", "(", "logfile", ",", "outfiles", ",", "dry_run", "=", "False", ")", ":", "remove_file", "(", "logfile", ",", "dry_run", ")", "for", "outfile", "in", "outfiles", ".", "values", "(", ")", ":", "remove_file", "(", "outfile", ",", "dry_ru...
Removes log file and files created by failed jobs. If dry_run is True, print name of files to be removed, but do not remove them.
[ "Removes", "log", "file", "and", "files", "created", "by", "failed", "jobs", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/sys_interface.py#L29-L36
train
fermiPy/fermipy
fermipy/jobs/sys_interface.py
check_log
def check_log(logfile, exited='Exited with exit code', successful='Successfully completed'): """Check a log file to determine status of LSF job Often logfile doesn't exist because the job hasn't begun to run. It is unclear what you want to do in that case... Parameters ---------- ...
python
def check_log(logfile, exited='Exited with exit code', successful='Successfully completed'): """Check a log file to determine status of LSF job Often logfile doesn't exist because the job hasn't begun to run. It is unclear what you want to do in that case... Parameters ---------- ...
[ "def", "check_log", "(", "logfile", ",", "exited", "=", "'Exited with exit code'", ",", "successful", "=", "'Successfully completed'", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "logfile", ")", ":", "return", "JobStatus", ".", "ready", "if...
Check a log file to determine status of LSF job Often logfile doesn't exist because the job hasn't begun to run. It is unclear what you want to do in that case... Parameters ---------- logfile : str String with path to logfile exited : str Value to check for in existing logf...
[ "Check", "a", "log", "file", "to", "determine", "status", "of", "LSF", "job" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/sys_interface.py#L39-L66
train
fermiPy/fermipy
fermipy/jobs/sys_interface.py
SysInterface.check_job
def check_job(cls, job_details): """ Check the status of a specfic job """ return check_log(job_details.logfile, cls.string_exited, cls.string_successful)
python
def check_job(cls, job_details): """ Check the status of a specfic job """ return check_log(job_details.logfile, cls.string_exited, cls.string_successful)
[ "def", "check_job", "(", "cls", ",", "job_details", ")", ":", "return", "check_log", "(", "job_details", ".", "logfile", ",", "cls", ".", "string_exited", ",", "cls", ".", "string_successful", ")" ]
Check the status of a specfic job
[ "Check", "the", "status", "of", "a", "specfic", "job" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/sys_interface.py#L82-L84
train
fermiPy/fermipy
fermipy/jobs/sys_interface.py
SysInterface.dispatch_job_hook
def dispatch_job_hook(self, link, key, job_config, logfile, stream=sys.stdout): """Hook to dispatch a single job""" raise NotImplementedError("SysInterface.dispatch_job_hook")
python
def dispatch_job_hook(self, link, key, job_config, logfile, stream=sys.stdout): """Hook to dispatch a single job""" raise NotImplementedError("SysInterface.dispatch_job_hook")
[ "def", "dispatch_job_hook", "(", "self", ",", "link", ",", "key", ",", "job_config", ",", "logfile", ",", "stream", "=", "sys", ".", "stdout", ")", ":", "raise", "NotImplementedError", "(", "\"SysInterface.dispatch_job_hook\"", ")" ]
Hook to dispatch a single job
[ "Hook", "to", "dispatch", "a", "single", "job" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/sys_interface.py#L86-L88
train
fermiPy/fermipy
fermipy/jobs/sys_interface.py
SysInterface.dispatch_job
def dispatch_job(self, link, key, job_archive, stream=sys.stdout): """Function to dispatch a single job Parameters ---------- link : `Link` Link object that sendes the job key : str Key used to identify this particular job job_archive : `JobArc...
python
def dispatch_job(self, link, key, job_archive, stream=sys.stdout): """Function to dispatch a single job Parameters ---------- link : `Link` Link object that sendes the job key : str Key used to identify this particular job job_archive : `JobArc...
[ "def", "dispatch_job", "(", "self", ",", "link", ",", "key", ",", "job_archive", ",", "stream", "=", "sys", ".", "stdout", ")", ":", "try", ":", "job_details", "=", "link", ".", "jobs", "[", "key", "]", "except", "KeyError", ":", "print", "(", "key",...
Function to dispatch a single job Parameters ---------- link : `Link` Link object that sendes the job key : str Key used to identify this particular job job_archive : `JobArchive` Archive used to keep track of jobs Returns `JobDeta...
[ "Function", "to", "dispatch", "a", "single", "job" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/sys_interface.py#L90-L122
train
fermiPy/fermipy
fermipy/jobs/sys_interface.py
SysInterface.submit_jobs
def submit_jobs(self, link, job_dict=None, job_archive=None, stream=sys.stdout): """Run the `Link` with all of the items job_dict as input. If job_dict is None, the job_dict will be take from link.jobs Returns a `JobStatus` enum """ failed = False if job_dict is None: ...
python
def submit_jobs(self, link, job_dict=None, job_archive=None, stream=sys.stdout): """Run the `Link` with all of the items job_dict as input. If job_dict is None, the job_dict will be take from link.jobs Returns a `JobStatus` enum """ failed = False if job_dict is None: ...
[ "def", "submit_jobs", "(", "self", ",", "link", ",", "job_dict", "=", "None", ",", "job_archive", "=", "None", ",", "stream", "=", "sys", ".", "stdout", ")", ":", "failed", "=", "False", "if", "job_dict", "is", "None", ":", "job_dict", "=", "link", "...
Run the `Link` with all of the items job_dict as input. If job_dict is None, the job_dict will be take from link.jobs Returns a `JobStatus` enum
[ "Run", "the", "Link", "with", "all", "of", "the", "items", "job_dict", "as", "input", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/sys_interface.py#L124-L152
train
fermiPy/fermipy
fermipy/jobs/sys_interface.py
SysInterface.clean_jobs
def clean_jobs(self, link, job_dict=None, clean_all=False): """ Clean up all the jobs associated with this link. Returns a `JobStatus` enum """ failed = False if job_dict is None: job_dict = link.jobs for job_details in job_dict.values(): # clean...
python
def clean_jobs(self, link, job_dict=None, clean_all=False): """ Clean up all the jobs associated with this link. Returns a `JobStatus` enum """ failed = False if job_dict is None: job_dict = link.jobs for job_details in job_dict.values(): # clean...
[ "def", "clean_jobs", "(", "self", ",", "link", ",", "job_dict", "=", "None", ",", "clean_all", "=", "False", ")", ":", "failed", "=", "False", "if", "job_dict", "is", "None", ":", "job_dict", "=", "link", ".", "jobs", "for", "job_details", "in", "job_d...
Clean up all the jobs associated with this link. Returns a `JobStatus` enum
[ "Clean", "up", "all", "the", "jobs", "associated", "with", "this", "link", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/sys_interface.py#L154-L171
train
fermiPy/fermipy
fermipy/model_utils.py
get_spatial_type
def get_spatial_type(spatial_model): """Translate a spatial model string to a spatial type.""" if spatial_model in ['SkyDirFunction', 'PointSource', 'Gaussian']: return 'SkyDirFunction' elif spatial_model in ['SpatialMap']: return 'SpatialMap' elif spatial_model...
python
def get_spatial_type(spatial_model): """Translate a spatial model string to a spatial type.""" if spatial_model in ['SkyDirFunction', 'PointSource', 'Gaussian']: return 'SkyDirFunction' elif spatial_model in ['SpatialMap']: return 'SpatialMap' elif spatial_model...
[ "def", "get_spatial_type", "(", "spatial_model", ")", ":", "if", "spatial_model", "in", "[", "'SkyDirFunction'", ",", "'PointSource'", ",", "'Gaussian'", "]", ":", "return", "'SkyDirFunction'", "elif", "spatial_model", "in", "[", "'SpatialMap'", "]", ":", "return"...
Translate a spatial model string to a spatial type.
[ "Translate", "a", "spatial", "model", "string", "to", "a", "spatial", "type", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/model_utils.py#L77-L95
train
fermiPy/fermipy
fermipy/model_utils.py
create_pars_from_dict
def create_pars_from_dict(name, pars_dict, rescale=True, update_bounds=False): """Create a dictionary for the parameters of a function. Parameters ---------- name : str Name of the function. pars_dict : dict Existing parameter dict that will be merged with the default d...
python
def create_pars_from_dict(name, pars_dict, rescale=True, update_bounds=False): """Create a dictionary for the parameters of a function. Parameters ---------- name : str Name of the function. pars_dict : dict Existing parameter dict that will be merged with the default d...
[ "def", "create_pars_from_dict", "(", "name", ",", "pars_dict", ",", "rescale", "=", "True", ",", "update_bounds", "=", "False", ")", ":", "o", "=", "get_function_defaults", "(", "name", ")", "pars_dict", "=", "pars_dict", ".", "copy", "(", ")", "for", "k",...
Create a dictionary for the parameters of a function. Parameters ---------- name : str Name of the function. pars_dict : dict Existing parameter dict that will be merged with the default dictionary created by this method. rescale : bool Rescale parameter values...
[ "Create", "a", "dictionary", "for", "the", "parameters", "of", "a", "function", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/model_utils.py#L120-L162
train
fermiPy/fermipy
fermipy/model_utils.py
make_parameter_dict
def make_parameter_dict(pdict, fixed_par=False, rescale=True, update_bounds=False): """ Update a parameter dictionary. This function will automatically set the parameter scale and bounds if they are not defined. Bounds are also adjusted to ensure that they encompass the para...
python
def make_parameter_dict(pdict, fixed_par=False, rescale=True, update_bounds=False): """ Update a parameter dictionary. This function will automatically set the parameter scale and bounds if they are not defined. Bounds are also adjusted to ensure that they encompass the para...
[ "def", "make_parameter_dict", "(", "pdict", ",", "fixed_par", "=", "False", ",", "rescale", "=", "True", ",", "update_bounds", "=", "False", ")", ":", "o", "=", "copy", ".", "deepcopy", "(", "pdict", ")", "o", ".", "setdefault", "(", "'scale'", ",", "1...
Update a parameter dictionary. This function will automatically set the parameter scale and bounds if they are not defined. Bounds are also adjusted to ensure that they encompass the parameter value.
[ "Update", "a", "parameter", "dictionary", ".", "This", "function", "will", "automatically", "set", "the", "parameter", "scale", "and", "bounds", "if", "they", "are", "not", "defined", ".", "Bounds", "are", "also", "adjusted", "to", "ensure", "that", "they", ...
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/model_utils.py#L165-L197
train
fermiPy/fermipy
fermipy/model_utils.py
cast_pars_dict
def cast_pars_dict(pars_dict): """Cast the bool and float elements of a parameters dict to the appropriate python types. """ o = {} for pname, pdict in pars_dict.items(): o[pname] = {} for k, v in pdict.items(): if k == 'free': o[pname][k] = bool(int(...
python
def cast_pars_dict(pars_dict): """Cast the bool and float elements of a parameters dict to the appropriate python types. """ o = {} for pname, pdict in pars_dict.items(): o[pname] = {} for k, v in pdict.items(): if k == 'free': o[pname][k] = bool(int(...
[ "def", "cast_pars_dict", "(", "pars_dict", ")", ":", "o", "=", "{", "}", "for", "pname", ",", "pdict", "in", "pars_dict", ".", "items", "(", ")", ":", "o", "[", "pname", "]", "=", "{", "}", "for", "k", ",", "v", "in", "pdict", ".", "items", "("...
Cast the bool and float elements of a parameters dict to the appropriate python types.
[ "Cast", "the", "bool", "and", "float", "elements", "of", "a", "parameters", "dict", "to", "the", "appropriate", "python", "types", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/model_utils.py#L200-L220
train
fermiPy/fermipy
fermipy/scripts/gather_srcmaps.py
do_gather
def do_gather(flist): """ Gather all the HDUs from a list of files""" hlist = [] nskip = 3 for fname in flist: fin = fits.open(fname) if len(hlist) == 0: if fin[1].name == 'SKYMAP': nskip = 4 start = 0 else: start = nskip ...
python
def do_gather(flist): """ Gather all the HDUs from a list of files""" hlist = [] nskip = 3 for fname in flist: fin = fits.open(fname) if len(hlist) == 0: if fin[1].name == 'SKYMAP': nskip = 4 start = 0 else: start = nskip ...
[ "def", "do_gather", "(", "flist", ")", ":", "hlist", "=", "[", "]", "nskip", "=", "3", "for", "fname", "in", "flist", ":", "fin", "=", "fits", ".", "open", "(", "fname", ")", "if", "len", "(", "hlist", ")", "==", "0", ":", "if", "fin", "[", "...
Gather all the HDUs from a list of files
[ "Gather", "all", "the", "HDUs", "from", "a", "list", "of", "files" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/scripts/gather_srcmaps.py#L10-L25
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
main_browse
def main_browse(): """Entry point for command line use for browsing a JobArchive """ parser = argparse.ArgumentParser(usage="job_archive.py [options]", description="Browse a job archive") parser.add_argument('--jobs', action='store', dest='job_archive_table', ...
python
def main_browse(): """Entry point for command line use for browsing a JobArchive """ parser = argparse.ArgumentParser(usage="job_archive.py [options]", description="Browse a job archive") parser.add_argument('--jobs', action='store', dest='job_archive_table', ...
[ "def", "main_browse", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "usage", "=", "\"job_archive.py [options]\"", ",", "description", "=", "\"Browse a job archive\"", ")", "parser", ".", "add_argument", "(", "'--jobs'", ",", "action", "=", ...
Entry point for command line use for browsing a JobArchive
[ "Entry", "point", "for", "command", "line", "use", "for", "browsing", "a", "JobArchive" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L690-L705
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobStatusVector.n_waiting
def n_waiting(self): """Return the number of jobs in various waiting states""" return self._counters[JobStatus.no_job] +\ self._counters[JobStatus.unknown] +\ self._counters[JobStatus.not_ready] +\ self._counters[JobStatus.ready]
python
def n_waiting(self): """Return the number of jobs in various waiting states""" return self._counters[JobStatus.no_job] +\ self._counters[JobStatus.unknown] +\ self._counters[JobStatus.not_ready] +\ self._counters[JobStatus.ready]
[ "def", "n_waiting", "(", "self", ")", ":", "return", "self", ".", "_counters", "[", "JobStatus", ".", "no_job", "]", "+", "self", ".", "_counters", "[", "JobStatus", ".", "unknown", "]", "+", "self", ".", "_counters", "[", "JobStatus", ".", "not_ready", ...
Return the number of jobs in various waiting states
[ "Return", "the", "number", "of", "jobs", "in", "various", "waiting", "states" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L87-L92
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobStatusVector.n_failed
def n_failed(self): """Return the number of failed jobs""" return self._counters[JobStatus.failed] + self._counters[JobStatus.partial_failed]
python
def n_failed(self): """Return the number of failed jobs""" return self._counters[JobStatus.failed] + self._counters[JobStatus.partial_failed]
[ "def", "n_failed", "(", "self", ")", ":", "return", "self", ".", "_counters", "[", "JobStatus", ".", "failed", "]", "+", "self", ".", "_counters", "[", "JobStatus", ".", "partial_failed", "]" ]
Return the number of failed jobs
[ "Return", "the", "number", "of", "failed", "jobs" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L110-L112
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobStatusVector.get_status
def get_status(self): """Return an overall status based on the number of jobs in various states. """ if self.n_total == 0: return JobStatus.no_job elif self.n_done == self.n_total: return JobStatus.done elif self.n_failed > 0: # If more...
python
def get_status(self): """Return an overall status based on the number of jobs in various states. """ if self.n_total == 0: return JobStatus.no_job elif self.n_done == self.n_total: return JobStatus.done elif self.n_failed > 0: # If more...
[ "def", "get_status", "(", "self", ")", ":", "if", "self", ".", "n_total", "==", "0", ":", "return", "JobStatus", ".", "no_job", "elif", "self", ".", "n_done", "==", "self", ".", "n_total", ":", "return", "JobStatus", ".", "done", "elif", "self", ".", ...
Return an overall status based on the number of jobs in various states.
[ "Return", "an", "overall", "status", "based", "on", "the", "number", "of", "jobs", "in", "various", "states", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L123-L140
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobDetails.make_tables
def make_tables(job_dict): """Build and return an `astropy.table.Table' to store `JobDetails`""" col_dbkey = Column(name='dbkey', dtype=int) col_jobname = Column(name='jobname', dtype='S64') col_jobkey = Column(name='jobkey', dtype='S64') col_appname = Column(name='appname', dtyp...
python
def make_tables(job_dict): """Build and return an `astropy.table.Table' to store `JobDetails`""" col_dbkey = Column(name='dbkey', dtype=int) col_jobname = Column(name='jobname', dtype='S64') col_jobkey = Column(name='jobkey', dtype='S64') col_appname = Column(name='appname', dtyp...
[ "def", "make_tables", "(", "job_dict", ")", ":", "col_dbkey", "=", "Column", "(", "name", "=", "'dbkey'", ",", "dtype", "=", "int", ")", "col_jobname", "=", "Column", "(", "name", "=", "'jobname'", ",", "dtype", "=", "'S64'", ")", "col_jobkey", "=", "C...
Build and return an `astropy.table.Table' to store `JobDetails`
[ "Build", "and", "return", "an", "astropy", ".", "table", ".", "Table", "to", "store", "JobDetails" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L228-L255
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobDetails.get_file_ids
def get_file_ids(self, file_archive, creator=None, status=FileStatus.no_file): """Fill the file id arrays from the file lists Parameters ---------- file_archive : `FileArchive` Used to look up file ids creator : int A unique key for the job that created...
python
def get_file_ids(self, file_archive, creator=None, status=FileStatus.no_file): """Fill the file id arrays from the file lists Parameters ---------- file_archive : `FileArchive` Used to look up file ids creator : int A unique key for the job that created...
[ "def", "get_file_ids", "(", "self", ",", "file_archive", ",", "creator", "=", "None", ",", "status", "=", "FileStatus", ".", "no_file", ")", ":", "file_dict", "=", "copy", ".", "deepcopy", "(", "self", ".", "file_dict", ")", "if", "self", ".", "sub_file_...
Fill the file id arrays from the file lists Parameters ---------- file_archive : `FileArchive` Used to look up file ids creator : int A unique key for the job that created these file status : `FileStatus` Enumeration giving current status...
[ "Fill", "the", "file", "id", "arrays", "from", "the", "file", "lists" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L264-L318
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobDetails.get_file_paths
def get_file_paths(self, file_archive, file_id_array): """Get the full paths of the files used by this object from the the id arrays Parameters ---------- file_archive : `FileArchive` Used to look up file ids file_id_array : `numpy.array` Array that rema...
python
def get_file_paths(self, file_archive, file_id_array): """Get the full paths of the files used by this object from the the id arrays Parameters ---------- file_archive : `FileArchive` Used to look up file ids file_id_array : `numpy.array` Array that rema...
[ "def", "get_file_paths", "(", "self", ",", "file_archive", ",", "file_id_array", ")", ":", "full_list", "=", "[", "]", "status_dict", "=", "{", "}", "full_list", "+=", "file_archive", ".", "get_file_paths", "(", "file_id_array", "[", "self", ".", "infile_ids",...
Get the full paths of the files used by this object from the the id arrays Parameters ---------- file_archive : `FileArchive` Used to look up file ids file_id_array : `numpy.array` Array that remaps the file indexes
[ "Get", "the", "full", "paths", "of", "the", "files", "used", "by", "this", "object", "from", "the", "the", "id", "arrays" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L320-L347
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobDetails._fill_array_from_list
def _fill_array_from_list(the_list, the_array): """Fill an `array` from a `list`""" for i, val in enumerate(the_list): the_array[i] = val return the_array
python
def _fill_array_from_list(the_list, the_array): """Fill an `array` from a `list`""" for i, val in enumerate(the_list): the_array[i] = val return the_array
[ "def", "_fill_array_from_list", "(", "the_list", ",", "the_array", ")", ":", "for", "i", ",", "val", "in", "enumerate", "(", "the_list", ")", ":", "the_array", "[", "i", "]", "=", "val", "return", "the_array" ]
Fill an `array` from a `list`
[ "Fill", "an", "array", "from", "a", "list" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L350-L354
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobDetails.make_dict
def make_dict(cls, table): """Build a dictionary map int to `JobDetails` from an `astropy.table.Table`""" ret_dict = {} for row in table: job_details = cls.create_from_row(row) ret_dict[job_details.dbkey] = job_details return ret_dict
python
def make_dict(cls, table): """Build a dictionary map int to `JobDetails` from an `astropy.table.Table`""" ret_dict = {} for row in table: job_details = cls.create_from_row(row) ret_dict[job_details.dbkey] = job_details return ret_dict
[ "def", "make_dict", "(", "cls", ",", "table", ")", ":", "ret_dict", "=", "{", "}", "for", "row", "in", "table", ":", "job_details", "=", "cls", ".", "create_from_row", "(", "row", ")", "ret_dict", "[", "job_details", ".", "dbkey", "]", "=", "job_detail...
Build a dictionary map int to `JobDetails` from an `astropy.table.Table`
[ "Build", "a", "dictionary", "map", "int", "to", "JobDetails", "from", "an", "astropy", ".", "table", ".", "Table" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L362-L368
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobDetails.check_status_logfile
def check_status_logfile(self, checker_func): """Check on the status of this particular job using the logfile""" self.status = checker_func(self.logfile) return self.status
python
def check_status_logfile(self, checker_func): """Check on the status of this particular job using the logfile""" self.status = checker_func(self.logfile) return self.status
[ "def", "check_status_logfile", "(", "self", ",", "checker_func", ")", ":", "self", ".", "status", "=", "checker_func", "(", "self", ".", "logfile", ")", "return", "self", ".", "status" ]
Check on the status of this particular job using the logfile
[ "Check", "on", "the", "status", "of", "this", "particular", "job", "using", "the", "logfile" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L441-L444
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobArchive._read_table_file
def _read_table_file(self, table_file): """Read an `astropy.table.Table` from table_file to set up the `JobArchive`""" self._table_file = table_file if os.path.exists(self._table_file): self._table = Table.read(self._table_file, hdu='JOB_ARCHIVE') self._table_ids = Table....
python
def _read_table_file(self, table_file): """Read an `astropy.table.Table` from table_file to set up the `JobArchive`""" self._table_file = table_file if os.path.exists(self._table_file): self._table = Table.read(self._table_file, hdu='JOB_ARCHIVE') self._table_ids = Table....
[ "def", "_read_table_file", "(", "self", ",", "table_file", ")", ":", "self", ".", "_table_file", "=", "table_file", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "_table_file", ")", ":", "self", ".", "_table", "=", "Table", ".", "read", "("...
Read an `astropy.table.Table` from table_file to set up the `JobArchive`
[ "Read", "an", "astropy", ".", "table", ".", "Table", "from", "table_file", "to", "set", "up", "the", "JobArchive" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L525-L534
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobArchive.get_details
def get_details(self, jobname, jobkey): """Get the `JobDetails` associated to a particular job instance""" fullkey = JobDetails.make_fullkey(jobname, jobkey) return self._cache[fullkey]
python
def get_details(self, jobname, jobkey): """Get the `JobDetails` associated to a particular job instance""" fullkey = JobDetails.make_fullkey(jobname, jobkey) return self._cache[fullkey]
[ "def", "get_details", "(", "self", ",", "jobname", ",", "jobkey", ")", ":", "fullkey", "=", "JobDetails", ".", "make_fullkey", "(", "jobname", ",", "jobkey", ")", "return", "self", ".", "_cache", "[", "fullkey", "]" ]
Get the `JobDetails` associated to a particular job instance
[ "Get", "the", "JobDetails", "associated", "to", "a", "particular", "job", "instance" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L544-L547
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobArchive.register_job
def register_job(self, job_details): """Register a job in this `JobArchive` """ # check to see if the job already exists try: job_details_old = self.get_details(job_details.jobname, job_details.jobkey) if job_details_old.stat...
python
def register_job(self, job_details): """Register a job in this `JobArchive` """ # check to see if the job already exists try: job_details_old = self.get_details(job_details.jobname, job_details.jobkey) if job_details_old.stat...
[ "def", "register_job", "(", "self", ",", "job_details", ")", ":", "try", ":", "job_details_old", "=", "self", ".", "get_details", "(", "job_details", ".", "jobname", ",", "job_details", ".", "jobkey", ")", "if", "job_details_old", ".", "status", "<=", "JobSt...
Register a job in this `JobArchive`
[ "Register", "a", "job", "in", "this", "JobArchive" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L549-L567
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobArchive.register_jobs
def register_jobs(self, job_dict): """Register a bunch of jobs in this archive""" njobs = len(job_dict) sys.stdout.write("Registering %i total jobs: " % njobs) for i, job_details in enumerate(job_dict.values()): if i % 10 == 0: sys.stdout.write('.') ...
python
def register_jobs(self, job_dict): """Register a bunch of jobs in this archive""" njobs = len(job_dict) sys.stdout.write("Registering %i total jobs: " % njobs) for i, job_details in enumerate(job_dict.values()): if i % 10 == 0: sys.stdout.write('.') ...
[ "def", "register_jobs", "(", "self", ",", "job_dict", ")", ":", "njobs", "=", "len", "(", "job_dict", ")", "sys", ".", "stdout", ".", "write", "(", "\"Registering %i total jobs: \"", "%", "njobs", ")", "for", "i", ",", "job_details", "in", "enumerate", "("...
Register a bunch of jobs in this archive
[ "Register", "a", "bunch", "of", "jobs", "in", "this", "archive" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L569-L578
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobArchive.register_job_from_link
def register_job_from_link(self, link, key, **kwargs): """Register a job in the `JobArchive` from a `Link` object """ job_config = kwargs.get('job_config', None) if job_config is None: job_config = link.args status = kwargs.get('status', JobStatus.unknown) job_details...
python
def register_job_from_link(self, link, key, **kwargs): """Register a job in the `JobArchive` from a `Link` object """ job_config = kwargs.get('job_config', None) if job_config is None: job_config = link.args status = kwargs.get('status', JobStatus.unknown) job_details...
[ "def", "register_job_from_link", "(", "self", ",", "link", ",", "key", ",", "**", "kwargs", ")", ":", "job_config", "=", "kwargs", ".", "get", "(", "'job_config'", ",", "None", ")", "if", "job_config", "is", "None", ":", "job_config", "=", "link", ".", ...
Register a job in the `JobArchive` from a `Link` object
[ "Register", "a", "job", "in", "the", "JobArchive", "from", "a", "Link", "object" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L580-L596
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobArchive.update_job
def update_job(self, job_details): """Update a job in the `JobArchive` """ other = self.get_details(job_details.jobname, job_details.jobkey) other.timestamp = job_details.timestamp other.status = job_details.status other.update_table_row(self._tab...
python
def update_job(self, job_details): """Update a job in the `JobArchive` """ other = self.get_details(job_details.jobname, job_details.jobkey) other.timestamp = job_details.timestamp other.status = job_details.status other.update_table_row(self._tab...
[ "def", "update_job", "(", "self", ",", "job_details", ")", ":", "other", "=", "self", ".", "get_details", "(", "job_details", ".", "jobname", ",", "job_details", ".", "jobkey", ")", "other", ".", "timestamp", "=", "job_details", ".", "timestamp", "other", ...
Update a job in the `JobArchive`
[ "Update", "a", "job", "in", "the", "JobArchive" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L598-L605
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobArchive.remove_jobs
def remove_jobs(self, mask): """Mark all jobs that match a mask as 'removed' """ jobnames = self.table[mask]['jobname'] jobkey = self.table[mask]['jobkey'] self.table[mask]['status'] = JobStatus.removed for jobname, jobkey in zip(jobnames, jobkey): fullkey = JobDetail...
python
def remove_jobs(self, mask): """Mark all jobs that match a mask as 'removed' """ jobnames = self.table[mask]['jobname'] jobkey = self.table[mask]['jobkey'] self.table[mask]['status'] = JobStatus.removed for jobname, jobkey in zip(jobnames, jobkey): fullkey = JobDetail...
[ "def", "remove_jobs", "(", "self", ",", "mask", ")", ":", "jobnames", "=", "self", ".", "table", "[", "mask", "]", "[", "'jobname'", "]", "jobkey", "=", "self", ".", "table", "[", "mask", "]", "[", "'jobkey'", "]", "self", ".", "table", "[", "mask"...
Mark all jobs that match a mask as 'removed'
[ "Mark", "all", "jobs", "that", "match", "a", "mask", "as", "removed" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L607-L615
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobArchive.build_temp_job_archive
def build_temp_job_archive(cls): """Build and return a `JobArchive` using defualt locations of persistent files. """ try: os.unlink('job_archive_temp.fits') os.unlink('file_archive_temp.fits') except OSError: pass cls._archive = cls(job_archiv...
python
def build_temp_job_archive(cls): """Build and return a `JobArchive` using defualt locations of persistent files. """ try: os.unlink('job_archive_temp.fits') os.unlink('file_archive_temp.fits') except OSError: pass cls._archive = cls(job_archiv...
[ "def", "build_temp_job_archive", "(", "cls", ")", ":", "try", ":", "os", ".", "unlink", "(", "'job_archive_temp.fits'", ")", "os", ".", "unlink", "(", "'file_archive_temp.fits'", ")", "except", "OSError", ":", "pass", "cls", ".", "_archive", "=", "cls", "(",...
Build and return a `JobArchive` using defualt locations of persistent files.
[ "Build", "and", "return", "a", "JobArchive", "using", "defualt", "locations", "of", "persistent", "files", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L618-L630
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobArchive.update_job_status
def update_job_status(self, checker_func): """Update the status of all the jobs in the archive""" njobs = len(self.cache.keys()) status_vect = np.zeros((8), int) sys.stdout.write("Updating status of %i jobs: " % njobs) sys.stdout.flush() for i, key in enumerate(self.cache...
python
def update_job_status(self, checker_func): """Update the status of all the jobs in the archive""" njobs = len(self.cache.keys()) status_vect = np.zeros((8), int) sys.stdout.write("Updating status of %i jobs: " % njobs) sys.stdout.flush() for i, key in enumerate(self.cache...
[ "def", "update_job_status", "(", "self", ",", "checker_func", ")", ":", "njobs", "=", "len", "(", "self", ".", "cache", ".", "keys", "(", ")", ")", "status_vect", "=", "np", ".", "zeros", "(", "(", "8", ")", ",", "int", ")", "sys", ".", "stdout", ...
Update the status of all the jobs in the archive
[ "Update", "the", "status", "of", "all", "the", "jobs", "in", "the", "archive" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L646-L675
train
fermiPy/fermipy
fermipy/jobs/job_archive.py
JobArchive.build_archive
def build_archive(cls, **kwargs): """Return the singleton `JobArchive` instance, building it if needed """ if cls._archive is None: cls._archive = cls(**kwargs) return cls._archive
python
def build_archive(cls, **kwargs): """Return the singleton `JobArchive` instance, building it if needed """ if cls._archive is None: cls._archive = cls(**kwargs) return cls._archive
[ "def", "build_archive", "(", "cls", ",", "**", "kwargs", ")", ":", "if", "cls", ".", "_archive", "is", "None", ":", "cls", ".", "_archive", "=", "cls", "(", "**", "kwargs", ")", "return", "cls", ".", "_archive" ]
Return the singleton `JobArchive` instance, building it if needed
[ "Return", "the", "singleton", "JobArchive", "instance", "building", "it", "if", "needed" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/jobs/job_archive.py#L683-L687
train
fermiPy/fermipy
fermipy/timing.py
Timer.elapsed_time
def elapsed_time(self): """Get the elapsed time.""" # Timer is running if self._t0 is not None: return self._time + self._get_time() else: return self._time
python
def elapsed_time(self): """Get the elapsed time.""" # Timer is running if self._t0 is not None: return self._time + self._get_time() else: return self._time
[ "def", "elapsed_time", "(", "self", ")", ":", "if", "self", ".", "_t0", "is", "not", "None", ":", "return", "self", ".", "_time", "+", "self", ".", "_get_time", "(", ")", "else", ":", "return", "self", ".", "_time" ]
Get the elapsed time.
[ "Get", "the", "elapsed", "time", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/timing.py#L14-L21
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
make_spatialmap_source
def make_spatialmap_source(name, Spatial_Filename, spectrum): """Construct and return a `fermipy.roi_model.Source` object """ data = dict(Spatial_Filename=Spatial_Filename, ra=0.0, dec=0.0, SpatialType='SpatialMap', Source_Name=name) if spectrum is not No...
python
def make_spatialmap_source(name, Spatial_Filename, spectrum): """Construct and return a `fermipy.roi_model.Source` object """ data = dict(Spatial_Filename=Spatial_Filename, ra=0.0, dec=0.0, SpatialType='SpatialMap', Source_Name=name) if spectrum is not No...
[ "def", "make_spatialmap_source", "(", "name", ",", "Spatial_Filename", ",", "spectrum", ")", ":", "data", "=", "dict", "(", "Spatial_Filename", "=", "Spatial_Filename", ",", "ra", "=", "0.0", ",", "dec", "=", "0.0", ",", "SpatialType", "=", "'SpatialMap'", "...
Construct and return a `fermipy.roi_model.Source` object
[ "Construct", "and", "return", "a", "fermipy", ".", "roi_model", ".", "Source", "object" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L21-L31
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
make_mapcube_source
def make_mapcube_source(name, Spatial_Filename, spectrum): """Construct and return a `fermipy.roi_model.MapCubeSource` object """ data = dict(Spatial_Filename=Spatial_Filename) if spectrum is not None: data.update(spectrum) return roi_model.MapCubeSource(name, data)
python
def make_mapcube_source(name, Spatial_Filename, spectrum): """Construct and return a `fermipy.roi_model.MapCubeSource` object """ data = dict(Spatial_Filename=Spatial_Filename) if spectrum is not None: data.update(spectrum) return roi_model.MapCubeSource(name, data)
[ "def", "make_mapcube_source", "(", "name", ",", "Spatial_Filename", ",", "spectrum", ")", ":", "data", "=", "dict", "(", "Spatial_Filename", "=", "Spatial_Filename", ")", "if", "spectrum", "is", "not", "None", ":", "data", ".", "update", "(", "spectrum", ")"...
Construct and return a `fermipy.roi_model.MapCubeSource` object
[ "Construct", "and", "return", "a", "fermipy", ".", "roi_model", ".", "MapCubeSource", "object" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L34-L41
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
make_isotropic_source
def make_isotropic_source(name, Spectrum_Filename, spectrum): """Construct and return a `fermipy.roi_model.IsoSource` object """ data = dict(Spectrum_Filename=Spectrum_Filename) if spectrum is not None: data.update(spectrum) return roi_model.IsoSource(name, data)
python
def make_isotropic_source(name, Spectrum_Filename, spectrum): """Construct and return a `fermipy.roi_model.IsoSource` object """ data = dict(Spectrum_Filename=Spectrum_Filename) if spectrum is not None: data.update(spectrum) return roi_model.IsoSource(name, data)
[ "def", "make_isotropic_source", "(", "name", ",", "Spectrum_Filename", ",", "spectrum", ")", ":", "data", "=", "dict", "(", "Spectrum_Filename", "=", "Spectrum_Filename", ")", "if", "spectrum", "is", "not", "None", ":", "data", ".", "update", "(", "spectrum", ...
Construct and return a `fermipy.roi_model.IsoSource` object
[ "Construct", "and", "return", "a", "fermipy", ".", "roi_model", ".", "IsoSource", "object" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L44-L51
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
make_composite_source
def make_composite_source(name, spectrum): """Construct and return a `fermipy.roi_model.CompositeSource` object """ data = dict(SpatialType='CompositeSource', SpatialModel='CompositeSource', SourceType='CompositeSource') if spectrum is not None: data.update(spectr...
python
def make_composite_source(name, spectrum): """Construct and return a `fermipy.roi_model.CompositeSource` object """ data = dict(SpatialType='CompositeSource', SpatialModel='CompositeSource', SourceType='CompositeSource') if spectrum is not None: data.update(spectr...
[ "def", "make_composite_source", "(", "name", ",", "spectrum", ")", ":", "data", "=", "dict", "(", "SpatialType", "=", "'CompositeSource'", ",", "SpatialModel", "=", "'CompositeSource'", ",", "SourceType", "=", "'CompositeSource'", ")", "if", "spectrum", "is", "n...
Construct and return a `fermipy.roi_model.CompositeSource` object
[ "Construct", "and", "return", "a", "fermipy", ".", "roi_model", ".", "CompositeSource", "object" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L54-L62
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
make_catalog_sources
def make_catalog_sources(catalog_roi_model, source_names): """Construct and return dictionary of sources that are a subset of sources in catalog_roi_model. Parameters ---------- catalog_roi_model : dict or `fermipy.roi_model.ROIModel` Input set of sources source_names : list N...
python
def make_catalog_sources(catalog_roi_model, source_names): """Construct and return dictionary of sources that are a subset of sources in catalog_roi_model. Parameters ---------- catalog_roi_model : dict or `fermipy.roi_model.ROIModel` Input set of sources source_names : list N...
[ "def", "make_catalog_sources", "(", "catalog_roi_model", ",", "source_names", ")", ":", "sources", "=", "{", "}", "for", "source_name", "in", "source_names", ":", "sources", "[", "source_name", "]", "=", "catalog_roi_model", "[", "source_name", "]", "return", "s...
Construct and return dictionary of sources that are a subset of sources in catalog_roi_model. Parameters ---------- catalog_roi_model : dict or `fermipy.roi_model.ROIModel` Input set of sources source_names : list Names of sourcs to extract Returns dict mapping source_name to...
[ "Construct", "and", "return", "dictionary", "of", "sources", "that", "are", "a", "subset", "of", "sources", "in", "catalog_roi_model", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L65-L83
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
make_sources
def make_sources(comp_key, comp_dict): """Make dictionary mapping component keys to a source or set of sources Parameters ---------- comp_key : str Key used to access sources comp_dict : dict Information used to build sources return `OrderedDict` maping comp_key to `fermi...
python
def make_sources(comp_key, comp_dict): """Make dictionary mapping component keys to a source or set of sources Parameters ---------- comp_key : str Key used to access sources comp_dict : dict Information used to build sources return `OrderedDict` maping comp_key to `fermi...
[ "def", "make_sources", "(", "comp_key", ",", "comp_dict", ")", ":", "srcdict", "=", "OrderedDict", "(", ")", "try", ":", "comp_info", "=", "comp_dict", ".", "info", "except", "AttributeError", ":", "comp_info", "=", "comp_dict", "try", ":", "spectrum", "=", ...
Make dictionary mapping component keys to a source or set of sources Parameters ---------- comp_key : str Key used to access sources comp_dict : dict Information used to build sources return `OrderedDict` maping comp_key to `fermipy.roi_model.Source`
[ "Make", "dictionary", "mapping", "component", "keys", "to", "a", "source", "or", "set", "of", "sources" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L86-L135
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
SourceFactory.add_sources
def add_sources(self, source_info_dict): """Add all of the sources in source_info_dict to this factory """ self._source_info_dict.update(source_info_dict) for key, value in source_info_dict.items(): self._sources.update(make_sources(key, value))
python
def add_sources(self, source_info_dict): """Add all of the sources in source_info_dict to this factory """ self._source_info_dict.update(source_info_dict) for key, value in source_info_dict.items(): self._sources.update(make_sources(key, value))
[ "def", "add_sources", "(", "self", ",", "source_info_dict", ")", ":", "self", ".", "_source_info_dict", ".", "update", "(", "source_info_dict", ")", "for", "key", ",", "value", "in", "source_info_dict", ".", "items", "(", ")", ":", "self", ".", "_sources", ...
Add all of the sources in source_info_dict to this factory
[ "Add", "all", "of", "the", "sources", "in", "source_info_dict", "to", "this", "factory" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L158-L163
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
SourceFactory.build_catalog
def build_catalog(**kwargs): """Build a `fermipy.catalog.Catalog` object Parameters ---------- catalog_type : str Specifies catalog type, options include 2FHL | 3FGL | 4FGLP catalog_file : str FITS file with catalog tables catalog_extdir : str ...
python
def build_catalog(**kwargs): """Build a `fermipy.catalog.Catalog` object Parameters ---------- catalog_type : str Specifies catalog type, options include 2FHL | 3FGL | 4FGLP catalog_file : str FITS file with catalog tables catalog_extdir : str ...
[ "def", "build_catalog", "(", "**", "kwargs", ")", ":", "catalog_type", "=", "kwargs", ".", "get", "(", "'catalog_type'", ")", "catalog_file", "=", "kwargs", ".", "get", "(", "'catalog_file'", ")", "catalog_extdir", "=", "kwargs", ".", "get", "(", "'catalog_e...
Build a `fermipy.catalog.Catalog` object Parameters ---------- catalog_type : str Specifies catalog type, options include 2FHL | 3FGL | 4FGLP catalog_file : str FITS file with catalog tables catalog_extdir : str Path to directory with extende...
[ "Build", "a", "fermipy", ".", "catalog", ".", "Catalog", "object" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L166-L192
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
SourceFactory.make_fermipy_roi_model_from_catalogs
def make_fermipy_roi_model_from_catalogs(cataloglist): """Build and return a `fermipy.roi_model.ROIModel object from a list of fermipy.catalog.Catalog` objects """ data = dict(catalogs=cataloglist, src_roiwidth=360.) return roi_model.ROIModel(data, skydir=SkyC...
python
def make_fermipy_roi_model_from_catalogs(cataloglist): """Build and return a `fermipy.roi_model.ROIModel object from a list of fermipy.catalog.Catalog` objects """ data = dict(catalogs=cataloglist, src_roiwidth=360.) return roi_model.ROIModel(data, skydir=SkyC...
[ "def", "make_fermipy_roi_model_from_catalogs", "(", "cataloglist", ")", ":", "data", "=", "dict", "(", "catalogs", "=", "cataloglist", ",", "src_roiwidth", "=", "360.", ")", "return", "roi_model", ".", "ROIModel", "(", "data", ",", "skydir", "=", "SkyCoord", "...
Build and return a `fermipy.roi_model.ROIModel object from a list of fermipy.catalog.Catalog` objects
[ "Build", "and", "return", "a", "fermipy", ".", "roi_model", ".", "ROIModel", "object", "from", "a", "list", "of", "fermipy", ".", "catalog", ".", "Catalog", "objects" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L195-L201
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
SourceFactory.make_roi
def make_roi(cls, sources=None): """Build and return a `fermipy.roi_model.ROIModel` object from a dict with information about the sources """ if sources is None: sources = {} src_fact = cls() src_fact.add_sources(sources) ret_model = roi_model.ROIModel...
python
def make_roi(cls, sources=None): """Build and return a `fermipy.roi_model.ROIModel` object from a dict with information about the sources """ if sources is None: sources = {} src_fact = cls() src_fact.add_sources(sources) ret_model = roi_model.ROIModel...
[ "def", "make_roi", "(", "cls", ",", "sources", "=", "None", ")", ":", "if", "sources", "is", "None", ":", "sources", "=", "{", "}", "src_fact", "=", "cls", "(", ")", "src_fact", ".", "add_sources", "(", "sources", ")", "ret_model", "=", "roi_model", ...
Build and return a `fermipy.roi_model.ROIModel` object from a dict with information about the sources
[ "Build", "and", "return", "a", "fermipy", ".", "roi_model", ".", "ROIModel", "object", "from", "a", "dict", "with", "information", "about", "the", "sources" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L204-L217
train
fermiPy/fermipy
fermipy/diffuse/source_factory.py
SourceFactory.copy_selected_sources
def copy_selected_sources(cls, roi, source_names): """Build and return a `fermipy.roi_model.ROIModel` object by copying selected sources from another such object """ roi_new = cls.make_roi() for source_name in source_names: try: src_cp = roi.copy_sourc...
python
def copy_selected_sources(cls, roi, source_names): """Build and return a `fermipy.roi_model.ROIModel` object by copying selected sources from another such object """ roi_new = cls.make_roi() for source_name in source_names: try: src_cp = roi.copy_sourc...
[ "def", "copy_selected_sources", "(", "cls", ",", "roi", ",", "source_names", ")", ":", "roi_new", "=", "cls", ".", "make_roi", "(", ")", "for", "source_name", "in", "source_names", ":", "try", ":", "src_cp", "=", "roi", ".", "copy_source", "(", "source_nam...
Build and return a `fermipy.roi_model.ROIModel` object by copying selected sources from another such object
[ "Build", "and", "return", "a", "fermipy", ".", "roi_model", ".", "ROIModel", "object", "by", "copying", "selected", "sources", "from", "another", "such", "object" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/source_factory.py#L220-L231
train
fermiPy/fermipy
fermipy/diffuse/timefilter.py
MktimeFilterDict.build_from_yamlfile
def build_from_yamlfile(yamlfile): """ Build a list of components from a yaml file """ d = yaml.load(open(yamlfile)) return MktimeFilterDict(d['aliases'], d['selections'])
python
def build_from_yamlfile(yamlfile): """ Build a list of components from a yaml file """ d = yaml.load(open(yamlfile)) return MktimeFilterDict(d['aliases'], d['selections'])
[ "def", "build_from_yamlfile", "(", "yamlfile", ")", ":", "d", "=", "yaml", ".", "load", "(", "open", "(", "yamlfile", ")", ")", "return", "MktimeFilterDict", "(", "d", "[", "'aliases'", "]", ",", "d", "[", "'selections'", "]", ")" ]
Build a list of components from a yaml file
[ "Build", "a", "list", "of", "components", "from", "a", "yaml", "file" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/timefilter.py#L39-L43
train
fermiPy/fermipy
fermipy/scripts/dispatch.py
collect_jobs
def collect_jobs(dirs, runscript, overwrite=False, max_job_age=90): """Construct a list of job dictionaries.""" jobs = [] for dirname in sorted(dirs): o = dict(cfgfile=os.path.join(dirname, 'config.yaml'), logfile=os.path.join( dirname, os.path.splitext(runsc...
python
def collect_jobs(dirs, runscript, overwrite=False, max_job_age=90): """Construct a list of job dictionaries.""" jobs = [] for dirname in sorted(dirs): o = dict(cfgfile=os.path.join(dirname, 'config.yaml'), logfile=os.path.join( dirname, os.path.splitext(runsc...
[ "def", "collect_jobs", "(", "dirs", ",", "runscript", ",", "overwrite", "=", "False", ",", "max_job_age", "=", "90", ")", ":", "jobs", "=", "[", "]", "for", "dirname", "in", "sorted", "(", "dirs", ")", ":", "o", "=", "dict", "(", "cfgfile", "=", "o...
Construct a list of job dictionaries.
[ "Construct", "a", "list", "of", "job", "dictionaries", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/scripts/dispatch.py#L18-L58
train
fermiPy/fermipy
fermipy/srcmap_utils.py
delete_source_map
def delete_source_map(srcmap_file, names, logger=None): """Delete a map from a binned analysis source map file if it exists. Parameters ---------- srcmap_file : str Path to the source map file. names : list List of HDU keys of source maps to be deleted. """ with fits.open(sr...
python
def delete_source_map(srcmap_file, names, logger=None): """Delete a map from a binned analysis source map file if it exists. Parameters ---------- srcmap_file : str Path to the source map file. names : list List of HDU keys of source maps to be deleted. """ with fits.open(sr...
[ "def", "delete_source_map", "(", "srcmap_file", ",", "names", ",", "logger", "=", "None", ")", ":", "with", "fits", ".", "open", "(", "srcmap_file", ")", "as", "hdulist", ":", "hdunames", "=", "[", "hdu", ".", "name", ".", "upper", "(", ")", "for", "...
Delete a map from a binned analysis source map file if it exists. Parameters ---------- srcmap_file : str Path to the source map file. names : list List of HDU keys of source maps to be deleted.
[ "Delete", "a", "map", "from", "a", "binned", "analysis", "source", "map", "file", "if", "it", "exists", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/srcmap_utils.py#L380-L403
train
fermiPy/fermipy
fermipy/srcmap_utils.py
MapInterpolator.get_offsets
def get_offsets(self, pix): """Get offset of the first pixel in each dimension in the global coordinate system. Parameters ---------- pix : `~numpy.ndarray` Pixel coordinates in global coordinate system. """ idx = [] for i in range(self.ndim)...
python
def get_offsets(self, pix): """Get offset of the first pixel in each dimension in the global coordinate system. Parameters ---------- pix : `~numpy.ndarray` Pixel coordinates in global coordinate system. """ idx = [] for i in range(self.ndim)...
[ "def", "get_offsets", "(", "self", ",", "pix", ")", ":", "idx", "=", "[", "]", "for", "i", "in", "range", "(", "self", ".", "ndim", ")", ":", "if", "i", "==", "0", ":", "idx", "+=", "[", "0", "]", "else", ":", "npix1", "=", "int", "(", "sel...
Get offset of the first pixel in each dimension in the global coordinate system. Parameters ---------- pix : `~numpy.ndarray` Pixel coordinates in global coordinate system.
[ "Get", "offset", "of", "the", "first", "pixel", "in", "each", "dimension", "in", "the", "global", "coordinate", "system", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/srcmap_utils.py#L62-L82
train
fermiPy/fermipy
fermipy/srcmap_utils.py
MapInterpolator.shift_to_coords
def shift_to_coords(self, pix, fill_value=np.nan): """Create a new map that is shifted to the pixel coordinates ``pix``.""" pix_offset = self.get_offsets(pix) dpix = np.zeros(len(self.shape) - 1) for i in range(len(self.shape) - 1): x = self.rebin * (pix[i] - pix_off...
python
def shift_to_coords(self, pix, fill_value=np.nan): """Create a new map that is shifted to the pixel coordinates ``pix``.""" pix_offset = self.get_offsets(pix) dpix = np.zeros(len(self.shape) - 1) for i in range(len(self.shape) - 1): x = self.rebin * (pix[i] - pix_off...
[ "def", "shift_to_coords", "(", "self", ",", "pix", ",", "fill_value", "=", "np", ".", "nan", ")", ":", "pix_offset", "=", "self", ".", "get_offsets", "(", "pix", ")", "dpix", "=", "np", ".", "zeros", "(", "len", "(", "self", ".", "shape", ")", "-",...
Create a new map that is shifted to the pixel coordinates ``pix``.
[ "Create", "a", "new", "map", "that", "is", "shifted", "to", "the", "pixel", "coordinates", "pix", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/srcmap_utils.py#L84-L112
train
fermiPy/fermipy
fermipy/srcmap_utils.py
SourceMapCache.create_map
def create_map(self, pix): """Create a new map with reference pixel coordinates shifted to the pixel coordinates ``pix``. Parameters ---------- pix : `~numpy.ndarray` Reference pixel of new map. Returns ------- out_map : `~numpy.ndarray` ...
python
def create_map(self, pix): """Create a new map with reference pixel coordinates shifted to the pixel coordinates ``pix``. Parameters ---------- pix : `~numpy.ndarray` Reference pixel of new map. Returns ------- out_map : `~numpy.ndarray` ...
[ "def", "create_map", "(", "self", ",", "pix", ")", ":", "k0", "=", "self", ".", "_m0", ".", "shift_to_coords", "(", "pix", ")", "k1", "=", "self", ".", "_m1", ".", "shift_to_coords", "(", "pix", ")", "k0", "[", "np", ".", "isfinite", "(", "k1", "...
Create a new map with reference pixel coordinates shifted to the pixel coordinates ``pix``. Parameters ---------- pix : `~numpy.ndarray` Reference pixel of new map. Returns ------- out_map : `~numpy.ndarray` The shifted map.
[ "Create", "a", "new", "map", "with", "reference", "pixel", "coordinates", "shifted", "to", "the", "pixel", "coordinates", "pix", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/srcmap_utils.py#L123-L142
train
fermiPy/fermipy
fermipy/version.py
render_pep440
def render_pep440(vcs): """Convert git release tag into a form that is PEP440 compliant.""" if vcs is None: return None tags = vcs.split('-') # Bare version number if len(tags) == 1: return tags[0] else: return tags[0] + '+' + '.'.join(tags[1:])
python
def render_pep440(vcs): """Convert git release tag into a form that is PEP440 compliant.""" if vcs is None: return None tags = vcs.split('-') # Bare version number if len(tags) == 1: return tags[0] else: return tags[0] + '+' + '.'.join(tags[1:])
[ "def", "render_pep440", "(", "vcs", ")", ":", "if", "vcs", "is", "None", ":", "return", "None", "tags", "=", "vcs", ".", "split", "(", "'-'", ")", "if", "len", "(", "tags", ")", "==", "1", ":", "return", "tags", "[", "0", "]", "else", ":", "ret...
Convert git release tag into a form that is PEP440 compliant.
[ "Convert", "git", "release", "tag", "into", "a", "form", "that", "is", "PEP440", "compliant", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/version.py#L62-L74
train
fermiPy/fermipy
fermipy/version.py
read_release_version
def read_release_version(): """Read the release version from ``_version.py``.""" import re dirname = os.path.abspath(os.path.dirname(__file__)) try: f = open(os.path.join(dirname, "_version.py"), "rt") for line in f.readlines(): m = re.match("__version__ = '([^']+)'", line)...
python
def read_release_version(): """Read the release version from ``_version.py``.""" import re dirname = os.path.abspath(os.path.dirname(__file__)) try: f = open(os.path.join(dirname, "_version.py"), "rt") for line in f.readlines(): m = re.match("__version__ = '([^']+)'", line)...
[ "def", "read_release_version", "(", ")", ":", "import", "re", "dirname", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "try", ":", "f", "=", "open", "(", "os", ".", "path", ".", "join", ...
Read the release version from ``_version.py``.
[ "Read", "the", "release", "version", "from", "_version", ".", "py", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/version.py#L114-L131
train
fermiPy/fermipy
fermipy/version.py
write_release_version
def write_release_version(version): """Write the release version to ``_version.py``.""" dirname = os.path.abspath(os.path.dirname(__file__)) f = open(os.path.join(dirname, "_version.py"), "wt") f.write("__version__ = '%s'\n" % version) f.close()
python
def write_release_version(version): """Write the release version to ``_version.py``.""" dirname = os.path.abspath(os.path.dirname(__file__)) f = open(os.path.join(dirname, "_version.py"), "wt") f.write("__version__ = '%s'\n" % version) f.close()
[ "def", "write_release_version", "(", "version", ")", ":", "dirname", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "f", "=", "open", "(", "os", ".", "path", ".", "join", "(", "dirname", "...
Write the release version to ``_version.py``.
[ "Write", "the", "release", "version", "to", "_version", ".", "py", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/version.py#L134-L139
train
fermiPy/fermipy
fermipy/diffuse/gt_split_and_mktime.py
make_full_path
def make_full_path(basedir, outkey, origname): """Make a full file path by combining tokens Parameters ----------- basedir : str The top level output area outkey : str The key for the particular instance of the analysis origname : str Template for the output file name...
python
def make_full_path(basedir, outkey, origname): """Make a full file path by combining tokens Parameters ----------- basedir : str The top level output area outkey : str The key for the particular instance of the analysis origname : str Template for the output file name...
[ "def", "make_full_path", "(", "basedir", ",", "outkey", ",", "origname", ")", ":", "return", "os", ".", "path", ".", "join", "(", "basedir", ",", "outkey", ",", "os", ".", "path", ".", "basename", "(", "origname", ")", ".", "replace", "(", "'.fits'", ...
Make a full file path by combining tokens Parameters ----------- basedir : str The top level output area outkey : str The key for the particular instance of the analysis origname : str Template for the output file name Returns ------- outpath : str T...
[ "Make", "a", "full", "file", "path", "by", "combining", "tokens" ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/diffuse/gt_split_and_mktime.py#L38-L63
train
fermiPy/fermipy
fermipy/utils.py
init_matplotlib_backend
def init_matplotlib_backend(backend=None): """This function initializes the matplotlib backend. When no DISPLAY is available the backend is automatically set to 'Agg'. Parameters ---------- backend : str matplotlib backend name. """ import matplotlib try: os.environ['D...
python
def init_matplotlib_backend(backend=None): """This function initializes the matplotlib backend. When no DISPLAY is available the backend is automatically set to 'Agg'. Parameters ---------- backend : str matplotlib backend name. """ import matplotlib try: os.environ['D...
[ "def", "init_matplotlib_backend", "(", "backend", "=", "None", ")", ":", "import", "matplotlib", "try", ":", "os", ".", "environ", "[", "'DISPLAY'", "]", "except", "KeyError", ":", "matplotlib", ".", "use", "(", "'Agg'", ")", "else", ":", "if", "backend", ...
This function initializes the matplotlib backend. When no DISPLAY is available the backend is automatically set to 'Agg'. Parameters ---------- backend : str matplotlib backend name.
[ "This", "function", "initializes", "the", "matplotlib", "backend", ".", "When", "no", "DISPLAY", "is", "available", "the", "backend", "is", "automatically", "set", "to", "Agg", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L22-L40
train
fermiPy/fermipy
fermipy/utils.py
load_data
def load_data(infile, workdir=None): """Load python data structure from either a YAML or numpy file. """ infile = resolve_path(infile, workdir=workdir) infile, ext = os.path.splitext(infile) if os.path.isfile(infile + '.npy'): infile += '.npy' elif os.path.isfile(infile + '.yaml'): ...
python
def load_data(infile, workdir=None): """Load python data structure from either a YAML or numpy file. """ infile = resolve_path(infile, workdir=workdir) infile, ext = os.path.splitext(infile) if os.path.isfile(infile + '.npy'): infile += '.npy' elif os.path.isfile(infile + '.yaml'): ...
[ "def", "load_data", "(", "infile", ",", "workdir", "=", "None", ")", ":", "infile", "=", "resolve_path", "(", "infile", ",", "workdir", "=", "workdir", ")", "infile", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", "infile", ")", "if", "os"...
Load python data structure from either a YAML or numpy file.
[ "Load", "python", "data", "structure", "from", "either", "a", "YAML", "or", "numpy", "file", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L63-L82
train
fermiPy/fermipy
fermipy/utils.py
resolve_file_path_list
def resolve_file_path_list(pathlist, workdir, prefix='', randomize=False): """Resolve the path of each file name in the file ``pathlist`` and write the updated paths to a new file. """ files = [] with open(pathlist, 'r') as f: files = [line.strip() for line in f] ...
python
def resolve_file_path_list(pathlist, workdir, prefix='', randomize=False): """Resolve the path of each file name in the file ``pathlist`` and write the updated paths to a new file. """ files = [] with open(pathlist, 'r') as f: files = [line.strip() for line in f] ...
[ "def", "resolve_file_path_list", "(", "pathlist", ",", "workdir", ",", "prefix", "=", "''", ",", "randomize", "=", "False", ")", ":", "files", "=", "[", "]", "with", "open", "(", "pathlist", ",", "'r'", ")", "as", "f", ":", "files", "=", "[", "line",...
Resolve the path of each file name in the file ``pathlist`` and write the updated paths to a new file.
[ "Resolve", "the", "path", "of", "each", "file", "name", "in", "the", "file", "pathlist", "and", "write", "the", "updated", "paths", "to", "a", "new", "file", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L123-L149
train
fermiPy/fermipy
fermipy/utils.py
collect_dirs
def collect_dirs(path, max_depth=1, followlinks=True): """Recursively find directories under the given path.""" if not os.path.isdir(path): return [] o = [path] if max_depth == 0: return o for subdir in os.listdir(path): subdir = os.path.join(path, subdir) if no...
python
def collect_dirs(path, max_depth=1, followlinks=True): """Recursively find directories under the given path.""" if not os.path.isdir(path): return [] o = [path] if max_depth == 0: return o for subdir in os.listdir(path): subdir = os.path.join(path, subdir) if no...
[ "def", "collect_dirs", "(", "path", ",", "max_depth", "=", "1", ",", "followlinks", "=", "True", ")", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "return", "[", "]", "o", "=", "[", "path", "]", "if", "max_depth", "==...
Recursively find directories under the given path.
[ "Recursively", "find", "directories", "under", "the", "given", "path", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L161-L187
train
fermiPy/fermipy
fermipy/utils.py
match_regex_list
def match_regex_list(patterns, string): """Perform a regex match of a string against a list of patterns. Returns true if the string matches at least one pattern in the list.""" for p in patterns: if re.findall(p, string): return True return False
python
def match_regex_list(patterns, string): """Perform a regex match of a string against a list of patterns. Returns true if the string matches at least one pattern in the list.""" for p in patterns: if re.findall(p, string): return True return False
[ "def", "match_regex_list", "(", "patterns", ",", "string", ")", ":", "for", "p", "in", "patterns", ":", "if", "re", ".", "findall", "(", "p", ",", "string", ")", ":", "return", "True", "return", "False" ]
Perform a regex match of a string against a list of patterns. Returns true if the string matches at least one pattern in the list.
[ "Perform", "a", "regex", "match", "of", "a", "string", "against", "a", "list", "of", "patterns", ".", "Returns", "true", "if", "the", "string", "matches", "at", "least", "one", "pattern", "in", "the", "list", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L190-L200
train
fermiPy/fermipy
fermipy/utils.py
find_rows_by_string
def find_rows_by_string(tab, names, colnames=['assoc']): """Find the rows in a table ``tab`` that match at least one of the strings in ``names``. This method ignores whitespace and case when matching strings. Parameters ---------- tab : `astropy.table.Table` Table that will be searched....
python
def find_rows_by_string(tab, names, colnames=['assoc']): """Find the rows in a table ``tab`` that match at least one of the strings in ``names``. This method ignores whitespace and case when matching strings. Parameters ---------- tab : `astropy.table.Table` Table that will be searched....
[ "def", "find_rows_by_string", "(", "tab", ",", "names", ",", "colnames", "=", "[", "'assoc'", "]", ")", ":", "mask", "=", "np", ".", "empty", "(", "len", "(", "tab", ")", ",", "dtype", "=", "bool", ")", "mask", ".", "fill", "(", "False", ")", "na...
Find the rows in a table ``tab`` that match at least one of the strings in ``names``. This method ignores whitespace and case when matching strings. Parameters ---------- tab : `astropy.table.Table` Table that will be searched. names : list List of strings. colname : str ...
[ "Find", "the", "rows", "in", "a", "table", "tab", "that", "match", "at", "least", "one", "of", "the", "strings", "in", "names", ".", "This", "method", "ignores", "whitespace", "and", "case", "when", "matching", "strings", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L203-L239
train
fermiPy/fermipy
fermipy/utils.py
separation_cos_angle
def separation_cos_angle(lon0, lat0, lon1, lat1): """Evaluate the cosine of the angular separation between two direction vectors.""" return (np.sin(lat1) * np.sin(lat0) + np.cos(lat1) * np.cos(lat0) * np.cos(lon1 - lon0))
python
def separation_cos_angle(lon0, lat0, lon1, lat1): """Evaluate the cosine of the angular separation between two direction vectors.""" return (np.sin(lat1) * np.sin(lat0) + np.cos(lat1) * np.cos(lat0) * np.cos(lon1 - lon0))
[ "def", "separation_cos_angle", "(", "lon0", ",", "lat0", ",", "lon1", ",", "lat1", ")", ":", "return", "(", "np", ".", "sin", "(", "lat1", ")", "*", "np", ".", "sin", "(", "lat0", ")", "+", "np", ".", "cos", "(", "lat1", ")", "*", "np", ".", ...
Evaluate the cosine of the angular separation between two direction vectors.
[ "Evaluate", "the", "cosine", "of", "the", "angular", "separation", "between", "two", "direction", "vectors", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L394-L398
train
fermiPy/fermipy
fermipy/utils.py
angle_to_cartesian
def angle_to_cartesian(lon, lat): """Convert spherical coordinates to cartesian unit vectors.""" theta = np.array(np.pi / 2. - lat) return np.vstack((np.sin(theta) * np.cos(lon), np.sin(theta) * np.sin(lon), np.cos(theta))).T
python
def angle_to_cartesian(lon, lat): """Convert spherical coordinates to cartesian unit vectors.""" theta = np.array(np.pi / 2. - lat) return np.vstack((np.sin(theta) * np.cos(lon), np.sin(theta) * np.sin(lon), np.cos(theta))).T
[ "def", "angle_to_cartesian", "(", "lon", ",", "lat", ")", ":", "theta", "=", "np", ".", "array", "(", "np", ".", "pi", "/", "2.", "-", "lat", ")", "return", "np", ".", "vstack", "(", "(", "np", ".", "sin", "(", "theta", ")", "*", "np", ".", "...
Convert spherical coordinates to cartesian unit vectors.
[ "Convert", "spherical", "coordinates", "to", "cartesian", "unit", "vectors", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L407-L412
train
fermiPy/fermipy
fermipy/utils.py
cov_to_correlation
def cov_to_correlation(cov): """Compute the correlation matrix given the covariance matrix. Parameters ---------- cov : `~numpy.ndarray` N x N matrix of covariances among N parameters. Returns ------- corr : `~numpy.ndarray` N x N matrix of correlations among N parameters. ...
python
def cov_to_correlation(cov): """Compute the correlation matrix given the covariance matrix. Parameters ---------- cov : `~numpy.ndarray` N x N matrix of covariances among N parameters. Returns ------- corr : `~numpy.ndarray` N x N matrix of correlations among N parameters. ...
[ "def", "cov_to_correlation", "(", "cov", ")", ":", "err", "=", "np", ".", "sqrt", "(", "np", ".", "diag", "(", "cov", ")", ")", "errinv", "=", "np", ".", "ones_like", "(", "err", ")", "*", "np", ".", "nan", "m", "=", "np", ".", "isfinite", "(",...
Compute the correlation matrix given the covariance matrix. Parameters ---------- cov : `~numpy.ndarray` N x N matrix of covariances among N parameters. Returns ------- corr : `~numpy.ndarray` N x N matrix of correlations among N parameters.
[ "Compute", "the", "correlation", "matrix", "given", "the", "covariance", "matrix", "." ]
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L495-L513
train
fermiPy/fermipy
fermipy/utils.py
ellipse_to_cov
def ellipse_to_cov(sigma_maj, sigma_min, theta): """Compute the covariance matrix in two variables x and y given the std. deviation along the semi-major and semi-minor axes and the rotation angle of the error ellipse. Parameters ---------- sigma_maj : float Std. deviation along major ax...
python
def ellipse_to_cov(sigma_maj, sigma_min, theta): """Compute the covariance matrix in two variables x and y given the std. deviation along the semi-major and semi-minor axes and the rotation angle of the error ellipse. Parameters ---------- sigma_maj : float Std. deviation along major ax...
[ "def", "ellipse_to_cov", "(", "sigma_maj", ",", "sigma_min", ",", "theta", ")", ":", "cth", "=", "np", ".", "cos", "(", "theta", ")", "sth", "=", "np", ".", "sin", "(", "theta", ")", "covxx", "=", "cth", "**", "2", "*", "sigma_maj", "**", "2", "+...
Compute the covariance matrix in two variables x and y given the std. deviation along the semi-major and semi-minor axes and the rotation angle of the error ellipse. Parameters ---------- sigma_maj : float Std. deviation along major axis of error ellipse. sigma_min : float Std....
[ "Compute", "the", "covariance", "matrix", "in", "two", "variables", "x", "and", "y", "given", "the", "std", ".", "deviation", "along", "the", "semi", "-", "major", "and", "semi", "-", "minor", "axes", "and", "the", "rotation", "angle", "of", "the", "erro...
9df5e7e3728307fd58c5bba36fd86783c39fbad4
https://github.com/fermiPy/fermipy/blob/9df5e7e3728307fd58c5bba36fd86783c39fbad4/fermipy/utils.py#L516-L537
train