partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
RadioGroup.handleImplicitCheck
Checkboxes are hidden when inside of a RadioGroup as a selection of the Radio button is an implicit selection of the Checkbox. As such, we have to manually "check" any checkbox as needed.
gooey/gui/components/widgets/radio_group.py
def handleImplicitCheck(self): """ Checkboxes are hidden when inside of a RadioGroup as a selection of the Radio button is an implicit selection of the Checkbox. As such, we have to manually "check" any checkbox as needed. """ for button, widget in zip(self.radioBut...
def handleImplicitCheck(self): """ Checkboxes are hidden when inside of a RadioGroup as a selection of the Radio button is an implicit selection of the Checkbox. As such, we have to manually "check" any checkbox as needed. """ for button, widget in zip(self.radioBut...
[ "Checkboxes", "are", "hidden", "when", "inside", "of", "a", "RadioGroup", "as", "a", "selection", "of", "the", "Radio", "button", "is", "an", "implicit", "selection", "of", "the", "Checkbox", ".", "As", "such", "we", "have", "to", "manually", "check", "any...
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/widgets/radio_group.py#L108-L119
[ "def", "handleImplicitCheck", "(", "self", ")", ":", "for", "button", ",", "widget", "in", "zip", "(", "self", ".", "radioButtons", ",", "self", ".", "widgets", ")", ":", "if", "isinstance", "(", "widget", ",", "CheckBox", ")", ":", "if", "button", "."...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
RadioGroup.createWidgets
Instantiate the Gooey Widgets that are used within the RadioGroup
gooey/gui/components/widgets/radio_group.py
def createWidgets(self): """ Instantiate the Gooey Widgets that are used within the RadioGroup """ from gooey.gui.components import widgets return [getattr(widgets, item['type'])(self, item) for item in getin(self.widgetInfo, ['data', 'widgets'], [])]
def createWidgets(self): """ Instantiate the Gooey Widgets that are used within the RadioGroup """ from gooey.gui.components import widgets return [getattr(widgets, item['type'])(self, item) for item in getin(self.widgetInfo, ['data', 'widgets'], [])]
[ "Instantiate", "the", "Gooey", "Widgets", "that", "are", "used", "within", "the", "RadioGroup" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/widgets/radio_group.py#L136-L142
[ "def", "createWidgets", "(", "self", ")", ":", "from", "gooey", ".", "gui", ".", "components", "import", "widgets", "return", "[", "getattr", "(", "widgets", ",", "item", "[", "'type'", "]", ")", "(", "self", ",", "item", ")", "for", "item", "in", "g...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
GooeyApplication.onStart
Verify user input and kick off the client's program if valid
gooey/gui/containers/application.py
def onStart(self, *args, **kwarg): """ Verify user input and kick off the client's program if valid """ with transactUI(self): config = self.navbar.getActiveConfig() config.resetErrors() if config.isValid(): self.clientRunner.ru...
def onStart(self, *args, **kwarg): """ Verify user input and kick off the client's program if valid """ with transactUI(self): config = self.navbar.getActiveConfig() config.resetErrors() if config.isValid(): self.clientRunner.ru...
[ "Verify", "user", "input", "and", "kick", "off", "the", "client", "s", "program", "if", "valid" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L71-L83
[ "def", "onStart", "(", "self", ",", "*", "args", ",", "*", "*", "kwarg", ")", ":", "with", "transactUI", "(", "self", ")", ":", "config", "=", "self", ".", "navbar", ".", "getActiveConfig", "(", ")", "config", ".", "resetErrors", "(", ")", "if", "c...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
GooeyApplication.onEdit
Return the user to the settings screen for further editing
gooey/gui/containers/application.py
def onEdit(self): """Return the user to the settings screen for further editing""" with transactUI(self): if self.buildSpec['poll_external_updates']: self.fetchExternalUpdates() self.showSettings()
def onEdit(self): """Return the user to the settings screen for further editing""" with transactUI(self): if self.buildSpec['poll_external_updates']: self.fetchExternalUpdates() self.showSettings()
[ "Return", "the", "user", "to", "the", "settings", "screen", "for", "further", "editing" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L86-L91
[ "def", "onEdit", "(", "self", ")", ":", "with", "transactUI", "(", "self", ")", ":", "if", "self", ".", "buildSpec", "[", "'poll_external_updates'", "]", ":", "self", ".", "fetchExternalUpdates", "(", ")", "self", ".", "showSettings", "(", ")" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
GooeyApplication.buildCliString
Collect all of the required information from the config screen and build a CLI string which can be used to invoke the client program
gooey/gui/containers/application.py
def buildCliString(self): """ Collect all of the required information from the config screen and build a CLI string which can be used to invoke the client program """ config = self.navbar.getActiveConfig() group = self.buildSpec['widgets'][self.navbar.getSelectedGro...
def buildCliString(self): """ Collect all of the required information from the config screen and build a CLI string which can be used to invoke the client program """ config = self.navbar.getActiveConfig() group = self.buildSpec['widgets'][self.navbar.getSelectedGro...
[ "Collect", "all", "of", "the", "required", "information", "from", "the", "config", "screen", "and", "build", "a", "CLI", "string", "which", "can", "be", "used", "to", "invoke", "the", "client", "program" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L94-L114
[ "def", "buildCliString", "(", "self", ")", ":", "config", "=", "self", ".", "navbar", ".", "getActiveConfig", "(", ")", "group", "=", "self", ".", "buildSpec", "[", "'widgets'", "]", "[", "self", ".", "navbar", ".", "getSelectedGroup", "(", ")", "]", "...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
GooeyApplication.onComplete
Display the appropriate screen based on the success/fail of the host program
gooey/gui/containers/application.py
def onComplete(self, *args, **kwargs): """ Display the appropriate screen based on the success/fail of the host program """ with transactUI(self): if self.clientRunner.was_success(): if self.buildSpec.get('return_to_config', False): ...
def onComplete(self, *args, **kwargs): """ Display the appropriate screen based on the success/fail of the host program """ with transactUI(self): if self.clientRunner.was_success(): if self.buildSpec.get('return_to_config', False): ...
[ "Display", "the", "appropriate", "screen", "based", "on", "the", "success", "/", "fail", "of", "the", "host", "program" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L117-L135
[ "def", "onComplete", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "with", "transactUI", "(", "self", ")", ":", "if", "self", ".", "clientRunner", ".", "was_success", "(", ")", ":", "if", "self", ".", "buildSpec", ".", "get", "(...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
GooeyApplication.fetchExternalUpdates
!Experimental! Calls out to the client code requesting seed values to use in the UI !Experimental!
gooey/gui/containers/application.py
def fetchExternalUpdates(self): """ !Experimental! Calls out to the client code requesting seed values to use in the UI !Experimental! """ seeds = seeder.fetchDynamicProperties( self.buildSpec['target'], self.buildSpec['encoding'] ...
def fetchExternalUpdates(self): """ !Experimental! Calls out to the client code requesting seed values to use in the UI !Experimental! """ seeds = seeder.fetchDynamicProperties( self.buildSpec['target'], self.buildSpec['encoding'] ...
[ "!Experimental!", "Calls", "out", "to", "the", "client", "code", "requesting", "seed", "values", "to", "use", "in", "the", "UI", "!Experimental!" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L145-L156
[ "def", "fetchExternalUpdates", "(", "self", ")", ":", "seeds", "=", "seeder", ".", "fetchDynamicProperties", "(", "self", ".", "buildSpec", "[", "'target'", "]", ",", "self", ".", "buildSpec", "[", "'encoding'", "]", ")", "for", "config", "in", "self", "."...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
GooeyApplication.buildNavigation
Chooses the appropriate layout navigation component based on user prefs
gooey/gui/containers/application.py
def buildNavigation(self): """ Chooses the appropriate layout navigation component based on user prefs """ if self.buildSpec['navigation'] == constants.TABBED: navigation = Tabbar(self, self.buildSpec, self.configs) else: navigation = Sidebar(self, ...
def buildNavigation(self): """ Chooses the appropriate layout navigation component based on user prefs """ if self.buildSpec['navigation'] == constants.TABBED: navigation = Tabbar(self, self.buildSpec, self.configs) else: navigation = Sidebar(self, ...
[ "Chooses", "the", "appropriate", "layout", "navigation", "component", "based", "on", "user", "prefs" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/containers/application.py#L189-L199
[ "def", "buildNavigation", "(", "self", ")", ":", "if", "self", ".", "buildSpec", "[", "'navigation'", "]", "==", "constants", ".", "TABBED", ":", "navigation", "=", "Tabbar", "(", "self", ",", "self", ".", "buildSpec", ",", "self", ".", "configs", ")", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
Console.getFontFace
Choose the best font face available given the user options
gooey/gui/components/console.py
def getFontFace(self): """Choose the best font face available given the user options""" userFace = self.buildSpec['terminal_font_family'] or self.defaultFont.GetFaceName() return ('' if self.buildSpec['monospace_display'] else userFace)
def getFontFace(self): """Choose the best font face available given the user options""" userFace = self.buildSpec['terminal_font_family'] or self.defaultFont.GetFaceName() return ('' if self.buildSpec['monospace_display'] else userFace)
[ "Choose", "the", "best", "font", "face", "available", "given", "the", "user", "options" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/console.py#L46-L51
[ "def", "getFontFace", "(", "self", ")", ":", "userFace", "=", "self", ".", "buildSpec", "[", "'terminal_font_family'", "]", "or", "self", ".", "defaultFont", ".", "GetFaceName", "(", ")", "return", "(", "''", "if", "self", ".", "buildSpec", "[", "'monospac...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
ProcessController._forward_stdout
Reads the stdout of `process` and forwards lines and progress to any interested subscribers
gooey/gui/processor.py
def _forward_stdout(self, process): ''' Reads the stdout of `process` and forwards lines and progress to any interested subscribers ''' while True: line = process.stdout.readline() if not line: break pub.send_message(ev...
def _forward_stdout(self, process): ''' Reads the stdout of `process` and forwards lines and progress to any interested subscribers ''' while True: line = process.stdout.readline() if not line: break pub.send_message(ev...
[ "Reads", "the", "stdout", "of", "process", "and", "forwards", "lines", "and", "progress", "to", "any", "interested", "subscribers" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/processor.py#L60-L72
[ "def", "_forward_stdout", "(", "self", ",", "process", ")", ":", "while", "True", ":", "line", "=", "process", ".", "stdout", ".", "readline", "(", ")", "if", "not", "line", ":", "break", "pub", ".", "send_message", "(", "events", ".", "CONSOLE_UPDATE", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
ProcessController._extract_progress
Finds progress information in the text using the user-supplied regex and calculation instructions
gooey/gui/processor.py
def _extract_progress(self, text): ''' Finds progress information in the text using the user-supplied regex and calculation instructions ''' # monad-ish dispatch to avoid the if/else soup find = partial(re.search, string=text.strip().decode(self.encoding)) ...
def _extract_progress(self, text): ''' Finds progress information in the text using the user-supplied regex and calculation instructions ''' # monad-ish dispatch to avoid the if/else soup find = partial(re.search, string=text.strip().decode(self.encoding)) ...
[ "Finds", "progress", "information", "in", "the", "text", "using", "the", "user", "-", "supplied", "regex", "and", "calculation", "instructions" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/processor.py#L74-L84
[ "def", "_extract_progress", "(", "self", ",", "text", ")", ":", "# monad-ish dispatch to avoid the if/else soup\r", "find", "=", "partial", "(", "re", ".", "search", ",", "string", "=", "text", ".", "strip", "(", ")", ".", "decode", "(", "self", ".", "encodi...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
ProcessController._calculate_progress
Calculates the final progress value found by the regex
gooey/gui/processor.py
def _calculate_progress(self, match): ''' Calculates the final progress value found by the regex ''' if not self.progress_expr: return safe_float(match.group(1)) else: return self._eval_progress(match)
def _calculate_progress(self, match): ''' Calculates the final progress value found by the regex ''' if not self.progress_expr: return safe_float(match.group(1)) else: return self._eval_progress(match)
[ "Calculates", "the", "final", "progress", "value", "found", "by", "the", "regex" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/processor.py#L86-L93
[ "def", "_calculate_progress", "(", "self", ",", "match", ")", ":", "if", "not", "self", ".", "progress_expr", ":", "return", "safe_float", "(", "match", ".", "group", "(", "1", ")", ")", "else", ":", "return", "self", ".", "_eval_progress", "(", "match",...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
ProcessController._eval_progress
Runs the user-supplied progress calculation rule
gooey/gui/processor.py
def _eval_progress(self, match): ''' Runs the user-supplied progress calculation rule ''' _locals = {k: safe_float(v) for k, v in match.groupdict().items()} if "x" not in _locals: _locals["x"] = [safe_float(x) for x in match.groups()] try: ...
def _eval_progress(self, match): ''' Runs the user-supplied progress calculation rule ''' _locals = {k: safe_float(v) for k, v in match.groupdict().items()} if "x" not in _locals: _locals["x"] = [safe_float(x) for x in match.groups()] try: ...
[ "Runs", "the", "user", "-", "supplied", "progress", "calculation", "rule" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/processor.py#L95-L105
[ "def", "_eval_progress", "(", "self", ",", "match", ")", ":", "_locals", "=", "{", "k", ":", "safe_float", "(", "v", ")", "for", "k", ",", "v", "in", "match", ".", "groupdict", "(", ")", ".", "items", "(", ")", "}", "if", "\"x\"", "not", "in", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
Sidebar.swapConfigPanels
Hide/show configuration panels based on the currently selected option in the sidebar
gooey/gui/components/sidebar.py
def swapConfigPanels(self, event): """Hide/show configuration panels based on the currently selected option in the sidebar """ for id, panel in enumerate(self.configPanels): panel.Hide() self.activeSelection = event.Selection self.configPanels[event.Selection]....
def swapConfigPanels(self, event): """Hide/show configuration panels based on the currently selected option in the sidebar """ for id, panel in enumerate(self.configPanels): panel.Hide() self.activeSelection = event.Selection self.configPanels[event.Selection]....
[ "Hide", "/", "show", "configuration", "panels", "based", "on", "the", "currently", "selected", "option", "in", "the", "sidebar" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/sidebar.py#L36-L43
[ "def", "swapConfigPanels", "(", "self", ",", "event", ")", ":", "for", "id", ",", "panel", "in", "enumerate", "(", "self", ".", "configPanels", ")", ":", "panel", ".", "Hide", "(", ")", "self", ".", "activeSelection", "=", "event", ".", "Selection", "s...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
Footer.updateProgressBar
value, disable_animation=False :param args: :param kwargs: :return:
gooey/gui/components/footer.py
def updateProgressBar(self, *args, **kwargs): ''' value, disable_animation=False :param args: :param kwargs: :return: ''' value = kwargs.get('progress') pb = self.progress_bar if value is None: return if value < 0: ...
def updateProgressBar(self, *args, **kwargs): ''' value, disable_animation=False :param args: :param kwargs: :return: ''' value = kwargs.get('progress') pb = self.progress_bar if value is None: return if value < 0: ...
[ "value", "disable_animation", "=", "False", ":", "param", "args", ":", ":", "param", "kwargs", ":", ":", "return", ":" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/footer.py#L38-L63
[ "def", "updateProgressBar", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "value", "=", "kwargs", ".", "get", "(", "'progress'", ")", "pb", "=", "self", ".", "progress_bar", "if", "value", "is", "None", ":", "return", "if", "value...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
Gooey
Decorator for client code's main function. Serializes argparse data to JSON for use with the Gooey front end
gooey/python_bindings/gooey_decorator.py
def Gooey(f=None, advanced=True, language='english', auto_start=False, # TODO: add this to the docs. Used to be `show_config=True` target=None, program_name=None, program_description=None, default_size=(610, 530), use_legacy_titles...
def Gooey(f=None, advanced=True, language='english', auto_start=False, # TODO: add this to the docs. Used to be `show_config=True` target=None, program_name=None, program_description=None, default_size=(610, 530), use_legacy_titles...
[ "Decorator", "for", "client", "code", "s", "main", "function", ".", "Serializes", "argparse", "data", "to", "JSON", "for", "use", "with", "the", "Gooey", "front", "end" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/python_bindings/gooey_decorator.py#L22-L99
[ "def", "Gooey", "(", "f", "=", "None", ",", "advanced", "=", "True", ",", "language", "=", "'english'", ",", "auto_start", "=", "False", ",", "# TODO: add this to the docs. Used to be `show_config=True`\r", "target", "=", "None", ",", "program_name", "=", "None", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
fetchDynamicProperties
Sends a gooey-seed-ui request to the client program it retrieve dynamically generated defaults with which to seed the UI
gooey/gui/seeder.py
def fetchDynamicProperties(target, encoding): """ Sends a gooey-seed-ui request to the client program it retrieve dynamically generated defaults with which to seed the UI """ cmd = '{} {}'.format(target, 'gooey-seed-ui --ignore-gooey') proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, s...
def fetchDynamicProperties(target, encoding): """ Sends a gooey-seed-ui request to the client program it retrieve dynamically generated defaults with which to seed the UI """ cmd = '{} {}'.format(target, 'gooey-seed-ui --ignore-gooey') proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, s...
[ "Sends", "a", "gooey", "-", "seed", "-", "ui", "request", "to", "the", "client", "program", "it", "retrieve", "dynamically", "generated", "defaults", "with", "which", "to", "seed", "the", "UI" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/seeder.py#L9-L21
[ "def", "fetchDynamicProperties", "(", "target", ",", "encoding", ")", ":", "cmd", "=", "'{} {}'", ".", "format", "(", "target", ",", "'gooey-seed-ui --ignore-gooey'", ")", "proc", "=", "subprocess", ".", "Popen", "(", "cmd", ",", "stdout", "=", "subprocess", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
ConfigPage.makeGroup
Messily builds the (potentially) nested and grouped layout Note! Mutates `self.reifiedWidgets` in place with the widgets as they're instantiated! I cannot figure out how to split out the creation of the widgets from their styling without WxPython violently exploding TODO: sort ou...
gooey/gui/components/config.py
def makeGroup(self, parent, thissizer, group, *args): ''' Messily builds the (potentially) nested and grouped layout Note! Mutates `self.reifiedWidgets` in place with the widgets as they're instantiated! I cannot figure out how to split out the creation of the widgets from...
def makeGroup(self, parent, thissizer, group, *args): ''' Messily builds the (potentially) nested and grouped layout Note! Mutates `self.reifiedWidgets` in place with the widgets as they're instantiated! I cannot figure out how to split out the creation of the widgets from...
[ "Messily", "builds", "the", "(", "potentially", ")", "nested", "and", "grouped", "layout", "Note!", "Mutates", "self", ".", "reifiedWidgets", "in", "place", "with", "the", "widgets", "as", "they", "re", "instantiated!", "I", "cannot", "figure", "out", "how", ...
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/config.py#L84-L134
[ "def", "makeGroup", "(", "self", ",", "parent", ",", "thissizer", ",", "group", ",", "*", "args", ")", ":", "# determine the type of border , if any, the main sizer will use\r", "if", "getin", "(", "group", ",", "[", "'options'", ",", "'show_border'", "]", ",", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
ConfigPage.chunkWidgets
chunk the widgets up into groups based on their sizing hints
gooey/gui/components/config.py
def chunkWidgets(self, group): ''' chunk the widgets up into groups based on their sizing hints ''' ui_groups = [] subgroup = [] for index, item in enumerate(group['items']): if getin(item, ['options', 'full_width'], False): ui_groups.append(subgroup) ...
def chunkWidgets(self, group): ''' chunk the widgets up into groups based on their sizing hints ''' ui_groups = [] subgroup = [] for index, item in enumerate(group['items']): if getin(item, ['options', 'full_width'], False): ui_groups.append(subgroup) ...
[ "chunk", "the", "widgets", "up", "into", "groups", "based", "on", "their", "sizing", "hints" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/config.py#L137-L152
[ "def", "chunkWidgets", "(", "self", ",", "group", ")", ":", "ui_groups", "=", "[", "]", "subgroup", "=", "[", "]", "for", "index", ",", "item", "in", "enumerate", "(", "group", "[", "'items'", "]", ")", ":", "if", "getin", "(", "item", ",", "[", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
ConfigPage.reifyWidget
Convert a JSON description of a widget into a WxObject
gooey/gui/components/config.py
def reifyWidget(self, parent, item): ''' Convert a JSON description of a widget into a WxObject ''' from gooey.gui.components import widgets widgetClass = getattr(widgets, item['type']) return widgetClass(parent, item)
def reifyWidget(self, parent, item): ''' Convert a JSON description of a widget into a WxObject ''' from gooey.gui.components import widgets widgetClass = getattr(widgets, item['type']) return widgetClass(parent, item)
[ "Convert", "a", "JSON", "description", "of", "a", "widget", "into", "a", "WxObject" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/components/config.py#L155-L159
[ "def", "reifyWidget", "(", "self", ",", "parent", ",", "item", ")", ":", "from", "gooey", ".", "gui", ".", "components", "import", "widgets", "widgetClass", "=", "getattr", "(", "widgets", ",", "item", "[", "'type'", "]", ")", "return", "widgetClass", "(...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
extract_groups
Recursively extract argument groups and associated actions from ParserGroup objects
gooey/python_bindings/argparse_to_json.py
def extract_groups(action_group): ''' Recursively extract argument groups and associated actions from ParserGroup objects ''' return { 'name': action_group.title, 'description': action_group.description, 'items': [action for action in action_group._group_actions ...
def extract_groups(action_group): ''' Recursively extract argument groups and associated actions from ParserGroup objects ''' return { 'name': action_group.title, 'description': action_group.description, 'items': [action for action in action_group._group_actions ...
[ "Recursively", "extract", "argument", "groups", "and", "associated", "actions", "from", "ParserGroup", "objects" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/python_bindings/argparse_to_json.py#L114-L128
[ "def", "extract_groups", "(", "action_group", ")", ":", "return", "{", "'name'", ":", "action_group", ".", "title", ",", "'description'", ":", "action_group", ".", "description", ",", "'items'", ":", "[", "action", "for", "action", "in", "action_group", ".", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
is_required
_actions possessing the `required` flag and not implicitly optional through `nargs` being '*' or '?'
gooey/python_bindings/argparse_to_json.py
def is_required(action): ''' _actions possessing the `required` flag and not implicitly optional through `nargs` being '*' or '?' ''' return not isinstance(action, _SubParsersAction) and ( action.required == True and action.nargs not in ['*', '?'])
def is_required(action): ''' _actions possessing the `required` flag and not implicitly optional through `nargs` being '*' or '?' ''' return not isinstance(action, _SubParsersAction) and ( action.required == True and action.nargs not in ['*', '?'])
[ "_actions", "possessing", "the", "required", "flag", "and", "not", "implicitly", "optional", "through", "nargs", "being", "*", "or", "?" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/python_bindings/argparse_to_json.py#L217-L223
[ "def", "is_required", "(", "action", ")", ":", "return", "not", "isinstance", "(", "action", ",", "_SubParsersAction", ")", "and", "(", "action", ".", "required", "==", "True", "and", "action", ".", "nargs", "not", "in", "[", "'*'", ",", "'?'", "]", ")...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
is_standard
actions which are general "store" instructions. e.g. anything which has an argument style like: $ script.py -f myfilename.txt
gooey/python_bindings/argparse_to_json.py
def is_standard(action): """ actions which are general "store" instructions. e.g. anything which has an argument style like: $ script.py -f myfilename.txt """ boolean_actions = ( _StoreConstAction, _StoreFalseAction, _StoreTrueAction ) return (not action.choices ...
def is_standard(action): """ actions which are general "store" instructions. e.g. anything which has an argument style like: $ script.py -f myfilename.txt """ boolean_actions = ( _StoreConstAction, _StoreFalseAction, _StoreTrueAction ) return (not action.choices ...
[ "actions", "which", "are", "general", "store", "instructions", ".", "e", ".", "g", ".", "anything", "which", "has", "an", "argument", "style", "like", ":", "$", "script", ".", "py", "-", "f", "myfilename", ".", "txt" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/python_bindings/argparse_to_json.py#L259-L271
[ "def", "is_standard", "(", "action", ")", ":", "boolean_actions", "=", "(", "_StoreConstAction", ",", "_StoreFalseAction", ",", "_StoreTrueAction", ")", "return", "(", "not", "action", ".", "choices", "and", "not", "isinstance", "(", "action", ",", "_CountAction...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
is_flag
_actions which are either storeconst, store_bool, etc..
gooey/python_bindings/argparse_to_json.py
def is_flag(action): """ _actions which are either storeconst, store_bool, etc.. """ action_types = [_StoreTrueAction, _StoreFalseAction, _StoreConstAction] return any(list(map(lambda Action: isinstance(action, Action), action_types)))
def is_flag(action): """ _actions which are either storeconst, store_bool, etc.. """ action_types = [_StoreTrueAction, _StoreFalseAction, _StoreConstAction] return any(list(map(lambda Action: isinstance(action, Action), action_types)))
[ "_actions", "which", "are", "either", "storeconst", "store_bool", "etc", ".." ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/python_bindings/argparse_to_json.py#L274-L277
[ "def", "is_flag", "(", "action", ")", ":", "action_types", "=", "[", "_StoreTrueAction", ",", "_StoreFalseAction", ",", "_StoreConstAction", "]", "return", "any", "(", "list", "(", "map", "(", "lambda", "Action", ":", "isinstance", "(", "action", ",", "Actio...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
counter
Returns str(option_string * DropDown Value) e.g. -vvvvv
gooey/gui/formatters.py
def counter(metatdata, value): ''' Returns str(option_string * DropDown Value) e.g. -vvvvv ''' if not str(value).isdigit(): return None arg = str(metatdata['commands'][0]).replace('-', '') repeated_args = arg * int(value) return '-' + repeated_args
def counter(metatdata, value): ''' Returns str(option_string * DropDown Value) e.g. -vvvvv ''' if not str(value).isdigit(): return None arg = str(metatdata['commands'][0]).replace('-', '') repeated_args = arg * int(value) return '-' + repeated_args
[ "Returns", "str", "(", "option_string", "*", "DropDown", "Value", ")", "e", ".", "g", ".", "-", "vvvvv" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/formatters.py#L39-L50
[ "def", "counter", "(", "metatdata", ",", "value", ")", ":", "if", "not", "str", "(", "value", ")", ".", "isdigit", "(", ")", ":", "return", "None", "arg", "=", "str", "(", "metatdata", "[", "'commands'", "]", "[", "0", "]", ")", ".", "replace", "...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
load
Open and return the supplied json file
gooey/gui/lang/i18n.py
def load(language_dir, filename, encoding): ''' Open and return the supplied json file ''' global _DICTIONARY try: json_file = filename + '.json' with io.open(os.path.join(language_dir, json_file), 'r', encoding=encoding) as f: _DICTIONARY = json.load(f) except IOError: raise IOError('...
def load(language_dir, filename, encoding): ''' Open and return the supplied json file ''' global _DICTIONARY try: json_file = filename + '.json' with io.open(os.path.join(language_dir, json_file), 'r', encoding=encoding) as f: _DICTIONARY = json.load(f) except IOError: raise IOError('...
[ "Open", "and", "return", "the", "supplied", "json", "file" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/gui/lang/i18n.py#L18-L28
[ "def", "load", "(", "language_dir", ",", "filename", ",", "encoding", ")", ":", "global", "_DICTIONARY", "try", ":", "json_file", "=", "filename", "+", "'.json'", "with", "io", ".", "open", "(", "os", ".", "path", ".", "join", "(", "language_dir", ",", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
getin
returns the value in a nested dict
gooey/util/functional.py
def getin(m, path, default=None): """returns the value in a nested dict""" keynotfound = ':com.gooey-project/not-found' result = reduce(lambda acc, val: acc.get(val, {keynotfound: None}), path, m) # falsey values like 0 would incorrectly trigger the default to be returned # so the keynotfound v...
def getin(m, path, default=None): """returns the value in a nested dict""" keynotfound = ':com.gooey-project/not-found' result = reduce(lambda acc, val: acc.get(val, {keynotfound: None}), path, m) # falsey values like 0 would incorrectly trigger the default to be returned # so the keynotfound v...
[ "returns", "the", "value", "in", "a", "nested", "dict" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/util/functional.py#L9-L17
[ "def", "getin", "(", "m", ",", "path", ",", "default", "=", "None", ")", ":", "keynotfound", "=", "':com.gooey-project/not-found'", "result", "=", "reduce", "(", "lambda", "acc", ",", "val", ":", "acc", ".", "get", "(", "val", ",", "{", "keynotfound", ...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
assoc
Copy-on-write associates a value in a dict
gooey/util/functional.py
def assoc(m, key, val): """Copy-on-write associates a value in a dict""" cpy = deepcopy(m) cpy[key] = val return cpy
def assoc(m, key, val): """Copy-on-write associates a value in a dict""" cpy = deepcopy(m) cpy[key] = val return cpy
[ "Copy", "-", "on", "-", "write", "associates", "a", "value", "in", "a", "dict" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/util/functional.py#L20-L24
[ "def", "assoc", "(", "m", ",", "key", ",", "val", ")", ":", "cpy", "=", "deepcopy", "(", "m", ")", "cpy", "[", "key", "]", "=", "val", "return", "cpy" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
associn
Copy-on-write associates a value in a nested dict
gooey/util/functional.py
def associn(m, path, value): """ Copy-on-write associates a value in a nested dict """ def assoc_recursively(m, path, value): if not path: return value p = path[0] return assoc(m, p, assoc_recursively(m.get(p,{}), path[1:], value)) return assoc_recursively(m, path,...
def associn(m, path, value): """ Copy-on-write associates a value in a nested dict """ def assoc_recursively(m, path, value): if not path: return value p = path[0] return assoc(m, p, assoc_recursively(m.get(p,{}), path[1:], value)) return assoc_recursively(m, path,...
[ "Copy", "-", "on", "-", "write", "associates", "a", "value", "in", "a", "nested", "dict" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/util/functional.py#L27-L34
[ "def", "associn", "(", "m", ",", "path", ",", "value", ")", ":", "def", "assoc_recursively", "(", "m", ",", "path", ",", "value", ")", ":", "if", "not", "path", ":", "return", "value", "p", "=", "path", "[", "0", "]", "return", "assoc", "(", "m",...
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
merge
Merge all maps left to right
gooey/util/functional.py
def merge(*maps): """Merge all maps left to right""" copies = map(deepcopy, maps) return reduce(lambda acc, val: acc.update(val) or acc, copies)
def merge(*maps): """Merge all maps left to right""" copies = map(deepcopy, maps) return reduce(lambda acc, val: acc.update(val) or acc, copies)
[ "Merge", "all", "maps", "left", "to", "right" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/util/functional.py#L37-L40
[ "def", "merge", "(", "*", "maps", ")", ":", "copies", "=", "map", "(", "deepcopy", ",", "maps", ")", "return", "reduce", "(", "lambda", "acc", ",", "val", ":", "acc", ".", "update", "(", "val", ")", "or", "acc", ",", "copies", ")" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
findfirst
Return first occurrence matching f, otherwise None
gooey/util/functional.py
def findfirst(f, coll): """Return first occurrence matching f, otherwise None""" result = list(dropwhile(f, coll)) return result[0] if result else None
def findfirst(f, coll): """Return first occurrence matching f, otherwise None""" result = list(dropwhile(f, coll)) return result[0] if result else None
[ "Return", "first", "occurrence", "matching", "f", "otherwise", "None" ]
chriskiehl/Gooey
python
https://github.com/chriskiehl/Gooey/blob/e598573c6519b953e0ccfc1f3663f827f8cd7e22/gooey/util/functional.py#L58-L61
[ "def", "findfirst", "(", "f", ",", "coll", ")", ":", "result", "=", "list", "(", "dropwhile", "(", "f", ",", "coll", ")", ")", "return", "result", "[", "0", "]", "if", "result", "else", "None" ]
e598573c6519b953e0ccfc1f3663f827f8cd7e22
train
visualize_activation_with_losses
Generates the `input_tensor` that minimizes the weighted `losses`. This function is intended for advanced use cases where a custom loss is desired. Args: input_tensor: An input tensor of shape: `(samples, channels, image_dims...)` if `image_data_format= channels_first` or `(samples, image_d...
vis/visualization/activation_maximization.py
def visualize_activation_with_losses(input_tensor, losses, wrt_tensor=None, seed_input=None, input_range=(0, 255), **optimizer_params): """Generates the `input_tensor` that minimizes the weighted `losses`. This function is intended for advanc...
def visualize_activation_with_losses(input_tensor, losses, wrt_tensor=None, seed_input=None, input_range=(0, 255), **optimizer_params): """Generates the `input_tensor` that minimizes the weighted `losses`. This function is intended for advanc...
[ "Generates", "the", "input_tensor", "that", "minimizes", "the", "weighted", "losses", ".", "This", "function", "is", "intended", "for", "advanced", "use", "cases", "where", "a", "custom", "loss", "is", "desired", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/activation_maximization.py#L13-L51
[ "def", "visualize_activation_with_losses", "(", "input_tensor", ",", "losses", ",", "wrt_tensor", "=", "None", ",", "seed_input", "=", "None", ",", "input_range", "=", "(", "0", ",", "255", ")", ",", "*", "*", "optimizer_params", ")", ":", "# Default optimizer...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
visualize_activation
Generates the model input that maximizes the output of all `filter_indices` in the given `layer_idx`. Args: model: The `keras.models.Model` instance. The model input shape must be: `(samples, channels, image_dims...)` if `image_data_format=channels_first` or `(samples, image_dims..., channels)`...
vis/visualization/activation_maximization.py
def visualize_activation(model, layer_idx, filter_indices=None, wrt_tensor=None, seed_input=None, input_range=(0, 255), backprop_modifier=None, grad_modifier=None, act_max_weight=1, lp_norm_weight=10, tv_weight=10, **opt...
def visualize_activation(model, layer_idx, filter_indices=None, wrt_tensor=None, seed_input=None, input_range=(0, 255), backprop_modifier=None, grad_modifier=None, act_max_weight=1, lp_norm_weight=10, tv_weight=10, **opt...
[ "Generates", "the", "model", "input", "that", "maximizes", "the", "output", "of", "all", "filter_indices", "in", "the", "given", "layer_idx", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/activation_maximization.py#L54-L112
[ "def", "visualize_activation", "(", "model", ",", "layer_idx", ",", "filter_indices", "=", "None", ",", "wrt_tensor", "=", "None", ",", "seed_input", "=", "None", ",", "input_range", "=", "(", "0", ",", "255", ")", ",", "backprop_modifier", "=", "None", ",...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
Optimizer._rmsprop
Uses RMSProp to compute step from gradients. Args: grads: numpy array of gradients. cache: numpy array of same shape as `grads` as RMSProp cache decay_rate: How fast to decay cache Returns: A tuple of step: numpy array of the same shape a...
vis/optimizer.py
def _rmsprop(self, grads, cache=None, decay_rate=0.95): """Uses RMSProp to compute step from gradients. Args: grads: numpy array of gradients. cache: numpy array of same shape as `grads` as RMSProp cache decay_rate: How fast to decay cache Returns: ...
def _rmsprop(self, grads, cache=None, decay_rate=0.95): """Uses RMSProp to compute step from gradients. Args: grads: numpy array of gradients. cache: numpy array of same shape as `grads` as RMSProp cache decay_rate: How fast to decay cache Returns: ...
[ "Uses", "RMSProp", "to", "compute", "step", "from", "gradients", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/optimizer.py#L69-L87
[ "def", "_rmsprop", "(", "self", ",", "grads", ",", "cache", "=", "None", ",", "decay_rate", "=", "0.95", ")", ":", "if", "cache", "is", "None", ":", "cache", "=", "np", ".", "zeros_like", "(", "grads", ")", "cache", "=", "decay_rate", "*", "cache", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
Optimizer._get_seed_input
Creates a random `seed_input` if None. Otherwise: - Ensures batch_size dim on provided `seed_input`. - Shuffle axis according to expected `image_data_format`.
vis/optimizer.py
def _get_seed_input(self, seed_input): """Creates a random `seed_input` if None. Otherwise: - Ensures batch_size dim on provided `seed_input`. - Shuffle axis according to expected `image_data_format`. """ desired_shape = (1, ) + K.int_shape(self.input_tensor)[1:] ...
def _get_seed_input(self, seed_input): """Creates a random `seed_input` if None. Otherwise: - Ensures batch_size dim on provided `seed_input`. - Shuffle axis according to expected `image_data_format`. """ desired_shape = (1, ) + K.int_shape(self.input_tensor)[1:] ...
[ "Creates", "a", "random", "seed_input", "if", "None", ".", "Otherwise", ":", "-", "Ensures", "batch_size", "dim", "on", "provided", "seed_input", ".", "-", "Shuffle", "axis", "according", "to", "expected", "image_data_format", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/optimizer.py#L89-L107
[ "def", "_get_seed_input", "(", "self", ",", "seed_input", ")", ":", "desired_shape", "=", "(", "1", ",", ")", "+", "K", ".", "int_shape", "(", "self", ".", "input_tensor", ")", "[", "1", ":", "]", "if", "seed_input", "is", "None", ":", "return", "uti...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
Optimizer.minimize
Performs gradient descent on the input image with respect to defined losses. Args: seed_input: An N-dim numpy array of shape: `(samples, channels, image_dims...)` if `image_data_format= channels_first` or `(samples, image_dims..., channels)` if `image_data_format=channels_last`. ...
vis/optimizer.py
def minimize(self, seed_input=None, max_iter=200, input_modifiers=None, grad_modifier=None, callbacks=None, verbose=True): """Performs gradient descent on the input image with respect to defined losses. Args: seed_input: An N-dim numpy array of shape: `(sam...
def minimize(self, seed_input=None, max_iter=200, input_modifiers=None, grad_modifier=None, callbacks=None, verbose=True): """Performs gradient descent on the input image with respect to defined losses. Args: seed_input: An N-dim numpy array of shape: `(sam...
[ "Performs", "gradient", "descent", "on", "the", "input", "image", "with", "respect", "to", "defined", "losses", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/optimizer.py#L109-L187
[ "def", "minimize", "(", "self", ",", "seed_input", "=", "None", ",", "max_iter", "=", "200", ",", "input_modifiers", "=", "None", ",", "grad_modifier", "=", "None", ",", "callbacks", "=", "None", ",", "verbose", "=", "True", ")", ":", "seed_input", "=", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
order_by_line_nos
Orders the set of `objs` by `line_nos`
docs/md_autogen.py
def order_by_line_nos(objs, line_nos): """Orders the set of `objs` by `line_nos` """ ordering = sorted(range(len(line_nos)), key=line_nos.__getitem__) return [objs[i] for i in ordering]
def order_by_line_nos(objs, line_nos): """Orders the set of `objs` by `line_nos` """ ordering = sorted(range(len(line_nos)), key=line_nos.__getitem__) return [objs[i] for i in ordering]
[ "Orders", "the", "set", "of", "objs", "by", "line_nos" ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/docs/md_autogen.py#L71-L75
[ "def", "order_by_line_nos", "(", "objs", ",", "line_nos", ")", ":", "ordering", "=", "sorted", "(", "range", "(", "len", "(", "line_nos", ")", ")", ",", "key", "=", "line_nos", ".", "__getitem__", ")", "return", "[", "objs", "[", "i", "]", "for", "i"...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
to_md_file
Import a module path and create an api doc from it Args: string (str): string with line breaks to write to file. filename (str): filename without the .md out_path (str): The output directory
docs/md_autogen.py
def to_md_file(string, filename, out_path="."): """Import a module path and create an api doc from it Args: string (str): string with line breaks to write to file. filename (str): filename without the .md out_path (str): The output directory """ md_file = "%s.md" % filename ...
def to_md_file(string, filename, out_path="."): """Import a module path and create an api doc from it Args: string (str): string with line breaks to write to file. filename (str): filename without the .md out_path (str): The output directory """ md_file = "%s.md" % filename ...
[ "Import", "a", "module", "path", "and", "create", "an", "api", "doc", "from", "it" ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/docs/md_autogen.py#L78-L89
[ "def", "to_md_file", "(", "string", ",", "filename", ",", "out_path", "=", "\".\"", ")", ":", "md_file", "=", "\"%s.md\"", "%", "filename", "with", "open", "(", "os", ".", "path", ".", "join", "(", "out_path", ",", "md_file", ")", ",", "\"w\"", ")", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
MarkdownAPIGenerator.get_src_path
Creates a src path string with line info for use as markdown link.
docs/md_autogen.py
def get_src_path(self, obj, append_base=True): """Creates a src path string with line info for use as markdown link. """ path = getsourcefile(obj) if self.src_root not in path: # this can happen with e.g. # inlinefunc-wrapped functions if hasattr(obj, ...
def get_src_path(self, obj, append_base=True): """Creates a src path string with line info for use as markdown link. """ path = getsourcefile(obj) if self.src_root not in path: # this can happen with e.g. # inlinefunc-wrapped functions if hasattr(obj, ...
[ "Creates", "a", "src", "path", "string", "with", "line", "info", "for", "use", "as", "markdown", "link", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/docs/md_autogen.py#L116-L136
[ "def", "get_src_path", "(", "self", ",", "obj", ",", "append_base", "=", "True", ")", ":", "path", "=", "getsourcefile", "(", "obj", ")", "if", "self", ".", "src_root", "not", "in", "path", ":", "# this can happen with e.g.", "# inlinefunc-wrapped functions", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
MarkdownAPIGenerator.doc2md
Parse docstring (parsed with getdoc) according to Google-style formatting and convert to markdown. We support the following Google style syntax: Args, Kwargs: argname (type): text freeform text Returns, Yields: retname (type): text freefor...
docs/md_autogen.py
def doc2md(self, func): """Parse docstring (parsed with getdoc) according to Google-style formatting and convert to markdown. We support the following Google style syntax: Args, Kwargs: argname (type): text freeform text Returns, Yields: retna...
def doc2md(self, func): """Parse docstring (parsed with getdoc) according to Google-style formatting and convert to markdown. We support the following Google style syntax: Args, Kwargs: argname (type): text freeform text Returns, Yields: retna...
[ "Parse", "docstring", "(", "parsed", "with", "getdoc", ")", "according", "to", "Google", "-", "style", "formatting", "and", "convert", "to", "markdown", ".", "We", "support", "the", "following", "Google", "style", "syntax", ":" ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/docs/md_autogen.py#L138-L184
[ "def", "doc2md", "(", "self", ",", "func", ")", ":", "doc", "=", "getdoc", "(", "func", ")", "or", "\"\"", "blockindent", "=", "0", "argindent", "=", "1", "out", "=", "[", "]", "for", "line", "in", "doc", ".", "split", "(", "\"\\n\"", ")", ":", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
MarkdownAPIGenerator.func2md
Takes a function (or method) and documents it. Args: clsname (str, optional): class name to prepend to funcname. depth (int, optional): number of ### to append to function name
docs/md_autogen.py
def func2md(self, func, clsname=None, names=None, depth=3): """Takes a function (or method) and documents it. Args: clsname (str, optional): class name to prepend to funcname. depth (int, optional): number of ### to append to function name """ section = "#" * de...
def func2md(self, func, clsname=None, names=None, depth=3): """Takes a function (or method) and documents it. Args: clsname (str, optional): class name to prepend to funcname. depth (int, optional): number of ### to append to function name """ section = "#" * de...
[ "Takes", "a", "function", "(", "or", "method", ")", "and", "documents", "it", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/docs/md_autogen.py#L186-L279
[ "def", "func2md", "(", "self", ",", "func", ",", "clsname", "=", "None", ",", "names", "=", "None", ",", "depth", "=", "3", ")", ":", "section", "=", "\"#\"", "*", "depth", "if", "names", "is", "None", ":", "names", "=", "[", "func", ".", "__name...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
MarkdownAPIGenerator.class2md
Takes a class and creates markdown text to document its methods and variables.
docs/md_autogen.py
def class2md(self, cls, depth=2): """Takes a class and creates markdown text to document its methods and variables. """ section = "#" * depth subsection = "#" * (depth + 2) clsname = cls.__name__ modname = cls.__module__ header = clsname path = self.get_s...
def class2md(self, cls, depth=2): """Takes a class and creates markdown text to document its methods and variables. """ section = "#" * depth subsection = "#" * (depth + 2) clsname = cls.__name__ modname = cls.__module__ header = clsname path = self.get_s...
[ "Takes", "a", "class", "and", "creates", "markdown", "text", "to", "document", "its", "methods", "and", "variables", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/docs/md_autogen.py#L281-L325
[ "def", "class2md", "(", "self", ",", "cls", ",", "depth", "=", "2", ")", ":", "section", "=", "\"#\"", "*", "depth", "subsection", "=", "\"#\"", "*", "(", "depth", "+", "2", ")", "clsname", "=", "cls", ".", "__name__", "modname", "=", "cls", ".", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
MarkdownAPIGenerator.module2md
Takes an imported module object and create a Markdown string containing functions and classes.
docs/md_autogen.py
def module2md(self, module): """Takes an imported module object and create a Markdown string containing functions and classes. """ modname = module.__name__ path = self.get_src_path(module, append_base=False) path = "[{}]({})".format(path, os.path.join(self.github_link, path)) ...
def module2md(self, module): """Takes an imported module object and create a Markdown string containing functions and classes. """ modname = module.__name__ path = self.get_src_path(module, append_base=False) path = "[{}]({})".format(path, os.path.join(self.github_link, path)) ...
[ "Takes", "an", "imported", "module", "object", "and", "create", "a", "Markdown", "string", "containing", "functions", "and", "classes", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/docs/md_autogen.py#L327-L392
[ "def", "module2md", "(", "self", ",", "module", ")", ":", "modname", "=", "module", ".", "__name__", "path", "=", "self", ".", "get_src_path", "(", "module", ",", "append_base", "=", "False", ")", "path", "=", "\"[{}]({})\"", ".", "format", "(", "path", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
_find_penultimate_layer
Searches for the nearest penultimate `Conv` or `Pooling` layer. Args: model: The `keras.models.Model` instance. layer_idx: The layer index within `model.layers`. penultimate_layer_idx: The pre-layer to `layer_idx`. If set to None, the nearest penultimate `Conv` or `Pooling` laye...
vis/visualization/saliency.py
def _find_penultimate_layer(model, layer_idx, penultimate_layer_idx): """Searches for the nearest penultimate `Conv` or `Pooling` layer. Args: model: The `keras.models.Model` instance. layer_idx: The layer index within `model.layers`. penultimate_layer_idx: The pre-layer to `layer_idx`....
def _find_penultimate_layer(model, layer_idx, penultimate_layer_idx): """Searches for the nearest penultimate `Conv` or `Pooling` layer. Args: model: The `keras.models.Model` instance. layer_idx: The layer index within `model.layers`. penultimate_layer_idx: The pre-layer to `layer_idx`....
[ "Searches", "for", "the", "nearest", "penultimate", "Conv", "or", "Pooling", "layer", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/saliency.py#L17-L47
[ "def", "_find_penultimate_layer", "(", "model", ",", "layer_idx", ",", "penultimate_layer_idx", ")", ":", "if", "penultimate_layer_idx", "is", "None", ":", "for", "idx", ",", "layer", "in", "utils", ".", "reverse_enumerate", "(", "model", ".", "layers", "[", "...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
visualize_saliency_with_losses
Generates an attention heatmap over the `seed_input` by using positive gradients of `input_tensor` with respect to weighted `losses`. This function is intended for advanced use cases where a custom loss is desired. For common use cases, refer to `visualize_class_saliency` or `visualize_regression_saliency`...
vis/visualization/saliency.py
def visualize_saliency_with_losses(input_tensor, losses, seed_input, wrt_tensor=None, grad_modifier='absolute', keepdims=False): """Generates an attention heatmap over the `seed_input` by using positive gradients of `input_tensor` with respect to weighted `losses`. This function is intended for advanced us...
def visualize_saliency_with_losses(input_tensor, losses, seed_input, wrt_tensor=None, grad_modifier='absolute', keepdims=False): """Generates an attention heatmap over the `seed_input` by using positive gradients of `input_tensor` with respect to weighted `losses`. This function is intended for advanced us...
[ "Generates", "an", "attention", "heatmap", "over", "the", "seed_input", "by", "using", "positive", "gradients", "of", "input_tensor", "with", "respect", "to", "weighted", "losses", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/saliency.py#L50-L84
[ "def", "visualize_saliency_with_losses", "(", "input_tensor", ",", "losses", ",", "seed_input", ",", "wrt_tensor", "=", "None", ",", "grad_modifier", "=", "'absolute'", ",", "keepdims", "=", "False", ")", ":", "opt", "=", "Optimizer", "(", "input_tensor", ",", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
visualize_saliency
Generates an attention heatmap over the `seed_input` for maximizing `filter_indices` output in the given `layer_idx`. Args: model: The `keras.models.Model` instance. The model input shape must be: `(samples, channels, image_dims...)` if `image_data_format=channels_first` or `(samples, image...
vis/visualization/saliency.py
def visualize_saliency(model, layer_idx, filter_indices, seed_input, wrt_tensor=None, backprop_modifier=None, grad_modifier='absolute', keepdims=False): """Generates an attention heatmap over the `seed_input` for maximizing `filter_indices` output in the given `layer_idx`. Args: ...
def visualize_saliency(model, layer_idx, filter_indices, seed_input, wrt_tensor=None, backprop_modifier=None, grad_modifier='absolute', keepdims=False): """Generates an attention heatmap over the `seed_input` for maximizing `filter_indices` output in the given `layer_idx`. Args: ...
[ "Generates", "an", "attention", "heatmap", "over", "the", "seed_input", "for", "maximizing", "filter_indices", "output", "in", "the", "given", "layer_idx", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/saliency.py#L87-L134
[ "def", "visualize_saliency", "(", "model", ",", "layer_idx", ",", "filter_indices", ",", "seed_input", ",", "wrt_tensor", "=", "None", ",", "backprop_modifier", "=", "None", ",", "grad_modifier", "=", "'absolute'", ",", "keepdims", "=", "False", ")", ":", "if"...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
visualize_cam_with_losses
Generates a gradient based class activation map (CAM) by using positive gradients of `input_tensor` with respect to weighted `losses`. For details on grad-CAM, see the paper: [Grad-CAM: Why did you say that? Visual Explanations from Deep Networks via Gradient-based Localization] (https://arxiv.org/pdf/...
vis/visualization/saliency.py
def visualize_cam_with_losses(input_tensor, losses, seed_input, penultimate_layer, grad_modifier=None): """Generates a gradient based class activation map (CAM) by using positive gradients of `input_tensor` with respect to weighted `losses`. For details on grad-CAM, see the paper: [Grad-CAM: Why did yo...
def visualize_cam_with_losses(input_tensor, losses, seed_input, penultimate_layer, grad_modifier=None): """Generates a gradient based class activation map (CAM) by using positive gradients of `input_tensor` with respect to weighted `losses`. For details on grad-CAM, see the paper: [Grad-CAM: Why did yo...
[ "Generates", "a", "gradient", "based", "class", "activation", "map", "(", "CAM", ")", "by", "using", "positive", "gradients", "of", "input_tensor", "with", "respect", "to", "weighted", "losses", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/saliency.py#L137-L196
[ "def", "visualize_cam_with_losses", "(", "input_tensor", ",", "losses", ",", "seed_input", ",", "penultimate_layer", ",", "grad_modifier", "=", "None", ")", ":", "penultimate_output", "=", "penultimate_layer", ".", "output", "opt", "=", "Optimizer", "(", "input_tens...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
visualize_cam
Generates a gradient based class activation map (grad-CAM) that maximizes the outputs of `filter_indices` in `layer_idx`. Args: model: The `keras.models.Model` instance. The model input shape must be: `(samples, channels, image_dims...)` if `image_data_format=channels_first` or `(samples, i...
vis/visualization/saliency.py
def visualize_cam(model, layer_idx, filter_indices, seed_input, penultimate_layer_idx=None, backprop_modifier=None, grad_modifier=None): """Generates a gradient based class activation map (grad-CAM) that maximizes the outputs of `filter_indices` in `layer_idx`. Args: ...
def visualize_cam(model, layer_idx, filter_indices, seed_input, penultimate_layer_idx=None, backprop_modifier=None, grad_modifier=None): """Generates a gradient based class activation map (grad-CAM) that maximizes the outputs of `filter_indices` in `layer_idx`. Args: ...
[ "Generates", "a", "gradient", "based", "class", "activation", "map", "(", "grad", "-", "CAM", ")", "that", "maximizes", "the", "outputs", "of", "filter_indices", "in", "layer_idx", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/saliency.py#L199-L245
[ "def", "visualize_cam", "(", "model", ",", "layer_idx", ",", "filter_indices", ",", "seed_input", ",", "penultimate_layer_idx", "=", "None", ",", "backprop_modifier", "=", "None", ",", "grad_modifier", "=", "None", ")", ":", "if", "backprop_modifier", "is", "not...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
modify_model_backprop
Creates a copy of model by modifying all activations to use a custom op to modify the backprop behavior. Args: model: The `keras.models.Model` instance. backprop_modifier: One of `{'guided', 'rectified'}` Returns: A copy of model with modified activations for backwards pass.
vis/backend/tensorflow_backend.py
def modify_model_backprop(model, backprop_modifier): """Creates a copy of model by modifying all activations to use a custom op to modify the backprop behavior. Args: model: The `keras.models.Model` instance. backprop_modifier: One of `{'guided', 'rectified'}` Returns: A copy of m...
def modify_model_backprop(model, backprop_modifier): """Creates a copy of model by modifying all activations to use a custom op to modify the backprop behavior. Args: model: The `keras.models.Model` instance. backprop_modifier: One of `{'guided', 'rectified'}` Returns: A copy of m...
[ "Creates", "a", "copy", "of", "model", "by", "modifying", "all", "activations", "to", "use", "a", "custom", "op", "to", "modify", "the", "backprop", "behavior", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/backend/tensorflow_backend.py#L53-L103
[ "def", "modify_model_backprop", "(", "model", ",", "backprop_modifier", ")", ":", "# The general strategy is as follows:", "# - Save original model so that upstream callers don't see unexpected results with their models.", "# - Call backend specific function that registers the custom op and load...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
normalize
Normalizes the `output_tensor` with respect to `input_tensor` dimensions. This makes regularizer weight factor more or less uniform across various input image dimensions. Args: input_tensor: An tensor of shape: `(samples, channels, image_dims...)` if `image_data_format= channels_first` ...
vis/regularizers.py
def normalize(input_tensor, output_tensor): """Normalizes the `output_tensor` with respect to `input_tensor` dimensions. This makes regularizer weight factor more or less uniform across various input image dimensions. Args: input_tensor: An tensor of shape: `(samples, channels, image_dims...)` if `...
def normalize(input_tensor, output_tensor): """Normalizes the `output_tensor` with respect to `input_tensor` dimensions. This makes regularizer weight factor more or less uniform across various input image dimensions. Args: input_tensor: An tensor of shape: `(samples, channels, image_dims...)` if `...
[ "Normalizes", "the", "output_tensor", "with", "respect", "to", "input_tensor", "dimensions", ".", "This", "makes", "regularizer", "weight", "factor", "more", "or", "less", "uniform", "across", "various", "input", "image", "dimensions", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/regularizers.py#L11-L24
[ "def", "normalize", "(", "input_tensor", ",", "output_tensor", ")", ":", "image_dims", "=", "utils", ".", "get_img_shape", "(", "input_tensor", ")", "[", "1", ":", "]", "return", "output_tensor", "/", "np", ".", "prod", "(", "image_dims", ")" ]
668b0e11dab93f3487f23c17e07f40554a8939e9
train
TotalVariation.build_loss
r"""Implements the N-dim version of function $$TV^{\beta}(x) = \sum_{whc} \left ( \left ( x(h, w+1, c) - x(h, w, c) \right )^{2} + \left ( x(h+1, w, c) - x(h, w, c) \right )^{2} \right )^{\frac{\beta}{2}}$$ to return total variation for all images in the batch.
vis/regularizers.py
def build_loss(self): r"""Implements the N-dim version of function $$TV^{\beta}(x) = \sum_{whc} \left ( \left ( x(h, w+1, c) - x(h, w, c) \right )^{2} + \left ( x(h+1, w, c) - x(h, w, c) \right )^{2} \right )^{\frac{\beta}{2}}$$ to return total variation for all images in the batch. ...
def build_loss(self): r"""Implements the N-dim version of function $$TV^{\beta}(x) = \sum_{whc} \left ( \left ( x(h, w+1, c) - x(h, w, c) \right )^{2} + \left ( x(h+1, w, c) - x(h, w, c) \right )^{2} \right )^{\frac{\beta}{2}}$$ to return total variation for all images in the batch. ...
[ "r", "Implements", "the", "N", "-", "dim", "version", "of", "function", "$$TV^", "{", "\\", "beta", "}", "(", "x", ")", "=", "\\", "sum_", "{", "whc", "}", "\\", "left", "(", "\\", "left", "(", "x", "(", "h", "w", "+", "1", "c", ")", "-", "...
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/regularizers.py#L46-L72
[ "def", "build_loss", "(", "self", ")", ":", "image_dims", "=", "K", ".", "ndim", "(", "self", ".", "img", ")", "-", "2", "# Constructing slice [1:] + [:-1] * (image_dims - 1) and [:-1] * (image_dims)", "start_slice", "=", "[", "slice", "(", "1", ",", "None", ","...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
_find_font_file
Utility to find font file.
vis/utils/utils.py
def _find_font_file(query): """Utility to find font file. """ return list(filter(lambda path: query.lower() in os.path.basename(path).lower(), fontman.findSystemFonts()))
def _find_font_file(query): """Utility to find font file. """ return list(filter(lambda path: query.lower() in os.path.basename(path).lower(), fontman.findSystemFonts()))
[ "Utility", "to", "find", "font", "file", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L38-L41
[ "def", "_find_font_file", "(", "query", ")", ":", "return", "list", "(", "filter", "(", "lambda", "path", ":", "query", ".", "lower", "(", ")", "in", "os", ".", "path", ".", "basename", "(", "path", ")", ".", "lower", "(", ")", ",", "fontman", ".",...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
add_defaults_to_kwargs
Updates `kwargs` with dict of `defaults` Args: defaults: A dictionary of keys and values **kwargs: The kwargs to update. Returns: The updated kwargs.
vis/utils/utils.py
def add_defaults_to_kwargs(defaults, **kwargs): """Updates `kwargs` with dict of `defaults` Args: defaults: A dictionary of keys and values **kwargs: The kwargs to update. Returns: The updated kwargs. """ defaults = dict(defaults) defaults.update(kwargs) return defa...
def add_defaults_to_kwargs(defaults, **kwargs): """Updates `kwargs` with dict of `defaults` Args: defaults: A dictionary of keys and values **kwargs: The kwargs to update. Returns: The updated kwargs. """ defaults = dict(defaults) defaults.update(kwargs) return defa...
[ "Updates", "kwargs", "with", "dict", "of", "defaults" ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L58-L70
[ "def", "add_defaults_to_kwargs", "(", "defaults", ",", "*", "*", "kwargs", ")", ":", "defaults", "=", "dict", "(", "defaults", ")", "defaults", ".", "update", "(", "kwargs", ")", "return", "defaults" ]
668b0e11dab93f3487f23c17e07f40554a8939e9
train
get_identifier
Helper utility to retrieve the callable function associated with a string identifier. Args: identifier: The identifier. Could be a string or function. module_globals: The global objects of the module. module_name: The module name Returns: The callable associated with the identi...
vis/utils/utils.py
def get_identifier(identifier, module_globals, module_name): """Helper utility to retrieve the callable function associated with a string identifier. Args: identifier: The identifier. Could be a string or function. module_globals: The global objects of the module. module_name: The modul...
def get_identifier(identifier, module_globals, module_name): """Helper utility to retrieve the callable function associated with a string identifier. Args: identifier: The identifier. Could be a string or function. module_globals: The global objects of the module. module_name: The modul...
[ "Helper", "utility", "to", "retrieve", "the", "callable", "function", "associated", "with", "a", "string", "identifier", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L73-L92
[ "def", "get_identifier", "(", "identifier", ",", "module_globals", ",", "module_name", ")", ":", "if", "isinstance", "(", "identifier", ",", "six", ".", "string_types", ")", ":", "fn", "=", "module_globals", ".", "get", "(", "identifier", ")", "if", "fn", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
apply_modifications
Applies modifications to the model layers to create a new Graph. For example, simply changing `model.layers[idx].activation = new activation` does not change the graph. The entire graph needs to be updated with modified inbound and outbound tensors because of change in layer building function. Args: ...
vis/utils/utils.py
def apply_modifications(model, custom_objects=None): """Applies modifications to the model layers to create a new Graph. For example, simply changing `model.layers[idx].activation = new activation` does not change the graph. The entire graph needs to be updated with modified inbound and outbound tensors bec...
def apply_modifications(model, custom_objects=None): """Applies modifications to the model layers to create a new Graph. For example, simply changing `model.layers[idx].activation = new activation` does not change the graph. The entire graph needs to be updated with modified inbound and outbound tensors bec...
[ "Applies", "modifications", "to", "the", "model", "layers", "to", "create", "a", "new", "Graph", ".", "For", "example", "simply", "changing", "model", ".", "layers", "[", "idx", "]", ".", "activation", "=", "new", "activation", "does", "not", "change", "th...
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L95-L115
[ "def", "apply_modifications", "(", "model", ",", "custom_objects", "=", "None", ")", ":", "# The strategy is to save the modified model and load it back. This is done because setting the activation", "# in a Keras layer doesnt actually change the graph. We have to iterate the entire graph and ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
random_array
Creates a uniformly distributed random array with the given `mean` and `std`. Args: shape: The desired shape mean: The desired mean (Default value = 128) std: The desired std (Default value = 20) Returns: Random numpy array of given `shape` uniformly distributed with desired `mean` and...
vis/utils/utils.py
def random_array(shape, mean=128., std=20.): """Creates a uniformly distributed random array with the given `mean` and `std`. Args: shape: The desired shape mean: The desired mean (Default value = 128) std: The desired std (Default value = 20) Returns: Random numpy array of given `...
def random_array(shape, mean=128., std=20.): """Creates a uniformly distributed random array with the given `mean` and `std`. Args: shape: The desired shape mean: The desired mean (Default value = 128) std: The desired std (Default value = 20) Returns: Random numpy array of given `...
[ "Creates", "a", "uniformly", "distributed", "random", "array", "with", "the", "given", "mean", "and", "std", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L118-L133
[ "def", "random_array", "(", "shape", ",", "mean", "=", "128.", ",", "std", "=", "20.", ")", ":", "x", "=", "np", ".", "random", ".", "random", "(", "shape", ")", "# normalize around mean=0, std=1", "x", "=", "(", "x", "-", "np", ".", "mean", "(", "...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
find_layer_idx
Looks up the layer index corresponding to `layer_name` from `model`. Args: model: The `keras.models.Model` instance. layer_name: The name of the layer to lookup. Returns: The layer index if found. Raises an exception otherwise.
vis/utils/utils.py
def find_layer_idx(model, layer_name): """Looks up the layer index corresponding to `layer_name` from `model`. Args: model: The `keras.models.Model` instance. layer_name: The name of the layer to lookup. Returns: The layer index if found. Raises an exception otherwise. """ ...
def find_layer_idx(model, layer_name): """Looks up the layer index corresponding to `layer_name` from `model`. Args: model: The `keras.models.Model` instance. layer_name: The name of the layer to lookup. Returns: The layer index if found. Raises an exception otherwise. """ ...
[ "Looks", "up", "the", "layer", "index", "corresponding", "to", "layer_name", "from", "model", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L136-L154
[ "def", "find_layer_idx", "(", "model", ",", "layer_name", ")", ":", "layer_idx", "=", "None", "for", "idx", ",", "layer", "in", "enumerate", "(", "model", ".", "layers", ")", ":", "if", "layer", ".", "name", "==", "layer_name", ":", "layer_idx", "=", "...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
deprocess_input
Utility function to scale the `input_array` to `input_range` throwing away high frequency artifacts. Args: input_array: An N-dim numpy array. input_range: Specifies the input range as a `(min, max)` tuple to rescale the `input_array`. Returns: The rescaled `input_array`.
vis/utils/utils.py
def deprocess_input(input_array, input_range=(0, 255)): """Utility function to scale the `input_array` to `input_range` throwing away high frequency artifacts. Args: input_array: An N-dim numpy array. input_range: Specifies the input range as a `(min, max)` tuple to rescale the `input_array`. ...
def deprocess_input(input_array, input_range=(0, 255)): """Utility function to scale the `input_array` to `input_range` throwing away high frequency artifacts. Args: input_array: An N-dim numpy array. input_range: Specifies the input range as a `(min, max)` tuple to rescale the `input_array`. ...
[ "Utility", "function", "to", "scale", "the", "input_array", "to", "input_range", "throwing", "away", "high", "frequency", "artifacts", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L157-L178
[ "def", "deprocess_input", "(", "input_array", ",", "input_range", "=", "(", "0", ",", "255", ")", ")", ":", "# normalize tensor: center on 0., ensure std is 0.1", "input_array", "=", "input_array", ".", "copy", "(", ")", "input_array", "-=", "input_array", ".", "m...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
stitch_images
Utility function to stitch images together with a `margin`. Args: images: The array of 2D images to stitch. margin: The black border margin size between images (Default value = 5) cols: Max number of image cols. New row is created when number of images exceed the column size. (D...
vis/utils/utils.py
def stitch_images(images, margin=5, cols=5): """Utility function to stitch images together with a `margin`. Args: images: The array of 2D images to stitch. margin: The black border margin size between images (Default value = 5) cols: Max number of image cols. New row is created when num...
def stitch_images(images, margin=5, cols=5): """Utility function to stitch images together with a `margin`. Args: images: The array of 2D images to stitch. margin: The black border margin size between images (Default value = 5) cols: Max number of image cols. New row is created when num...
[ "Utility", "function", "to", "stitch", "images", "together", "with", "a", "margin", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L181-L213
[ "def", "stitch_images", "(", "images", ",", "margin", "=", "5", ",", "cols", "=", "5", ")", ":", "if", "len", "(", "images", ")", "==", "0", ":", "return", "None", "h", ",", "w", ",", "c", "=", "images", "[", "0", "]", ".", "shape", "n_rows", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
get_img_shape
Returns image shape in a backend agnostic manner. Args: img: An image tensor of shape: `(channels, image_dims...)` if data_format='channels_first' or `(image_dims..., channels)` if data_format='channels_last'. Returns: Tuple containing image shape information in `(samples, channels...
vis/utils/utils.py
def get_img_shape(img): """Returns image shape in a backend agnostic manner. Args: img: An image tensor of shape: `(channels, image_dims...)` if data_format='channels_first' or `(image_dims..., channels)` if data_format='channels_last'. Returns: Tuple containing image shape inf...
def get_img_shape(img): """Returns image shape in a backend agnostic manner. Args: img: An image tensor of shape: `(channels, image_dims...)` if data_format='channels_first' or `(image_dims..., channels)` if data_format='channels_last'. Returns: Tuple containing image shape inf...
[ "Returns", "image", "shape", "in", "a", "backend", "agnostic", "manner", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L216-L235
[ "def", "get_img_shape", "(", "img", ")", ":", "if", "isinstance", "(", "img", ",", "np", ".", "ndarray", ")", ":", "shape", "=", "img", ".", "shape", "else", ":", "shape", "=", "K", ".", "int_shape", "(", "img", ")", "if", "K", ".", "image_data_for...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
load_img
Utility function to load an image from disk. Args: path: The image file path. grayscale: True to convert to grayscale image (Default value = False) target_size: (w, h) to resize. (Default value = None) Returns: The loaded numpy image.
vis/utils/utils.py
def load_img(path, grayscale=False, target_size=None): """Utility function to load an image from disk. Args: path: The image file path. grayscale: True to convert to grayscale image (Default value = False) target_size: (w, h) to resize. (Default value = None) Returns: The loaded ...
def load_img(path, grayscale=False, target_size=None): """Utility function to load an image from disk. Args: path: The image file path. grayscale: True to convert to grayscale image (Default value = False) target_size: (w, h) to resize. (Default value = None) Returns: The loaded ...
[ "Utility", "function", "to", "load", "an", "image", "from", "disk", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L238-L252
[ "def", "load_img", "(", "path", ",", "grayscale", "=", "False", ",", "target_size", "=", "None", ")", ":", "img", "=", "io", ".", "imread", "(", "path", ",", "grayscale", ")", "if", "target_size", ":", "img", "=", "transform", ".", "resize", "(", "im...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
lookup_imagenet_labels
Utility function to return the image net label for the final `dense` layer output index. Args: indices: Could be a single value or an array of indices whose labels should be looked up. Returns: Image net label corresponding to the image category.
vis/utils/utils.py
def lookup_imagenet_labels(indices): """Utility function to return the image net label for the final `dense` layer output index. Args: indices: Could be a single value or an array of indices whose labels should be looked up. Returns: Image net label corresponding to the image category. ...
def lookup_imagenet_labels(indices): """Utility function to return the image net label for the final `dense` layer output index. Args: indices: Could be a single value or an array of indices whose labels should be looked up. Returns: Image net label corresponding to the image category. ...
[ "Utility", "function", "to", "return", "the", "image", "net", "label", "for", "the", "final", "dense", "layer", "output", "index", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L255-L270
[ "def", "lookup_imagenet_labels", "(", "indices", ")", ":", "global", "_CLASS_INDEX", "if", "_CLASS_INDEX", "is", "None", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'../../...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
draw_text
Draws text over the image. Requires PIL. Args: img: The image to use. text: The text string to overlay. position: The text (x, y) position. (Default value = (10, 10)) font: The ttf or open type font to use. (Default value = 'FreeSans.ttf') font_size: The text font size. (Def...
vis/utils/utils.py
def draw_text(img, text, position=(10, 10), font='FreeSans.ttf', font_size=14, color=(0, 0, 0)): """Draws text over the image. Requires PIL. Args: img: The image to use. text: The text string to overlay. position: The text (x, y) position. (Default value = (10, 10)) font: The tt...
def draw_text(img, text, position=(10, 10), font='FreeSans.ttf', font_size=14, color=(0, 0, 0)): """Draws text over the image. Requires PIL. Args: img: The image to use. text: The text string to overlay. position: The text (x, y) position. (Default value = (10, 10)) font: The tt...
[ "Draws", "text", "over", "the", "image", ".", "Requires", "PIL", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L273-L299
[ "def", "draw_text", "(", "img", ",", "text", ",", "position", "=", "(", "10", ",", "10", ")", ",", "font", "=", "'FreeSans.ttf'", ",", "font_size", "=", "14", ",", "color", "=", "(", "0", ",", "0", ",", "0", ")", ")", ":", "_check_pil", "(", ")...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
normalize
Normalizes the numpy array to (min_value, max_value) Args: array: The numpy array min_value: The min value in normalized array (Default value = 0) max_value: The max value in normalized array (Default value = 1) Returns: The array normalized to range between (min_value, max_val...
vis/utils/utils.py
def normalize(array, min_value=0., max_value=1.): """Normalizes the numpy array to (min_value, max_value) Args: array: The numpy array min_value: The min value in normalized array (Default value = 0) max_value: The max value in normalized array (Default value = 1) Returns: ...
def normalize(array, min_value=0., max_value=1.): """Normalizes the numpy array to (min_value, max_value) Args: array: The numpy array min_value: The min value in normalized array (Default value = 0) max_value: The max value in normalized array (Default value = 1) Returns: ...
[ "Normalizes", "the", "numpy", "array", "to", "(", "min_value", "max_value", ")" ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/utils/utils.py#L313-L327
[ "def", "normalize", "(", "array", ",", "min_value", "=", "0.", ",", "max_value", "=", "1.", ")", ":", "arr_min", "=", "np", ".", "min", "(", "array", ")", "arr_max", "=", "np", ".", "max", "(", "array", ")", "normalized", "=", "(", "array", "-", ...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
get_num_filters
Determines the number of filters within the given `layer`. Args: layer: The keras layer to use. Returns: Total number of filters within `layer`. For `keras.layers.Dense` layer, this is the total number of outputs.
vis/visualization/__init__.py
def get_num_filters(layer): """Determines the number of filters within the given `layer`. Args: layer: The keras layer to use. Returns: Total number of filters within `layer`. For `keras.layers.Dense` layer, this is the total number of outputs. """ # Handle layers with no c...
def get_num_filters(layer): """Determines the number of filters within the given `layer`. Args: layer: The keras layer to use. Returns: Total number of filters within `layer`. For `keras.layers.Dense` layer, this is the total number of outputs. """ # Handle layers with no c...
[ "Determines", "the", "number", "of", "filters", "within", "the", "given", "layer", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/__init__.py#L15-L30
[ "def", "get_num_filters", "(", "layer", ")", ":", "# Handle layers with no channels.", "if", "K", ".", "ndim", "(", "layer", ".", "output", ")", "==", "2", ":", "return", "K", ".", "int_shape", "(", "layer", ".", "output", ")", "[", "-", "1", "]", "cha...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
overlay
Overlays `array1` onto `array2` with `alpha` blending. Args: array1: The first numpy array. array2: The second numpy array. alpha: The alpha value of `array1` as overlayed onto `array2`. This value needs to be between [0, 1], with 0 being `array2` only to 1 being `array1` only (...
vis/visualization/__init__.py
def overlay(array1, array2, alpha=0.5): """Overlays `array1` onto `array2` with `alpha` blending. Args: array1: The first numpy array. array2: The second numpy array. alpha: The alpha value of `array1` as overlayed onto `array2`. This value needs to be between [0, 1], with 0...
def overlay(array1, array2, alpha=0.5): """Overlays `array1` onto `array2` with `alpha` blending. Args: array1: The first numpy array. array2: The second numpy array. alpha: The alpha value of `array1` as overlayed onto `array2`. This value needs to be between [0, 1], with 0...
[ "Overlays", "array1", "onto", "array2", "with", "alpha", "blending", "." ]
raghakot/keras-vis
python
https://github.com/raghakot/keras-vis/blob/668b0e11dab93f3487f23c17e07f40554a8939e9/vis/visualization/__init__.py#L33-L50
[ "def", "overlay", "(", "array1", ",", "array2", ",", "alpha", "=", "0.5", ")", ":", "if", "alpha", "<", "0.", "or", "alpha", ">", "1.", ":", "raise", "ValueError", "(", "\"`alpha` needs to be between [0, 1]\"", ")", "if", "array1", ".", "shape", "!=", "a...
668b0e11dab93f3487f23c17e07f40554a8939e9
train
_infer_coords_and_dims
All the logic for creating a new DataArray
xarray/core/dataarray.py
def _infer_coords_and_dims(shape, coords, dims): """All the logic for creating a new DataArray""" if (coords is not None and not utils.is_dict_like(coords) and len(coords) != len(shape)): raise ValueError('coords is not dict-like, but it has %s items, ' 'which does ...
def _infer_coords_and_dims(shape, coords, dims): """All the logic for creating a new DataArray""" if (coords is not None and not utils.is_dict_like(coords) and len(coords) != len(shape)): raise ValueError('coords is not dict-like, but it has %s items, ' 'which does ...
[ "All", "the", "logic", "for", "creating", "a", "new", "DataArray" ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L28-L92
[ "def", "_infer_coords_and_dims", "(", "shape", ",", "coords", ",", "dims", ")", ":", "if", "(", "coords", "is", "not", "None", "and", "not", "utils", ".", "is_dict_like", "(", "coords", ")", "and", "len", "(", "coords", ")", "!=", "len", "(", "shape", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.to_dataset
Convert a DataArray to a Dataset. Parameters ---------- dim : str, optional Name of the dimension on this array along which to split this array into separate variables. If not provided, this array is converted into a Dataset of one variable. name : st...
xarray/core/dataarray.py
def to_dataset(self, dim=None, name=None): """Convert a DataArray to a Dataset. Parameters ---------- dim : str, optional Name of the dimension on this array along which to split this array into separate variables. If not provided, this array is converted ...
def to_dataset(self, dim=None, name=None): """Convert a DataArray to a Dataset. Parameters ---------- dim : str, optional Name of the dimension on this array along which to split this array into separate variables. If not provided, this array is converted ...
[ "Convert", "a", "DataArray", "to", "a", "Dataset", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L328-L358
[ "def", "to_dataset", "(", "self", ",", "dim", "=", "None", ",", "name", "=", "None", ")", ":", "if", "dim", "is", "not", "None", "and", "dim", "not", "in", "self", ".", "dims", ":", "warnings", ".", "warn", "(", "'the order of the arguments on DataArray....
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray._level_coords
Return a mapping of all MultiIndex levels and their corresponding coordinate name.
xarray/core/dataarray.py
def _level_coords(self): """Return a mapping of all MultiIndex levels and their corresponding coordinate name. """ level_coords = OrderedDict() for cname, var in self._coords.items(): if var.ndim == 1 and isinstance(var, IndexVariable): level_names = v...
def _level_coords(self): """Return a mapping of all MultiIndex levels and their corresponding coordinate name. """ level_coords = OrderedDict() for cname, var in self._coords.items(): if var.ndim == 1 and isinstance(var, IndexVariable): level_names = v...
[ "Return", "a", "mapping", "of", "all", "MultiIndex", "levels", "and", "their", "corresponding", "coordinate", "name", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L449-L460
[ "def", "_level_coords", "(", "self", ")", ":", "level_coords", "=", "OrderedDict", "(", ")", "for", "cname", ",", "var", "in", "self", ".", "_coords", ".", "items", "(", ")", ":", "if", "var", ".", "ndim", "==", "1", "and", "isinstance", "(", "var", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.indexes
Mapping of pandas.Index objects used for label based indexing
xarray/core/dataarray.py
def indexes(self): """Mapping of pandas.Index objects used for label based indexing """ if self._indexes is None: self._indexes = default_indexes(self._coords, self.dims) return Indexes(self._indexes)
def indexes(self): """Mapping of pandas.Index objects used for label based indexing """ if self._indexes is None: self._indexes = default_indexes(self._coords, self.dims) return Indexes(self._indexes)
[ "Mapping", "of", "pandas", ".", "Index", "objects", "used", "for", "label", "based", "indexing" ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L539-L544
[ "def", "indexes", "(", "self", ")", ":", "if", "self", ".", "_indexes", "is", "None", ":", "self", ".", "_indexes", "=", "default_indexes", "(", "self", ".", "_coords", ",", "self", ".", "dims", ")", "return", "Indexes", "(", "self", ".", "_indexes", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.reset_coords
Given names of coordinates, reset them to become variables. Parameters ---------- names : str or list of str, optional Name(s) of non-index coordinates in this dataset to reset into variables. By default, all non-index coordinates are reset. drop : bool, optional...
xarray/core/dataarray.py
def reset_coords(self, names=None, drop=False, inplace=None): """Given names of coordinates, reset them to become variables. Parameters ---------- names : str or list of str, optional Name(s) of non-index coordinates in this dataset to reset into variables. By de...
def reset_coords(self, names=None, drop=False, inplace=None): """Given names of coordinates, reset them to become variables. Parameters ---------- names : str or list of str, optional Name(s) of non-index coordinates in this dataset to reset into variables. By de...
[ "Given", "names", "of", "coordinates", "reset", "them", "to", "become", "variables", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L552-L588
[ "def", "reset_coords", "(", "self", ",", "names", "=", "None", ",", "drop", "=", "False", ",", "inplace", "=", "None", ")", ":", "inplace", "=", "_check_inplace", "(", "inplace", ")", "if", "inplace", "and", "not", "drop", ":", "raise", "ValueError", "...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.load
Manually trigger loading of this array's data from disk or a remote source into memory and return this array. Normally, it should not be necessary to call this method in user code, because all xarray functions should either work on deferred data or load data automatically. However, this...
xarray/core/dataarray.py
def load(self, **kwargs): """Manually trigger loading of this array's data from disk or a remote source into memory and return this array. Normally, it should not be necessary to call this method in user code, because all xarray functions should either work on deferred data or l...
def load(self, **kwargs): """Manually trigger loading of this array's data from disk or a remote source into memory and return this array. Normally, it should not be necessary to call this method in user code, because all xarray functions should either work on deferred data or l...
[ "Manually", "trigger", "loading", "of", "this", "array", "s", "data", "from", "disk", "or", "a", "remote", "source", "into", "memory", "and", "return", "this", "array", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L622-L644
[ "def", "load", "(", "self", ",", "*", "*", "kwargs", ")", ":", "ds", "=", "self", ".", "_to_temp_dataset", "(", ")", ".", "load", "(", "*", "*", "kwargs", ")", "new", "=", "self", ".", "_from_temp_dataset", "(", "ds", ")", "self", ".", "_variable",...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.persist
Trigger computation in constituent dask arrays This keeps them as dask arrays but encourages them to keep data in memory. This is particularly useful when on a distributed machine. When on a single machine consider using ``.compute()`` instead. Parameters ---------- **...
xarray/core/dataarray.py
def persist(self, **kwargs): """ Trigger computation in constituent dask arrays This keeps them as dask arrays but encourages them to keep data in memory. This is particularly useful when on a distributed machine. When on a single machine consider using ``.compute()`` instead. ...
def persist(self, **kwargs): """ Trigger computation in constituent dask arrays This keeps them as dask arrays but encourages them to keep data in memory. This is particularly useful when on a distributed machine. When on a single machine consider using ``.compute()`` instead. ...
[ "Trigger", "computation", "in", "constituent", "dask", "arrays" ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L668-L685
[ "def", "persist", "(", "self", ",", "*", "*", "kwargs", ")", ":", "ds", "=", "self", ".", "_to_temp_dataset", "(", ")", ".", "persist", "(", "*", "*", "kwargs", ")", "return", "self", ".", "_from_temp_dataset", "(", "ds", ")" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.copy
Returns a copy of this array. If `deep=True`, a deep copy is made of the data array. Otherwise, a shallow copy is made, so each variable in the new array's dataset is also a variable in this array's dataset. Use `data` to create a new object with the same structure as original ...
xarray/core/dataarray.py
def copy(self, deep=True, data=None): """Returns a copy of this array. If `deep=True`, a deep copy is made of the data array. Otherwise, a shallow copy is made, so each variable in the new array's dataset is also a variable in this array's dataset. Use `data` to create a new ob...
def copy(self, deep=True, data=None): """Returns a copy of this array. If `deep=True`, a deep copy is made of the data array. Otherwise, a shallow copy is made, so each variable in the new array's dataset is also a variable in this array's dataset. Use `data` to create a new ob...
[ "Returns", "a", "copy", "of", "this", "array", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L687-L760
[ "def", "copy", "(", "self", ",", "deep", "=", "True", ",", "data", "=", "None", ")", ":", "variable", "=", "self", ".", "variable", ".", "copy", "(", "deep", "=", "deep", ",", "data", "=", "data", ")", "coords", "=", "OrderedDict", "(", "(", "k",...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.chunk
Coerce this array's data into a dask arrays with the given chunks. If this variable is a non-dask array, it will be converted to dask array. If it's a dask array, it will be rechunked to the given chunk sizes. If neither chunks is not provided for one or more dimensions, chunk ...
xarray/core/dataarray.py
def chunk(self, chunks=None, name_prefix='xarray-', token=None, lock=False): """Coerce this array's data into a dask arrays with the given chunks. If this variable is a non-dask array, it will be converted to dask array. If it's a dask array, it will be rechunked to the given chun...
def chunk(self, chunks=None, name_prefix='xarray-', token=None, lock=False): """Coerce this array's data into a dask arrays with the given chunks. If this variable is a non-dask array, it will be converted to dask array. If it's a dask array, it will be rechunked to the given chun...
[ "Coerce", "this", "array", "s", "data", "into", "a", "dask", "arrays", "with", "the", "given", "chunks", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L781-L815
[ "def", "chunk", "(", "self", ",", "chunks", "=", "None", ",", "name_prefix", "=", "'xarray-'", ",", "token", "=", "None", ",", "lock", "=", "False", ")", ":", "if", "isinstance", "(", "chunks", ",", "(", "list", ",", "tuple", ")", ")", ":", "chunks...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.isel
Return a new DataArray whose dataset is given by integer indexing along the specified dimension(s). See Also -------- Dataset.isel DataArray.sel
xarray/core/dataarray.py
def isel(self, indexers=None, drop=False, **indexers_kwargs): """Return a new DataArray whose dataset is given by integer indexing along the specified dimension(s). See Also -------- Dataset.isel DataArray.sel """ indexers = either_dict_or_kwargs(indexers...
def isel(self, indexers=None, drop=False, **indexers_kwargs): """Return a new DataArray whose dataset is given by integer indexing along the specified dimension(s). See Also -------- Dataset.isel DataArray.sel """ indexers = either_dict_or_kwargs(indexers...
[ "Return", "a", "new", "DataArray", "whose", "dataset", "is", "given", "by", "integer", "indexing", "along", "the", "specified", "dimension", "(", "s", ")", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L817-L828
[ "def", "isel", "(", "self", ",", "indexers", "=", "None", ",", "drop", "=", "False", ",", "*", "*", "indexers_kwargs", ")", ":", "indexers", "=", "either_dict_or_kwargs", "(", "indexers", ",", "indexers_kwargs", ",", "'isel'", ")", "ds", "=", "self", "."...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.sel
Return a new DataArray whose dataset is given by selecting index labels along the specified dimension(s). .. warning:: Do not try to assign values when using any of the indexing methods ``isel`` or ``sel``:: da = xr.DataArray([0, 1, 2, 3], dims=['x']) # DO ...
xarray/core/dataarray.py
def sel(self, indexers=None, method=None, tolerance=None, drop=False, **indexers_kwargs): """Return a new DataArray whose dataset is given by selecting index labels along the specified dimension(s). .. warning:: Do not try to assign values when using any of the indexing m...
def sel(self, indexers=None, method=None, tolerance=None, drop=False, **indexers_kwargs): """Return a new DataArray whose dataset is given by selecting index labels along the specified dimension(s). .. warning:: Do not try to assign values when using any of the indexing m...
[ "Return", "a", "new", "DataArray", "whose", "dataset", "is", "given", "by", "selecting", "index", "labels", "along", "the", "specified", "dimension", "(", "s", ")", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L830-L856
[ "def", "sel", "(", "self", ",", "indexers", "=", "None", ",", "method", "=", "None", ",", "tolerance", "=", "None", ",", "drop", "=", "False", ",", "*", "*", "indexers_kwargs", ")", ":", "ds", "=", "self", ".", "_to_temp_dataset", "(", ")", ".", "s...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.isel_points
Return a new DataArray whose dataset is given by pointwise integer indexing along the specified dimension(s). See Also -------- Dataset.isel_points
xarray/core/dataarray.py
def isel_points(self, dim='points', **indexers): """Return a new DataArray whose dataset is given by pointwise integer indexing along the specified dimension(s). See Also -------- Dataset.isel_points """ ds = self._to_temp_dataset().isel_points(dim=dim, **indexer...
def isel_points(self, dim='points', **indexers): """Return a new DataArray whose dataset is given by pointwise integer indexing along the specified dimension(s). See Also -------- Dataset.isel_points """ ds = self._to_temp_dataset().isel_points(dim=dim, **indexer...
[ "Return", "a", "new", "DataArray", "whose", "dataset", "is", "given", "by", "pointwise", "integer", "indexing", "along", "the", "specified", "dimension", "(", "s", ")", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L858-L867
[ "def", "isel_points", "(", "self", ",", "dim", "=", "'points'", ",", "*", "*", "indexers", ")", ":", "ds", "=", "self", ".", "_to_temp_dataset", "(", ")", ".", "isel_points", "(", "dim", "=", "dim", ",", "*", "*", "indexers", ")", "return", "self", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.sel_points
Return a new DataArray whose dataset is given by pointwise selection of index labels along the specified dimension(s). See Also -------- Dataset.sel_points
xarray/core/dataarray.py
def sel_points(self, dim='points', method=None, tolerance=None, **indexers): """Return a new DataArray whose dataset is given by pointwise selection of index labels along the specified dimension(s). See Also -------- Dataset.sel_points """ ds =...
def sel_points(self, dim='points', method=None, tolerance=None, **indexers): """Return a new DataArray whose dataset is given by pointwise selection of index labels along the specified dimension(s). See Also -------- Dataset.sel_points """ ds =...
[ "Return", "a", "new", "DataArray", "whose", "dataset", "is", "given", "by", "pointwise", "selection", "of", "index", "labels", "along", "the", "specified", "dimension", "(", "s", ")", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L869-L880
[ "def", "sel_points", "(", "self", ",", "dim", "=", "'points'", ",", "method", "=", "None", ",", "tolerance", "=", "None", ",", "*", "*", "indexers", ")", ":", "ds", "=", "self", ".", "_to_temp_dataset", "(", ")", ".", "sel_points", "(", "dim", "=", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.reindex
Conform this object onto a new set of indexes, filling in missing values with NaN. Parameters ---------- indexers : dict, optional Dictionary with keys given by dimension names and values given by arrays of coordinates tick labels. Any mis-matched coordinate ...
xarray/core/dataarray.py
def reindex(self, indexers=None, method=None, tolerance=None, copy=True, **indexers_kwargs): """Conform this object onto a new set of indexes, filling in missing values with NaN. Parameters ---------- indexers : dict, optional Dictionary with keys giv...
def reindex(self, indexers=None, method=None, tolerance=None, copy=True, **indexers_kwargs): """Conform this object onto a new set of indexes, filling in missing values with NaN. Parameters ---------- indexers : dict, optional Dictionary with keys giv...
[ "Conform", "this", "object", "onto", "a", "new", "set", "of", "indexes", "filling", "in", "missing", "values", "with", "NaN", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L929-L978
[ "def", "reindex", "(", "self", ",", "indexers", "=", "None", ",", "method", "=", "None", ",", "tolerance", "=", "None", ",", "copy", "=", "True", ",", "*", "*", "indexers_kwargs", ")", ":", "indexers", "=", "either_dict_or_kwargs", "(", "indexers", ",", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.interp
Multidimensional interpolation of variables. coords : dict, optional Mapping from dimension names to the new coordinates. new coordinate can be an scalar, array-like or DataArray. If DataArrays are passed as new coordates, their dimensions are used for the broadc...
xarray/core/dataarray.py
def interp(self, coords=None, method='linear', assume_sorted=False, kwargs={}, **coords_kwargs): """ Multidimensional interpolation of variables. coords : dict, optional Mapping from dimension names to the new coordinates. new coordinate can be an scalar, array-li...
def interp(self, coords=None, method='linear', assume_sorted=False, kwargs={}, **coords_kwargs): """ Multidimensional interpolation of variables. coords : dict, optional Mapping from dimension names to the new coordinates. new coordinate can be an scalar, array-li...
[ "Multidimensional", "interpolation", "of", "variables", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L980-L1032
[ "def", "interp", "(", "self", ",", "coords", "=", "None", ",", "method", "=", "'linear'", ",", "assume_sorted", "=", "False", ",", "kwargs", "=", "{", "}", ",", "*", "*", "coords_kwargs", ")", ":", "if", "self", ".", "dtype", ".", "kind", "not", "i...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.interp_like
Interpolate this object onto the coordinates of another object, filling out of range values with NaN. Parameters ---------- other : Dataset or DataArray Object with an 'indexes' attribute giving a mapping from dimension names to an 1d array-like, which provides c...
xarray/core/dataarray.py
def interp_like(self, other, method='linear', assume_sorted=False, kwargs={}): """Interpolate this object onto the coordinates of another object, filling out of range values with NaN. Parameters ---------- other : Dataset or DataArray Object with ...
def interp_like(self, other, method='linear', assume_sorted=False, kwargs={}): """Interpolate this object onto the coordinates of another object, filling out of range values with NaN. Parameters ---------- other : Dataset or DataArray Object with ...
[ "Interpolate", "this", "object", "onto", "the", "coordinates", "of", "another", "object", "filling", "out", "of", "range", "values", "with", "NaN", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1034-L1080
[ "def", "interp_like", "(", "self", ",", "other", ",", "method", "=", "'linear'", ",", "assume_sorted", "=", "False", ",", "kwargs", "=", "{", "}", ")", ":", "if", "self", ".", "dtype", ".", "kind", "not", "in", "'uifc'", ":", "raise", "TypeError", "(...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.rename
Returns a new DataArray with renamed coordinates or a new name. Parameters ---------- new_name_or_name_dict : str or dict-like, optional If the argument is dict-like, it it used as a mapping from old names to new names for coordinates. Otherwise, use the argument ...
xarray/core/dataarray.py
def rename(self, new_name_or_name_dict=None, **names): """Returns a new DataArray with renamed coordinates or a new name. Parameters ---------- new_name_or_name_dict : str or dict-like, optional If the argument is dict-like, it it used as a mapping from old names...
def rename(self, new_name_or_name_dict=None, **names): """Returns a new DataArray with renamed coordinates or a new name. Parameters ---------- new_name_or_name_dict : str or dict-like, optional If the argument is dict-like, it it used as a mapping from old names...
[ "Returns", "a", "new", "DataArray", "with", "renamed", "coordinates", "or", "a", "new", "name", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1082-L1113
[ "def", "rename", "(", "self", ",", "new_name_or_name_dict", "=", "None", ",", "*", "*", "names", ")", ":", "if", "names", "or", "utils", ".", "is_dict_like", "(", "new_name_or_name_dict", ")", ":", "name_dict", "=", "either_dict_or_kwargs", "(", "new_name_or_n...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.swap_dims
Returns a new DataArray with swapped dimensions. Parameters ---------- dims_dict : dict-like Dictionary whose keys are current dimension names and whose values are new names. Each value must already be a coordinate on this array. Returns ----...
xarray/core/dataarray.py
def swap_dims(self, dims_dict): """Returns a new DataArray with swapped dimensions. Parameters ---------- dims_dict : dict-like Dictionary whose keys are current dimension names and whose values are new names. Each value must already be a coordinate on this ...
def swap_dims(self, dims_dict): """Returns a new DataArray with swapped dimensions. Parameters ---------- dims_dict : dict-like Dictionary whose keys are current dimension names and whose values are new names. Each value must already be a coordinate on this ...
[ "Returns", "a", "new", "DataArray", "with", "swapped", "dimensions", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1115-L1137
[ "def", "swap_dims", "(", "self", ",", "dims_dict", ")", ":", "ds", "=", "self", ".", "_to_temp_dataset", "(", ")", ".", "swap_dims", "(", "dims_dict", ")", "return", "self", ".", "_from_temp_dataset", "(", "ds", ")" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.expand_dims
Return a new object with an additional axis (or axes) inserted at the corresponding position in the array shape. If dim is already a scalar coordinate, it will be promoted to a 1D coordinate consisting of a single value. Parameters ---------- dim : str, sequence of str,...
xarray/core/dataarray.py
def expand_dims(self, dim=None, axis=None, **dim_kwargs): """Return a new object with an additional axis (or axes) inserted at the corresponding position in the array shape. If dim is already a scalar coordinate, it will be promoted to a 1D coordinate consisting of a single value. ...
def expand_dims(self, dim=None, axis=None, **dim_kwargs): """Return a new object with an additional axis (or axes) inserted at the corresponding position in the array shape. If dim is already a scalar coordinate, it will be promoted to a 1D coordinate consisting of a single value. ...
[ "Return", "a", "new", "object", "with", "an", "additional", "axis", "(", "or", "axes", ")", "inserted", "at", "the", "corresponding", "position", "in", "the", "array", "shape", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1139-L1196
[ "def", "expand_dims", "(", "self", ",", "dim", "=", "None", ",", "axis", "=", "None", ",", "*", "*", "dim_kwargs", ")", ":", "if", "isinstance", "(", "dim", ",", "int", ")", ":", "raise", "TypeError", "(", "'dim should be str or sequence of strs or dict'", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.set_index
Set DataArray (multi-)indexes using one or more existing coordinates. Parameters ---------- indexes : {dim: index, ...} Mapping from names matching dimensions and values given by (lists of) the names of existing coordinates or variables to set as new ...
xarray/core/dataarray.py
def set_index(self, indexes=None, append=False, inplace=None, **indexes_kwargs): """Set DataArray (multi-)indexes using one or more existing coordinates. Parameters ---------- indexes : {dim: index, ...} Mapping from names matching dimensions and va...
def set_index(self, indexes=None, append=False, inplace=None, **indexes_kwargs): """Set DataArray (multi-)indexes using one or more existing coordinates. Parameters ---------- indexes : {dim: index, ...} Mapping from names matching dimensions and va...
[ "Set", "DataArray", "(", "multi", "-", ")", "indexes", "using", "one", "or", "more", "existing", "coordinates", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1198-L1234
[ "def", "set_index", "(", "self", ",", "indexes", "=", "None", ",", "append", "=", "False", ",", "inplace", "=", "None", ",", "*", "*", "indexes_kwargs", ")", ":", "inplace", "=", "_check_inplace", "(", "inplace", ")", "indexes", "=", "either_dict_or_kwargs...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.reset_index
Reset the specified index(es) or multi-index level(s). Parameters ---------- dims_or_levels : str or list Name(s) of the dimension(s) and/or multi-index level(s) that will be reset. drop : bool, optional If True, remove the specified indexes and/or mu...
xarray/core/dataarray.py
def reset_index(self, dims_or_levels, drop=False, inplace=None): """Reset the specified index(es) or multi-index level(s). Parameters ---------- dims_or_levels : str or list Name(s) of the dimension(s) and/or multi-index level(s) that will be reset. drop ...
def reset_index(self, dims_or_levels, drop=False, inplace=None): """Reset the specified index(es) or multi-index level(s). Parameters ---------- dims_or_levels : str or list Name(s) of the dimension(s) and/or multi-index level(s) that will be reset. drop ...
[ "Reset", "the", "specified", "index", "(", "es", ")", "or", "multi", "-", "index", "level", "(", "s", ")", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1236-L1267
[ "def", "reset_index", "(", "self", ",", "dims_or_levels", ",", "drop", "=", "False", ",", "inplace", "=", "None", ")", ":", "inplace", "=", "_check_inplace", "(", "inplace", ")", "coords", ",", "_", "=", "split_indexes", "(", "dims_or_levels", ",", "self",...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.reorder_levels
Rearrange index levels using input order. Parameters ---------- dim_order : optional Mapping from names matching dimensions and values given by lists representing new level orders. Every given dimension must have a multi-index. inplace : bool, optiona...
xarray/core/dataarray.py
def reorder_levels(self, dim_order=None, inplace=None, **dim_order_kwargs): """Rearrange index levels using input order. Parameters ---------- dim_order : optional Mapping from names matching dimensions and values given by lists representin...
def reorder_levels(self, dim_order=None, inplace=None, **dim_order_kwargs): """Rearrange index levels using input order. Parameters ---------- dim_order : optional Mapping from names matching dimensions and values given by lists representin...
[ "Rearrange", "index", "levels", "using", "input", "order", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1269-L1308
[ "def", "reorder_levels", "(", "self", ",", "dim_order", "=", "None", ",", "inplace", "=", "None", ",", "*", "*", "dim_order_kwargs", ")", ":", "inplace", "=", "_check_inplace", "(", "inplace", ")", "dim_order", "=", "either_dict_or_kwargs", "(", "dim_order", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.stack
Stack any number of existing dimensions into a single new dimension. New dimensions will be added at the end, and the corresponding coordinate variables will be combined into a MultiIndex. Parameters ---------- dimensions : Mapping of the form new_name=(dim1, dim2, ...) ...
xarray/core/dataarray.py
def stack(self, dimensions=None, **dimensions_kwargs): """ Stack any number of existing dimensions into a single new dimension. New dimensions will be added at the end, and the corresponding coordinate variables will be combined into a MultiIndex. Parameters ---------- ...
def stack(self, dimensions=None, **dimensions_kwargs): """ Stack any number of existing dimensions into a single new dimension. New dimensions will be added at the end, and the corresponding coordinate variables will be combined into a MultiIndex. Parameters ---------- ...
[ "Stack", "any", "number", "of", "existing", "dimensions", "into", "a", "single", "new", "dimension", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1310-L1354
[ "def", "stack", "(", "self", ",", "dimensions", "=", "None", ",", "*", "*", "dimensions_kwargs", ")", ":", "ds", "=", "self", ".", "_to_temp_dataset", "(", ")", ".", "stack", "(", "dimensions", ",", "*", "*", "dimensions_kwargs", ")", "return", "self", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.unstack
Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions. New dimensions will be added at the end. Parameters ---------- dim : str or sequence of str, optional Dimension(s) over which to unstack. By default unstacks all Mult...
xarray/core/dataarray.py
def unstack(self, dim=None): """ Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions. New dimensions will be added at the end. Parameters ---------- dim : str or sequence of str, optional Dimension(s) over which to ...
def unstack(self, dim=None): """ Unstack existing dimensions corresponding to MultiIndexes into multiple new dimensions. New dimensions will be added at the end. Parameters ---------- dim : str or sequence of str, optional Dimension(s) over which to ...
[ "Unstack", "existing", "dimensions", "corresponding", "to", "MultiIndexes", "into", "multiple", "new", "dimensions", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1356-L1400
[ "def", "unstack", "(", "self", ",", "dim", "=", "None", ")", ":", "ds", "=", "self", ".", "_to_temp_dataset", "(", ")", ".", "unstack", "(", "dim", ")", "return", "self", ".", "_from_temp_dataset", "(", "ds", ")" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.transpose
Return a new DataArray object with transposed dimensions. Parameters ---------- *dims : str, optional By default, reverse the dimensions. Otherwise, reorder the dimensions to this order. Returns ------- transposed : DataArray The retu...
xarray/core/dataarray.py
def transpose(self, *dims) -> 'DataArray': """Return a new DataArray object with transposed dimensions. Parameters ---------- *dims : str, optional By default, reverse the dimensions. Otherwise, reorder the dimensions to this order. Returns -----...
def transpose(self, *dims) -> 'DataArray': """Return a new DataArray object with transposed dimensions. Parameters ---------- *dims : str, optional By default, reverse the dimensions. Otherwise, reorder the dimensions to this order. Returns -----...
[ "Return", "a", "new", "DataArray", "object", "with", "transposed", "dimensions", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1402-L1428
[ "def", "transpose", "(", "self", ",", "*", "dims", ")", "->", "'DataArray'", ":", "variable", "=", "self", ".", "variable", ".", "transpose", "(", "*", "dims", ")", "return", "self", ".", "_replace", "(", "variable", ")" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.drop
Drop coordinates or index labels from this DataArray. Parameters ---------- labels : scalar or list of scalars Name(s) of coordinate variables or index labels to drop. dim : str, optional Dimension along which to drop index labels. By default (if ``di...
xarray/core/dataarray.py
def drop(self, labels, dim=None): """Drop coordinates or index labels from this DataArray. Parameters ---------- labels : scalar or list of scalars Name(s) of coordinate variables or index labels to drop. dim : str, optional Dimension along which to drop ...
def drop(self, labels, dim=None): """Drop coordinates or index labels from this DataArray. Parameters ---------- labels : scalar or list of scalars Name(s) of coordinate variables or index labels to drop. dim : str, optional Dimension along which to drop ...
[ "Drop", "coordinates", "or", "index", "labels", "from", "this", "DataArray", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1434-L1452
[ "def", "drop", "(", "self", ",", "labels", ",", "dim", "=", "None", ")", ":", "if", "utils", ".", "is_scalar", "(", "labels", ")", ":", "labels", "=", "[", "labels", "]", "ds", "=", "self", ".", "_to_temp_dataset", "(", ")", ".", "drop", "(", "la...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.dropna
Returns a new array with dropped labels for missing values along the provided dimension. Parameters ---------- dim : str Dimension along which to drop missing values. Dropping along multiple dimensions simultaneously is not yet supported. how : {'any', 'a...
xarray/core/dataarray.py
def dropna(self, dim, how='any', thresh=None): """Returns a new array with dropped labels for missing values along the provided dimension. Parameters ---------- dim : str Dimension along which to drop missing values. Dropping along multiple dimensions sim...
def dropna(self, dim, how='any', thresh=None): """Returns a new array with dropped labels for missing values along the provided dimension. Parameters ---------- dim : str Dimension along which to drop missing values. Dropping along multiple dimensions sim...
[ "Returns", "a", "new", "array", "with", "dropped", "labels", "for", "missing", "values", "along", "the", "provided", "dimension", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1454-L1474
[ "def", "dropna", "(", "self", ",", "dim", ",", "how", "=", "'any'", ",", "thresh", "=", "None", ")", ":", "ds", "=", "self", ".", "_to_temp_dataset", "(", ")", ".", "dropna", "(", "dim", ",", "how", "=", "how", ",", "thresh", "=", "thresh", ")", ...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.fillna
Fill missing values in this object. This operation follows the normal broadcasting and alignment rules that xarray uses for binary arithmetic, except the result is aligned to this object (``join='left'``) instead of aligned to the intersection of index coordinates (``join='inner'``). ...
xarray/core/dataarray.py
def fillna(self, value): """Fill missing values in this object. This operation follows the normal broadcasting and alignment rules that xarray uses for binary arithmetic, except the result is aligned to this object (``join='left'``) instead of aligned to the intersection of inde...
def fillna(self, value): """Fill missing values in this object. This operation follows the normal broadcasting and alignment rules that xarray uses for binary arithmetic, except the result is aligned to this object (``join='left'``) instead of aligned to the intersection of inde...
[ "Fill", "missing", "values", "in", "this", "object", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1476-L1499
[ "def", "fillna", "(", "self", ",", "value", ")", ":", "if", "utils", ".", "is_dict_like", "(", "value", ")", ":", "raise", "TypeError", "(", "'cannot provide fill value as a dictionary with '", "'fillna on a DataArray'", ")", "out", "=", "ops", ".", "fillna", "(...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.ffill
Fill NaN values by propogating values forward *Requires bottleneck.* Parameters ---------- dim : str Specifies the dimension along which to propagate values when filling. limit : int, default None The maximum number of consecutive NaN values ...
xarray/core/dataarray.py
def ffill(self, dim, limit=None): '''Fill NaN values by propogating values forward *Requires bottleneck.* Parameters ---------- dim : str Specifies the dimension along which to propagate values when filling. limit : int, default None ...
def ffill(self, dim, limit=None): '''Fill NaN values by propogating values forward *Requires bottleneck.* Parameters ---------- dim : str Specifies the dimension along which to propagate values when filling. limit : int, default None ...
[ "Fill", "NaN", "values", "by", "propogating", "values", "forward" ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1546-L1567
[ "def", "ffill", "(", "self", ",", "dim", ",", "limit", "=", "None", ")", ":", "from", ".", "missing", "import", "ffill", "return", "ffill", "(", "self", ",", "dim", ",", "limit", "=", "limit", ")" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.bfill
Fill NaN values by propogating values backward *Requires bottleneck.* Parameters ---------- dim : str Specifies the dimension along which to propagate values when filling. limit : int, default None The maximum number of consecutive NaN values...
xarray/core/dataarray.py
def bfill(self, dim, limit=None): '''Fill NaN values by propogating values backward *Requires bottleneck.* Parameters ---------- dim : str Specifies the dimension along which to propagate values when filling. limit : int, default None ...
def bfill(self, dim, limit=None): '''Fill NaN values by propogating values backward *Requires bottleneck.* Parameters ---------- dim : str Specifies the dimension along which to propagate values when filling. limit : int, default None ...
[ "Fill", "NaN", "values", "by", "propogating", "values", "backward" ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1569-L1590
[ "def", "bfill", "(", "self", ",", "dim", ",", "limit", "=", "None", ")", ":", "from", ".", "missing", "import", "bfill", "return", "bfill", "(", "self", ",", "dim", ",", "limit", "=", "limit", ")" ]
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.reduce
Reduce this array by applying `func` along some dimension(s). Parameters ---------- func : function Function which can be called in the form `f(x, axis=axis, **kwargs)` to return the result of reducing an np.ndarray over an integer valued axis. dim : ...
xarray/core/dataarray.py
def reduce(self, func, dim=None, axis=None, keep_attrs=None, **kwargs): """Reduce this array by applying `func` along some dimension(s). Parameters ---------- func : function Function which can be called in the form `f(x, axis=axis, **kwargs)` to return the resul...
def reduce(self, func, dim=None, axis=None, keep_attrs=None, **kwargs): """Reduce this array by applying `func` along some dimension(s). Parameters ---------- func : function Function which can be called in the form `f(x, axis=axis, **kwargs)` to return the resul...
[ "Reduce", "this", "array", "by", "applying", "func", "along", "some", "dimension", "(", "s", ")", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1610-L1641
[ "def", "reduce", "(", "self", ",", "func", ",", "dim", "=", "None", ",", "axis", "=", "None", ",", "keep_attrs", "=", "None", ",", "*", "*", "kwargs", ")", ":", "var", "=", "self", ".", "variable", ".", "reduce", "(", "func", ",", "dim", ",", "...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.to_pandas
Convert this array into a pandas object with the same shape. The type of the returned object depends on the number of DataArray dimensions: * 1D -> `pandas.Series` * 2D -> `pandas.DataFrame` * 3D -> `pandas.Panel` Only works for arrays with 3 or fewer dimensions. ...
xarray/core/dataarray.py
def to_pandas(self): """Convert this array into a pandas object with the same shape. The type of the returned object depends on the number of DataArray dimensions: * 1D -> `pandas.Series` * 2D -> `pandas.DataFrame` * 3D -> `pandas.Panel` Only works for arrays w...
def to_pandas(self): """Convert this array into a pandas object with the same shape. The type of the returned object depends on the number of DataArray dimensions: * 1D -> `pandas.Series` * 2D -> `pandas.DataFrame` * 3D -> `pandas.Panel` Only works for arrays w...
[ "Convert", "this", "array", "into", "a", "pandas", "object", "with", "the", "same", "shape", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1643-L1669
[ "def", "to_pandas", "(", "self", ")", ":", "# TODO: consolidate the info about pandas constructors and the", "# attributes that correspond to their indexes into a separate module?", "constructors", "=", "{", "0", ":", "lambda", "x", ":", "x", ",", "1", ":", "pd", ".", "Se...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.to_dataframe
Convert this array and its coordinates into a tidy pandas.DataFrame. The DataFrame is indexed by the Cartesian product of index coordinates (in the form of a :py:class:`pandas.MultiIndex`). Other coordinates are included as columns in the DataFrame.
xarray/core/dataarray.py
def to_dataframe(self, name=None): """Convert this array and its coordinates into a tidy pandas.DataFrame. The DataFrame is indexed by the Cartesian product of index coordinates (in the form of a :py:class:`pandas.MultiIndex`). Other coordinates are included as columns in the DataFrame...
def to_dataframe(self, name=None): """Convert this array and its coordinates into a tidy pandas.DataFrame. The DataFrame is indexed by the Cartesian product of index coordinates (in the form of a :py:class:`pandas.MultiIndex`). Other coordinates are included as columns in the DataFrame...
[ "Convert", "this", "array", "and", "its", "coordinates", "into", "a", "tidy", "pandas", ".", "DataFrame", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1671-L1696
[ "def", "to_dataframe", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "is", "None", ":", "name", "=", "self", ".", "name", "if", "name", "is", "None", ":", "raise", "ValueError", "(", "'cannot convert an unnamed DataArray to a '", "'DataFrame...
6d93a95d05bdbfc33fff24064f67d29dd891ab58
train
DataArray.to_series
Convert this array into a pandas.Series. The Series is indexed by the Cartesian product of index coordinates (in the form of a :py:class:`pandas.MultiIndex`).
xarray/core/dataarray.py
def to_series(self): """Convert this array into a pandas.Series. The Series is indexed by the Cartesian product of index coordinates (in the form of a :py:class:`pandas.MultiIndex`). """ index = self.coords.to_index() return pd.Series(self.values.reshape(-1), index=index...
def to_series(self): """Convert this array into a pandas.Series. The Series is indexed by the Cartesian product of index coordinates (in the form of a :py:class:`pandas.MultiIndex`). """ index = self.coords.to_index() return pd.Series(self.values.reshape(-1), index=index...
[ "Convert", "this", "array", "into", "a", "pandas", ".", "Series", "." ]
pydata/xarray
python
https://github.com/pydata/xarray/blob/6d93a95d05bdbfc33fff24064f67d29dd891ab58/xarray/core/dataarray.py#L1698-L1705
[ "def", "to_series", "(", "self", ")", ":", "index", "=", "self", ".", "coords", ".", "to_index", "(", ")", "return", "pd", ".", "Series", "(", "self", ".", "values", ".", "reshape", "(", "-", "1", ")", ",", "index", "=", "index", ",", "name", "="...
6d93a95d05bdbfc33fff24064f67d29dd891ab58