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
what-studio/profiling
profiling/viewer.py
StatisticsWidget.get_mark
def get_mark(self): """Gets an expanded, collapsed, or leaf icon.""" if self.is_leaf: char = self.icon_chars[2] else: char = self.icon_chars[int(self.expanded)] return urwid.SelectableIcon(('mark', char), 0)
python
def get_mark(self): """Gets an expanded, collapsed, or leaf icon.""" if self.is_leaf: char = self.icon_chars[2] else: char = self.icon_chars[int(self.expanded)] return urwid.SelectableIcon(('mark', char), 0)
[ "def", "get_mark", "(", "self", ")", ":", "if", "self", ".", "is_leaf", ":", "char", "=", "self", ".", "icon_chars", "[", "2", "]", "else", ":", "char", "=", "self", ".", "icon_chars", "[", "int", "(", "self", ".", "expanded", ")", "]", "return", ...
Gets an expanded, collapsed, or leaf icon.
[ "Gets", "an", "expanded", "collapsed", "or", "leaf", "icon", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/viewer.py#L271-L277
train
what-studio/profiling
profiling/viewer.py
StatisticsTable.get_path
def get_path(self): """Gets the path to the focused statistics. Each step is a hash of statistics object. """ path = deque() __, node = self.get_focus() while not node.is_root(): stats = node.get_value() path.appendleft(hash(stats)) nod...
python
def get_path(self): """Gets the path to the focused statistics. Each step is a hash of statistics object. """ path = deque() __, node = self.get_focus() while not node.is_root(): stats = node.get_value() path.appendleft(hash(stats)) nod...
[ "def", "get_path", "(", "self", ")", ":", "path", "=", "deque", "(", ")", "__", ",", "node", "=", "self", ".", "get_focus", "(", ")", "while", "not", "node", ".", "is_root", "(", ")", ":", "stats", "=", "node", ".", "get_value", "(", ")", "path",...
Gets the path to the focused statistics. Each step is a hash of statistics object.
[ "Gets", "the", "path", "to", "the", "focused", "statistics", ".", "Each", "step", "is", "a", "hash", "of", "statistics", "object", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/viewer.py#L551-L561
train
what-studio/profiling
profiling/viewer.py
StatisticsTable.find_node
def find_node(self, node, path): """Finds a node by the given path from the given node.""" for hash_value in path: if isinstance(node, LeafStatisticsNode): break for stats in node.get_child_keys(): if hash(stats) == hash_value: ...
python
def find_node(self, node, path): """Finds a node by the given path from the given node.""" for hash_value in path: if isinstance(node, LeafStatisticsNode): break for stats in node.get_child_keys(): if hash(stats) == hash_value: ...
[ "def", "find_node", "(", "self", ",", "node", ",", "path", ")", ":", "for", "hash_value", "in", "path", ":", "if", "isinstance", "(", "node", ",", "LeafStatisticsNode", ")", ":", "break", "for", "stats", "in", "node", ".", "get_child_keys", "(", ")", "...
Finds a node by the given path from the given node.
[ "Finds", "a", "node", "by", "the", "given", "path", "from", "the", "given", "node", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/viewer.py#L563-L574
train
what-studio/profiling
profiling/viewer.py
StatisticsViewer.update_result
def update_result(self): """Updates the result on the table.""" try: if self.paused: result = self._paused_result else: result = self._final_result except AttributeError: self.table.update_frame() return stat...
python
def update_result(self): """Updates the result on the table.""" try: if self.paused: result = self._paused_result else: result = self._final_result except AttributeError: self.table.update_frame() return stat...
[ "def", "update_result", "(", "self", ")", ":", "try", ":", "if", "self", ".", "paused", ":", "result", "=", "self", ".", "_paused_result", "else", ":", "result", "=", "self", ".", "_final_result", "except", "AttributeError", ":", "self", ".", "table", "....
Updates the result on the table.
[ "Updates", "the", "result", "on", "the", "table", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/viewer.py#L812-L823
train
what-studio/profiling
profiling/__main__.py
option_getter
def option_getter(type): """Gets an unbound method to get a configuration option as the given type. """ option_getters = {None: ConfigParser.get, int: ConfigParser.getint, float: ConfigParser.getfloat, bool: ConfigParser.getboolean} retur...
python
def option_getter(type): """Gets an unbound method to get a configuration option as the given type. """ option_getters = {None: ConfigParser.get, int: ConfigParser.getint, float: ConfigParser.getfloat, bool: ConfigParser.getboolean} retur...
[ "def", "option_getter", "(", "type", ")", ":", "option_getters", "=", "{", "None", ":", "ConfigParser", ".", "get", ",", "int", ":", "ConfigParser", ".", "getint", ",", "float", ":", "ConfigParser", ".", "getfloat", ",", "bool", ":", "ConfigParser", ".", ...
Gets an unbound method to get a configuration option as the given type.
[ "Gets", "an", "unbound", "method", "to", "get", "a", "configuration", "option", "as", "the", "given", "type", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/__main__.py#L116-L123
train
what-studio/profiling
profiling/__main__.py
config_default
def config_default(option, default=None, type=None, section=cli.name): """Guesses a default value of a CLI option from the configuration. :: @click.option('--locale', default=config_default('locale')) """ def f(option=option, default=default, type=type, section=section): config = read_...
python
def config_default(option, default=None, type=None, section=cli.name): """Guesses a default value of a CLI option from the configuration. :: @click.option('--locale', default=config_default('locale')) """ def f(option=option, default=default, type=type, section=section): config = read_...
[ "def", "config_default", "(", "option", ",", "default", "=", "None", ",", "type", "=", "None", ",", "section", "=", "cli", ".", "name", ")", ":", "def", "f", "(", "option", "=", "option", ",", "default", "=", "default", ",", "type", "=", "type", ",...
Guesses a default value of a CLI option from the configuration. :: @click.option('--locale', default=config_default('locale'))
[ "Guesses", "a", "default", "value", "of", "a", "CLI", "option", "from", "the", "configuration", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/__main__.py#L126-L144
train
what-studio/profiling
profiling/__main__.py
config_flag
def config_flag(option, value, default=False, section=cli.name): """Guesses whether a CLI flag should be turned on or off from the configuration. If the configuration option value is same with the given value, it returns ``True``. :: @click.option('--ko-kr', 'locale', is_flag=True, ...
python
def config_flag(option, value, default=False, section=cli.name): """Guesses whether a CLI flag should be turned on or off from the configuration. If the configuration option value is same with the given value, it returns ``True``. :: @click.option('--ko-kr', 'locale', is_flag=True, ...
[ "def", "config_flag", "(", "option", ",", "value", ",", "default", "=", "False", ",", "section", "=", "cli", ".", "name", ")", ":", "class", "x", "(", "object", ")", ":", "def", "__bool__", "(", "self", ",", "option", "=", "option", ",", "value", "...
Guesses whether a CLI flag should be turned on or off from the configuration. If the configuration option value is same with the given value, it returns ``True``. :: @click.option('--ko-kr', 'locale', is_flag=True, default=config_flag('locale', 'ko_KR'))
[ "Guesses", "whether", "a", "CLI", "flag", "should", "be", "turned", "on", "or", "off", "from", "the", "configuration", ".", "If", "the", "configuration", "option", "value", "is", "same", "with", "the", "given", "value", "it", "returns", "True", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/__main__.py#L147-L169
train
what-studio/profiling
profiling/__main__.py
get_title
def get_title(src_name, src_type=None): """Normalizes a source name as a string to be used for viewer's title.""" if src_type == 'tcp': return '{0}:{1}'.format(*src_name) return os.path.basename(src_name)
python
def get_title(src_name, src_type=None): """Normalizes a source name as a string to be used for viewer's title.""" if src_type == 'tcp': return '{0}:{1}'.format(*src_name) return os.path.basename(src_name)
[ "def", "get_title", "(", "src_name", ",", "src_type", "=", "None", ")", ":", "if", "src_type", "==", "'tcp'", ":", "return", "'{0}:{1}'", ".", "format", "(", "*", "src_name", ")", "return", "os", ".", "path", ".", "basename", "(", "src_name", ")" ]
Normalizes a source name as a string to be used for viewer's title.
[ "Normalizes", "a", "source", "name", "as", "a", "string", "to", "be", "used", "for", "viewer", "s", "title", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/__main__.py#L172-L176
train
what-studio/profiling
profiling/__main__.py
spawn_thread
def spawn_thread(func, *args, **kwargs): """Spawns a daemon thread.""" thread = threading.Thread(target=func, args=args, kwargs=kwargs) thread.daemon = True thread.start() return thread
python
def spawn_thread(func, *args, **kwargs): """Spawns a daemon thread.""" thread = threading.Thread(target=func, args=args, kwargs=kwargs) thread.daemon = True thread.start() return thread
[ "def", "spawn_thread", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "func", ",", "args", "=", "args", ",", "kwargs", "=", "kwargs", ")", "thread", ".", "daemon", "=...
Spawns a daemon thread.
[ "Spawns", "a", "daemon", "thread", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/__main__.py#L189-L194
train
what-studio/profiling
profiling/__main__.py
spawn
def spawn(mode, func, *args, **kwargs): """Spawns a thread-like object which runs the given function concurrently. Available modes: - `threading` - `greenlet` - `eventlet` """ if mode is None: # 'threading' is the default mode. mode = 'threading' elif mode not in spawn...
python
def spawn(mode, func, *args, **kwargs): """Spawns a thread-like object which runs the given function concurrently. Available modes: - `threading` - `greenlet` - `eventlet` """ if mode is None: # 'threading' is the default mode. mode = 'threading' elif mode not in spawn...
[ "def", "spawn", "(", "mode", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "mode", "is", "None", ":", "# 'threading' is the default mode.", "mode", "=", "'threading'", "elif", "mode", "not", "in", "spawn", ".", "modes", ":", "...
Spawns a thread-like object which runs the given function concurrently. Available modes: - `threading` - `greenlet` - `eventlet`
[ "Spawns", "a", "thread", "-", "like", "object", "which", "runs", "the", "given", "function", "concurrently", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/__main__.py#L197-L225
train
what-studio/profiling
profiling/__main__.py
profile
def profile(script, argv, profiler_factory, pickle_protocol, dump_filename, mono): """Profile a Python script.""" filename, code, globals_ = script sys.argv[:] = [filename] + list(argv) __profile__(filename, code, globals_, profiler_factory, pickle_protocol=pickle_protocol, d...
python
def profile(script, argv, profiler_factory, pickle_protocol, dump_filename, mono): """Profile a Python script.""" filename, code, globals_ = script sys.argv[:] = [filename] + list(argv) __profile__(filename, code, globals_, profiler_factory, pickle_protocol=pickle_protocol, d...
[ "def", "profile", "(", "script", ",", "argv", ",", "profiler_factory", ",", "pickle_protocol", ",", "dump_filename", ",", "mono", ")", ":", "filename", ",", "code", ",", "globals_", "=", "script", "sys", ".", "argv", "[", ":", "]", "=", "[", "filename", ...
Profile a Python script.
[ "Profile", "a", "Python", "script", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/__main__.py#L582-L589
train
what-studio/profiling
profiling/__main__.py
live_profile
def live_profile(script, argv, profiler_factory, interval, spawn, signum, pickle_protocol, mono): """Profile a Python script continuously.""" filename, code, globals_ = script sys.argv[:] = [filename] + list(argv) parent_sock, child_sock = socket.socketpair() stderr_r_fd, stderr_w_f...
python
def live_profile(script, argv, profiler_factory, interval, spawn, signum, pickle_protocol, mono): """Profile a Python script continuously.""" filename, code, globals_ = script sys.argv[:] = [filename] + list(argv) parent_sock, child_sock = socket.socketpair() stderr_r_fd, stderr_w_f...
[ "def", "live_profile", "(", "script", ",", "argv", ",", "profiler_factory", ",", "interval", ",", "spawn", ",", "signum", ",", "pickle_protocol", ",", "mono", ")", ":", "filename", ",", "code", ",", "globals_", "=", "script", "sys", ".", "argv", "[", ":"...
Profile a Python script continuously.
[ "Profile", "a", "Python", "script", "continuously", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/__main__.py#L597-L657
train
what-studio/profiling
profiling/__main__.py
view
def view(src, mono): """Inspect statistics by TUI view.""" src_type, src_name = src title = get_title(src_name, src_type) viewer, loop = make_viewer(mono) if src_type == 'dump': time = datetime.fromtimestamp(os.path.getmtime(src_name)) with open(src_name, 'rb') as f: prof...
python
def view(src, mono): """Inspect statistics by TUI view.""" src_type, src_name = src title = get_title(src_name, src_type) viewer, loop = make_viewer(mono) if src_type == 'dump': time = datetime.fromtimestamp(os.path.getmtime(src_name)) with open(src_name, 'rb') as f: prof...
[ "def", "view", "(", "src", ",", "mono", ")", ":", "src_type", ",", "src_name", "=", "src", "title", "=", "get_title", "(", "src_name", ",", "src_type", ")", "viewer", ",", "loop", "=", "make_viewer", "(", "mono", ")", "if", "src_type", "==", "'dump'", ...
Inspect statistics by TUI view.
[ "Inspect", "statistics", "by", "TUI", "view", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/__main__.py#L707-L727
train
what-studio/profiling
profiling/__main__.py
timeit_profile
def timeit_profile(stmt, number, repeat, setup, profiler_factory, pickle_protocol, dump_filename, mono, **_ignored): """Profile a Python statement like timeit.""" del _ignored globals_ = {} exec_(setup, globals_) if number is None: # determine number so ...
python
def timeit_profile(stmt, number, repeat, setup, profiler_factory, pickle_protocol, dump_filename, mono, **_ignored): """Profile a Python statement like timeit.""" del _ignored globals_ = {} exec_(setup, globals_) if number is None: # determine number so ...
[ "def", "timeit_profile", "(", "stmt", ",", "number", ",", "repeat", ",", "setup", ",", "profiler_factory", ",", "pickle_protocol", ",", "dump_filename", ",", "mono", ",", "*", "*", "_ignored", ")", ":", "del", "_ignored", "globals_", "=", "{", "}", "exec_"...
Profile a Python statement like timeit.
[ "Profile", "a", "Python", "statement", "like", "timeit", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/__main__.py#L744-L768
train
what-studio/profiling
profiling/stats.py
spread_stats
def spread_stats(stats, spreader=False): """Iterates all descendant statistics under the given root statistics. When ``spreader=True``, each iteration yields a descendant statistics and `spread()` function together. You should call `spread()` if you want to spread the yielded statistics also. """...
python
def spread_stats(stats, spreader=False): """Iterates all descendant statistics under the given root statistics. When ``spreader=True``, each iteration yields a descendant statistics and `spread()` function together. You should call `spread()` if you want to spread the yielded statistics also. """...
[ "def", "spread_stats", "(", "stats", ",", "spreader", "=", "False", ")", ":", "spread", "=", "spread_t", "(", ")", "if", "spreader", "else", "True", "descendants", "=", "deque", "(", "stats", ")", "while", "descendants", ":", "_stats", "=", "descendants", ...
Iterates all descendant statistics under the given root statistics. When ``spreader=True``, each iteration yields a descendant statistics and `spread()` function together. You should call `spread()` if you want to spread the yielded statistics also.
[ "Iterates", "all", "descendant", "statistics", "under", "the", "given", "root", "statistics", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/stats.py#L38-L56
train
what-studio/profiling
profiling/stats.py
Statistics.own_time
def own_time(self): """The exclusive execution time.""" sub_time = sum(stats.deep_time for stats in self) return max(0., self.deep_time - sub_time)
python
def own_time(self): """The exclusive execution time.""" sub_time = sum(stats.deep_time for stats in self) return max(0., self.deep_time - sub_time)
[ "def", "own_time", "(", "self", ")", ":", "sub_time", "=", "sum", "(", "stats", ".", "deep_time", "for", "stats", "in", "self", ")", "return", "max", "(", "0.", ",", "self", ".", "deep_time", "-", "sub_time", ")" ]
The exclusive execution time.
[ "The", "exclusive", "execution", "time", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/stats.py#L137-L140
train
what-studio/profiling
profiling/stats.py
FlatFrozenStatistics.flatten
def flatten(cls, stats): """Makes a flat statistics from the given statistics.""" flat_children = {} for _stats in spread_stats(stats): key = (_stats.name, _stats.filename, _stats.lineno, _stats.module) try: flat_stats = flat_children[key] exce...
python
def flatten(cls, stats): """Makes a flat statistics from the given statistics.""" flat_children = {} for _stats in spread_stats(stats): key = (_stats.name, _stats.filename, _stats.lineno, _stats.module) try: flat_stats = flat_children[key] exce...
[ "def", "flatten", "(", "cls", ",", "stats", ")", ":", "flat_children", "=", "{", "}", "for", "_stats", "in", "spread_stats", "(", "stats", ")", ":", "key", "=", "(", "_stats", ".", "name", ",", "_stats", ".", "filename", ",", "_stats", ".", "lineno",...
Makes a flat statistics from the given statistics.
[ "Makes", "a", "flat", "statistics", "from", "the", "given", "statistics", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/stats.py#L357-L373
train
what-studio/profiling
setup.py
requirements
def requirements(filename): """Reads requirements from a file.""" with open(filename) as f: return [x.strip() for x in f.readlines() if x.strip()]
python
def requirements(filename): """Reads requirements from a file.""" with open(filename) as f: return [x.strip() for x in f.readlines() if x.strip()]
[ "def", "requirements", "(", "filename", ")", ":", "with", "open", "(", "filename", ")", "as", "f", ":", "return", "[", "x", ".", "strip", "(", ")", "for", "x", "in", "f", ".", "readlines", "(", ")", "if", "x", ".", "strip", "(", ")", "]" ]
Reads requirements from a file.
[ "Reads", "requirements", "from", "a", "file", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/setup.py#L68-L71
train
what-studio/profiling
profiling/sampling/__init__.py
SamplingProfiler.sample
def sample(self, frame): """Samples the given frame.""" frames = self.frame_stack(frame) if frames: frames.pop() parent_stats = self.stats for f in frames: parent_stats = parent_stats.ensure_child(f.f_code, void) stats = parent_stats.ensure_child(f...
python
def sample(self, frame): """Samples the given frame.""" frames = self.frame_stack(frame) if frames: frames.pop() parent_stats = self.stats for f in frames: parent_stats = parent_stats.ensure_child(f.f_code, void) stats = parent_stats.ensure_child(f...
[ "def", "sample", "(", "self", ",", "frame", ")", ":", "frames", "=", "self", ".", "frame_stack", "(", "frame", ")", "if", "frames", ":", "frames", ".", "pop", "(", ")", "parent_stats", "=", "self", ".", "stats", "for", "f", "in", "frames", ":", "pa...
Samples the given frame.
[ "Samples", "the", "given", "frame", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/sampling/__init__.py#L65-L74
train
what-studio/profiling
profiling/utils.py
deferral
def deferral(): """Defers a function call when it is being required like Go. :: with deferral() as defer: sys.setprofile(f) defer(sys.setprofile, None) # do something. """ deferred = [] defer = lambda f, *a, **k: deferred.append((f, a, k)) try: ...
python
def deferral(): """Defers a function call when it is being required like Go. :: with deferral() as defer: sys.setprofile(f) defer(sys.setprofile, None) # do something. """ deferred = [] defer = lambda f, *a, **k: deferred.append((f, a, k)) try: ...
[ "def", "deferral", "(", ")", ":", "deferred", "=", "[", "]", "defer", "=", "lambda", "f", ",", "*", "a", ",", "*", "*", "k", ":", "deferred", ".", "append", "(", "(", "f", ",", "a", ",", "k", ")", ")", "try", ":", "yield", "defer", "finally",...
Defers a function call when it is being required like Go. :: with deferral() as defer: sys.setprofile(f) defer(sys.setprofile, None) # do something.
[ "Defers", "a", "function", "call", "when", "it", "is", "being", "required", "like", "Go", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/utils.py#L135-L153
train
what-studio/profiling
profiling/utils.py
Runnable.start
def start(self, *args, **kwargs): """Starts the instance. :raises RuntimeError: has been already started. :raises TypeError: :meth:`run` is not canonical. """ if self.is_running(): raise RuntimeError('Already started') self._running = self.run(*args, **kwarg...
python
def start(self, *args, **kwargs): """Starts the instance. :raises RuntimeError: has been already started. :raises TypeError: :meth:`run` is not canonical. """ if self.is_running(): raise RuntimeError('Already started') self._running = self.run(*args, **kwarg...
[ "def", "start", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "self", ".", "is_running", "(", ")", ":", "raise", "RuntimeError", "(", "'Already started'", ")", "self", ".", "_running", "=", "self", ".", "run", "(", "*", "a...
Starts the instance. :raises RuntimeError: has been already started. :raises TypeError: :meth:`run` is not canonical.
[ "Starts", "the", "instance", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/utils.py#L38-L53
train
what-studio/profiling
profiling/utils.py
Runnable.stop
def stop(self): """Stops the instance. :raises RuntimeError: has not been started. :raises TypeError: :meth:`run` is not canonical. """ if not self.is_running(): raise RuntimeError('Not started') running, self._running = self._running, None try: ...
python
def stop(self): """Stops the instance. :raises RuntimeError: has not been started. :raises TypeError: :meth:`run` is not canonical. """ if not self.is_running(): raise RuntimeError('Not started') running, self._running = self._running, None try: ...
[ "def", "stop", "(", "self", ")", ":", "if", "not", "self", ".", "is_running", "(", ")", ":", "raise", "RuntimeError", "(", "'Not started'", ")", "running", ",", "self", ".", "_running", "=", "self", ".", "_running", ",", "None", "try", ":", "next", "...
Stops the instance. :raises RuntimeError: has not been started. :raises TypeError: :meth:`run` is not canonical.
[ "Stops", "the", "instance", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/utils.py#L55-L71
train
what-studio/profiling
profiling/remote/select.py
SelectProfilingServer.sockets
def sockets(self): """Returns the set of the sockets.""" if self.listener is None: return self.clients else: return self.clients.union([self.listener])
python
def sockets(self): """Returns the set of the sockets.""" if self.listener is None: return self.clients else: return self.clients.union([self.listener])
[ "def", "sockets", "(", "self", ")", ":", "if", "self", ".", "listener", "is", "None", ":", "return", "self", ".", "clients", "else", ":", "return", "self", ".", "clients", ".", "union", "(", "[", "self", ".", "listener", "]", ")" ]
Returns the set of the sockets.
[ "Returns", "the", "set", "of", "the", "sockets", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/remote/select.py#L62-L67
train
what-studio/profiling
profiling/remote/select.py
SelectProfilingServer.select_sockets
def select_sockets(self, timeout=None): """EINTR safe version of `select`. It focuses on just incoming sockets. """ if timeout is not None: t = time.time() while True: try: ready, __, __ = select.select(self.sockets(), (), (), timeout) ...
python
def select_sockets(self, timeout=None): """EINTR safe version of `select`. It focuses on just incoming sockets. """ if timeout is not None: t = time.time() while True: try: ready, __, __ = select.select(self.sockets(), (), (), timeout) ...
[ "def", "select_sockets", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "not", "None", ":", "t", "=", "time", ".", "time", "(", ")", "while", "True", ":", "try", ":", "ready", ",", "__", ",", "__", "=", "select", ".", ...
EINTR safe version of `select`. It focuses on just incoming sockets.
[ "EINTR", "safe", "version", "of", "select", ".", "It", "focuses", "on", "just", "incoming", "sockets", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/remote/select.py#L69-L97
train
what-studio/profiling
profiling/remote/select.py
SelectProfilingServer.dispatch_sockets
def dispatch_sockets(self, timeout=None): """Dispatches incoming sockets.""" for sock in self.select_sockets(timeout=timeout): if sock is self.listener: listener = sock sock, addr = listener.accept() self.connected(sock) else: ...
python
def dispatch_sockets(self, timeout=None): """Dispatches incoming sockets.""" for sock in self.select_sockets(timeout=timeout): if sock is self.listener: listener = sock sock, addr = listener.accept() self.connected(sock) else: ...
[ "def", "dispatch_sockets", "(", "self", ",", "timeout", "=", "None", ")", ":", "for", "sock", "in", "self", ".", "select_sockets", "(", "timeout", "=", "timeout", ")", ":", "if", "sock", "is", "self", ".", "listener", ":", "listener", "=", "sock", "soc...
Dispatches incoming sockets.
[ "Dispatches", "incoming", "sockets", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/remote/select.py#L99-L112
train
what-studio/profiling
profiling/tracing/__init__.py
TracingProfiler.record_entering
def record_entering(self, time, code, frame_key, parent_stats): """Entered to a function call.""" stats = parent_stats.ensure_child(code, RecordingStatistics) self._times_entered[(code, frame_key)] = time stats.own_hits += 1
python
def record_entering(self, time, code, frame_key, parent_stats): """Entered to a function call.""" stats = parent_stats.ensure_child(code, RecordingStatistics) self._times_entered[(code, frame_key)] = time stats.own_hits += 1
[ "def", "record_entering", "(", "self", ",", "time", ",", "code", ",", "frame_key", ",", "parent_stats", ")", ":", "stats", "=", "parent_stats", ".", "ensure_child", "(", "code", ",", "RecordingStatistics", ")", "self", ".", "_times_entered", "[", "(", "code"...
Entered to a function call.
[ "Entered", "to", "a", "function", "call", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/tracing/__init__.py#L110-L114
train
what-studio/profiling
profiling/tracing/__init__.py
TracingProfiler.record_leaving
def record_leaving(self, time, code, frame_key, parent_stats): """Left from a function call.""" try: stats = parent_stats.get_child(code) time_entered = self._times_entered.pop((code, frame_key)) except KeyError: return time_elapsed = time - time_enter...
python
def record_leaving(self, time, code, frame_key, parent_stats): """Left from a function call.""" try: stats = parent_stats.get_child(code) time_entered = self._times_entered.pop((code, frame_key)) except KeyError: return time_elapsed = time - time_enter...
[ "def", "record_leaving", "(", "self", ",", "time", ",", "code", ",", "frame_key", ",", "parent_stats", ")", ":", "try", ":", "stats", "=", "parent_stats", ".", "get_child", "(", "code", ")", "time_entered", "=", "self", ".", "_times_entered", ".", "pop", ...
Left from a function call.
[ "Left", "from", "a", "function", "call", "." ]
49666ba3ea295eb73782ae6c18a4ec7929d7d8b7
https://github.com/what-studio/profiling/blob/49666ba3ea295eb73782ae6c18a4ec7929d7d8b7/profiling/tracing/__init__.py#L116-L124
train
semiversus/python-broqer
broqer/op/subscribers/sink.py
build_sink
def build_sink(function: Callable[..., None] = None, *, unpack: bool = False): """ Decorator to wrap a function to return a Sink subscriber. :param function: function to be wrapped :param unpack: value from emits will be unpacked (*value) """ def _build_sink(function: Callable[..., N...
python
def build_sink(function: Callable[..., None] = None, *, unpack: bool = False): """ Decorator to wrap a function to return a Sink subscriber. :param function: function to be wrapped :param unpack: value from emits will be unpacked (*value) """ def _build_sink(function: Callable[..., N...
[ "def", "build_sink", "(", "function", ":", "Callable", "[", "...", ",", "None", "]", "=", "None", ",", "*", ",", "unpack", ":", "bool", "=", "False", ")", ":", "def", "_build_sink", "(", "function", ":", "Callable", "[", "...", ",", "None", "]", ")...
Decorator to wrap a function to return a Sink subscriber. :param function: function to be wrapped :param unpack: value from emits will be unpacked (*value)
[ "Decorator", "to", "wrap", "a", "function", "to", "return", "a", "Sink", "subscriber", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/subscribers/sink.py#L62-L80
train
semiversus/python-broqer
broqer/op/map_.py
build_map
def build_map(function: Callable[[Any], Any] = None, unpack: bool = False): """ Decorator to wrap a function to return a Map operator. :param function: function to be wrapped :param unpack: value from emits will be unpacked (*value) """ def _build_map(function: Callable[[Any], Any]): ...
python
def build_map(function: Callable[[Any], Any] = None, unpack: bool = False): """ Decorator to wrap a function to return a Map operator. :param function: function to be wrapped :param unpack: value from emits will be unpacked (*value) """ def _build_map(function: Callable[[Any], Any]): ...
[ "def", "build_map", "(", "function", ":", "Callable", "[", "[", "Any", "]", ",", "Any", "]", "=", "None", ",", "unpack", ":", "bool", "=", "False", ")", ":", "def", "_build_map", "(", "function", ":", "Callable", "[", "[", "Any", "]", ",", "Any", ...
Decorator to wrap a function to return a Map operator. :param function: function to be wrapped :param unpack: value from emits will be unpacked (*value)
[ "Decorator", "to", "wrap", "a", "function", "to", "return", "a", "Map", "operator", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/map_.py#L92-L110
train
semiversus/python-broqer
broqer/op/subscribers/trace.py
Trace._trace_handler
def _trace_handler(publisher, value, label=None): """ Default trace handler is printing the timestamp, the publisher name and the emitted value """ line = '--- %8.3f: ' % (time() - Trace._timestamp_start) line += repr(publisher) if label is None else label line += ' %r' %...
python
def _trace_handler(publisher, value, label=None): """ Default trace handler is printing the timestamp, the publisher name and the emitted value """ line = '--- %8.3f: ' % (time() - Trace._timestamp_start) line += repr(publisher) if label is None else label line += ' %r' %...
[ "def", "_trace_handler", "(", "publisher", ",", "value", ",", "label", "=", "None", ")", ":", "line", "=", "'--- %8.3f: '", "%", "(", "time", "(", ")", "-", "Trace", ".", "_timestamp_start", ")", "line", "+=", "repr", "(", "publisher", ")", "if", "labe...
Default trace handler is printing the timestamp, the publisher name and the emitted value
[ "Default", "trace", "handler", "is", "printing", "the", "timestamp", "the", "publisher", "name", "and", "the", "emitted", "value" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/subscribers/trace.py#L45-L52
train
semiversus/python-broqer
broqer/op/subscribers/sink_async.py
build_sink_async
def build_sink_async(coro=None, *, mode=None, unpack: bool = False): """ Decorator to wrap a coroutine to return a SinkAsync subscriber. :param coro: coroutine to be wrapped :param mode: behavior when a value is currently processed :param unpack: value from emits will be unpacked (*value) """ _...
python
def build_sink_async(coro=None, *, mode=None, unpack: bool = False): """ Decorator to wrap a coroutine to return a SinkAsync subscriber. :param coro: coroutine to be wrapped :param mode: behavior when a value is currently processed :param unpack: value from emits will be unpacked (*value) """ _...
[ "def", "build_sink_async", "(", "coro", "=", "None", ",", "*", ",", "mode", "=", "None", ",", "unpack", ":", "bool", "=", "False", ")", ":", "_mode", "=", "mode", "def", "_build_sink_async", "(", "coro", ")", ":", "@", "wraps", "(", "coro", ")", "d...
Decorator to wrap a coroutine to return a SinkAsync subscriber. :param coro: coroutine to be wrapped :param mode: behavior when a value is currently processed :param unpack: value from emits will be unpacked (*value)
[ "Decorator", "to", "wrap", "a", "coroutine", "to", "return", "a", "SinkAsync", "subscriber", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/subscribers/sink_async.py#L60-L82
train
semiversus/python-broqer
broqer/op/accumulate.py
build_accumulate
def build_accumulate(function: Callable[[Any, Any], Tuple[Any, Any]] = None, *, init: Any = NONE): """ Decorator to wrap a function to return an Accumulate operator. :param function: function to be wrapped :param init: optional initialization for state """ _init = init def...
python
def build_accumulate(function: Callable[[Any, Any], Tuple[Any, Any]] = None, *, init: Any = NONE): """ Decorator to wrap a function to return an Accumulate operator. :param function: function to be wrapped :param init: optional initialization for state """ _init = init def...
[ "def", "build_accumulate", "(", "function", ":", "Callable", "[", "[", "Any", ",", "Any", "]", ",", "Tuple", "[", "Any", ",", "Any", "]", "]", "=", "None", ",", "*", ",", "init", ":", "Any", "=", "NONE", ")", ":", "_init", "=", "init", "def", "...
Decorator to wrap a function to return an Accumulate operator. :param function: function to be wrapped :param init: optional initialization for state
[ "Decorator", "to", "wrap", "a", "function", "to", "return", "an", "Accumulate", "operator", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/accumulate.py#L75-L96
train
semiversus/python-broqer
broqer/hub/utils/datatype_check.py
resolve_meta_key
def resolve_meta_key(hub, key, meta): """ Resolve a value when it's a string and starts with '>' """ if key not in meta: return None value = meta[key] if isinstance(value, str) and value[0] == '>': topic = value[1:] if topic not in hub: raise KeyError('topic %s not fo...
python
def resolve_meta_key(hub, key, meta): """ Resolve a value when it's a string and starts with '>' """ if key not in meta: return None value = meta[key] if isinstance(value, str) and value[0] == '>': topic = value[1:] if topic not in hub: raise KeyError('topic %s not fo...
[ "def", "resolve_meta_key", "(", "hub", ",", "key", ",", "meta", ")", ":", "if", "key", "not", "in", "meta", ":", "return", "None", "value", "=", "meta", "[", "key", "]", "if", "isinstance", "(", "value", ",", "str", ")", "and", "value", "[", "0", ...
Resolve a value when it's a string and starts with '>'
[ "Resolve", "a", "value", "when", "it", "s", "a", "string", "and", "starts", "with", ">" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/hub/utils/datatype_check.py#L10-L20
train
semiversus/python-broqer
broqer/hub/utils/datatype_check.py
DTTopic.checked_emit
def checked_emit(self, value: Any) -> asyncio.Future: """ Casting and checking in one call """ if not isinstance(self._subject, Subscriber): raise TypeError('Topic %r has to be a subscriber' % self._path) value = self.cast(value) self.check(value) return self._subje...
python
def checked_emit(self, value: Any) -> asyncio.Future: """ Casting and checking in one call """ if not isinstance(self._subject, Subscriber): raise TypeError('Topic %r has to be a subscriber' % self._path) value = self.cast(value) self.check(value) return self._subje...
[ "def", "checked_emit", "(", "self", ",", "value", ":", "Any", ")", "->", "asyncio", ".", "Future", ":", "if", "not", "isinstance", "(", "self", ".", "_subject", ",", "Subscriber", ")", ":", "raise", "TypeError", "(", "'Topic %r has to be a subscriber'", "%",...
Casting and checking in one call
[ "Casting", "and", "checking", "in", "one", "call" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/hub/utils/datatype_check.py#L178-L186
train
semiversus/python-broqer
broqer/hub/utils/datatype_check.py
DTRegistry.add_datatype
def add_datatype(self, name: str, datatype: DT): """ Register the datatype with it's name """ self._datatypes[name] = datatype
python
def add_datatype(self, name: str, datatype: DT): """ Register the datatype with it's name """ self._datatypes[name] = datatype
[ "def", "add_datatype", "(", "self", ",", "name", ":", "str", ",", "datatype", ":", "DT", ")", ":", "self", ".", "_datatypes", "[", "name", "]", "=", "datatype" ]
Register the datatype with it's name
[ "Register", "the", "datatype", "with", "it", "s", "name" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/hub/utils/datatype_check.py#L202-L204
train
semiversus/python-broqer
broqer/hub/utils/datatype_check.py
DTRegistry.cast
def cast(self, topic, value): """ Cast a string to the value based on the datatype """ datatype_key = topic.meta.get('datatype', 'none') result = self._datatypes[datatype_key].cast(topic, value) validate_dt = topic.meta.get('validate', None) if validate_dt: result = s...
python
def cast(self, topic, value): """ Cast a string to the value based on the datatype """ datatype_key = topic.meta.get('datatype', 'none') result = self._datatypes[datatype_key].cast(topic, value) validate_dt = topic.meta.get('validate', None) if validate_dt: result = s...
[ "def", "cast", "(", "self", ",", "topic", ",", "value", ")", ":", "datatype_key", "=", "topic", ".", "meta", ".", "get", "(", "'datatype'", ",", "'none'", ")", "result", "=", "self", ".", "_datatypes", "[", "datatype_key", "]", ".", "cast", "(", "top...
Cast a string to the value based on the datatype
[ "Cast", "a", "string", "to", "the", "value", "based", "on", "the", "datatype" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/hub/utils/datatype_check.py#L213-L220
train
semiversus/python-broqer
broqer/hub/utils/datatype_check.py
DTRegistry.check
def check(self, topic, value): """ Checking the value if it fits into the given specification """ datatype_key = topic.meta.get('datatype', 'none') self._datatypes[datatype_key].check(topic, value) validate_dt = topic.meta.get('validate', None) if validate_dt: self._d...
python
def check(self, topic, value): """ Checking the value if it fits into the given specification """ datatype_key = topic.meta.get('datatype', 'none') self._datatypes[datatype_key].check(topic, value) validate_dt = topic.meta.get('validate', None) if validate_dt: self._d...
[ "def", "check", "(", "self", ",", "topic", ",", "value", ")", ":", "datatype_key", "=", "topic", ".", "meta", ".", "get", "(", "'datatype'", ",", "'none'", ")", "self", ".", "_datatypes", "[", "datatype_key", "]", ".", "check", "(", "topic", ",", "va...
Checking the value if it fits into the given specification
[ "Checking", "the", "value", "if", "it", "fits", "into", "the", "given", "specification" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/hub/utils/datatype_check.py#L222-L228
train
semiversus/python-broqer
broqer/op/partition.py
Partition.flush
def flush(self): """ Emits the current queue and clears the queue """ self.notify(tuple(self._queue)) self._queue.clear()
python
def flush(self): """ Emits the current queue and clears the queue """ self.notify(tuple(self._queue)) self._queue.clear()
[ "def", "flush", "(", "self", ")", ":", "self", ".", "notify", "(", "tuple", "(", "self", ".", "_queue", ")", ")", "self", ".", "_queue", ".", "clear", "(", ")" ]
Emits the current queue and clears the queue
[ "Emits", "the", "current", "queue", "and", "clears", "the", "queue" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/partition.py#L66-L69
train
semiversus/python-broqer
broqer/op/sample.py
Sample._periodic_callback
def _periodic_callback(self): """ Will be started on first emit """ try: self.notify(self._state) # emit to all subscribers except Exception: # pylint: disable=broad-except self._error_callback(*sys.exc_info()) if self._subscriptions: # if there are...
python
def _periodic_callback(self): """ Will be started on first emit """ try: self.notify(self._state) # emit to all subscribers except Exception: # pylint: disable=broad-except self._error_callback(*sys.exc_info()) if self._subscriptions: # if there are...
[ "def", "_periodic_callback", "(", "self", ")", ":", "try", ":", "self", ".", "notify", "(", "self", ".", "_state", ")", "# emit to all subscribers", "except", "Exception", ":", "# pylint: disable=broad-except", "self", ".", "_error_callback", "(", "*", "sys", "....
Will be started on first emit
[ "Will", "be", "started", "on", "first", "emit" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/sample.py#L84-L97
train
semiversus/python-broqer
broqer/op/reduce.py
build_reduce
def build_reduce(function: Callable[[Any, Any], Any] = None, *, init: Any = NONE): """ Decorator to wrap a function to return a Reduce operator. :param function: function to be wrapped :param init: optional initialization for state """ _init = init def _build_reduce(function: ...
python
def build_reduce(function: Callable[[Any, Any], Any] = None, *, init: Any = NONE): """ Decorator to wrap a function to return a Reduce operator. :param function: function to be wrapped :param init: optional initialization for state """ _init = init def _build_reduce(function: ...
[ "def", "build_reduce", "(", "function", ":", "Callable", "[", "[", "Any", ",", "Any", "]", ",", "Any", "]", "=", "None", ",", "*", ",", "init", ":", "Any", "=", "NONE", ")", ":", "_init", "=", "init", "def", "_build_reduce", "(", "function", ":", ...
Decorator to wrap a function to return a Reduce operator. :param function: function to be wrapped :param init: optional initialization for state
[ "Decorator", "to", "wrap", "a", "function", "to", "return", "a", "Reduce", "operator", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/reduce.py#L54-L75
train
semiversus/python-broqer
broqer/op/sliding_window.py
SlidingWindow.flush
def flush(self): """ Flush the queue - this will emit the current queue """ if not self._emit_partial and len(self._state) != self._state.maxlen: self.notify(tuple(self._state)) self._state.clear()
python
def flush(self): """ Flush the queue - this will emit the current queue """ if not self._emit_partial and len(self._state) != self._state.maxlen: self.notify(tuple(self._state)) self._state.clear()
[ "def", "flush", "(", "self", ")", ":", "if", "not", "self", ".", "_emit_partial", "and", "len", "(", "self", ".", "_state", ")", "!=", "self", ".", "_state", ".", "maxlen", ":", "self", ".", "notify", "(", "tuple", "(", "self", ".", "_state", ")", ...
Flush the queue - this will emit the current queue
[ "Flush", "the", "queue", "-", "this", "will", "emit", "the", "current", "queue" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/sliding_window.py#L73-L77
train
semiversus/python-broqer
broqer/op/map_async.py
build_map_async
def build_map_async(coro=None, *, mode=None, unpack: bool = False): """ Decorator to wrap a coroutine to return a MapAsync operator. :param coro: coroutine to be wrapped :param mode: behavior when a value is currently processed :param unpack: value from emits will be unpacked (*value) """ _mode...
python
def build_map_async(coro=None, *, mode=None, unpack: bool = False): """ Decorator to wrap a coroutine to return a MapAsync operator. :param coro: coroutine to be wrapped :param mode: behavior when a value is currently processed :param unpack: value from emits will be unpacked (*value) """ _mode...
[ "def", "build_map_async", "(", "coro", "=", "None", ",", "*", ",", "mode", "=", "None", ",", "unpack", ":", "bool", "=", "False", ")", ":", "_mode", "=", "mode", "def", "_build_map_async", "(", "coro", ")", ":", "@", "wraps", "(", "coro", ")", "def...
Decorator to wrap a coroutine to return a MapAsync operator. :param coro: coroutine to be wrapped :param mode: behavior when a value is currently processed :param unpack: value from emits will be unpacked (*value)
[ "Decorator", "to", "wrap", "a", "coroutine", "to", "return", "a", "MapAsync", "operator", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/map_async.py#L234-L256
train
semiversus/python-broqer
broqer/op/map_async.py
MapAsync._future_done
def _future_done(self, future): """ Will be called when the coroutine is done """ try: # notify the subscribers (except result is an exception or NONE) result = future.result() # may raise exception if result is not NONE: self.notify(result) # may al...
python
def _future_done(self, future): """ Will be called when the coroutine is done """ try: # notify the subscribers (except result is an exception or NONE) result = future.result() # may raise exception if result is not NONE: self.notify(result) # may al...
[ "def", "_future_done", "(", "self", ",", "future", ")", ":", "try", ":", "# notify the subscribers (except result is an exception or NONE)", "result", "=", "future", ".", "result", "(", ")", "# may raise exception", "if", "result", "is", "not", "NONE", ":", "self", ...
Will be called when the coroutine is done
[ "Will", "be", "called", "when", "the", "coroutine", "is", "done" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/map_async.py#L188-L207
train
semiversus/python-broqer
broqer/op/map_async.py
MapAsync._run_coro
def _run_coro(self, value): """ Start the coroutine as task """ # when LAST_DISTINCT is used only start coroutine when value changed if self._options.mode is MODE.LAST_DISTINCT and \ value == self._last_emit: self._future = None return # store th...
python
def _run_coro(self, value): """ Start the coroutine as task """ # when LAST_DISTINCT is used only start coroutine when value changed if self._options.mode is MODE.LAST_DISTINCT and \ value == self._last_emit: self._future = None return # store th...
[ "def", "_run_coro", "(", "self", ",", "value", ")", ":", "# when LAST_DISTINCT is used only start coroutine when value changed", "if", "self", ".", "_options", ".", "mode", "is", "MODE", ".", "LAST_DISTINCT", "and", "value", "==", "self", ".", "_last_emit", ":", "...
Start the coroutine as task
[ "Start", "the", "coroutine", "as", "task" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/map_async.py#L209-L231
train
semiversus/python-broqer
broqer/op/filter_.py
build_filter
def build_filter(predicate: Callable[[Any], bool] = None, *, unpack: bool = False): """ Decorator to wrap a function to return a Filter operator. :param predicate: function to be wrapped :param unpack: value from emits will be unpacked (*value) """ def _build_filter(predicate: Call...
python
def build_filter(predicate: Callable[[Any], bool] = None, *, unpack: bool = False): """ Decorator to wrap a function to return a Filter operator. :param predicate: function to be wrapped :param unpack: value from emits will be unpacked (*value) """ def _build_filter(predicate: Call...
[ "def", "build_filter", "(", "predicate", ":", "Callable", "[", "[", "Any", "]", ",", "bool", "]", "=", "None", ",", "*", ",", "unpack", ":", "bool", "=", "False", ")", ":", "def", "_build_filter", "(", "predicate", ":", "Callable", "[", "[", "Any", ...
Decorator to wrap a function to return a Filter operator. :param predicate: function to be wrapped :param unpack: value from emits will be unpacked (*value)
[ "Decorator", "to", "wrap", "a", "function", "to", "return", "a", "Filter", "operator", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/filter_.py#L119-L137
train
semiversus/python-broqer
broqer/op/operator_overloading.py
apply_operator_overloading
def apply_operator_overloading(): """ Function to apply operator overloading to Publisher class """ # operator overloading is (unfortunately) not working for the following # cases: # int, float, str - should return appropriate type instead of a Publisher # len - should return an integer # "x in ...
python
def apply_operator_overloading(): """ Function to apply operator overloading to Publisher class """ # operator overloading is (unfortunately) not working for the following # cases: # int, float, str - should return appropriate type instead of a Publisher # len - should return an integer # "x in ...
[ "def", "apply_operator_overloading", "(", ")", ":", "# operator overloading is (unfortunately) not working for the following", "# cases:", "# int, float, str - should return appropriate type instead of a Publisher", "# len - should return an integer", "# \"x in y\" - is using __bool__ which is not...
Function to apply operator overloading to Publisher class
[ "Function", "to", "apply", "operator", "overloading", "to", "Publisher", "class" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/operator_overloading.py#L112-L162
train
semiversus/python-broqer
broqer/hub/hub.py
Topic.assign
def assign(self, subject): """ Assigns the given subject to the topic """ if not isinstance(subject, (Publisher, Subscriber)): raise TypeError('Assignee has to be Publisher or Subscriber') # check if not already assigned if self._subject is not None: raise Subscr...
python
def assign(self, subject): """ Assigns the given subject to the topic """ if not isinstance(subject, (Publisher, Subscriber)): raise TypeError('Assignee has to be Publisher or Subscriber') # check if not already assigned if self._subject is not None: raise Subscr...
[ "def", "assign", "(", "self", ",", "subject", ")", ":", "if", "not", "isinstance", "(", "subject", ",", "(", "Publisher", ",", "Subscriber", ")", ")", ":", "raise", "TypeError", "(", "'Assignee has to be Publisher or Subscriber'", ")", "# check if not already assi...
Assigns the given subject to the topic
[ "Assigns", "the", "given", "subject", "to", "the", "topic" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/hub/hub.py#L149-L170
train
semiversus/python-broqer
broqer/hub/hub.py
Hub.freeze
def freeze(self, freeze: bool = True): """ Freezing the hub means that each topic has to be assigned and no new topics can be created after this point. """ for topic in self._topics.values(): topic.freeze() self._frozen = freeze
python
def freeze(self, freeze: bool = True): """ Freezing the hub means that each topic has to be assigned and no new topics can be created after this point. """ for topic in self._topics.values(): topic.freeze() self._frozen = freeze
[ "def", "freeze", "(", "self", ",", "freeze", ":", "bool", "=", "True", ")", ":", "for", "topic", "in", "self", ".", "_topics", ".", "values", "(", ")", ":", "topic", ".", "freeze", "(", ")", "self", ".", "_frozen", "=", "freeze" ]
Freezing the hub means that each topic has to be assigned and no new topics can be created after this point.
[ "Freezing", "the", "hub", "means", "that", "each", "topic", "has", "to", "be", "assigned", "and", "no", "new", "topics", "can", "be", "created", "after", "this", "point", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/hub/hub.py#L247-L253
train
semiversus/python-broqer
broqer/op/throttle.py
Throttle.reset
def reset(self): """ Reseting duration for throttling """ if self._call_later_handler is not None: self._call_later_handler.cancel() self._call_later_handler = None self._wait_done_cb()
python
def reset(self): """ Reseting duration for throttling """ if self._call_later_handler is not None: self._call_later_handler.cancel() self._call_later_handler = None self._wait_done_cb()
[ "def", "reset", "(", "self", ")", ":", "if", "self", ".", "_call_later_handler", "is", "not", "None", ":", "self", ".", "_call_later_handler", ".", "cancel", "(", ")", "self", ".", "_call_later_handler", "=", "None", "self", ".", "_wait_done_cb", "(", ")" ...
Reseting duration for throttling
[ "Reseting", "duration", "for", "throttling" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/throttle.py#L82-L87
train
semiversus/python-broqer
broqer/op/map_threaded.py
build_map_threaded
def build_map_threaded(function: Callable[[Any], Any] = None, mode=MODE.CONCURRENT, unpack: bool = False): """ Decorator to wrap a function to return a MapThreaded operator. :param function: function to be wrapped :param mode: behavior when a value is currently processed :param u...
python
def build_map_threaded(function: Callable[[Any], Any] = None, mode=MODE.CONCURRENT, unpack: bool = False): """ Decorator to wrap a function to return a MapThreaded operator. :param function: function to be wrapped :param mode: behavior when a value is currently processed :param u...
[ "def", "build_map_threaded", "(", "function", ":", "Callable", "[", "[", "Any", "]", ",", "Any", "]", "=", "None", ",", "mode", "=", "MODE", ".", "CONCURRENT", ",", "unpack", ":", "bool", "=", "False", ")", ":", "_mode", "=", "mode", "def", "_build_m...
Decorator to wrap a function to return a MapThreaded operator. :param function: function to be wrapped :param mode: behavior when a value is currently processed :param unpack: value from emits will be unpacked (*value)
[ "Decorator", "to", "wrap", "a", "function", "to", "return", "a", "MapThreaded", "operator", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/map_threaded.py#L130-L154
train
semiversus/python-broqer
broqer/op/map_threaded.py
MapThreaded._thread_coro
async def _thread_coro(self, *args): """ Coroutine called by MapAsync. It's wrapping the call of run_in_executor to run the synchronous function as thread """ return await self._loop.run_in_executor( self._executor, self._function, *args)
python
async def _thread_coro(self, *args): """ Coroutine called by MapAsync. It's wrapping the call of run_in_executor to run the synchronous function as thread """ return await self._loop.run_in_executor( self._executor, self._function, *args)
[ "async", "def", "_thread_coro", "(", "self", ",", "*", "args", ")", ":", "return", "await", "self", ".", "_loop", ".", "run_in_executor", "(", "self", ".", "_executor", ",", "self", ".", "_function", ",", "*", "args", ")" ]
Coroutine called by MapAsync. It's wrapping the call of run_in_executor to run the synchronous function as thread
[ "Coroutine", "called", "by", "MapAsync", ".", "It", "s", "wrapping", "the", "call", "of", "run_in_executor", "to", "run", "the", "synchronous", "function", "as", "thread" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/map_threaded.py#L123-L127
train
semiversus/python-broqer
broqer/op/debounce.py
Debounce.reset
def reset(self): """ Reset the debounce time """ if self._retrigger_value is not NONE: self.notify(self._retrigger_value) self._state = self._retrigger_value self._next_state = self._retrigger_value if self._call_later_handler: self._call_later_han...
python
def reset(self): """ Reset the debounce time """ if self._retrigger_value is not NONE: self.notify(self._retrigger_value) self._state = self._retrigger_value self._next_state = self._retrigger_value if self._call_later_handler: self._call_later_han...
[ "def", "reset", "(", "self", ")", ":", "if", "self", ".", "_retrigger_value", "is", "not", "NONE", ":", "self", ".", "notify", "(", "self", ".", "_retrigger_value", ")", "self", ".", "_state", "=", "self", ".", "_retrigger_value", "self", ".", "_next_sta...
Reset the debounce time
[ "Reset", "the", "debounce", "time" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/op/debounce.py#L136-L144
train
semiversus/python-broqer
broqer/publisher.py
Publisher.subscribe
def subscribe(self, subscriber: 'Subscriber', prepend: bool = False) -> SubscriptionDisposable: """ Subscribing the given subscriber. :param subscriber: subscriber to add :param prepend: For internal use - usually the subscribers will be added at the end of a list....
python
def subscribe(self, subscriber: 'Subscriber', prepend: bool = False) -> SubscriptionDisposable: """ Subscribing the given subscriber. :param subscriber: subscriber to add :param prepend: For internal use - usually the subscribers will be added at the end of a list....
[ "def", "subscribe", "(", "self", ",", "subscriber", ":", "'Subscriber'", ",", "prepend", ":", "bool", "=", "False", ")", "->", "SubscriptionDisposable", ":", "# `subscriber in self._subscriptions` is not working because", "# tuple.__contains__ is using __eq__ which is overwritt...
Subscribing the given subscriber. :param subscriber: subscriber to add :param prepend: For internal use - usually the subscribers will be added at the end of a list. When prepend is True, it will be added in front of the list. This will habe an effect in the order the ...
[ "Subscribing", "the", "given", "subscriber", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/publisher.py#L45-L68
train
semiversus/python-broqer
broqer/publisher.py
Publisher.unsubscribe
def unsubscribe(self, subscriber: 'Subscriber') -> None: """ Unsubscribe the given subscriber :param subscriber: subscriber to unsubscribe :raises SubscriptionError: if subscriber is not subscribed (anymore) """ # here is a special implementation which is replacing the more ...
python
def unsubscribe(self, subscriber: 'Subscriber') -> None: """ Unsubscribe the given subscriber :param subscriber: subscriber to unsubscribe :raises SubscriptionError: if subscriber is not subscribed (anymore) """ # here is a special implementation which is replacing the more ...
[ "def", "unsubscribe", "(", "self", ",", "subscriber", ":", "'Subscriber'", ")", "->", "None", ":", "# here is a special implementation which is replacing the more", "# obvious one: self._subscriptions.remove(subscriber) - this will not", "# work because list.remove(x) is doing comparisio...
Unsubscribe the given subscriber :param subscriber: subscriber to unsubscribe :raises SubscriptionError: if subscriber is not subscribed (anymore)
[ "Unsubscribe", "the", "given", "subscriber" ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/publisher.py#L70-L85
train
semiversus/python-broqer
broqer/publisher.py
Publisher.inherit_type
def inherit_type(self, type_cls: Type[TInherit]) \ -> Union[TInherit, 'Publisher']: """ enables the usage of method and attribute overloading for this publisher. """ self._inherited_type = type_cls return self
python
def inherit_type(self, type_cls: Type[TInherit]) \ -> Union[TInherit, 'Publisher']: """ enables the usage of method and attribute overloading for this publisher. """ self._inherited_type = type_cls return self
[ "def", "inherit_type", "(", "self", ",", "type_cls", ":", "Type", "[", "TInherit", "]", ")", "->", "Union", "[", "TInherit", ",", "'Publisher'", "]", ":", "self", ".", "_inherited_type", "=", "type_cls", "return", "self" ]
enables the usage of method and attribute overloading for this publisher.
[ "enables", "the", "usage", "of", "method", "and", "attribute", "overloading", "for", "this", "publisher", "." ]
8957110b034f982451392072d9fa16761adc9c9e
https://github.com/semiversus/python-broqer/blob/8957110b034f982451392072d9fa16761adc9c9e/broqer/publisher.py#L150-L156
train
astropy/photutils
photutils/extern/sigma_clipping.py
_move_tuple_axes_first
def _move_tuple_axes_first(array, axis): """ Bottleneck can only take integer axis, not tuple, so this function takes all the axes to be operated on and combines them into the first dimension of the array so that we can then use axis=0 """ # Figure out how many axes we are operating over na...
python
def _move_tuple_axes_first(array, axis): """ Bottleneck can only take integer axis, not tuple, so this function takes all the axes to be operated on and combines them into the first dimension of the array so that we can then use axis=0 """ # Figure out how many axes we are operating over na...
[ "def", "_move_tuple_axes_first", "(", "array", ",", "axis", ")", ":", "# Figure out how many axes we are operating over", "naxis", "=", "len", "(", "axis", ")", "# Add remaining axes to the axis tuple", "axis", "+=", "tuple", "(", "i", "for", "i", "in", "range", "("...
Bottleneck can only take integer axis, not tuple, so this function takes all the axes to be operated on and combines them into the first dimension of the array so that we can then use axis=0
[ "Bottleneck", "can", "only", "take", "integer", "axis", "not", "tuple", "so", "this", "function", "takes", "all", "the", "axes", "to", "be", "operated", "on", "and", "combines", "them", "into", "the", "first", "dimension", "of", "the", "array", "so", "that...
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L22-L48
train
astropy/photutils
photutils/extern/sigma_clipping.py
_nanmean
def _nanmean(array, axis=None): """Bottleneck nanmean function that handle tuple axis.""" if isinstance(axis, tuple): array = _move_tuple_axes_first(array, axis=axis) axis = 0 return bottleneck.nanmean(array, axis=axis)
python
def _nanmean(array, axis=None): """Bottleneck nanmean function that handle tuple axis.""" if isinstance(axis, tuple): array = _move_tuple_axes_first(array, axis=axis) axis = 0 return bottleneck.nanmean(array, axis=axis)
[ "def", "_nanmean", "(", "array", ",", "axis", "=", "None", ")", ":", "if", "isinstance", "(", "axis", ",", "tuple", ")", ":", "array", "=", "_move_tuple_axes_first", "(", "array", ",", "axis", "=", "axis", ")", "axis", "=", "0", "return", "bottleneck",...
Bottleneck nanmean function that handle tuple axis.
[ "Bottleneck", "nanmean", "function", "that", "handle", "tuple", "axis", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L51-L57
train
astropy/photutils
photutils/extern/sigma_clipping.py
_nanmedian
def _nanmedian(array, axis=None): """Bottleneck nanmedian function that handle tuple axis.""" if isinstance(axis, tuple): array = _move_tuple_axes_first(array, axis=axis) axis = 0 return bottleneck.nanmedian(array, axis=axis)
python
def _nanmedian(array, axis=None): """Bottleneck nanmedian function that handle tuple axis.""" if isinstance(axis, tuple): array = _move_tuple_axes_first(array, axis=axis) axis = 0 return bottleneck.nanmedian(array, axis=axis)
[ "def", "_nanmedian", "(", "array", ",", "axis", "=", "None", ")", ":", "if", "isinstance", "(", "axis", ",", "tuple", ")", ":", "array", "=", "_move_tuple_axes_first", "(", "array", ",", "axis", "=", "axis", ")", "axis", "=", "0", "return", "bottleneck...
Bottleneck nanmedian function that handle tuple axis.
[ "Bottleneck", "nanmedian", "function", "that", "handle", "tuple", "axis", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L60-L66
train
astropy/photutils
photutils/extern/sigma_clipping.py
_nanstd
def _nanstd(array, axis=None, ddof=0): """Bottleneck nanstd function that handle tuple axis.""" if isinstance(axis, tuple): array = _move_tuple_axes_first(array, axis=axis) axis = 0 return bottleneck.nanstd(array, axis=axis, ddof=ddof)
python
def _nanstd(array, axis=None, ddof=0): """Bottleneck nanstd function that handle tuple axis.""" if isinstance(axis, tuple): array = _move_tuple_axes_first(array, axis=axis) axis = 0 return bottleneck.nanstd(array, axis=axis, ddof=ddof)
[ "def", "_nanstd", "(", "array", ",", "axis", "=", "None", ",", "ddof", "=", "0", ")", ":", "if", "isinstance", "(", "axis", ",", "tuple", ")", ":", "array", "=", "_move_tuple_axes_first", "(", "array", ",", "axis", "=", "axis", ")", "axis", "=", "0...
Bottleneck nanstd function that handle tuple axis.
[ "Bottleneck", "nanstd", "function", "that", "handle", "tuple", "axis", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L69-L75
train
astropy/photutils
photutils/extern/sigma_clipping.py
sigma_clip
def sigma_clip(data, sigma=3, sigma_lower=None, sigma_upper=None, maxiters=5, cenfunc='median', stdfunc='std', axis=None, masked=True, return_bounds=False, copy=True): """ Perform sigma-clipping on the provided data. The data will be iterated over, each time rejecting values t...
python
def sigma_clip(data, sigma=3, sigma_lower=None, sigma_upper=None, maxiters=5, cenfunc='median', stdfunc='std', axis=None, masked=True, return_bounds=False, copy=True): """ Perform sigma-clipping on the provided data. The data will be iterated over, each time rejecting values t...
[ "def", "sigma_clip", "(", "data", ",", "sigma", "=", "3", ",", "sigma_lower", "=", "None", ",", "sigma_upper", "=", "None", ",", "maxiters", "=", "5", ",", "cenfunc", "=", "'median'", ",", "stdfunc", "=", "'std'", ",", "axis", "=", "None", ",", "mask...
Perform sigma-clipping on the provided data. The data will be iterated over, each time rejecting values that are less or more than a specified number of standard deviations from a center value. Clipped (rejected) pixels are those where:: data < cenfunc(data [,axis=int]) - (sigma_lower * stdfu...
[ "Perform", "sigma", "-", "clipping", "on", "the", "provided", "data", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L467-L640
train
astropy/photutils
photutils/extern/sigma_clipping.py
sigma_clipped_stats
def sigma_clipped_stats(data, mask=None, mask_value=None, sigma=3.0, sigma_lower=None, sigma_upper=None, maxiters=5, cenfunc='median', stdfunc='std', std_ddof=0, axis=None): """ Calculate sigma-clipped statistics on the provided data. ...
python
def sigma_clipped_stats(data, mask=None, mask_value=None, sigma=3.0, sigma_lower=None, sigma_upper=None, maxiters=5, cenfunc='median', stdfunc='std', std_ddof=0, axis=None): """ Calculate sigma-clipped statistics on the provided data. ...
[ "def", "sigma_clipped_stats", "(", "data", ",", "mask", "=", "None", ",", "mask_value", "=", "None", ",", "sigma", "=", "3.0", ",", "sigma_lower", "=", "None", ",", "sigma_upper", "=", "None", ",", "maxiters", "=", "5", ",", "cenfunc", "=", "'median'", ...
Calculate sigma-clipped statistics on the provided data. Parameters ---------- data : array-like or `~numpy.ma.MaskedArray` Data array or object that can be converted to an array. mask : `numpy.ndarray` (bool), optional A boolean mask with the same shape as ``data``, where a `True` ...
[ "Calculate", "sigma", "-", "clipped", "statistics", "on", "the", "provided", "data", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L644-L753
train
astropy/photutils
photutils/extern/sigma_clipping.py
SigmaClip._sigmaclip_noaxis
def _sigmaclip_noaxis(self, data, masked=True, return_bounds=False, copy=True): """ Sigma clip the data when ``axis`` is None. In this simple case, we remove clipped elements from the flattened array during each iteration. """ filtered_data = d...
python
def _sigmaclip_noaxis(self, data, masked=True, return_bounds=False, copy=True): """ Sigma clip the data when ``axis`` is None. In this simple case, we remove clipped elements from the flattened array during each iteration. """ filtered_data = d...
[ "def", "_sigmaclip_noaxis", "(", "self", ",", "data", ",", "masked", "=", "True", ",", "return_bounds", "=", "False", ",", "copy", "=", "True", ")", ":", "filtered_data", "=", "data", ".", "ravel", "(", ")", "# remove masked values and convert to ndarray", "if...
Sigma clip the data when ``axis`` is None. In this simple case, we remove clipped elements from the flattened array during each iteration.
[ "Sigma", "clip", "the", "data", "when", "axis", "is", "None", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L265-L313
train
astropy/photutils
photutils/extern/sigma_clipping.py
SigmaClip._sigmaclip_withaxis
def _sigmaclip_withaxis(self, data, axis=None, masked=True, return_bounds=False, copy=True): """ Sigma clip the data when ``axis`` is specified. In this case, we replace clipped values with NaNs as placeholder values. """ # float array type i...
python
def _sigmaclip_withaxis(self, data, axis=None, masked=True, return_bounds=False, copy=True): """ Sigma clip the data when ``axis`` is specified. In this case, we replace clipped values with NaNs as placeholder values. """ # float array type i...
[ "def", "_sigmaclip_withaxis", "(", "self", ",", "data", ",", "axis", "=", "None", ",", "masked", "=", "True", ",", "return_bounds", "=", "False", ",", "copy", "=", "True", ")", ":", "# float array type is needed to insert nans into the array", "filtered_data", "="...
Sigma clip the data when ``axis`` is specified. In this case, we replace clipped values with NaNs as placeholder values.
[ "Sigma", "clip", "the", "data", "when", "axis", "is", "specified", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/extern/sigma_clipping.py#L315-L385
train
astropy/photutils
photutils/aperture/core.py
PixelAperture.do_photometry
def do_photometry(self, data, error=None, mask=None, method='exact', subpixels=5, unit=None): """ Perform aperture photometry on the input data. Parameters ---------- data : array_like or `~astropy.units.Quantity` instance The 2D array on which ...
python
def do_photometry(self, data, error=None, mask=None, method='exact', subpixels=5, unit=None): """ Perform aperture photometry on the input data. Parameters ---------- data : array_like or `~astropy.units.Quantity` instance The 2D array on which ...
[ "def", "do_photometry", "(", "self", ",", "data", ",", "error", "=", "None", ",", "mask", "=", "None", ",", "method", "=", "'exact'", ",", "subpixels", "=", "5", ",", "unit", "=", "None", ")", ":", "data", "=", "np", ".", "asanyarray", "(", "data",...
Perform aperture photometry on the input data. Parameters ---------- data : array_like or `~astropy.units.Quantity` instance The 2D array on which to perform photometry. ``data`` should be background subtracted. error : array_like or `~astropy.units.Quantity`, ...
[ "Perform", "aperture", "photometry", "on", "the", "input", "data", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/core.py#L301-L410
train
astropy/photutils
photutils/aperture/core.py
PixelAperture._to_sky_params
def _to_sky_params(self, wcs, mode='all'): """ Convert the pixel aperture parameters to those for a sky aperture. Parameters ---------- wcs : `~astropy.wcs.WCS` The world coordinate system (WCS) transformation to use. mode : {'all', 'wcs'}, optional ...
python
def _to_sky_params(self, wcs, mode='all'): """ Convert the pixel aperture parameters to those for a sky aperture. Parameters ---------- wcs : `~astropy.wcs.WCS` The world coordinate system (WCS) transformation to use. mode : {'all', 'wcs'}, optional ...
[ "def", "_to_sky_params", "(", "self", ",", "wcs", ",", "mode", "=", "'all'", ")", ":", "sky_params", "=", "{", "}", "x", ",", "y", "=", "np", ".", "transpose", "(", "self", ".", "positions", ")", "sky_params", "[", "'positions'", "]", "=", "pixel_to_...
Convert the pixel aperture parameters to those for a sky aperture. Parameters ---------- wcs : `~astropy.wcs.WCS` The world coordinate system (WCS) transformation to use. mode : {'all', 'wcs'}, optional Whether to do the transformation including distorti...
[ "Convert", "the", "pixel", "aperture", "parameters", "to", "those", "for", "a", "sky", "aperture", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/core.py#L526-L568
train
astropy/photutils
photutils/aperture/core.py
SkyAperture._to_pixel_params
def _to_pixel_params(self, wcs, mode='all'): """ Convert the sky aperture parameters to those for a pixel aperture. Parameters ---------- wcs : `~astropy.wcs.WCS` The world coordinate system (WCS) transformation to use. mode : {'all', 'wcs'}, optiona...
python
def _to_pixel_params(self, wcs, mode='all'): """ Convert the sky aperture parameters to those for a pixel aperture. Parameters ---------- wcs : `~astropy.wcs.WCS` The world coordinate system (WCS) transformation to use. mode : {'all', 'wcs'}, optiona...
[ "def", "_to_pixel_params", "(", "self", ",", "wcs", ",", "mode", "=", "'all'", ")", ":", "pixel_params", "=", "{", "}", "x", ",", "y", "=", "skycoord_to_pixel", "(", "self", ".", "positions", ",", "wcs", ",", "mode", "=", "mode", ")", "pixel_params", ...
Convert the sky aperture parameters to those for a pixel aperture. Parameters ---------- wcs : `~astropy.wcs.WCS` The world coordinate system (WCS) transformation to use. mode : {'all', 'wcs'}, optional Whether to do the transformation including distorti...
[ "Convert", "the", "sky", "aperture", "parameters", "to", "those", "for", "a", "pixel", "aperture", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/aperture/core.py#L601-L647
train
astropy/photutils
photutils/segmentation/properties.py
source_properties
def source_properties(data, segment_img, error=None, mask=None, background=None, filter_kernel=None, wcs=None, labels=None): """ Calculate photometry and morphological properties of sources defined by a labeled segmentation image. Parameters ---------- ...
python
def source_properties(data, segment_img, error=None, mask=None, background=None, filter_kernel=None, wcs=None, labels=None): """ Calculate photometry and morphological properties of sources defined by a labeled segmentation image. Parameters ---------- ...
[ "def", "source_properties", "(", "data", ",", "segment_img", ",", "error", "=", "None", ",", "mask", "=", "None", ",", "background", "=", "None", ",", "filter_kernel", "=", "None", ",", "wcs", "=", "None", ",", "labels", "=", "None", ")", ":", "if", ...
Calculate photometry and morphological properties of sources defined by a labeled segmentation image. Parameters ---------- data : array_like or `~astropy.units.Quantity` The 2D array from which to calculate the source photometry and properties. ``data`` should be background-subtracted...
[ "Calculate", "photometry", "and", "morphological", "properties", "of", "sources", "defined", "by", "a", "labeled", "segmentation", "image", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L1223-L1412
train
astropy/photutils
photutils/segmentation/properties.py
_properties_table
def _properties_table(obj, columns=None, exclude_columns=None): """ Construct a `~astropy.table.QTable` of source properties from a `SourceProperties` or `SourceCatalog` object. Parameters ---------- obj : `SourceProperties` or `SourceCatalog` instance The object containing the source p...
python
def _properties_table(obj, columns=None, exclude_columns=None): """ Construct a `~astropy.table.QTable` of source properties from a `SourceProperties` or `SourceCatalog` object. Parameters ---------- obj : `SourceProperties` or `SourceCatalog` instance The object containing the source p...
[ "def", "_properties_table", "(", "obj", ",", "columns", "=", "None", ",", "exclude_columns", "=", "None", ")", ":", "# default properties", "columns_all", "=", "[", "'id'", ",", "'xcentroid'", ",", "'ycentroid'", ",", "'sky_centroid'", ",", "'sky_centroid_icrs'", ...
Construct a `~astropy.table.QTable` of source properties from a `SourceProperties` or `SourceCatalog` object. Parameters ---------- obj : `SourceProperties` or `SourceCatalog` instance The object containing the source properties. columns : str or list of str, optional Names of colu...
[ "Construct", "a", "~astropy", ".", "table", ".", "QTable", "of", "source", "properties", "from", "a", "SourceProperties", "or", "SourceCatalog", "object", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L1609-L1673
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties._total_mask
def _total_mask(self): """ Combination of the _segment_mask, _input_mask, and _data_mask. This mask is applied to ``data``, ``error``, and ``background`` inputs when calculating properties. """ mask = self._segment_mask | self._data_mask if self._input_mask is ...
python
def _total_mask(self): """ Combination of the _segment_mask, _input_mask, and _data_mask. This mask is applied to ``data``, ``error``, and ``background`` inputs when calculating properties. """ mask = self._segment_mask | self._data_mask if self._input_mask is ...
[ "def", "_total_mask", "(", "self", ")", ":", "mask", "=", "self", ".", "_segment_mask", "|", "self", ".", "_data_mask", "if", "self", ".", "_input_mask", "is", "not", "None", ":", "mask", "|=", "self", ".", "_input_mask", "return", "mask" ]
Combination of the _segment_mask, _input_mask, and _data_mask. This mask is applied to ``data``, ``error``, and ``background`` inputs when calculating properties.
[ "Combination", "of", "the", "_segment_mask", "_input_mask", "and", "_data_mask", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L228-L241
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.to_table
def to_table(self, columns=None, exclude_columns=None): """ Create a `~astropy.table.QTable` of properties. If ``columns`` or ``exclude_columns`` are not input, then the `~astropy.table.QTable` will include a default list of scalar-valued properties. Parameters ...
python
def to_table(self, columns=None, exclude_columns=None): """ Create a `~astropy.table.QTable` of properties. If ``columns`` or ``exclude_columns`` are not input, then the `~astropy.table.QTable` will include a default list of scalar-valued properties. Parameters ...
[ "def", "to_table", "(", "self", ",", "columns", "=", "None", ",", "exclude_columns", "=", "None", ")", ":", "return", "_properties_table", "(", "self", ",", "columns", "=", "columns", ",", "exclude_columns", "=", "exclude_columns", ")" ]
Create a `~astropy.table.QTable` of properties. If ``columns`` or ``exclude_columns`` are not input, then the `~astropy.table.QTable` will include a default list of scalar-valued properties. Parameters ---------- columns : str or list of str, optional Names ...
[ "Create", "a", "~astropy", ".", "table", ".", "QTable", "of", "properties", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L330-L356
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.data_cutout_ma
def data_cutout_ma(self): """ A 2D `~numpy.ma.MaskedArray` cutout from the data. The mask is `True` for pixels outside of the source segment (labeled region of interest), masked pixels from the ``mask`` input, or any non-finite ``data`` values (e.g. NaN or inf). """ ...
python
def data_cutout_ma(self): """ A 2D `~numpy.ma.MaskedArray` cutout from the data. The mask is `True` for pixels outside of the source segment (labeled region of interest), masked pixels from the ``mask`` input, or any non-finite ``data`` values (e.g. NaN or inf). """ ...
[ "def", "data_cutout_ma", "(", "self", ")", ":", "return", "np", ".", "ma", ".", "masked_array", "(", "self", ".", "_data", "[", "self", ".", "_slice", "]", ",", "mask", "=", "self", ".", "_total_mask", ")" ]
A 2D `~numpy.ma.MaskedArray` cutout from the data. The mask is `True` for pixels outside of the source segment (labeled region of interest), masked pixels from the ``mask`` input, or any non-finite ``data`` values (e.g. NaN or inf).
[ "A", "2D", "~numpy", ".", "ma", ".", "MaskedArray", "cutout", "from", "the", "data", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L368-L378
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.error_cutout_ma
def error_cutout_ma(self): """ A 2D `~numpy.ma.MaskedArray` cutout from the input ``error`` image. The mask is `True` for pixels outside of the source segment (labeled region of interest), masked pixels from the ``mask`` input, or any non-finite ``data`` values (e.g. NaN...
python
def error_cutout_ma(self): """ A 2D `~numpy.ma.MaskedArray` cutout from the input ``error`` image. The mask is `True` for pixels outside of the source segment (labeled region of interest), masked pixels from the ``mask`` input, or any non-finite ``data`` values (e.g. NaN...
[ "def", "error_cutout_ma", "(", "self", ")", ":", "if", "self", ".", "_error", "is", "None", ":", "return", "None", "else", ":", "return", "np", ".", "ma", ".", "masked_array", "(", "self", ".", "_error", "[", "self", ".", "_slice", "]", ",", "mask", ...
A 2D `~numpy.ma.MaskedArray` cutout from the input ``error`` image. The mask is `True` for pixels outside of the source segment (labeled region of interest), masked pixels from the ``mask`` input, or any non-finite ``data`` values (e.g. NaN or inf). If ``error`` is `None`, then...
[ "A", "2D", "~numpy", ".", "ma", ".", "MaskedArray", "cutout", "from", "the", "input", "error", "image", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L381-L397
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.background_cutout_ma
def background_cutout_ma(self): """ A 2D `~numpy.ma.MaskedArray` cutout from the input ``background``. The mask is `True` for pixels outside of the source segment (labeled region of interest), masked pixels from the ``mask`` input, or any non-finite ``data`` values (e.g....
python
def background_cutout_ma(self): """ A 2D `~numpy.ma.MaskedArray` cutout from the input ``background``. The mask is `True` for pixels outside of the source segment (labeled region of interest), masked pixels from the ``mask`` input, or any non-finite ``data`` values (e.g....
[ "def", "background_cutout_ma", "(", "self", ")", ":", "if", "self", ".", "_background", "is", "None", ":", "return", "None", "else", ":", "return", "np", ".", "ma", ".", "masked_array", "(", "self", ".", "_background", "[", "self", ".", "_slice", "]", ...
A 2D `~numpy.ma.MaskedArray` cutout from the input ``background``. The mask is `True` for pixels outside of the source segment (labeled region of interest), masked pixels from the ``mask`` input, or any non-finite ``data`` values (e.g. NaN or inf). If ``background`` is `None`, ...
[ "A", "2D", "~numpy", ".", "ma", ".", "MaskedArray", "cutout", "from", "the", "input", "background", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L400-L417
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.coords
def coords(self): """ A tuple of two `~numpy.ndarray` containing the ``y`` and ``x`` pixel coordinates of unmasked pixels within the source segment. Non-finite pixel values (e.g. NaN, infs) are excluded (automatically masked). If all pixels are masked, ``coords`` will b...
python
def coords(self): """ A tuple of two `~numpy.ndarray` containing the ``y`` and ``x`` pixel coordinates of unmasked pixels within the source segment. Non-finite pixel values (e.g. NaN, infs) are excluded (automatically masked). If all pixels are masked, ``coords`` will b...
[ "def", "coords", "(", "self", ")", ":", "yy", ",", "xx", "=", "np", ".", "nonzero", "(", "self", ".", "data_cutout_ma", ")", "return", "(", "yy", "+", "self", ".", "_slice", "[", "0", "]", ".", "start", ",", "xx", "+", "self", ".", "_slice", "[...
A tuple of two `~numpy.ndarray` containing the ``y`` and ``x`` pixel coordinates of unmasked pixels within the source segment. Non-finite pixel values (e.g. NaN, infs) are excluded (automatically masked). If all pixels are masked, ``coords`` will be a tuple of two empty arrays.
[ "A", "tuple", "of", "two", "~numpy", ".", "ndarray", "containing", "the", "y", "and", "x", "pixel", "coordinates", "of", "unmasked", "pixels", "within", "the", "source", "segment", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L442-L455
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.sky_centroid
def sky_centroid(self): """ The sky coordinates of the centroid within the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The output coordinate frame is the same as the input WCS. """ if self._wcs is not None: return pixel_to_skycoord(...
python
def sky_centroid(self): """ The sky coordinates of the centroid within the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The output coordinate frame is the same as the input WCS. """ if self._wcs is not None: return pixel_to_skycoord(...
[ "def", "sky_centroid", "(", "self", ")", ":", "if", "self", ".", "_wcs", "is", "not", "None", ":", "return", "pixel_to_skycoord", "(", "self", ".", "xcentroid", ".", "value", ",", "self", ".", "ycentroid", ".", "value", ",", "self", ".", "_wcs", ",", ...
The sky coordinates of the centroid within the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The output coordinate frame is the same as the input WCS.
[ "The", "sky", "coordinates", "of", "the", "centroid", "within", "the", "source", "segment", "returned", "as", "a", "~astropy", ".", "coordinates", ".", "SkyCoord", "object", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L526-L539
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.sky_bbox_ll
def sky_bbox_ll(self): """ The sky coordinates of the lower-left vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertice...
python
def sky_bbox_ll(self): """ The sky coordinates of the lower-left vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertice...
[ "def", "sky_bbox_ll", "(", "self", ")", ":", "if", "self", ".", "_wcs", "is", "not", "None", ":", "return", "pixel_to_skycoord", "(", "self", ".", "xmin", ".", "value", "-", "0.5", ",", "self", ".", "ymin", ".", "value", "-", "0.5", ",", "self", "....
The sky coordinates of the lower-left vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertices are at the pixel *corners*.
[ "The", "sky", "coordinates", "of", "the", "lower", "-", "left", "vertex", "of", "the", "minimal", "bounding", "box", "of", "the", "source", "segment", "returned", "as", "a", "~astropy", ".", "coordinates", ".", "SkyCoord", "object", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L602-L617
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.sky_bbox_ul
def sky_bbox_ul(self): """ The sky coordinates of the upper-left vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertice...
python
def sky_bbox_ul(self): """ The sky coordinates of the upper-left vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertice...
[ "def", "sky_bbox_ul", "(", "self", ")", ":", "if", "self", ".", "_wcs", "is", "not", "None", ":", "return", "pixel_to_skycoord", "(", "self", ".", "xmin", ".", "value", "-", "0.5", ",", "self", ".", "ymax", ".", "value", "+", "0.5", ",", "self", "....
The sky coordinates of the upper-left vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertices are at the pixel *corners*.
[ "The", "sky", "coordinates", "of", "the", "upper", "-", "left", "vertex", "of", "the", "minimal", "bounding", "box", "of", "the", "source", "segment", "returned", "as", "a", "~astropy", ".", "coordinates", ".", "SkyCoord", "object", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L620-L635
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.sky_bbox_lr
def sky_bbox_lr(self): """ The sky coordinates of the lower-right vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertic...
python
def sky_bbox_lr(self): """ The sky coordinates of the lower-right vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertic...
[ "def", "sky_bbox_lr", "(", "self", ")", ":", "if", "self", ".", "_wcs", "is", "not", "None", ":", "return", "pixel_to_skycoord", "(", "self", ".", "xmax", ".", "value", "+", "0.5", ",", "self", ".", "ymin", ".", "value", "-", "0.5", ",", "self", "....
The sky coordinates of the lower-right vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertices are at the pixel *corners*.
[ "The", "sky", "coordinates", "of", "the", "lower", "-", "right", "vertex", "of", "the", "minimal", "bounding", "box", "of", "the", "source", "segment", "returned", "as", "a", "~astropy", ".", "coordinates", ".", "SkyCoord", "object", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L638-L653
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.sky_bbox_ur
def sky_bbox_ur(self): """ The sky coordinates of the upper-right vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertic...
python
def sky_bbox_ur(self): """ The sky coordinates of the upper-right vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertic...
[ "def", "sky_bbox_ur", "(", "self", ")", ":", "if", "self", ".", "_wcs", "is", "not", "None", ":", "return", "pixel_to_skycoord", "(", "self", ".", "xmax", ".", "value", "+", "0.5", ",", "self", ".", "ymax", ".", "value", "+", "0.5", ",", "self", "....
The sky coordinates of the upper-right vertex of the minimal bounding box of the source segment, returned as a `~astropy.coordinates.SkyCoord` object. The bounding box encloses all of the source segment pixels in their entirety, thus the vertices are at the pixel *corners*.
[ "The", "sky", "coordinates", "of", "the", "upper", "-", "right", "vertex", "of", "the", "minimal", "bounding", "box", "of", "the", "source", "segment", "returned", "as", "a", "~astropy", ".", "coordinates", ".", "SkyCoord", "object", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L656-L671
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.min_value
def min_value(self): """ The minimum pixel value of the ``data`` within the source segment. """ if self._is_completely_masked: return np.nan * self._data_unit else: return np.min(self.values)
python
def min_value(self): """ The minimum pixel value of the ``data`` within the source segment. """ if self._is_completely_masked: return np.nan * self._data_unit else: return np.min(self.values)
[ "def", "min_value", "(", "self", ")", ":", "if", "self", ".", "_is_completely_masked", ":", "return", "np", ".", "nan", "*", "self", ".", "_data_unit", "else", ":", "return", "np", ".", "min", "(", "self", ".", "values", ")" ]
The minimum pixel value of the ``data`` within the source segment.
[ "The", "minimum", "pixel", "value", "of", "the", "data", "within", "the", "source", "segment", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L674-L683
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.max_value
def max_value(self): """ The maximum pixel value of the ``data`` within the source segment. """ if self._is_completely_masked: return np.nan * self._data_unit else: return np.max(self.values)
python
def max_value(self): """ The maximum pixel value of the ``data`` within the source segment. """ if self._is_completely_masked: return np.nan * self._data_unit else: return np.max(self.values)
[ "def", "max_value", "(", "self", ")", ":", "if", "self", ".", "_is_completely_masked", ":", "return", "np", ".", "nan", "*", "self", ".", "_data_unit", "else", ":", "return", "np", ".", "max", "(", "self", ".", "values", ")" ]
The maximum pixel value of the ``data`` within the source segment.
[ "The", "maximum", "pixel", "value", "of", "the", "data", "within", "the", "source", "segment", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L686-L695
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.source_sum
def source_sum(self): """ The sum of the unmasked ``data`` values within the source segment. .. math:: F = \\sum_{i \\in S} (I_i - B_i) where :math:`F` is ``source_sum``, :math:`(I_i - B_i)` is the ``data``, and :math:`S` are the unmasked pixels in the source segment. ...
python
def source_sum(self): """ The sum of the unmasked ``data`` values within the source segment. .. math:: F = \\sum_{i \\in S} (I_i - B_i) where :math:`F` is ``source_sum``, :math:`(I_i - B_i)` is the ``data``, and :math:`S` are the unmasked pixels in the source segment. ...
[ "def", "source_sum", "(", "self", ")", ":", "if", "self", ".", "_is_completely_masked", ":", "return", "np", ".", "nan", "*", "self", ".", "_data_unit", "# table output needs unit", "else", ":", "return", "np", ".", "sum", "(", "self", ".", "values", ")" ]
The sum of the unmasked ``data`` values within the source segment. .. math:: F = \\sum_{i \\in S} (I_i - B_i) where :math:`F` is ``source_sum``, :math:`(I_i - B_i)` is the ``data``, and :math:`S` are the unmasked pixels in the source segment. Non-finite pixel values (e.g. NaN,...
[ "The", "sum", "of", "the", "unmasked", "data", "values", "within", "the", "source", "segment", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L818-L835
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.source_sum_err
def source_sum_err(self): """ The uncertainty of `~photutils.SourceProperties.source_sum`, propagated from the input ``error`` array. ``source_sum_err`` is the quadrature sum of the total errors over the non-masked pixels within the source segment: .. math:: \\Delta F =...
python
def source_sum_err(self): """ The uncertainty of `~photutils.SourceProperties.source_sum`, propagated from the input ``error`` array. ``source_sum_err`` is the quadrature sum of the total errors over the non-masked pixels within the source segment: .. math:: \\Delta F =...
[ "def", "source_sum_err", "(", "self", ")", ":", "if", "self", ".", "_error", "is", "not", "None", ":", "if", "self", ".", "_is_completely_masked", ":", "return", "np", ".", "nan", "*", "self", ".", "_error_unit", "# table output needs unit", "else", ":", "...
The uncertainty of `~photutils.SourceProperties.source_sum`, propagated from the input ``error`` array. ``source_sum_err`` is the quadrature sum of the total errors over the non-masked pixels within the source segment: .. math:: \\Delta F = \\sqrt{\\sum_{i \\in S} \\s...
[ "The", "uncertainty", "of", "~photutils", ".", "SourceProperties", ".", "source_sum", "propagated", "from", "the", "input", "error", "array", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L838-L865
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.background_sum
def background_sum(self): """ The sum of ``background`` values within the source segment. Pixel values that are masked in the input ``data``, including any non-finite pixel values (i.e. NaN, infs) that are automatically masked, are also masked in the background array. ""...
python
def background_sum(self): """ The sum of ``background`` values within the source segment. Pixel values that are masked in the input ``data``, including any non-finite pixel values (i.e. NaN, infs) that are automatically masked, are also masked in the background array. ""...
[ "def", "background_sum", "(", "self", ")", ":", "if", "self", ".", "_background", "is", "not", "None", ":", "if", "self", ".", "_is_completely_masked", ":", "return", "np", ".", "nan", "*", "self", ".", "_background_unit", "# unit for table", "else", ":", ...
The sum of ``background`` values within the source segment. Pixel values that are masked in the input ``data``, including any non-finite pixel values (i.e. NaN, infs) that are automatically masked, are also masked in the background array.
[ "The", "sum", "of", "background", "values", "within", "the", "source", "segment", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L868-L883
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.background_mean
def background_mean(self): """ The mean of ``background`` values within the source segment. Pixel values that are masked in the input ``data``, including any non-finite pixel values (i.e. NaN, infs) that are automatically masked, are also masked in the background array. ...
python
def background_mean(self): """ The mean of ``background`` values within the source segment. Pixel values that are masked in the input ``data``, including any non-finite pixel values (i.e. NaN, infs) that are automatically masked, are also masked in the background array. ...
[ "def", "background_mean", "(", "self", ")", ":", "if", "self", ".", "_background", "is", "not", "None", ":", "if", "self", ".", "_is_completely_masked", ":", "return", "np", ".", "nan", "*", "self", ".", "_background_unit", "# unit for table", "else", ":", ...
The mean of ``background`` values within the source segment. Pixel values that are masked in the input ``data``, including any non-finite pixel values (i.e. NaN, infs) that are automatically masked, are also masked in the background array.
[ "The", "mean", "of", "background", "values", "within", "the", "source", "segment", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L886-L901
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.background_at_centroid
def background_at_centroid(self): """ The value of the ``background`` at the position of the source centroid. The background value at fractional position values are determined using bilinear interpolation. """ from scipy.ndimage import map_coordinates i...
python
def background_at_centroid(self): """ The value of the ``background`` at the position of the source centroid. The background value at fractional position values are determined using bilinear interpolation. """ from scipy.ndimage import map_coordinates i...
[ "def", "background_at_centroid", "(", "self", ")", ":", "from", "scipy", ".", "ndimage", "import", "map_coordinates", "if", "self", ".", "_background", "is", "not", "None", ":", "# centroid can still be NaN if all data values are <= 0", "if", "(", "self", ".", "_is_...
The value of the ``background`` at the position of the source centroid. The background value at fractional position values are determined using bilinear interpolation.
[ "The", "value", "of", "the", "background", "at", "the", "position", "of", "the", "source", "centroid", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L904-L928
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.perimeter
def perimeter(self): """ The total perimeter of the source segment, approximated lines through the centers of the border pixels using a 4-connectivity. If any masked pixels make holes within the source segment, then the perimeter around the inner hole (e.g. an annulus) will also...
python
def perimeter(self): """ The total perimeter of the source segment, approximated lines through the centers of the border pixels using a 4-connectivity. If any masked pixels make holes within the source segment, then the perimeter around the inner hole (e.g. an annulus) will also...
[ "def", "perimeter", "(", "self", ")", ":", "if", "self", ".", "_is_completely_masked", ":", "return", "np", ".", "nan", "*", "u", ".", "pix", "# unit for table", "else", ":", "from", "skimage", ".", "measure", "import", "perimeter", "return", "perimeter", ...
The total perimeter of the source segment, approximated lines through the centers of the border pixels using a 4-connectivity. If any masked pixels make holes within the source segment, then the perimeter around the inner hole (e.g. an annulus) will also contribute to the total perimete...
[ "The", "total", "perimeter", "of", "the", "source", "segment", "approximated", "lines", "through", "the", "centers", "of", "the", "border", "pixels", "using", "a", "4", "-", "connectivity", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L957-L971
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.inertia_tensor
def inertia_tensor(self): """ The inertia tensor of the source for the rotation around its center of mass. """ mu = self.moments_central a = mu[0, 2] b = -mu[1, 1] c = mu[2, 0] return np.array([[a, b], [b, c]]) * u.pix**2
python
def inertia_tensor(self): """ The inertia tensor of the source for the rotation around its center of mass. """ mu = self.moments_central a = mu[0, 2] b = -mu[1, 1] c = mu[2, 0] return np.array([[a, b], [b, c]]) * u.pix**2
[ "def", "inertia_tensor", "(", "self", ")", ":", "mu", "=", "self", ".", "moments_central", "a", "=", "mu", "[", "0", ",", "2", "]", "b", "=", "-", "mu", "[", "1", ",", "1", "]", "c", "=", "mu", "[", "2", ",", "0", "]", "return", "np", ".", ...
The inertia tensor of the source for the rotation around its center of mass.
[ "The", "inertia", "tensor", "of", "the", "source", "for", "the", "rotation", "around", "its", "center", "of", "mass", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L974-L984
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.covariance
def covariance(self): """ The covariance matrix of the 2D Gaussian function that has the same second-order moments as the source. """ mu = self.moments_central if mu[0, 0] != 0: m = mu / mu[0, 0] covariance = self._check_covariance( ...
python
def covariance(self): """ The covariance matrix of the 2D Gaussian function that has the same second-order moments as the source. """ mu = self.moments_central if mu[0, 0] != 0: m = mu / mu[0, 0] covariance = self._check_covariance( ...
[ "def", "covariance", "(", "self", ")", ":", "mu", "=", "self", ".", "moments_central", "if", "mu", "[", "0", ",", "0", "]", "!=", "0", ":", "m", "=", "mu", "/", "mu", "[", "0", ",", "0", "]", "covariance", "=", "self", ".", "_check_covariance", ...
The covariance matrix of the 2D Gaussian function that has the same second-order moments as the source.
[ "The", "covariance", "matrix", "of", "the", "2D", "Gaussian", "function", "that", "has", "the", "same", "second", "-", "order", "moments", "as", "the", "source", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L987-L1000
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.covariance_eigvals
def covariance_eigvals(self): """ The two eigenvalues of the `covariance` matrix in decreasing order. """ if not np.isnan(np.sum(self.covariance)): eigvals = np.linalg.eigvals(self.covariance) if np.any(eigvals < 0): # negative variance ...
python
def covariance_eigvals(self): """ The two eigenvalues of the `covariance` matrix in decreasing order. """ if not np.isnan(np.sum(self.covariance)): eigvals = np.linalg.eigvals(self.covariance) if np.any(eigvals < 0): # negative variance ...
[ "def", "covariance_eigvals", "(", "self", ")", ":", "if", "not", "np", ".", "isnan", "(", "np", ".", "sum", "(", "self", ".", "covariance", ")", ")", ":", "eigvals", "=", "np", ".", "linalg", ".", "eigvals", "(", "self", ".", "covariance", ")", "if...
The two eigenvalues of the `covariance` matrix in decreasing order.
[ "The", "two", "eigenvalues", "of", "the", "covariance", "matrix", "in", "decreasing", "order", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L1024-L1036
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.eccentricity
def eccentricity(self): """ The eccentricity of the 2D Gaussian function that has the same second-order moments as the source. The eccentricity is the fraction of the distance along the semimajor axis at which the focus lies. .. math:: e = \\sqrt{1 - \\frac{b^2}{a^2}} ...
python
def eccentricity(self): """ The eccentricity of the 2D Gaussian function that has the same second-order moments as the source. The eccentricity is the fraction of the distance along the semimajor axis at which the focus lies. .. math:: e = \\sqrt{1 - \\frac{b^2}{a^2}} ...
[ "def", "eccentricity", "(", "self", ")", ":", "l1", ",", "l2", "=", "self", ".", "covariance_eigvals", "if", "l1", "==", "0", ":", "return", "0.", "# pragma: no cover", "return", "np", ".", "sqrt", "(", "1.", "-", "(", "l2", "/", "l1", ")", ")" ]
The eccentricity of the 2D Gaussian function that has the same second-order moments as the source. The eccentricity is the fraction of the distance along the semimajor axis at which the focus lies. .. math:: e = \\sqrt{1 - \\frac{b^2}{a^2}} where :math:`a` and :math:`b` are th...
[ "The", "eccentricity", "of", "the", "2D", "Gaussian", "function", "that", "has", "the", "same", "second", "-", "order", "moments", "as", "the", "source", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L1061-L1078
train
astropy/photutils
photutils/segmentation/properties.py
SourceProperties.orientation
def orientation(self): """ The angle in radians between the ``x`` axis and the major axis of the 2D Gaussian function that has the same second-order moments as the source. The angle increases in the counter-clockwise direction. """ a, b, b, c = self.covariance.f...
python
def orientation(self): """ The angle in radians between the ``x`` axis and the major axis of the 2D Gaussian function that has the same second-order moments as the source. The angle increases in the counter-clockwise direction. """ a, b, b, c = self.covariance.f...
[ "def", "orientation", "(", "self", ")", ":", "a", ",", "b", ",", "b", ",", "c", "=", "self", ".", "covariance", ".", "flat", "if", "a", "<", "0", "or", "c", "<", "0", ":", "# negative variance", "return", "np", ".", "nan", "*", "u", ".", "rad",...
The angle in radians between the ``x`` axis and the major axis of the 2D Gaussian function that has the same second-order moments as the source. The angle increases in the counter-clockwise direction.
[ "The", "angle", "in", "radians", "between", "the", "x", "axis", "and", "the", "major", "axis", "of", "the", "2D", "Gaussian", "function", "that", "has", "the", "same", "second", "-", "order", "moments", "as", "the", "source", ".", "The", "angle", "increa...
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/segmentation/properties.py#L1081-L1092
train
astropy/photutils
photutils/utils/stats.py
_mesh_values
def _mesh_values(data, box_size): """ Extract all the data values in boxes of size ``box_size``. Values from incomplete boxes, either because of the image edges or masked pixels, are not returned. Parameters ---------- data : 2D `~numpy.ma.MaskedArray` The input masked array. ...
python
def _mesh_values(data, box_size): """ Extract all the data values in boxes of size ``box_size``. Values from incomplete boxes, either because of the image edges or masked pixels, are not returned. Parameters ---------- data : 2D `~numpy.ma.MaskedArray` The input masked array. ...
[ "def", "_mesh_values", "(", "data", ",", "box_size", ")", ":", "data", "=", "np", ".", "ma", ".", "asanyarray", "(", "data", ")", "ny", ",", "nx", "=", "data", ".", "shape", "nyboxes", "=", "ny", "//", "box_size", "nxboxes", "=", "nx", "//", "box_s...
Extract all the data values in boxes of size ``box_size``. Values from incomplete boxes, either because of the image edges or masked pixels, are not returned. Parameters ---------- data : 2D `~numpy.ma.MaskedArray` The input masked array. box_size : int The box size. Retu...
[ "Extract", "all", "the", "data", "values", "in", "boxes", "of", "size", "box_size", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/stats.py#L9-L50
train
astropy/photutils
photutils/utils/stats.py
std_blocksum
def std_blocksum(data, block_sizes, mask=None): """ Calculate the standard deviation of block-summed data values at sizes of ``block_sizes``. Values from incomplete blocks, either because of the image edges or masked pixels, are not included. Parameters ---------- data : array-like ...
python
def std_blocksum(data, block_sizes, mask=None): """ Calculate the standard deviation of block-summed data values at sizes of ``block_sizes``. Values from incomplete blocks, either because of the image edges or masked pixels, are not included. Parameters ---------- data : array-like ...
[ "def", "std_blocksum", "(", "data", ",", "block_sizes", ",", "mask", "=", "None", ")", ":", "data", "=", "np", ".", "ma", ".", "asanyarray", "(", "data", ")", "if", "mask", "is", "not", "None", "and", "mask", "is", "not", "np", ".", "ma", ".", "n...
Calculate the standard deviation of block-summed data values at sizes of ``block_sizes``. Values from incomplete blocks, either because of the image edges or masked pixels, are not included. Parameters ---------- data : array-like The 2D array to block sum. block_sizes : int, arra...
[ "Calculate", "the", "standard", "deviation", "of", "block", "-", "summed", "data", "values", "at", "sizes", "of", "block_sizes", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/stats.py#L53-L97
train
astropy/photutils
photutils/psf/photometry.py
BasicPSFPhotometry.nstar
def nstar(self, image, star_groups): """ Fit, as appropriate, a compound or single model to the given ``star_groups``. Groups are fitted sequentially from the smallest to the biggest. In each iteration, ``image`` is subtracted by the previous fitted group. Parameters ...
python
def nstar(self, image, star_groups): """ Fit, as appropriate, a compound or single model to the given ``star_groups``. Groups are fitted sequentially from the smallest to the biggest. In each iteration, ``image`` is subtracted by the previous fitted group. Parameters ...
[ "def", "nstar", "(", "self", ",", "image", ",", "star_groups", ")", ":", "result_tab", "=", "Table", "(", ")", "for", "param_tab_name", "in", "self", ".", "_pars_to_output", ".", "keys", "(", ")", ":", "result_tab", ".", "add_column", "(", "Column", "(",...
Fit, as appropriate, a compound or single model to the given ``star_groups``. Groups are fitted sequentially from the smallest to the biggest. In each iteration, ``image`` is subtracted by the previous fitted group. Parameters ---------- image : numpy.ndarray ...
[ "Fit", "as", "appropriate", "a", "compound", "or", "single", "model", "to", "the", "given", "star_groups", ".", "Groups", "are", "fitted", "sequentially", "from", "the", "smallest", "to", "the", "biggest", ".", "In", "each", "iteration", "image", "is", "subt...
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/photometry.py#L298-L375
train
astropy/photutils
photutils/psf/photometry.py
BasicPSFPhotometry._get_uncertainties
def _get_uncertainties(self, star_group_size): """ Retrieve uncertainties on fitted parameters from the fitter object. Parameters ---------- star_group_size : int Number of stars in the given group. Returns ------- unc_tab : `~astropy...
python
def _get_uncertainties(self, star_group_size): """ Retrieve uncertainties on fitted parameters from the fitter object. Parameters ---------- star_group_size : int Number of stars in the given group. Returns ------- unc_tab : `~astropy...
[ "def", "_get_uncertainties", "(", "self", ",", "star_group_size", ")", ":", "unc_tab", "=", "Table", "(", ")", "for", "param_name", "in", "self", ".", "psf_model", ".", "param_names", ":", "if", "not", "self", ".", "psf_model", ".", "fixed", "[", "param_na...
Retrieve uncertainties on fitted parameters from the fitter object. Parameters ---------- star_group_size : int Number of stars in the given group. Returns ------- unc_tab : `~astropy.table.Table` Table which contains uncertainties on the...
[ "Retrieve", "uncertainties", "on", "fitted", "parameters", "from", "the", "fitter", "object", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/photometry.py#L403-L435
train
astropy/photutils
photutils/psf/photometry.py
BasicPSFPhotometry._model_params2table
def _model_params2table(self, fit_model, star_group_size): """ Place fitted parameters into an astropy table. Parameters ---------- fit_model : `astropy.modeling.Fittable2DModel` instance PSF or PRF model to fit the data. Could be one of the models in thi...
python
def _model_params2table(self, fit_model, star_group_size): """ Place fitted parameters into an astropy table. Parameters ---------- fit_model : `astropy.modeling.Fittable2DModel` instance PSF or PRF model to fit the data. Could be one of the models in thi...
[ "def", "_model_params2table", "(", "self", ",", "fit_model", ",", "star_group_size", ")", ":", "param_tab", "=", "Table", "(", ")", "for", "param_tab_name", "in", "self", ".", "_pars_to_output", ".", "keys", "(", ")", ":", "param_tab", ".", "add_column", "("...
Place fitted parameters into an astropy table. Parameters ---------- fit_model : `astropy.modeling.Fittable2DModel` instance PSF or PRF model to fit the data. Could be one of the models in this package like `~photutils.psf.sandbox.DiscretePRF`, `~photutils.ps...
[ "Place", "fitted", "parameters", "into", "an", "astropy", "table", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/photometry.py#L437-L473
train
astropy/photutils
photutils/psf/photometry.py
IterativelySubtractedPSFPhotometry._do_photometry
def _do_photometry(self, param_tab, n_start=1): """ Helper function which performs the iterations of the photometry process. Parameters ---------- param_names : list Names of the columns which represent the initial guesses. For example, ['x_0', '...
python
def _do_photometry(self, param_tab, n_start=1): """ Helper function which performs the iterations of the photometry process. Parameters ---------- param_names : list Names of the columns which represent the initial guesses. For example, ['x_0', '...
[ "def", "_do_photometry", "(", "self", ",", "param_tab", ",", "n_start", "=", "1", ")", ":", "output_table", "=", "Table", "(", ")", "self", ".", "_define_fit_param_names", "(", ")", "for", "(", "init_parname", ",", "fit_parname", ")", "in", "zip", "(", "...
Helper function which performs the iterations of the photometry process. Parameters ---------- param_names : list Names of the columns which represent the initial guesses. For example, ['x_0', 'y_0', 'flux_0'], for intial guesses on the center positi...
[ "Helper", "function", "which", "performs", "the", "iterations", "of", "the", "photometry", "process", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/psf/photometry.py#L666-L740
train
astropy/photutils
photutils/utils/wcs_helpers.py
pixel_scale_angle_at_skycoord
def pixel_scale_angle_at_skycoord(skycoord, wcs, offset=1. * u.arcsec): """ Calculate the pixel scale and WCS rotation angle at the position of a SkyCoord coordinate. Parameters ---------- skycoord : `~astropy.coordinates.SkyCoord` The SkyCoord coordinate. wcs : `~astropy.wcs.WCS` ...
python
def pixel_scale_angle_at_skycoord(skycoord, wcs, offset=1. * u.arcsec): """ Calculate the pixel scale and WCS rotation angle at the position of a SkyCoord coordinate. Parameters ---------- skycoord : `~astropy.coordinates.SkyCoord` The SkyCoord coordinate. wcs : `~astropy.wcs.WCS` ...
[ "def", "pixel_scale_angle_at_skycoord", "(", "skycoord", ",", "wcs", ",", "offset", "=", "1.", "*", "u", ".", "arcsec", ")", ":", "# We take a point directly \"above\" (in latitude) the input position", "# and convert it to pixel coordinates, then we use the pixel deltas", "# bet...
Calculate the pixel scale and WCS rotation angle at the position of a SkyCoord coordinate. Parameters ---------- skycoord : `~astropy.coordinates.SkyCoord` The SkyCoord coordinate. wcs : `~astropy.wcs.WCS` The world coordinate system (WCS) transformation to use. offset : `~astro...
[ "Calculate", "the", "pixel", "scale", "and", "WCS", "rotation", "angle", "at", "the", "position", "of", "a", "SkyCoord", "coordinate", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/wcs_helpers.py#L9-L62
train
astropy/photutils
photutils/utils/wcs_helpers.py
pixel_to_icrs_coords
def pixel_to_icrs_coords(x, y, wcs): """ Convert pixel coordinates to ICRS Right Ascension and Declination. This is merely a convenience function to extract RA and Dec. from a `~astropy.coordinates.SkyCoord` instance so they can be put in separate columns in a `~astropy.table.Table`. Parameter...
python
def pixel_to_icrs_coords(x, y, wcs): """ Convert pixel coordinates to ICRS Right Ascension and Declination. This is merely a convenience function to extract RA and Dec. from a `~astropy.coordinates.SkyCoord` instance so they can be put in separate columns in a `~astropy.table.Table`. Parameter...
[ "def", "pixel_to_icrs_coords", "(", "x", ",", "y", ",", "wcs", ")", ":", "icrs_coords", "=", "pixel_to_skycoord", "(", "x", ",", "y", ",", "wcs", ")", ".", "icrs", "icrs_ra", "=", "icrs_coords", ".", "ra", ".", "degree", "*", "u", ".", "deg", "icrs_d...
Convert pixel coordinates to ICRS Right Ascension and Declination. This is merely a convenience function to extract RA and Dec. from a `~astropy.coordinates.SkyCoord` instance so they can be put in separate columns in a `~astropy.table.Table`. Parameters ---------- x : float or array-like ...
[ "Convert", "pixel", "coordinates", "to", "ICRS", "Right", "Ascension", "and", "Declination", "." ]
cc9bb4534ab76bac98cb5f374a348a2573d10401
https://github.com/astropy/photutils/blob/cc9bb4534ab76bac98cb5f374a348a2573d10401/photutils/utils/wcs_helpers.py#L95-L129
train