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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6294fbedb86c7df2a987c45fc9ad1194e6f40a42 | Ipuch/OnDynamicsForSommersaults | analyses/utils.py | [
"MIT"
] | Python | add_annotation_letter | go.Figure | def add_annotation_letter(
fig: go.Figure, letter: str, x: float, y: float, row: int = None, col: int = None, on_paper: bool = False
) -> go.Figure:
"""
Adds a letter to the plot for scientific articles.
Parameters
----------
fig: go.Figure
The figure to annotate
letter: str
... |
Adds a letter to the plot for scientific articles.
Parameters
----------
fig: go.Figure
The figure to annotate
letter: str
The letter to add to the plot.
x: float
The x coordinate of the letter.
y: float
The y coordinate of the letter.
row: int
T... | Adds a letter to the plot for scientific articles.
Parameters
go.Figure
The figure to annotate
letter: str
The letter to add to the plot.
x: float
The x coordinate of the letter.
y: float
The y coordinate of the letter.
row: int
The row of the plot to annotate.
col: int
The column of the plot to annotate.
on_paper: bo... | [
"Adds",
"a",
"letter",
"to",
"the",
"plot",
"for",
"scientific",
"articles",
".",
"Parameters",
"go",
".",
"Figure",
"The",
"figure",
"to",
"annotate",
"letter",
":",
"str",
"The",
"letter",
"to",
"add",
"to",
"the",
"plot",
".",
"x",
":",
"float",
"Th... | def add_annotation_letter(
fig: go.Figure, letter: str, x: float, y: float, row: int = None, col: int = None, on_paper: bool = False
) -> go.Figure:
if on_paper:
xref = "paper"
yref = "paper"
else:
xref = f"x{col}" if row is not None else None
yref = f"y{row}" if row is not N... | [
"def",
"add_annotation_letter",
"(",
"fig",
":",
"go",
".",
"Figure",
",",
"letter",
":",
"str",
",",
"x",
":",
"float",
",",
"y",
":",
"float",
",",
"row",
":",
"int",
"=",
"None",
",",
"col",
":",
"int",
"=",
"None",
",",
"on_paper",
":",
"bool... | Adds a letter to the plot for scientific articles. | [
"Adds",
"a",
"letter",
"to",
"the",
"plot",
"for",
"scientific",
"articles",
"."
] | [
"\"\"\"\n Adds a letter to the plot for scientific articles.\n\n Parameters\n ----------\n fig: go.Figure\n The figure to annotate\n letter: str\n The letter to add to the plot.\n x: float\n The x coordinate of the letter.\n y: float\n The y coordinate of the letter.... | [
{
"param": "fig",
"type": "go.Figure"
},
{
"param": "letter",
"type": "str"
},
{
"param": "x",
"type": "float"
},
{
"param": "y",
"type": "float"
},
{
"param": "row",
"type": "int"
},
{
"param": "col",
"type": "int"
},
{
"param": "on_paper"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fig",
"type": "go.Figure",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "letter",
"type": "str",
"docstring": null,
"docstring_t... |
a1c33bd79728032c9720e35ac8813448f5e7ac16 | Ipuch/OnDynamicsForSommersaults | analyses/videos.py | [
"MIT"
] | Python | generate_video | None | def generate_video(solution: Solution, save_folder: str, filename: str) -> None:
"""
Generate a video of the solution.
Parameters
----------
solution : Solution
The solution to be visualized.
save_folder : str
The folder where the video will be saved.
filename : str
... |
Generate a video of the solution.
Parameters
----------
solution : Solution
The solution to be visualized.
save_folder : str
The folder where the video will be saved.
filename : str
The name of the video.
| Generate a video of the solution.
Parameters
solution : Solution
The solution to be visualized.
save_folder : str
The folder where the video will be saved.
filename : str
The name of the video. | [
"Generate",
"a",
"video",
"of",
"the",
"solution",
".",
"Parameters",
"solution",
":",
"Solution",
"The",
"solution",
"to",
"be",
"visualized",
".",
"save_folder",
":",
"str",
"The",
"folder",
"where",
"the",
"video",
"will",
"be",
"saved",
".",
"filename",
... | def generate_video(solution: Solution, save_folder: str, filename: str) -> None:
b: bioviz.Viz = solution.animate(
show_now=False,
show_meshes=True,
show_global_center_of_mass=False,
show_gravity_vector=False,
show_floor=False,
show_segments_center_of_mass=False,
... | [
"def",
"generate_video",
"(",
"solution",
":",
"Solution",
",",
"save_folder",
":",
"str",
",",
"filename",
":",
"str",
")",
"->",
"None",
":",
"b",
":",
"bioviz",
".",
"Viz",
"=",
"solution",
".",
"animate",
"(",
"show_now",
"=",
"False",
",",
"show_m... | Generate a video of the solution. | [
"Generate",
"a",
"video",
"of",
"the",
"solution",
"."
] | [
"\"\"\"\n Generate a video of the solution.\n\n Parameters\n ----------\n solution : Solution\n The solution to be visualized.\n save_folder : str\n The folder where the video will be saved.\n filename : str\n The name of the video.\n \"\"\"",
"# Position camera",
"# Re... | [
{
"param": "solution",
"type": "Solution"
},
{
"param": "save_folder",
"type": "str"
},
{
"param": "filename",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "solution",
"type": "Solution",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "save_folder",
"type": "str",
"docstring": null,
"do... |
6527602d11aed7596dc780cc07ef960b374a22af | Ipuch/OnDynamicsForSommersaults | custom_dynamics/root_explicit_qddot_joint.py | [
"MIT"
] | Python | custom_configure_root_explicit | null | def custom_configure_root_explicit(ocp: OptimalControlProgram, nlp: NonLinearProgram):
"""
Tell the program which variables are states and controls.
The user is expected to use the ConfigureProblem.configure_xxx functions.
Parameters
----------
ocp: OptimalControlProgram
A reference to ... |
Tell the program which variables are states and controls.
The user is expected to use the ConfigureProblem.configure_xxx functions.
Parameters
----------
ocp: OptimalControlProgram
A reference to the ocp
nlp: NonLinearProgram
A reference to the phase
| Tell the program which variables are states and controls.
The user is expected to use the ConfigureProblem.configure_xxx functions.
Parameters
OptimalControlProgram
A reference to the ocp
nlp: NonLinearProgram
A reference to the phase | [
"Tell",
"the",
"program",
"which",
"variables",
"are",
"states",
"and",
"controls",
".",
"The",
"user",
"is",
"expected",
"to",
"use",
"the",
"ConfigureProblem",
".",
"configure_xxx",
"functions",
".",
"Parameters",
"OptimalControlProgram",
"A",
"reference",
"to",... | def custom_configure_root_explicit(ocp: OptimalControlProgram, nlp: NonLinearProgram):
ConfigureProblem.configure_q(nlp, as_states=True, as_controls=False)
ConfigureProblem.configure_qdot(nlp, as_states=True, as_controls=False)
configure_qddot_joint(nlp, as_states=False, as_controls=True)
ConfigureProbl... | [
"def",
"custom_configure_root_explicit",
"(",
"ocp",
":",
"OptimalControlProgram",
",",
"nlp",
":",
"NonLinearProgram",
")",
":",
"ConfigureProblem",
".",
"configure_q",
"(",
"nlp",
",",
"as_states",
"=",
"True",
",",
"as_controls",
"=",
"False",
")",
"ConfigurePr... | Tell the program which variables are states and controls. | [
"Tell",
"the",
"program",
"which",
"variables",
"are",
"states",
"and",
"controls",
"."
] | [
"\"\"\"\n Tell the program which variables are states and controls.\n The user is expected to use the ConfigureProblem.configure_xxx functions.\n\n Parameters\n ----------\n ocp: OptimalControlProgram\n A reference to the ocp\n nlp: NonLinearProgram\n A reference to the phase\n \"... | [
{
"param": "ocp",
"type": "OptimalControlProgram"
},
{
"param": "nlp",
"type": "NonLinearProgram"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ocp",
"type": "OptimalControlProgram",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nlp",
"type": "NonLinearProgram",
"docstring": nu... |
6527602d11aed7596dc780cc07ef960b374a22af | Ipuch/OnDynamicsForSommersaults | custom_dynamics/root_explicit_qddot_joint.py | [
"MIT"
] | Python | configure_qddot_joint | null | def configure_qddot_joint(nlp, as_states: bool, as_controls: bool):
"""
Configure the generalized accelerations
Parameters
----------
nlp: NonLinearProgram
A reference to the phase
as_states: bool
If the generalized velocities should be a state
as_controls: bool
If t... |
Configure the generalized accelerations
Parameters
----------
nlp: NonLinearProgram
A reference to the phase
as_states: bool
If the generalized velocities should be a state
as_controls: bool
If the generalized velocities should be a control
| Configure the generalized accelerations
Parameters
NonLinearProgram
A reference to the phase
as_states: bool
If the generalized velocities should be a state
as_controls: bool
If the generalized velocities should be a control | [
"Configure",
"the",
"generalized",
"accelerations",
"Parameters",
"NonLinearProgram",
"A",
"reference",
"to",
"the",
"phase",
"as_states",
":",
"bool",
"If",
"the",
"generalized",
"velocities",
"should",
"be",
"a",
"state",
"as_controls",
":",
"bool",
"If",
"the",... | def configure_qddot_joint(nlp, as_states: bool, as_controls: bool):
nb_root = nlp.model.nbRoot()
name_qddot_joint = [str(i + nb_root) for i in range(nlp.model.nbQddot() - nb_root)]
ConfigureProblem.configure_new_variable("qddot_joint", name_qddot_joint, nlp, as_states, as_controls) | [
"def",
"configure_qddot_joint",
"(",
"nlp",
",",
"as_states",
":",
"bool",
",",
"as_controls",
":",
"bool",
")",
":",
"nb_root",
"=",
"nlp",
".",
"model",
".",
"nbRoot",
"(",
")",
"name_qddot_joint",
"=",
"[",
"str",
"(",
"i",
"+",
"nb_root",
")",
"for... | Configure the generalized accelerations
Parameters | [
"Configure",
"the",
"generalized",
"accelerations",
"Parameters"
] | [
"\"\"\"\n Configure the generalized accelerations\n\n Parameters\n ----------\n nlp: NonLinearProgram\n A reference to the phase\n as_states: bool\n If the generalized velocities should be a state\n as_controls: bool\n If the generalized velocities should be a control\n \"\... | [
{
"param": "nlp",
"type": null
},
{
"param": "as_states",
"type": "bool"
},
{
"param": "as_controls",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "nlp",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "as_states",
"type": "bool",
"docstring": null,
"docstring_toke... |
4feb050d2c2bbe9b73e78282dc97bb091ef6a8a0 | Ipuch/OnDynamicsForSommersaults | custom_dynamics/root_implicit.py | [
"MIT"
] | Python | custom_configure_root_implicit | null | def custom_configure_root_implicit(ocp: OptimalControlProgram, nlp: NonLinearProgram):
"""
Tell the program which variables are states and controls.
The user is expected to use the ConfigureProblem.configure_xxx functions.
Parameters
----------
ocp: OptimalControlProgram
A reference to ... |
Tell the program which variables are states and controls.
The user is expected to use the ConfigureProblem.configure_xxx functions.
Parameters
----------
ocp: OptimalControlProgram
A reference to the ocp
nlp: NonLinearProgram
A reference to the phase
| Tell the program which variables are states and controls.
The user is expected to use the ConfigureProblem.configure_xxx functions.
Parameters
OptimalControlProgram
A reference to the ocp
nlp: NonLinearProgram
A reference to the phase | [
"Tell",
"the",
"program",
"which",
"variables",
"are",
"states",
"and",
"controls",
".",
"The",
"user",
"is",
"expected",
"to",
"use",
"the",
"ConfigureProblem",
".",
"configure_xxx",
"functions",
".",
"Parameters",
"OptimalControlProgram",
"A",
"reference",
"to",... | def custom_configure_root_implicit(ocp: OptimalControlProgram, nlp: NonLinearProgram):
ConfigureProblem.configure_q(nlp, as_states=True, as_controls=False)
ConfigureProblem.configure_qdot(nlp, as_states=True, as_controls=False)
ConfigureProblem.configure_qddot(nlp, as_states=False, as_controls=True)
ocp... | [
"def",
"custom_configure_root_implicit",
"(",
"ocp",
":",
"OptimalControlProgram",
",",
"nlp",
":",
"NonLinearProgram",
")",
":",
"ConfigureProblem",
".",
"configure_q",
"(",
"nlp",
",",
"as_states",
"=",
"True",
",",
"as_controls",
"=",
"False",
")",
"ConfigurePr... | Tell the program which variables are states and controls. | [
"Tell",
"the",
"program",
"which",
"variables",
"are",
"states",
"and",
"controls",
"."
] | [
"\"\"\"\n Tell the program which variables are states and controls.\n The user is expected to use the ConfigureProblem.configure_xxx functions.\n\n Parameters\n ----------\n ocp: OptimalControlProgram\n A reference to the ocp\n nlp: NonLinearProgram\n A reference to the phase\n \"... | [
{
"param": "ocp",
"type": "OptimalControlProgram"
},
{
"param": "nlp",
"type": "NonLinearProgram"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ocp",
"type": "OptimalControlProgram",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nlp",
"type": "NonLinearProgram",
"docstring": nu... |
4feb050d2c2bbe9b73e78282dc97bb091ef6a8a0 | Ipuch/OnDynamicsForSommersaults | custom_dynamics/root_implicit.py | [
"MIT"
] | Python | implicit_root_dynamics | <not_specific> | def implicit_root_dynamics(all_pn: PenaltyNodeList, **unused_param):
"""
Compute the difference between symbolic joint torques and inverse dynamic results
It does not include any inversion of mass matrix
Parameters
----------
all_pn: PenaltyNodeList
The penalty node elements
**unuse... |
Compute the difference between symbolic joint torques and inverse dynamic results
It does not include any inversion of mass matrix
Parameters
----------
all_pn: PenaltyNodeList
The penalty node elements
**unused_param: dict
Since the function does nothing, we can safely ignore ... | Compute the difference between symbolic joint torques and inverse dynamic results
It does not include any inversion of mass matrix
Parameters
PenaltyNodeList
The penalty node elements
unused_param: dict
Since the function does nothing, we can safely ignore any argument | [
"Compute",
"the",
"difference",
"between",
"symbolic",
"joint",
"torques",
"and",
"inverse",
"dynamic",
"results",
"It",
"does",
"not",
"include",
"any",
"inversion",
"of",
"mass",
"matrix",
"Parameters",
"PenaltyNodeList",
"The",
"penalty",
"node",
"elements",
"u... | def implicit_root_dynamics(all_pn: PenaltyNodeList, **unused_param):
nlp = all_pn.nlp
nb_root = nlp.model.nbRoot()
q = nlp.states["q"].mx
qdot = nlp.states["qdot"].mx
qddot = nlp.states["qddot"].mx if "qddot" in nlp.states.keys() else nlp.controls["qddot"].mx
if nlp.external_forces:
rais... | [
"def",
"implicit_root_dynamics",
"(",
"all_pn",
":",
"PenaltyNodeList",
",",
"**",
"unused_param",
")",
":",
"nlp",
"=",
"all_pn",
".",
"nlp",
"nb_root",
"=",
"nlp",
".",
"model",
".",
"nbRoot",
"(",
")",
"q",
"=",
"nlp",
".",
"states",
"[",
"\"q\"",
"... | Compute the difference between symbolic joint torques and inverse dynamic results
It does not include any inversion of mass matrix | [
"Compute",
"the",
"difference",
"between",
"symbolic",
"joint",
"torques",
"and",
"inverse",
"dynamic",
"results",
"It",
"does",
"not",
"include",
"any",
"inversion",
"of",
"mass",
"matrix"
] | [
"\"\"\"\n Compute the difference between symbolic joint torques and inverse dynamic results\n It does not include any inversion of mass matrix\n\n Parameters\n ----------\n all_pn: PenaltyNodeList\n The penalty node elements\n **unused_param: dict\n Since the function does nothing, w... | [
{
"param": "all_pn",
"type": "PenaltyNodeList"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "all_pn",
"type": "PenaltyNodeList",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
27a83e82b95b4546c09550be3ec02fb2a72b222d | Ipuch/OnDynamicsForSommersaults | miller_viz.py | [
"MIT"
] | Python | plot_linear_momentum | <not_specific> | def plot_linear_momentum(x, nlp: NonLinearProgram):
"""
Compute the linear momentum of the system.
Parameters
----------
x
State vector
nlp: NonLinearProgram
Non linear program
"""
linear_momentum = (
nlp.model.mass().to_mx() * nlp.model.CoMdot(nlp.states["q"].mx... |
Compute the linear momentum of the system.
Parameters
----------
x
State vector
nlp: NonLinearProgram
Non linear program
| Compute the linear momentum of the system.
Parameters
x
State vector
nlp: NonLinearProgram
Non linear program | [
"Compute",
"the",
"linear",
"momentum",
"of",
"the",
"system",
".",
"Parameters",
"x",
"State",
"vector",
"nlp",
":",
"NonLinearProgram",
"Non",
"linear",
"program"
] | def plot_linear_momentum(x, nlp: NonLinearProgram):
linear_momentum = (
nlp.model.mass().to_mx() * nlp.model.CoMdot(nlp.states["q"].mx, nlp.states["qdot"].mx, True).to_mx()
)
linear_momentum_func = biorbd.to_casadi_func(
"LinearMomentum", linear_momentum, nlp.states["q"].mx, nlp.states["qdot... | [
"def",
"plot_linear_momentum",
"(",
"x",
",",
"nlp",
":",
"NonLinearProgram",
")",
":",
"linear_momentum",
"=",
"(",
"nlp",
".",
"model",
".",
"mass",
"(",
")",
".",
"to_mx",
"(",
")",
"*",
"nlp",
".",
"model",
".",
"CoMdot",
"(",
"nlp",
".",
"states... | Compute the linear momentum of the system. | [
"Compute",
"the",
"linear",
"momentum",
"of",
"the",
"system",
"."
] | [
"\"\"\"\n Compute the linear momentum of the system.\n\n Parameters\n ----------\n x\n State vector\n nlp: NonLinearProgram\n Non linear program\n \"\"\""
] | [
{
"param": "x",
"type": null
},
{
"param": "nlp",
"type": "NonLinearProgram"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nlp",
"type": "NonLinearProgram",
"docstring": null,
"docstring_... |
27a83e82b95b4546c09550be3ec02fb2a72b222d | Ipuch/OnDynamicsForSommersaults | miller_viz.py | [
"MIT"
] | Python | plot_angular_momentum | <not_specific> | def plot_angular_momentum(x, nlp: NonLinearProgram):
"""
Compute the angular momentum of the system.
Parameters
----------
x
State vector
nlp: NonLinearProgram
Non linear program
"""
angular_momentum_func = biorbd.to_casadi_func(
"AngularMomentum", nlp.model.angu... |
Compute the angular momentum of the system.
Parameters
----------
x
State vector
nlp: NonLinearProgram
Non linear program
| Compute the angular momentum of the system.
Parameters
x
State vector
nlp: NonLinearProgram
Non linear program | [
"Compute",
"the",
"angular",
"momentum",
"of",
"the",
"system",
".",
"Parameters",
"x",
"State",
"vector",
"nlp",
":",
"NonLinearProgram",
"Non",
"linear",
"program"
] | def plot_angular_momentum(x, nlp: NonLinearProgram):
angular_momentum_func = biorbd.to_casadi_func(
"AngularMomentum", nlp.model.angularMomentum, nlp.states["q"].mx, nlp.states["qdot"].mx, expand=False
)
q = nlp.states["q"].mapping.to_second.map(x[nlp.states["q"].index, :])
qdot = nlp.states["qd... | [
"def",
"plot_angular_momentum",
"(",
"x",
",",
"nlp",
":",
"NonLinearProgram",
")",
":",
"angular_momentum_func",
"=",
"biorbd",
".",
"to_casadi_func",
"(",
"\"AngularMomentum\"",
",",
"nlp",
".",
"model",
".",
"angularMomentum",
",",
"nlp",
".",
"states",
"[",
... | Compute the angular momentum of the system. | [
"Compute",
"the",
"angular",
"momentum",
"of",
"the",
"system",
"."
] | [
"\"\"\"\n Compute the angular momentum of the system.\n\n Parameters\n ----------\n x\n State vector\n nlp: NonLinearProgram\n Non linear program\n \"\"\""
] | [
{
"param": "x",
"type": null
},
{
"param": "nlp",
"type": "NonLinearProgram"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "nlp",
"type": "NonLinearProgram",
"docstring": null,
"docstring_... |
27a83e82b95b4546c09550be3ec02fb2a72b222d | Ipuch/OnDynamicsForSommersaults | miller_viz.py | [
"MIT"
] | Python | plot_residual_torque | <not_specific> | def plot_residual_torque(x, u, nlp: NonLinearProgram):
"""
Compute the residual torque of the system.
Parameters
----------
x
State vector
u
Control vector
nlp: NonLinearProgram
Non linear program
"""
qddot_mx = nlp.controls["qddot"].mx if "qddot" in nlp.cont... |
Compute the residual torque of the system.
Parameters
----------
x
State vector
u
Control vector
nlp: NonLinearProgram
Non linear program
| Compute the residual torque of the system.
Parameters
x
State vector
u
Control vector
nlp: NonLinearProgram
Non linear program | [
"Compute",
"the",
"residual",
"torque",
"of",
"the",
"system",
".",
"Parameters",
"x",
"State",
"vector",
"u",
"Control",
"vector",
"nlp",
":",
"NonLinearProgram",
"Non",
"linear",
"program"
] | def plot_residual_torque(x, u, nlp: NonLinearProgram):
qddot_mx = nlp.controls["qddot"].mx if "qddot" in nlp.controls.keys() else nlp.states["qddot"].mx
ID_func = biorbd.to_casadi_func(
"ResidualTorque",
nlp.model.InverseDynamics,
nlp.states["q"].mx,
nlp.states["qdot"].mx,
... | [
"def",
"plot_residual_torque",
"(",
"x",
",",
"u",
",",
"nlp",
":",
"NonLinearProgram",
")",
":",
"qddot_mx",
"=",
"nlp",
".",
"controls",
"[",
"\"qddot\"",
"]",
".",
"mx",
"if",
"\"qddot\"",
"in",
"nlp",
".",
"controls",
".",
"keys",
"(",
")",
"else",... | Compute the residual torque of the system. | [
"Compute",
"the",
"residual",
"torque",
"of",
"the",
"system",
"."
] | [
"\"\"\"\n Compute the residual torque of the system.\n\n Parameters\n ----------\n x\n State vector\n u\n Control vector\n nlp: NonLinearProgram\n Non linear program\n \"\"\""
] | [
{
"param": "x",
"type": null
},
{
"param": "u",
"type": null
},
{
"param": "nlp",
"type": "NonLinearProgram"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "u",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
27a83e82b95b4546c09550be3ec02fb2a72b222d | Ipuch/OnDynamicsForSommersaults | miller_viz.py | [
"MIT"
] | Python | add_custom_plots | null | def add_custom_plots(ocp: OptimalControlProgram, dynamics_type: MillerDynamics):
"""
Add extra plots to the OCP.
Parameters
----------
ocp: OptimalControlProgram
Optimal control program
dynamics_type: MillerDynamics
Type of dynamics of the Miller optimal control problem
"""
... |
Add extra plots to the OCP.
Parameters
----------
ocp: OptimalControlProgram
Optimal control program
dynamics_type: MillerDynamics
Type of dynamics of the Miller optimal control problem
| Add extra plots to the OCP.
Parameters
OptimalControlProgram
Optimal control program
dynamics_type: MillerDynamics
Type of dynamics of the Miller optimal control problem | [
"Add",
"extra",
"plots",
"to",
"the",
"OCP",
".",
"Parameters",
"OptimalControlProgram",
"Optimal",
"control",
"program",
"dynamics_type",
":",
"MillerDynamics",
"Type",
"of",
"dynamics",
"of",
"the",
"Miller",
"optimal",
"control",
"problem"
] | def add_custom_plots(ocp: OptimalControlProgram, dynamics_type: MillerDynamics):
for i, nlp in enumerate(ocp.nlp):
ocp.add_plot(
"LinearMomentum",
lambda t, x, u, p: plot_linear_momentum(x, nlp),
phase=i,
legend=["Linear Momentum x", "Linear Momentum y", "Line... | [
"def",
"add_custom_plots",
"(",
"ocp",
":",
"OptimalControlProgram",
",",
"dynamics_type",
":",
"MillerDynamics",
")",
":",
"for",
"i",
",",
"nlp",
"in",
"enumerate",
"(",
"ocp",
".",
"nlp",
")",
":",
"ocp",
".",
"add_plot",
"(",
"\"LinearMomentum\"",
",",
... | Add extra plots to the OCP. | [
"Add",
"extra",
"plots",
"to",
"the",
"OCP",
"."
] | [
"\"\"\"\n Add extra plots to the OCP.\n\n Parameters\n ----------\n ocp: OptimalControlProgram\n Optimal control program\n dynamics_type: MillerDynamics\n Type of dynamics of the Miller optimal control problem\n \"\"\""
] | [
{
"param": "ocp",
"type": "OptimalControlProgram"
},
{
"param": "dynamics_type",
"type": "MillerDynamics"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ocp",
"type": "OptimalControlProgram",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dynamics_type",
"type": "MillerDynamics",
"docstr... |
8ee8f1dd7e8d7dcfc1865ebe6ec12de12e9410a5 | Ipuch/OnDynamicsForSommersaults | miller.py | [
"MIT"
] | Python | main | null | def main(
dynamics_type: MillerDynamics,
thread: int = 1,
solver: OdeSolver = OdeSolver.RK4,
extra_obj: bool = False,
n_shooting: tuple = (125, 25),
):
"""
Main function for running the Miller optimal control problem with 15-dof human.
Parameters
----------
dynamics_type : Mille... |
Main function for running the Miller optimal control problem with 15-dof human.
Parameters
----------
dynamics_type : MillerDynamics
Type of dynamics to use.
thread : int
Number of threads to use.
solver : OdeSolver
Type of solver to use.
extra_obj : bool
Wh... | Main function for running the Miller optimal control problem with 15-dof human.
Parameters
dynamics_type : MillerDynamics
Type of dynamics to use.
thread : int
Number of threads to use.
solver : OdeSolver
Type of solver to use.
extra_obj : bool
Whether to use the extra objective (only for implicit dynamics). | [
"Main",
"function",
"for",
"running",
"the",
"Miller",
"optimal",
"control",
"problem",
"with",
"15",
"-",
"dof",
"human",
".",
"Parameters",
"dynamics_type",
":",
"MillerDynamics",
"Type",
"of",
"dynamics",
"to",
"use",
".",
"thread",
":",
"int",
"Number",
... | def main(
dynamics_type: MillerDynamics,
thread: int = 1,
solver: OdeSolver = OdeSolver.RK4,
extra_obj: bool = False,
n_shooting: tuple = (125, 25),
):
model_path = "Model_JeCh_15DoFs.bioMod"
miller = MillerOcp(
biorbd_model_path=model_path,
n_shooting=n_shooting,
ode... | [
"def",
"main",
"(",
"dynamics_type",
":",
"MillerDynamics",
",",
"thread",
":",
"int",
"=",
"1",
",",
"solver",
":",
"OdeSolver",
"=",
"OdeSolver",
".",
"RK4",
",",
"extra_obj",
":",
"bool",
"=",
"False",
",",
"n_shooting",
":",
"tuple",
"=",
"(",
"125... | Main function for running the Miller optimal control problem with 15-dof human. | [
"Main",
"function",
"for",
"running",
"the",
"Miller",
"optimal",
"control",
"problem",
"with",
"15",
"-",
"dof",
"human",
"."
] | [
"\"\"\"\n Main function for running the Miller optimal control problem with 15-dof human.\n\n Parameters\n ----------\n dynamics_type : MillerDynamics\n Type of dynamics to use.\n thread : int\n Number of threads to use.\n solver : OdeSolver\n Type of solver to use.\n extra... | [
{
"param": "dynamics_type",
"type": "MillerDynamics"
},
{
"param": "thread",
"type": "int"
},
{
"param": "solver",
"type": "OdeSolver"
},
{
"param": "extra_obj",
"type": "bool"
},
{
"param": "n_shooting",
"type": "tuple"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dynamics_type",
"type": "MillerDynamics",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "thread",
"type": "int",
"docstring": null,
... |
7840754e396b31720e2df8866aa160259fa7e517 | Ipuch/OnDynamicsForSommersaults | miller_ocp.py | [
"MIT"
] | Python | _set_dynamics | null | def _set_dynamics(self):
"""
Set the dynamics of the optimal control problem
"""
for phase in range(len(self.n_shooting)):
if self.dynamics_type == MillerDynamics.EXPLICIT:
self.dynamics.add(DynamicsFcn.TORQUE_DRIVEN, with_contact=False)
elif self.... |
Set the dynamics of the optimal control problem
| Set the dynamics of the optimal control problem | [
"Set",
"the",
"dynamics",
"of",
"the",
"optimal",
"control",
"problem"
] | def _set_dynamics(self):
for phase in range(len(self.n_shooting)):
if self.dynamics_type == MillerDynamics.EXPLICIT:
self.dynamics.add(DynamicsFcn.TORQUE_DRIVEN, with_contact=False)
elif self.dynamics_type == MillerDynamics.ROOT_EXPLICIT:
self.dynamics.add... | [
"def",
"_set_dynamics",
"(",
"self",
")",
":",
"for",
"phase",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"n_shooting",
")",
")",
":",
"if",
"self",
".",
"dynamics_type",
"==",
"MillerDynamics",
".",
"EXPLICIT",
":",
"self",
".",
"dynamics",
".",
"ad... | Set the dynamics of the optimal control problem | [
"Set",
"the",
"dynamics",
"of",
"the",
"optimal",
"control",
"problem"
] | [
"\"\"\"\n Set the dynamics of the optimal control problem\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7840754e396b31720e2df8866aa160259fa7e517 | Ipuch/OnDynamicsForSommersaults | miller_ocp.py | [
"MIT"
] | Python | _set_objective_functions | null | def _set_objective_functions(self):
"""
Set the multi-objective functions for each phase with specific weights
"""
# --- Objective function --- #
w_qdot = 1
w_penalty = 1
w_penalty_foot = 10
w_penalty_core = 10
w_track_final = 0.1
w_angula... |
Set the multi-objective functions for each phase with specific weights
| Set the multi-objective functions for each phase with specific weights | [
"Set",
"the",
"multi",
"-",
"objective",
"functions",
"for",
"each",
"phase",
"with",
"specific",
"weights"
] | def _set_objective_functions(self):
w_qdot = 1
w_penalty = 1
w_penalty_foot = 10
w_penalty_core = 10
w_track_final = 0.1
w_angular_momentum_x = 100000
w_angular_momentum_yz = 1000
for i in range(len(self.n_shooting)):
self.objective_functions.a... | [
"def",
"_set_objective_functions",
"(",
"self",
")",
":",
"w_qdot",
"=",
"1",
"w_penalty",
"=",
"1",
"w_penalty_foot",
"=",
"10",
"w_penalty_core",
"=",
"10",
"w_track_final",
"=",
"0.1",
"w_angular_momentum_x",
"=",
"100000",
"w_angular_momentum_yz",
"=",
"1000",... | Set the multi-objective functions for each phase with specific weights | [
"Set",
"the",
"multi",
"-",
"objective",
"functions",
"for",
"each",
"phase",
"with",
"specific",
"weights"
] | [
"\"\"\"\n Set the multi-objective functions for each phase with specific weights\n \"\"\"",
"# --- Objective function --- #",
"# Regularization",
"# Right hand trajectory",
"# Left hand trajectory",
"########### Lagrange",
"# feet trajectory",
"# core DoFs",
"# Track momentum and Minim... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7840754e396b31720e2df8866aa160259fa7e517 | Ipuch/OnDynamicsForSommersaults | miller_ocp.py | [
"MIT"
] | Python | _set_initial_momentum | null | def _set_initial_momentum(self):
"""
Set initial angular momentum and linear momentum.
"""
q_init = self.x_bounds[0].min[: self.n_q, 0]
qdot_init = self.x_bounds[0].min[self.n_q :, 0]
m = brd.Model(self.biorbd_model_path)
self.sigma0 = m.angularMomentum(q_init, q... |
Set initial angular momentum and linear momentum.
| Set initial angular momentum and linear momentum. | [
"Set",
"initial",
"angular",
"momentum",
"and",
"linear",
"momentum",
"."
] | def _set_initial_momentum(self):
q_init = self.x_bounds[0].min[: self.n_q, 0]
qdot_init = self.x_bounds[0].min[self.n_q :, 0]
m = brd.Model(self.biorbd_model_path)
self.sigma0 = m.angularMomentum(q_init, qdot_init, True).to_array()
self.p0 = m.mass() * m.CoMdot(q_init, qdot_init,... | [
"def",
"_set_initial_momentum",
"(",
"self",
")",
":",
"q_init",
"=",
"self",
".",
"x_bounds",
"[",
"0",
"]",
".",
"min",
"[",
":",
"self",
".",
"n_q",
",",
"0",
"]",
"qdot_init",
"=",
"self",
".",
"x_bounds",
"[",
"0",
"]",
".",
"min",
"[",
"sel... | Set initial angular momentum and linear momentum. | [
"Set",
"initial",
"angular",
"momentum",
"and",
"linear",
"momentum",
"."
] | [
"\"\"\"\n Set initial angular momentum and linear momentum.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7840754e396b31720e2df8866aa160259fa7e517 | Ipuch/OnDynamicsForSommersaults | miller_ocp.py | [
"MIT"
] | Python | _set_initial_guesses | null | def _set_initial_guesses(self):
"""
Set the initial guess for the optimal control problem (states and controls)
"""
# --- Initial guess --- #
total_n_shooting = np.sum(self.n_shooting) + len(self.n_shooting)
# Initialize state vector
# if self.x is None:
s... |
Set the initial guess for the optimal control problem (states and controls)
| Set the initial guess for the optimal control problem (states and controls) | [
"Set",
"the",
"initial",
"guess",
"for",
"the",
"optimal",
"control",
"problem",
"(",
"states",
"and",
"controls",
")"
] | def _set_initial_guesses(self):
total_n_shooting = np.sum(self.n_shooting) + len(self.n_shooting)
self.x = np.zeros((self.n_q + self.n_qdot, total_n_shooting))
v0 = 1 / 2 * 9.81 * self.duration
time vector
data_point = np.linspace(0, self.duration, total_n_shooting)
p... | [
"def",
"_set_initial_guesses",
"(",
"self",
")",
":",
"total_n_shooting",
"=",
"np",
".",
"sum",
"(",
"self",
".",
"n_shooting",
")",
"+",
"len",
"(",
"self",
".",
"n_shooting",
")",
"self",
".",
"x",
"=",
"np",
".",
"zeros",
"(",
"(",
"self",
".",
... | Set the initial guess for the optimal control problem (states and controls) | [
"Set",
"the",
"initial",
"guess",
"for",
"the",
"optimal",
"control",
"problem",
"(",
"states",
"and",
"controls",
")"
] | [
"\"\"\"\n Set the initial guess for the optimal control problem (states and controls)\n \"\"\"",
"# --- Initial guess --- #",
"# Initialize state vector",
"# if self.x is None:",
"# determine v such that final z == 0",
"#",
"# time vector",
"# parabolic trajectory on Z",
"# Somersaults... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7840754e396b31720e2df8866aa160259fa7e517 | Ipuch/OnDynamicsForSommersaults | miller_ocp.py | [
"MIT"
] | Python | _set_initial_states | null | def _set_initial_states(self, X0: np.array = None):
"""
Set the initial states of the optimal control problem.
"""
if self.ode_solver.is_direct_shooting:
if X0 is None:
self.x_init.add([0] * (self.n_q + self.n_q))
else:
mesh_point_i... |
Set the initial states of the optimal control problem.
| Set the initial states of the optimal control problem. | [
"Set",
"the",
"initial",
"states",
"of",
"the",
"optimal",
"control",
"problem",
"."
] | def _set_initial_states(self, X0: np.array = None):
if self.ode_solver.is_direct_shooting:
if X0 is None:
self.x_init.add([0] * (self.n_q + self.n_q))
else:
mesh_point_init = 0
for i in range(self.n_phases):
self.x_init.... | [
"def",
"_set_initial_states",
"(",
"self",
",",
"X0",
":",
"np",
".",
"array",
"=",
"None",
")",
":",
"if",
"self",
".",
"ode_solver",
".",
"is_direct_shooting",
":",
"if",
"X0",
"is",
"None",
":",
"self",
".",
"x_init",
".",
"add",
"(",
"[",
"0",
... | Set the initial states of the optimal control problem. | [
"Set",
"the",
"initial",
"states",
"of",
"the",
"optimal",
"control",
"problem",
"."
] | [
"\"\"\"\n Set the initial states of the optimal control problem.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "X0",
"type": "np.array"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "X0",
"type": "np.array",
"docstring": null,
"docstring_tokens... |
7840754e396b31720e2df8866aa160259fa7e517 | Ipuch/OnDynamicsForSommersaults | miller_ocp.py | [
"MIT"
] | Python | _interpolate_initial_states | <not_specific> | def _interpolate_initial_states(self, X0: np.array):
"""
Interpolate the initial states to match the number of shooting nodes
"""
print("interpolating initial states to match the number of shooting nodes")
x = np.linspace(0, self.phase_time, X0.shape[1])
y = X0
f ... |
Interpolate the initial states to match the number of shooting nodes
| Interpolate the initial states to match the number of shooting nodes | [
"Interpolate",
"the",
"initial",
"states",
"to",
"match",
"the",
"number",
"of",
"shooting",
"nodes"
] | def _interpolate_initial_states(self, X0: np.array):
print("interpolating initial states to match the number of shooting nodes")
x = np.linspace(0, self.phase_time, X0.shape[1])
y = X0
f = interpolate.interp1d(x, y)
x_new = np.linspace(0, self.phase_time, np.sum(self.n_shooting) ... | [
"def",
"_interpolate_initial_states",
"(",
"self",
",",
"X0",
":",
"np",
".",
"array",
")",
":",
"print",
"(",
"\"interpolating initial states to match the number of shooting nodes\"",
")",
"x",
"=",
"np",
".",
"linspace",
"(",
"0",
",",
"self",
".",
"phase_time",... | Interpolate the initial states to match the number of shooting nodes | [
"Interpolate",
"the",
"initial",
"states",
"to",
"match",
"the",
"number",
"of",
"shooting",
"nodes"
] | [
"\"\"\"\n Interpolate the initial states to match the number of shooting nodes\n \"\"\"",
"# use interpolation function returned by `interp1d`"
] | [
{
"param": "self",
"type": null
},
{
"param": "X0",
"type": "np.array"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "X0",
"type": "np.array",
"docstring": null,
"docstring_tokens... |
7840754e396b31720e2df8866aa160259fa7e517 | Ipuch/OnDynamicsForSommersaults | miller_ocp.py | [
"MIT"
] | Python | _interpolate_initial_controls | <not_specific> | def _interpolate_initial_controls(self, U0: np.array):
"""
Interpolate the initial controls to match the number of shooting nodes
"""
print("interpolating initial controls to match the number of shooting nodes")
x = np.linspace(0, self.phase_time, U0.shape[1])
y = U0
... |
Interpolate the initial controls to match the number of shooting nodes
| Interpolate the initial controls to match the number of shooting nodes | [
"Interpolate",
"the",
"initial",
"controls",
"to",
"match",
"the",
"number",
"of",
"shooting",
"nodes"
] | def _interpolate_initial_controls(self, U0: np.array):
print("interpolating initial controls to match the number of shooting nodes")
x = np.linspace(0, self.phase_time, U0.shape[1])
y = U0
f = interpolate.interp1d(x, y)
x_new = np.linspace(0, self.phase_time, self.n_shooting)
... | [
"def",
"_interpolate_initial_controls",
"(",
"self",
",",
"U0",
":",
"np",
".",
"array",
")",
":",
"print",
"(",
"\"interpolating initial controls to match the number of shooting nodes\"",
")",
"x",
"=",
"np",
".",
"linspace",
"(",
"0",
",",
"self",
".",
"phase_ti... | Interpolate the initial controls to match the number of shooting nodes | [
"Interpolate",
"the",
"initial",
"controls",
"to",
"match",
"the",
"number",
"of",
"shooting",
"nodes"
] | [
"\"\"\"\n Interpolate the initial controls to match the number of shooting nodes\n \"\"\"",
"# use interpolation function returned by `interp1d`"
] | [
{
"param": "self",
"type": null
},
{
"param": "U0",
"type": "np.array"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "U0",
"type": "np.array",
"docstring": null,
"docstring_tokens... |
7840754e396b31720e2df8866aa160259fa7e517 | Ipuch/OnDynamicsForSommersaults | miller_ocp.py | [
"MIT"
] | Python | _set_mapping | null | def _set_mapping(self):
"""
Set the mapping between the states and controls of the model
"""
if self.dynamics_type == MillerDynamics.EXPLICIT:
self.mapping.add(
"tau", [None, None, None, None, None, None, 0, 1, 2, 3, 4, 5, 6, 7, 8], [6, 7, 8, 9, 10, 11, 12, 13... |
Set the mapping between the states and controls of the model
| Set the mapping between the states and controls of the model | [
"Set",
"the",
"mapping",
"between",
"the",
"states",
"and",
"controls",
"of",
"the",
"model"
] | def _set_mapping(self):
if self.dynamics_type == MillerDynamics.EXPLICIT:
self.mapping.add(
"tau", [None, None, None, None, None, None, 0, 1, 2, 3, 4, 5, 6, 7, 8], [6, 7, 8, 9, 10, 11, 12, 13, 14]
)
elif self.dynamics_type == MillerDynamics.ROOT_EXPLICIT:
... | [
"def",
"_set_mapping",
"(",
"self",
")",
":",
"if",
"self",
".",
"dynamics_type",
"==",
"MillerDynamics",
".",
"EXPLICIT",
":",
"self",
".",
"mapping",
".",
"add",
"(",
"\"tau\"",
",",
"[",
"None",
",",
"None",
",",
"None",
",",
"None",
",",
"None",
... | Set the mapping between the states and controls of the model | [
"Set",
"the",
"mapping",
"between",
"the",
"states",
"and",
"controls",
"of",
"the",
"model"
] | [
"\"\"\"\n Set the mapping between the states and controls of the 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": []
} |
7840754e396b31720e2df8866aa160259fa7e517 | Ipuch/OnDynamicsForSommersaults | miller_ocp.py | [
"MIT"
] | Python | _print_bounds | null | def _print_bounds(self):
"""
Prints the bounds of the states
"""
max = []
min = []
for nlp in self.ocp.nlp:
max.append(np.array(nlp.x_bounds.max.tolist()))
min.append(np.array(nlp.x_bounds.min.tolist()))
s = ""
for i, nlp in enumer... |
Prints the bounds of the states
| Prints the bounds of the states | [
"Prints",
"the",
"bounds",
"of",
"the",
"states"
] | def _print_bounds(self):
max = []
min = []
for nlp in self.ocp.nlp:
max.append(np.array(nlp.x_bounds.max.tolist()))
min.append(np.array(nlp.x_bounds.min.tolist()))
s = ""
for i, nlp in enumerate(self.ocp.nlp):
s += f"Phase {i}"
s +=... | [
"def",
"_print_bounds",
"(",
"self",
")",
":",
"max",
"=",
"[",
"]",
"min",
"=",
"[",
"]",
"for",
"nlp",
"in",
"self",
".",
"ocp",
".",
"nlp",
":",
"max",
".",
"append",
"(",
"np",
".",
"array",
"(",
"nlp",
".",
"x_bounds",
".",
"max",
".",
"... | Prints the bounds of the states | [
"Prints",
"the",
"bounds",
"of",
"the",
"states"
] | [
"\"\"\"\n Prints the bounds of the 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": []
} |
0c61a7e1c8627fc8d9bce8905b0d535246a88d47 | rosario-riccio/MediStormSeeker | dbMongo.py | [
"Apache-2.0"
] | Python | groupByClassPolygonDB | <not_specific> | def groupByClassPolygonDB(self,date1):
"""This method allows to ask the DB for the polygons's classes list grouped by classes of specific date"""
count = self.db.PolygonCollection.find({"properties.dateStr": date1}).count()
print(count)
if count > 0:
result = True
... | This method allows to ask the DB for the polygons's classes list grouped by classes of specific date | This method allows to ask the DB for the polygons's classes list grouped by classes of specific date | [
"This",
"method",
"allows",
"to",
"ask",
"the",
"DB",
"for",
"the",
"polygons",
"'",
"s",
"classes",
"list",
"grouped",
"by",
"classes",
"of",
"specific",
"date"
] | def groupByClassPolygonDB(self,date1):
count = self.db.PolygonCollection.find({"properties.dateStr": date1}).count()
print(count)
if count > 0:
result = True
cursorClassPolygon = self.db.PolygonCollection.aggregate(
[{"$match" : { "properties.dateStr" : da... | [
"def",
"groupByClassPolygonDB",
"(",
"self",
",",
"date1",
")",
":",
"count",
"=",
"self",
".",
"db",
".",
"PolygonCollection",
".",
"find",
"(",
"{",
"\"properties.dateStr\"",
":",
"date1",
"}",
")",
".",
"count",
"(",
")",
"print",
"(",
"count",
")",
... | This method allows to ask the DB for the polygons's classes list grouped by classes of specific date | [
"This",
"method",
"allows",
"to",
"ask",
"the",
"DB",
"for",
"the",
"polygons",
"'",
"s",
"classes",
"list",
"grouped",
"by",
"classes",
"of",
"specific",
"date"
] | [
"\"\"\"This method allows to ask the DB for the polygons's classes list grouped by classes of specific date\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "date1",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "date1",
"type": null,
"docstring": null,
"docstring_tokens": ... |
0c61a7e1c8627fc8d9bce8905b0d535246a88d47 | rosario-riccio/MediStormSeeker | dbMongo.py | [
"Apache-2.0"
] | Python | groupByClassPolygonDBNoDate | <not_specific> | def groupByClassPolygonDBNoDate(self):
"""This method returns polygons grouped by label from DB"""
count = self.db.PolygonCollection.find().count()
print("number of polygon n.",count)
if count > 0:
result = True
cursorClassPolygon = self.db.PolygonCollection.aggre... | This method returns polygons grouped by label from DB | This method returns polygons grouped by label from DB | [
"This",
"method",
"returns",
"polygons",
"grouped",
"by",
"label",
"from",
"DB"
] | def groupByClassPolygonDBNoDate(self):
count = self.db.PolygonCollection.find().count()
print("number of polygon n.",count)
if count > 0:
result = True
cursorClassPolygon = self.db.PolygonCollection.aggregate(
[{"$group": {"_id":{"name" : "$properties.name... | [
"def",
"groupByClassPolygonDBNoDate",
"(",
"self",
")",
":",
"count",
"=",
"self",
".",
"db",
".",
"PolygonCollection",
".",
"find",
"(",
")",
".",
"count",
"(",
")",
"print",
"(",
"\"number of polygon n.\"",
",",
"count",
")",
"if",
"count",
">",
"0",
"... | This method returns polygons grouped by label from DB | [
"This",
"method",
"returns",
"polygons",
"grouped",
"by",
"label",
"from",
"DB"
] | [
"\"\"\"This method returns polygons grouped by label from DB\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0c61a7e1c8627fc8d9bce8905b0d535246a88d47 | rosario-riccio/MediStormSeeker | dbMongo.py | [
"Apache-2.0"
] | Python | insertPolygonDB | <not_specific> | def insertPolygonDB(self,polygonGeoJson):
"""This method allows to add polygon"""
count = self.db.PolygonCollection.find({"$and":[{"geometry.coordinates":polygonGeoJson["geometry"]["coordinates"]},{"properties.dateStr":polygonGeoJson["properties"]["dateStr"]}]}).count()
print("equal polygons ",c... | This method allows to add polygon | This method allows to add polygon | [
"This",
"method",
"allows",
"to",
"add",
"polygon"
] | def insertPolygonDB(self,polygonGeoJson):
count = self.db.PolygonCollection.find({"$and":[{"geometry.coordinates":polygonGeoJson["geometry"]["coordinates"]},{"properties.dateStr":polygonGeoJson["properties"]["dateStr"]}]}).count()
print("equal polygons ",count)
if count == 0:
id = se... | [
"def",
"insertPolygonDB",
"(",
"self",
",",
"polygonGeoJson",
")",
":",
"count",
"=",
"self",
".",
"db",
".",
"PolygonCollection",
".",
"find",
"(",
"{",
"\"$and\"",
":",
"[",
"{",
"\"geometry.coordinates\"",
":",
"polygonGeoJson",
"[",
"\"geometry\"",
"]",
... | This method allows to add polygon | [
"This",
"method",
"allows",
"to",
"add",
"polygon"
] | [
"\"\"\"This method allows to add polygon\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "polygonGeoJson",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "polygonGeoJson",
"type": null,
"docstring": null,
"docstring_... |
0c61a7e1c8627fc8d9bce8905b0d535246a88d47 | rosario-riccio/MediStormSeeker | dbMongo.py | [
"Apache-2.0"
] | Python | deletePolygonDB | <not_specific> | def deletePolygonDB(self,id):
"""This method allows to remove polygon"""
count = self.db.PolygonCollection.count({"_id":ObjectId(id)})
print(count)
if count == 1:
result1 = self.db.PolygonCollection.delete_one({"_id":ObjectId(id)})
print("Number polygon removed {}... | This method allows to remove polygon | This method allows to remove polygon | [
"This",
"method",
"allows",
"to",
"remove",
"polygon"
] | def deletePolygonDB(self,id):
count = self.db.PolygonCollection.count({"_id":ObjectId(id)})
print(count)
if count == 1:
result1 = self.db.PolygonCollection.delete_one({"_id":ObjectId(id)})
print("Number polygon removed {}".format(result1.deleted_count))
result... | [
"def",
"deletePolygonDB",
"(",
"self",
",",
"id",
")",
":",
"count",
"=",
"self",
".",
"db",
".",
"PolygonCollection",
".",
"count",
"(",
"{",
"\"_id\"",
":",
"ObjectId",
"(",
"id",
")",
"}",
")",
"print",
"(",
"count",
")",
"if",
"count",
"==",
"1... | This method allows to remove polygon | [
"This",
"method",
"allows",
"to",
"remove",
"polygon"
] | [
"\"\"\"This method allows to remove polygon\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
0c61a7e1c8627fc8d9bce8905b0d535246a88d47 | rosario-riccio/MediStormSeeker | dbMongo.py | [
"Apache-2.0"
] | Python | listPolygonOnDateDB | <not_specific> | def listPolygonOnDateDB(self,date1):
"""This method allows to ask the DB for the polygons' list of specific date"""
count = self.db.PolygonCollection.find({"properties.dateStr":date1}).count()
if(count >= 1):
result = True
cursorListPolygon = self.db.PolygonCollection.fin... | This method allows to ask the DB for the polygons' list of specific date | This method allows to ask the DB for the polygons' list of specific date | [
"This",
"method",
"allows",
"to",
"ask",
"the",
"DB",
"for",
"the",
"polygons",
"'",
"list",
"of",
"specific",
"date"
] | def listPolygonOnDateDB(self,date1):
count = self.db.PolygonCollection.find({"properties.dateStr":date1}).count()
if(count >= 1):
result = True
cursorListPolygon = self.db.PolygonCollection.find({"properties.dateStr":date1})
return result,cursorListPolygon
els... | [
"def",
"listPolygonOnDateDB",
"(",
"self",
",",
"date1",
")",
":",
"count",
"=",
"self",
".",
"db",
".",
"PolygonCollection",
".",
"find",
"(",
"{",
"\"properties.dateStr\"",
":",
"date1",
"}",
")",
".",
"count",
"(",
")",
"if",
"(",
"count",
">=",
"1"... | This method allows to ask the DB for the polygons' list of specific date | [
"This",
"method",
"allows",
"to",
"ask",
"the",
"DB",
"for",
"the",
"polygons",
"'",
"list",
"of",
"specific",
"date"
] | [
"\"\"\"This method allows to ask the DB for the polygons' list of specific date\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "date1",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "date1",
"type": null,
"docstring": null,
"docstring_tokens": ... |
0c61a7e1c8627fc8d9bce8905b0d535246a88d47 | rosario-riccio/MediStormSeeker | dbMongo.py | [
"Apache-2.0"
] | Python | listClassClusterDB | <not_specific> | def listClassClusterDB(self):
"""This method allows to ask the DB for clusters' classes list"""
count = self.db.ClassClusterCollection.find().count()
print("Number clusters' classes: ",count)
if(count >= 1):
result = True
cursorListClassCluster = self.db.ClassClus... | This method allows to ask the DB for clusters' classes list | This method allows to ask the DB for clusters' classes list | [
"This",
"method",
"allows",
"to",
"ask",
"the",
"DB",
"for",
"clusters",
"'",
"classes",
"list"
] | def listClassClusterDB(self):
count = self.db.ClassClusterCollection.find().count()
print("Number clusters' classes: ",count)
if(count >= 1):
result = True
cursorListClassCluster = self.db.ClassClusterCollection.find()
return result,cursorListClassCluster
... | [
"def",
"listClassClusterDB",
"(",
"self",
")",
":",
"count",
"=",
"self",
".",
"db",
".",
"ClassClusterCollection",
".",
"find",
"(",
")",
".",
"count",
"(",
")",
"print",
"(",
"\"Number clusters' classes: \"",
",",
"count",
")",
"if",
"(",
"count",
">=",
... | This method allows to ask the DB for clusters' classes list | [
"This",
"method",
"allows",
"to",
"ask",
"the",
"DB",
"for",
"clusters",
"'",
"classes",
"list"
] | [
"\"\"\"This method allows to ask the DB for clusters' classes list\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0c61a7e1c8627fc8d9bce8905b0d535246a88d47 | rosario-riccio/MediStormSeeker | dbMongo.py | [
"Apache-2.0"
] | Python | listPointClusterOnDateDB | <not_specific> | def listPointClusterOnDateDB(self,date1):
"""This method allows to ask the DB for clusters' points of specific date"""
count = self.db.PointClusterCollection.find({"properties.dateStr":date1}).count()
print("Number Point:",count)
if(count >= 1):
result = True
curs... | This method allows to ask the DB for clusters' points of specific date | This method allows to ask the DB for clusters' points of specific date | [
"This",
"method",
"allows",
"to",
"ask",
"the",
"DB",
"for",
"clusters",
"'",
"points",
"of",
"specific",
"date"
] | def listPointClusterOnDateDB(self,date1):
count = self.db.PointClusterCollection.find({"properties.dateStr":date1}).count()
print("Number Point:",count)
if(count >= 1):
result = True
cursorListPointCluster = self.db.PointClusterCollection.find({"properties.dateStr":date1}... | [
"def",
"listPointClusterOnDateDB",
"(",
"self",
",",
"date1",
")",
":",
"count",
"=",
"self",
".",
"db",
".",
"PointClusterCollection",
".",
"find",
"(",
"{",
"\"properties.dateStr\"",
":",
"date1",
"}",
")",
".",
"count",
"(",
")",
"print",
"(",
"\"Number... | This method allows to ask the DB for clusters' points of specific date | [
"This",
"method",
"allows",
"to",
"ask",
"the",
"DB",
"for",
"clusters",
"'",
"points",
"of",
"specific",
"date"
] | [
"\"\"\"This method allows to ask the DB for clusters' points of specific date\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "date1",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "date1",
"type": null,
"docstring": null,
"docstring_tokens": ... |
0c61a7e1c8627fc8d9bce8905b0d535246a88d47 | rosario-riccio/MediStormSeeker | dbMongo.py | [
"Apache-2.0"
] | Python | insertLabelDB | <not_specific> | def insertLabelDB(self, label):
"""This method insert a new label"""
count = self.db.LabelCollection.find({"labelName":label["labelName"]}).count()
if(count == 0):
result = True
id = self.db.LabelCollection.insert(label)
return result,id
else:
... | This method insert a new label | This method insert a new label | [
"This",
"method",
"insert",
"a",
"new",
"label"
] | def insertLabelDB(self, label):
count = self.db.LabelCollection.find({"labelName":label["labelName"]}).count()
if(count == 0):
result = True
id = self.db.LabelCollection.insert(label)
return result,id
else:
result= False
id = None
... | [
"def",
"insertLabelDB",
"(",
"self",
",",
"label",
")",
":",
"count",
"=",
"self",
".",
"db",
".",
"LabelCollection",
".",
"find",
"(",
"{",
"\"labelName\"",
":",
"label",
"[",
"\"labelName\"",
"]",
"}",
")",
".",
"count",
"(",
")",
"if",
"(",
"count... | This method insert a new label | [
"This",
"method",
"insert",
"a",
"new",
"label"
] | [
"\"\"\"This method insert a new label\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "label",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "label",
"type": null,
"docstring": null,
"docstring_tokens": ... |
56f3ca429ec6c9eb7139c765bd407576c71565b6 | rosario-riccio/MediStormSeeker | myfunction.py | [
"Apache-2.0"
] | Python | validityCheckDB | <not_specific> | def validityCheckDB(self,managedb):
"""This method allows:
A) to check if DB was actived
B) to check if labels existed
C) to check if polygons existed
D) to check if every polygon had its label
"""
try:
result, cursorLabelCollection = managedb.listLabe... | This method allows:
A) to check if DB was actived
B) to check if labels existed
C) to check if polygons existed
D) to check if every polygon had its label
| This method allows:
A) to check if DB was actived
B) to check if labels existed
C) to check if polygons existed
D) to check if every polygon had its label | [
"This",
"method",
"allows",
":",
"A",
")",
"to",
"check",
"if",
"DB",
"was",
"actived",
"B",
")",
"to",
"check",
"if",
"labels",
"existed",
"C",
")",
"to",
"check",
"if",
"polygons",
"existed",
"D",
")",
"to",
"check",
"if",
"every",
"polygon",
"had"... | def validityCheckDB(self,managedb):
try:
result, cursorLabelCollection = managedb.listLabelDB()
if result == False:
print("Error: there aren't label")
return result
result1, cursorClassPolygon = managedb.groupByClassPolygonDBNoDate()
... | [
"def",
"validityCheckDB",
"(",
"self",
",",
"managedb",
")",
":",
"try",
":",
"result",
",",
"cursorLabelCollection",
"=",
"managedb",
".",
"listLabelDB",
"(",
")",
"if",
"result",
"==",
"False",
":",
"print",
"(",
"\"Error: there aren't label\"",
")",
"return... | This method allows:
A) to check if DB was actived
B) to check if labels existed
C) to check if polygons existed
D) to check if every polygon had its label | [
"This",
"method",
"allows",
":",
"A",
")",
"to",
"check",
"if",
"DB",
"was",
"actived",
"B",
")",
"to",
"check",
"if",
"labels",
"existed",
"C",
")",
"to",
"check",
"if",
"polygons",
"existed",
"D",
")",
"to",
"check",
"if",
"every",
"polygon",
"had"... | [
"\"\"\"This method allows:\n A) to check if DB was actived\n B) to check if labels existed\n C) to check if polygons existed\n D) to check if every polygon had its label\n \"\"\"",
"# print(polygon)"
] | [
{
"param": "self",
"type": null
},
{
"param": "managedb",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "managedb",
"type": null,
"docstring": null,
"docstring_tokens... |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | index | <not_specific> | def index():
"""This function allows to execute the login; if user is already logged in , he will able to access the main page"""
global data
if "logged_in" in session and session["logged_in"] == True:
print("User login",session["username"])
try:
count1 = managedb.getCountLoginDB... | This function allows to execute the login; if user is already logged in , he will able to access the main page | This function allows to execute the login; if user is already logged in , he will able to access the main page | [
"This",
"function",
"allows",
"to",
"execute",
"the",
"login",
";",
"if",
"user",
"is",
"already",
"logged",
"in",
"he",
"will",
"able",
"to",
"access",
"the",
"main",
"page"
] | def index():
global data
if "logged_in" in session and session["logged_in"] == True:
print("User login",session["username"])
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
session.clear()
return render_template(... | [
"def",
"index",
"(",
")",
":",
"global",
"data",
"if",
"\"logged_in\"",
"in",
"session",
"and",
"session",
"[",
"\"logged_in\"",
"]",
"==",
"True",
":",
"print",
"(",
"\"User login\"",
",",
"session",
"[",
"\"username\"",
"]",
")",
"try",
":",
"count1",
... | This function allows to execute the login; if user is already logged in , he will able to access the main page | [
"This",
"function",
"allows",
"to",
"execute",
"the",
"login",
";",
"if",
"user",
"is",
"already",
"logged",
"in",
"he",
"will",
"able",
"to",
"access",
"the",
"main",
"page"
] | [
"\"\"\"This function allows to execute the login; if user is already logged in , he will able to access the main page\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | main | <not_specific> | def main():
"""This functions allows to access to web app main page"""
global data
if "logged_in" in session and session["logged_in"] == True:
print("User login", session["username"])
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
... | This functions allows to access to web app main page | This functions allows to access to web app main page | [
"This",
"functions",
"allows",
"to",
"access",
"to",
"web",
"app",
"main",
"page"
] | def main():
global data
if "logged_in" in session and session["logged_in"] == True:
print("User login", session["username"])
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
session.clear()
return redirect(url_for... | [
"def",
"main",
"(",
")",
":",
"global",
"data",
"if",
"\"logged_in\"",
"in",
"session",
"and",
"session",
"[",
"\"logged_in\"",
"]",
"==",
"True",
":",
"print",
"(",
"\"User login\"",
",",
"session",
"[",
"\"username\"",
"]",
")",
"try",
":",
"count1",
"... | This functions allows to access to web app main page | [
"This",
"functions",
"allows",
"to",
"access",
"to",
"web",
"app",
"main",
"page"
] | [
"\"\"\"This functions allows to access to web app main page\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | home | <not_specific> | def home():
"""This functions allows to access to user management page"""
if "logged_in" in session and session["logged_in"] == True:
print("User login", session["username"])
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
retur... | This functions allows to access to user management page | This functions allows to access to user management page | [
"This",
"functions",
"allows",
"to",
"access",
"to",
"user",
"management",
"page"
] | def home():
if "logged_in" in session and session["logged_in"] == True:
print("User login", session["username"])
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
return redirect(url_for('index'))
return render_template('/... | [
"def",
"home",
"(",
")",
":",
"if",
"\"logged_in\"",
"in",
"session",
"and",
"session",
"[",
"\"logged_in\"",
"]",
"==",
"True",
":",
"print",
"(",
"\"User login\"",
",",
"session",
"[",
"\"username\"",
"]",
")",
"try",
":",
"count1",
"=",
"managedb",
".... | This functions allows to access to user management page | [
"This",
"functions",
"allows",
"to",
"access",
"to",
"user",
"management",
"page"
] | [
"\"\"\"This functions allows to access to user management page\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | CSVcreation | <not_specific> | def CSVcreation():
"""This functions allows to access to page for the creation of csv"""
if "logged_in" in session and session["logged_in"] == True:
print("User login", session["username"])
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
... | This functions allows to access to page for the creation of csv | This functions allows to access to page for the creation of csv | [
"This",
"functions",
"allows",
"to",
"access",
"to",
"page",
"for",
"the",
"creation",
"of",
"csv"
] | def CSVcreation():
if "logged_in" in session and session["logged_in"] == True:
print("User login", session["username"])
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
return redirect(url_for('index'))
return render_temp... | [
"def",
"CSVcreation",
"(",
")",
":",
"if",
"\"logged_in\"",
"in",
"session",
"and",
"session",
"[",
"\"logged_in\"",
"]",
"==",
"True",
":",
"print",
"(",
"\"User login\"",
",",
"session",
"[",
"\"username\"",
"]",
")",
"try",
":",
"count1",
"=",
"managedb... | This functions allows to access to page for the creation of csv | [
"This",
"functions",
"allows",
"to",
"access",
"to",
"page",
"for",
"the",
"creation",
"of",
"csv"
] | [
"\"\"\"This functions allows to access to page for the creation of csv\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | logout | <not_specific> | def logout():
"""This function allows to execute the logout"""
if "logged_in" not in session or session["logged_in"] != True:
print("Unregistered user")
print("Logout",session["username"])
session.clear()
return redirect(url_for('index')) | This function allows to execute the logout | This function allows to execute the logout | [
"This",
"function",
"allows",
"to",
"execute",
"the",
"logout"
] | def logout():
if "logged_in" not in session or session["logged_in"] != True:
print("Unregistered user")
print("Logout",session["username"])
session.clear()
return redirect(url_for('index')) | [
"def",
"logout",
"(",
")",
":",
"if",
"\"logged_in\"",
"not",
"in",
"session",
"or",
"session",
"[",
"\"logged_in\"",
"]",
"!=",
"True",
":",
"print",
"(",
"\"Unregistered user\"",
")",
"print",
"(",
"\"Logout\"",
",",
"session",
"[",
"\"username\"",
"]",
... | This function allows to execute the logout | [
"This",
"function",
"allows",
"to",
"execute",
"the",
"logout"
] | [
"\"\"\"This function allows to execute the logout\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | login | <not_specific> | def login():
"""This function allows to execute the login"""
if request.method == "POST":
print("Check login DB")
username = request.form["username"]
password = request.form["password"]
print(username,password)
try:
count,userDB = managedb.loginDB(username)
... | This function allows to execute the login | This function allows to execute the login | [
"This",
"function",
"allows",
"to",
"execute",
"the",
"login"
] | def login():
if request.method == "POST":
print("Check login DB")
username = request.form["username"]
password = request.form["password"]
print(username,password)
try:
count,userDB = managedb.loginDB(username)
print(userDB)
if(count == 0):
... | [
"def",
"login",
"(",
")",
":",
"if",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"print",
"(",
"\"Check login DB\"",
")",
"username",
"=",
"request",
".",
"form",
"[",
"\"username\"",
"]",
"password",
"=",
"request",
".",
"form",
"[",
"\"password\"",
... | This function allows to execute the login | [
"This",
"function",
"allows",
"to",
"execute",
"the",
"login"
] | [
"\"\"\"This function allows to execute the login\"\"\"",
"#print(\"Utente che accede nome:\",session[\"username\"])",
"#print(\"login corretto\")"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | listClassPolygon | <not_specific> | def listClassPolygon():
"""This function allows to ask db for the polygons' classes list"""
if request.is_xhr and request.method=="POST":
try:
dateold = request.form['dateStr']
datenew = datetime(int(dateold[0:4]), int(dateold[4:6]), int(dateold[6:8]), int(dateold[9:11]))
... | This function allows to ask db for the polygons' classes list | This function allows to ask db for the polygons' classes list | [
"This",
"function",
"allows",
"to",
"ask",
"db",
"for",
"the",
"polygons",
"'",
"classes",
"list"
] | def listClassPolygon():
if request.is_xhr and request.method=="POST":
try:
dateold = request.form['dateStr']
datenew = datetime(int(dateold[0:4]), int(dateold[4:6]), int(dateold[6:8]), int(dateold[9:11]))
result, cursorListClassPolygon = managedb.groupByClassPolygonDB(dat... | [
"def",
"listClassPolygon",
"(",
")",
":",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"try",
":",
"dateold",
"=",
"request",
".",
"form",
"[",
"'dateStr'",
"]",
"datenew",
"=",
"datetime",
"(",
"int",
"(",
"d... | This function allows to ask db for the polygons' classes list | [
"This",
"function",
"allows",
"to",
"ask",
"db",
"for",
"the",
"polygons",
"'",
"classes",
"list"
] | [
"\"\"\"This function allows to ask db for the polygons' classes list\"\"\"",
"#print(\"Individuare classi di Polygon con datetime : \", str(datenew))",
"#return json.dumps({\"result\": \"ok\"})"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | insertStorm | <not_specific> | def insertStorm():
"""This function allows to insert the polygon into db"""
if request.is_xhr and request.method=="POST":
#print(type(request.form))
#for a in request.form:
# print("dati:",a,request.form[a])
polygonGeoJson = request.get_json()
#print("Polygon da inseri... | This function allows to insert the polygon into db | This function allows to insert the polygon into db | [
"This",
"function",
"allows",
"to",
"insert",
"the",
"polygon",
"into",
"db"
] | def insertStorm():
if request.is_xhr and request.method=="POST":
polygonGeoJson = request.get_json()
dateold = polygonGeoJson['properties']['dateStr']
datenew = datetime(int(dateold[0:4]),int(dateold[4:6]),int(dateold[6:8]),int(dateold[9:11]))
polygonGeoJson['properties']['dateStr'] ... | [
"def",
"insertStorm",
"(",
")",
":",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"polygonGeoJson",
"=",
"request",
".",
"get_json",
"(",
")",
"dateold",
"=",
"polygonGeoJson",
"[",
"'properties'",
"]",
"[",
"'dat... | This function allows to insert the polygon into db | [
"This",
"function",
"allows",
"to",
"insert",
"the",
"polygon",
"into",
"db"
] | [
"\"\"\"This function allows to insert the polygon into db\"\"\"",
"#print(type(request.form))",
"#for a in request.form:",
"# print(\"dati:\",a,request.form[a])",
"#print(\"Polygon da inserire con datetime: \",polygonGeoJson['properties']['dateStr'])",
"#modifica data in stringa in datatime",
"#print... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | deleteStorm | <not_specific> | def deleteStorm():
"""This function allows to remove a polygon from db"""
if request.is_xhr and request.method=="POST":
idDB = request.form['id']
print("Polygon to be deleted with idDB",idDB)
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 ==... | This function allows to remove a polygon from db | This function allows to remove a polygon from db | [
"This",
"function",
"allows",
"to",
"remove",
"a",
"polygon",
"from",
"db"
] | def deleteStorm():
if request.is_xhr and request.method=="POST":
idDB = request.form['id']
print("Polygon to be deleted with idDB",idDB)
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
return json.dumps({"result": "exit"})
... | [
"def",
"deleteStorm",
"(",
")",
":",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"idDB",
"=",
"request",
".",
"form",
"[",
"'id'",
"]",
"print",
"(",
"\"Polygon to be deleted with idDB\"",
",",
"idDB",
")",
"try"... | This function allows to remove a polygon from db | [
"This",
"function",
"allows",
"to",
"remove",
"a",
"polygon",
"from",
"db"
] | [
"\"\"\"This function allows to remove a polygon from db\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | listStormOnDate | <not_specific> | def listStormOnDate():
"""This function allows to ask the db for polygons' list of specific date"""
if request.is_xhr and request.method=="POST":
dateold = request.form['dateStr']
datenew = datetime(int(dateold[0:4]), int(dateold[4:6]), int(dateold[6:8]), int(dateold[9:11]))
print("Reque... | This function allows to ask the db for polygons' list of specific date | This function allows to ask the db for polygons' list of specific date | [
"This",
"function",
"allows",
"to",
"ask",
"the",
"db",
"for",
"polygons",
"'",
"list",
"of",
"specific",
"date"
] | def listStormOnDate():
if request.is_xhr and request.method=="POST":
dateold = request.form['dateStr']
datenew = datetime(int(dateold[0:4]), int(dateold[4:6]), int(dateold[6:8]), int(dateold[9:11]))
print("Request Polygon list with datetime: ",str(datenew))
try:
result,cu... | [
"def",
"listStormOnDate",
"(",
")",
":",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"dateold",
"=",
"request",
".",
"form",
"[",
"'dateStr'",
"]",
"datenew",
"=",
"datetime",
"(",
"int",
"(",
"dateold",
"[",
... | This function allows to ask the db for polygons' list of specific date | [
"This",
"function",
"allows",
"to",
"ask",
"the",
"db",
"for",
"polygons",
"'",
"list",
"of",
"specific",
"date"
] | [
"\"\"\"This function allows to ask the db for polygons' list of specific date\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | listLabelsOnIdDB | <not_specific> | def listLabelsOnIdDB():
"""This function allows to ask the db for labels' list"""
if request.is_xhr and request.method=="POST":
idDB = request.form["id"]
global flag
global count12
try:
count12 = managedb.countLabelDB()
print("Label count:", count12)
... | This function allows to ask the db for labels' list | This function allows to ask the db for labels' list | [
"This",
"function",
"allows",
"to",
"ask",
"the",
"db",
"for",
"labels",
"'",
"list"
] | def listLabelsOnIdDB():
if request.is_xhr and request.method=="POST":
idDB = request.form["id"]
global flag
global count12
try:
count12 = managedb.countLabelDB()
print("Label count:", count12)
if(count12 == 0):
flag = True
e... | [
"def",
"listLabelsOnIdDB",
"(",
")",
":",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"idDB",
"=",
"request",
".",
"form",
"[",
"\"id\"",
"]",
"global",
"flag",
"global",
"count12",
"try",
":",
"count12",
"=",
... | This function allows to ask the db for labels' list | [
"This",
"function",
"allows",
"to",
"ask",
"the",
"db",
"for",
"labels",
"'",
"list"
] | [
"\"\"\"This function allows to ask the db for labels' list\"\"\"",
"#the insertion default values",
"#print(result15,id)"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | insertLabelsOnIdDB | <not_specific> | def insertLabelsOnIdDB():
"""This function allows to add a new label"""
global count12
if request.is_xhr and request.method=="POST":
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
return json.dumps({"result": "exit"})
c... | This function allows to add a new label | This function allows to add a new label | [
"This",
"function",
"allows",
"to",
"add",
"a",
"new",
"label"
] | def insertLabelsOnIdDB():
global count12
if request.is_xhr and request.method=="POST":
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
return json.dumps({"result": "exit"})
count12 = managedb.countLabelDB()
except Ex... | [
"def",
"insertLabelsOnIdDB",
"(",
")",
":",
"global",
"count12",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"try",
":",
"count1",
"=",
"managedb",
".",
"getCountLoginDB",
"(",
"session",
"[",
"\"username\"",
"]",
... | This function allows to add a new label | [
"This",
"function",
"allows",
"to",
"add",
"a",
"new",
"label"
] | [
"\"\"\"This function allows to add a new label\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | checkLabel | <not_specific> | def checkLabel():
"""This function allows to change the label of a polygon"""
if request.is_xhr and request.method=="POST":
idDB = request.form["id"]
#print("modifica label del Polygon con idDB",idDB)
#print("nuova etichetta",name)
try:
count,result1,cursorPolygon = m... | This function allows to change the label of a polygon | This function allows to change the label of a polygon | [
"This",
"function",
"allows",
"to",
"change",
"the",
"label",
"of",
"a",
"polygon"
] | def checkLabel():
if request.is_xhr and request.method=="POST":
idDB = request.form["id"]
try:
count,result1,cursorPolygon = managedb.checkLabelPolygononIdDB(idDB)
if(count == 1):
result2 = {"result":"correct","label":cursorPolygon["properties"]["name"]}
... | [
"def",
"checkLabel",
"(",
")",
":",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"idDB",
"=",
"request",
".",
"form",
"[",
"\"id\"",
"]",
"try",
":",
"count",
",",
"result1",
",",
"cursorPolygon",
"=",
"manage... | This function allows to change the label of a polygon | [
"This",
"function",
"allows",
"to",
"change",
"the",
"label",
"of",
"a",
"polygon"
] | [
"\"\"\"This function allows to change the label of a polygon\"\"\"",
"#print(\"modifica label del Polygon con idDB\",idDB)",
"#print(\"nuova etichetta\",name)"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | modifyLabel | <not_specific> | def modifyLabel():
"""This function allows to change the label of a polygon"""
if request.is_xhr and request.method=="POST":
idDB = request.form["id"]
name = request.form["name"]
#print("modifica label del Polygon con idDB",idDB)
#print("nuova etichetta",name)
try:
... | This function allows to change the label of a polygon | This function allows to change the label of a polygon | [
"This",
"function",
"allows",
"to",
"change",
"the",
"label",
"of",
"a",
"polygon"
] | def modifyLabel():
if request.is_xhr and request.method=="POST":
idDB = request.form["id"]
name = request.form["name"]
try:
count1 = managedb.getCountLoginDB(session["username"])
if count1 == 0:
return json.dumps({"result": "exit"})
managed... | [
"def",
"modifyLabel",
"(",
")",
":",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"idDB",
"=",
"request",
".",
"form",
"[",
"\"id\"",
"]",
"name",
"=",
"request",
".",
"form",
"[",
"\"name\"",
"]",
"try",
":... | This function allows to change the label of a polygon | [
"This",
"function",
"allows",
"to",
"change",
"the",
"label",
"of",
"a",
"polygon"
] | [
"\"\"\"This function allows to change the label of a polygon\"\"\"",
"#print(\"modifica label del Polygon con idDB\",idDB)",
"#print(\"nuova etichetta\",name)"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | listPointClusterOnDate | <not_specific> | def listPointClusterOnDate():
"""This function asks the db for clusters' points list of specific date"""
if request.is_xhr and request.method=="POST":
dateold = request.form['dateStr']
datenew = datetime(int(dateold[0:4]), int(dateold[4:6]), int(dateold[6:8]), int(dateold[9:11]))
#print(... | This function asks the db for clusters' points list of specific date | This function asks the db for clusters' points list of specific date | [
"This",
"function",
"asks",
"the",
"db",
"for",
"clusters",
"'",
"points",
"list",
"of",
"specific",
"date"
] | def listPointClusterOnDate():
if request.is_xhr and request.method=="POST":
dateold = request.form['dateStr']
datenew = datetime(int(dateold[0:4]), int(dateold[4:6]), int(dateold[6:8]), int(dateold[9:11]))
try:
result, cursorListPointCluster = managedb.listPointClusterOnDateDB(da... | [
"def",
"listPointClusterOnDate",
"(",
")",
":",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"dateold",
"=",
"request",
".",
"form",
"[",
"'dateStr'",
"]",
"datenew",
"=",
"datetime",
"(",
"int",
"(",
"dateold",
... | This function asks the db for clusters' points list of specific date | [
"This",
"function",
"asks",
"the",
"db",
"for",
"clusters",
"'",
"points",
"list",
"of",
"specific",
"date"
] | [
"\"\"\"This function asks the db for clusters' points list of specific date\"\"\"",
"#print(\"Individuare i Point Cluster con datetime\", str(datenew))"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | listClassCluster | <not_specific> | def listClassCluster():
"""This function asks the db for clusters' classes list"""
if request.is_xhr and request.method=="POST":
try:
result, cursorListClassCluster = managedb.listClassClusterDB()
if (result == False):
print("clusters' classes: there aren't result... | This function asks the db for clusters' classes list | This function asks the db for clusters' classes list | [
"This",
"function",
"asks",
"the",
"db",
"for",
"clusters",
"'",
"classes",
"list"
] | def listClassCluster():
if request.is_xhr and request.method=="POST":
try:
result, cursorListClassCluster = managedb.listClassClusterDB()
if (result == False):
print("clusters' classes: there aren't results")
return json.dumps({"result": "empty"})
... | [
"def",
"listClassCluster",
"(",
")",
":",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"try",
":",
"result",
",",
"cursorListClassCluster",
"=",
"managedb",
".",
"listClassClusterDB",
"(",
")",
"if",
"(",
"result",
... | This function asks the db for clusters' classes list | [
"This",
"function",
"asks",
"the",
"db",
"for",
"clusters",
"'",
"classes",
"list"
] | [
"\"\"\"This function asks the db for clusters' classes list\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
114d9d4a9c1369ae250956fe4f5091adc74cc43a | rosario-riccio/MediStormSeeker | views.py | [
"Apache-2.0"
] | Python | csvCreationRequest | <not_specific> | def csvCreationRequest(): #rStart,rEnd,yStart,mStart,dStart,hStart,yEnd,mEnd,dEnd,hEnd
"""This method allows to generate csv file of netCDF"""
if request.is_xhr and request.method=="POST":
startDate = request.form["startDate"]
startDate = startDate.split("-")
yStart = startDate[0]
... | This method allows to generate csv file of netCDF | This method allows to generate csv file of netCDF | [
"This",
"method",
"allows",
"to",
"generate",
"csv",
"file",
"of",
"netCDF"
] | def csvCreationRequest():
if request.is_xhr and request.method=="POST":
startDate = request.form["startDate"]
startDate = startDate.split("-")
yStart = startDate[0]
mStart = startDate[1]
dStart = startDate[2]
hStart = request.form["startHour"]
endDate = reque... | [
"def",
"csvCreationRequest",
"(",
")",
":",
"if",
"request",
".",
"is_xhr",
"and",
"request",
".",
"method",
"==",
"\"POST\"",
":",
"startDate",
"=",
"request",
".",
"form",
"[",
"\"startDate\"",
"]",
"startDate",
"=",
"startDate",
".",
"split",
"(",
"\"-\... | This method allows to generate csv file of netCDF | [
"This",
"method",
"allows",
"to",
"generate",
"csv",
"file",
"of",
"netCDF"
] | [
"#rStart,rEnd,yStart,mStart,dStart,hStart,yEnd,mEnd,dEnd,hEnd",
"\"\"\"This method allows to generate csv file of netCDF\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
95ba2833ed1001ef3de5720f7d597d8718b501a7 | guyfromthesky/OCR-Project | OCR Project.py | [
"MIT"
] | Python | delete_treeview_line | null | def delete_treeview_line(self, event):
'''
Function activate when select an entry from a Treeview and press Delete btn
'''
selected = self.Treeview.selection()
to_remove = []
for child_obj in selected:
child = self.Treeview.item(child_obj)
tm_index = child['values'][0]
to_remove.append(tm_index)
... |
Function activate when select an entry from a Treeview and press Delete btn
| Function activate when select an entry from a Treeview and press Delete btn | [
"Function",
"activate",
"when",
"select",
"an",
"entry",
"from",
"a",
"Treeview",
"and",
"press",
"Delete",
"btn"
] | def delete_treeview_line(self, event):
selected = self.Treeview.selection()
to_remove = []
for child_obj in selected:
child = self.Treeview.item(child_obj)
tm_index = child['values'][0]
to_remove.append(tm_index)
self.Treeview.delete(child_obj) | [
"def",
"delete_treeview_line",
"(",
"self",
",",
"event",
")",
":",
"selected",
"=",
"self",
".",
"Treeview",
".",
"selection",
"(",
")",
"to_remove",
"=",
"[",
"]",
"for",
"child_obj",
"in",
"selected",
":",
"child",
"=",
"self",
".",
"Treeview",
".",
... | Function activate when select an entry from a Treeview and press Delete btn | [
"Function",
"activate",
"when",
"select",
"an",
"entry",
"from",
"a",
"Treeview",
"and",
"press",
"Delete",
"btn"
] | [
"'''\n\t\tFunction activate when select an entry from a Treeview and press Delete btn\n\t\t'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": ... |
95ba2833ed1001ef3de5720f7d597d8718b501a7 | guyfromthesky/OCR-Project | OCR Project.py | [
"MIT"
] | Python | double_right_click_treeview | null | def double_right_click_treeview(self, event):
'''
Function activate when double click an entry from Treeview
'''
focused = self.Treeview.focus()
child = self.Treeview.item(focused)
self.Debugger.insert("end", "\n")
self.Debugger.insert("end", 'Korean: ' + str(child["text"]))
self.Debugger.insert("end", ... |
Function activate when double click an entry from Treeview
| Function activate when double click an entry from Treeview | [
"Function",
"activate",
"when",
"double",
"click",
"an",
"entry",
"from",
"Treeview"
] | def double_right_click_treeview(self, event):
focused = self.Treeview.focus()
child = self.Treeview.item(focused)
self.Debugger.insert("end", "\n")
self.Debugger.insert("end", 'Korean: ' + str(child["text"]))
self.Debugger.insert("end", "\n")
self.Debugger.insert("end", 'English: ' + str(child["values"][0])... | [
"def",
"double_right_click_treeview",
"(",
"self",
",",
"event",
")",
":",
"focused",
"=",
"self",
".",
"Treeview",
".",
"focus",
"(",
")",
"child",
"=",
"self",
".",
"Treeview",
".",
"item",
"(",
"focused",
")",
"self",
".",
"Debugger",
".",
"insert",
... | Function activate when double click an entry from Treeview | [
"Function",
"activate",
"when",
"double",
"click",
"an",
"entry",
"from",
"Treeview"
] | [
"'''\n\t\tFunction activate when double click an entry from Treeview\n\t\t'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": ... |
95ba2833ed1001ef3de5720f7d597d8718b501a7 | guyfromthesky/OCR-Project | OCR Project.py | [
"MIT"
] | Python | load_tm_list | null | def load_tm_list(self):
"""
When clicking the [Load] button in TM Manager tab
Display the pair languages in the text box.
"""
self.remove_treeview()
_area_list = []
for location in _area_list:
try:
self.Treeview.insert('', 'end', text= '', values=( str(location['index']), str(location['x']), s... |
When clicking the [Load] button in TM Manager tab
Display the pair languages in the text box.
| When clicking the [Load] button in TM Manager tab
Display the pair languages in the text box. | [
"When",
"clicking",
"the",
"[",
"Load",
"]",
"button",
"in",
"TM",
"Manager",
"tab",
"Display",
"the",
"pair",
"languages",
"in",
"the",
"text",
"box",
"."
] | def load_tm_list(self):
self.remove_treeview()
_area_list = []
for location in _area_list:
try:
self.Treeview.insert('', 'end', text= '', values=( str(location['index']), str(location['x']), str(location['y']), str(location['h']), str(location['w'])))
except:
pass | [
"def",
"load_tm_list",
"(",
"self",
")",
":",
"self",
".",
"remove_treeview",
"(",
")",
"_area_list",
"=",
"[",
"]",
"for",
"location",
"in",
"_area_list",
":",
"try",
":",
"self",
".",
"Treeview",
".",
"insert",
"(",
"''",
",",
"'end'",
",",
"text",
... | When clicking the [Load] button in TM Manager tab
Display the pair languages in the text box. | [
"When",
"clicking",
"the",
"[",
"Load",
"]",
"button",
"in",
"TM",
"Manager",
"tab",
"Display",
"the",
"pair",
"languages",
"in",
"the",
"text",
"box",
"."
] | [
"\"\"\"\n\t\tWhen clicking the [Load] button in TM Manager tab\n\t\tDisplay the pair languages in the text box.\n\t\t\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
95ba2833ed1001ef3de5720f7d597d8718b501a7 | guyfromthesky/OCR-Project | OCR Project.py | [
"MIT"
] | Python | add_treeview_row | null | def add_treeview_row(self, location):
'''
Add a row to the current Treeview
'''
self.Treeview.insert('', 'end', text= '', values=(str(location[0]), str(location[1]), str(location[2]), str(location[3]))) |
Add a row to the current Treeview
| Add a row to the current Treeview | [
"Add",
"a",
"row",
"to",
"the",
"current",
"Treeview"
] | def add_treeview_row(self, location):
self.Treeview.insert('', 'end', text= '', values=(str(location[0]), str(location[1]), str(location[2]), str(location[3]))) | [
"def",
"add_treeview_row",
"(",
"self",
",",
"location",
")",
":",
"self",
".",
"Treeview",
".",
"insert",
"(",
"''",
",",
"'end'",
",",
"text",
"=",
"''",
",",
"values",
"=",
"(",
"str",
"(",
"location",
"[",
"0",
"]",
")",
",",
"str",
"(",
"loc... | Add a row to the current Treeview | [
"Add",
"a",
"row",
"to",
"the",
"current",
"Treeview"
] | [
"'''\n\t\tAdd a row to the current Treeview\n\t\t'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "location",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "location",
"type": null,
"docstring": null,
"docstring_tokens... |
95ba2833ed1001ef3de5720f7d597d8718b501a7 | guyfromthesky/OCR-Project | OCR Project.py | [
"MIT"
] | Python | Write_Debug | null | def Write_Debug(self, text):
'''
Function write the text to debugger box and move to the end of the box
'''
self.Debugger.insert("end", "\n")
self.Debugger.insert("end", str(text))
self.Debugger.yview(END) |
Function write the text to debugger box and move to the end of the box
| Function write the text to debugger box and move to the end of the box | [
"Function",
"write",
"the",
"text",
"to",
"debugger",
"box",
"and",
"move",
"to",
"the",
"end",
"of",
"the",
"box"
] | def Write_Debug(self, text):
self.Debugger.insert("end", "\n")
self.Debugger.insert("end", str(text))
self.Debugger.yview(END) | [
"def",
"Write_Debug",
"(",
"self",
",",
"text",
")",
":",
"self",
".",
"Debugger",
".",
"insert",
"(",
"\"end\"",
",",
"\"\\n\"",
")",
"self",
".",
"Debugger",
".",
"insert",
"(",
"\"end\"",
",",
"str",
"(",
"text",
")",
")",
"self",
".",
"Debugger",... | Function write the text to debugger box and move to the end of the box | [
"Function",
"write",
"the",
"text",
"to",
"debugger",
"box",
"and",
"move",
"to",
"the",
"end",
"of",
"the",
"box"
] | [
"'''\n\t\tFunction write the text to debugger box and move to the end of the box\n\t\t'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text",
"type": null,
"docstring": null,
"docstring_tokens": [... |
95ba2833ed1001ef3de5720f7d597d8718b501a7 | guyfromthesky/OCR-Project | OCR Project.py | [
"MIT"
] | Python | Btn_OCR_Save_Config_File | <not_specific> | def Btn_OCR_Save_Config_File(self, event=None):
'''
Save all added scan areas to csv file.
'''
_scan_type = self.ScanType.get()
filename = filedialog.asksaveasfilename(title = "Select file", filetypes = (("Scan Config", "*.csv"),),)
filename = self.CorrectExt(filename, "csv")
if filename == "":
return... |
Save all added scan areas to csv file.
| Save all added scan areas to csv file. | [
"Save",
"all",
"added",
"scan",
"areas",
"to",
"csv",
"file",
"."
] | def Btn_OCR_Save_Config_File(self, event=None):
_scan_type = self.ScanType.get()
filename = filedialog.asksaveasfilename(title = "Select file", filetypes = (("Scan Config", "*.csv"),),)
filename = self.CorrectExt(filename, "csv")
if filename == "":
return
else:
with open(filename, 'w', newline='') as cs... | [
"def",
"Btn_OCR_Save_Config_File",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"_scan_type",
"=",
"self",
".",
"ScanType",
".",
"get",
"(",
")",
"filename",
"=",
"filedialog",
".",
"asksaveasfilename",
"(",
"title",
"=",
"\"Select file\"",
",",
"filety... | Save all added scan areas to csv file. | [
"Save",
"all",
"added",
"scan",
"areas",
"to",
"csv",
"file",
"."
] | [
"'''\n\t\tSave all added scan areas to csv file.\n\t\t'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": ... |
95ba2833ed1001ef3de5720f7d597d8718b501a7 | guyfromthesky/OCR-Project | OCR Project.py | [
"MIT"
] | Python | Treeview_Edit_Row | null | def Treeview_Edit_Row(self, event):
'''
Function activate when double click an entry from Treeview
'''
self.Focused_Item = self.Treeview.focus()
self.Generate_Arg_Edit_Window(self.Focused_Item) |
Function activate when double click an entry from Treeview
| Function activate when double click an entry from Treeview | [
"Function",
"activate",
"when",
"double",
"click",
"an",
"entry",
"from",
"Treeview"
] | def Treeview_Edit_Row(self, event):
self.Focused_Item = self.Treeview.focus()
self.Generate_Arg_Edit_Window(self.Focused_Item) | [
"def",
"Treeview_Edit_Row",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"Focused_Item",
"=",
"self",
".",
"Treeview",
".",
"focus",
"(",
")",
"self",
".",
"Generate_Arg_Edit_Window",
"(",
"self",
".",
"Focused_Item",
")"
] | Function activate when double click an entry from Treeview | [
"Function",
"activate",
"when",
"double",
"click",
"an",
"entry",
"from",
"Treeview"
] | [
"'''\n\t\tFunction activate when double click an entry from Treeview\n\t\t'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": ... |
95ba2833ed1001ef3de5720f7d597d8718b501a7 | guyfromthesky/OCR-Project | OCR Project.py | [
"MIT"
] | Python | Treeview_OCR_Select_Row | null | def Treeview_OCR_Select_Row(self, event):
'''
Function activate when double click an entry from Treeview
'''
self.Focused_Item = self.Treeview.focus()
child = self.Treeview.item(self.Focused_Item)
self.Btn_Update_Area.configure(state=NORMAL)
if self.Region_Type.get() == 1:
x = 0
else:
x = 4
... |
Function activate when double click an entry from Treeview
| Function activate when double click an entry from Treeview | [
"Function",
"activate",
"when",
"double",
"click",
"an",
"entry",
"from",
"Treeview"
] | def Treeview_OCR_Select_Row(self, event):
self.Focused_Item = self.Treeview.focus()
child = self.Treeview.item(self.Focused_Item)
self.Btn_Update_Area.configure(state=NORMAL)
if self.Region_Type.get() == 1:
x = 0
else:
x = 4
self.Str_CenterX.delete("1.0", END)
try:
self.Str_CenterX.insert("end",... | [
"def",
"Treeview_OCR_Select_Row",
"(",
"self",
",",
"event",
")",
":",
"self",
".",
"Focused_Item",
"=",
"self",
".",
"Treeview",
".",
"focus",
"(",
")",
"child",
"=",
"self",
".",
"Treeview",
".",
"item",
"(",
"self",
".",
"Focused_Item",
")",
"self",
... | Function activate when double click an entry from Treeview | [
"Function",
"activate",
"when",
"double",
"click",
"an",
"entry",
"from",
"Treeview"
] | [
"'''\n\t\tFunction activate when double click an entry from Treeview\n\t\t'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": ... |
95ba2833ed1001ef3de5720f7d597d8718b501a7 | guyfromthesky/OCR-Project | OCR Project.py | [
"MIT"
] | Python | initFolder | null | def initFolder(dir_path):
'''
Create the config folder incase it's not existed
'''
if not os.path.isdir(dir_path):
try:
os.mkdir(dir_path)
except OSError:
print ("Creation of the directory %s failed" % dir_path)
else:
print ("Successfully created the directory %s " % dir_path)
#Check local database |
Create the config folder incase it's not existed
| Create the config folder incase it's not existed | [
"Create",
"the",
"config",
"folder",
"incase",
"it",
"'",
"s",
"not",
"existed"
] | def initFolder(dir_path):
if not os.path.isdir(dir_path):
try:
os.mkdir(dir_path)
except OSError:
print ("Creation of the directory %s failed" % dir_path)
else:
print ("Successfully created the directory %s " % dir_path) | [
"def",
"initFolder",
"(",
"dir_path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"dir_path",
")",
":",
"try",
":",
"os",
".",
"mkdir",
"(",
"dir_path",
")",
"except",
"OSError",
":",
"print",
"(",
"\"Creation of the directory %s failed\""... | Create the config folder incase it's not existed | [
"Create",
"the",
"config",
"folder",
"incase",
"it",
"'",
"s",
"not",
"existed"
] | [
"'''\n\tCreate the config folder incase it's not existed\n\t'''",
"#Check local database"
] | [
{
"param": "dir_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dir_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
237601a2ad2721613e41d4f2f6d37ad199ad2ddf | guyfromthesky/OCR-Project | libs/configmanager.py | [
"MIT"
] | Python | initFolder | null | def initFolder(self):
'''
Create the config folder incase it's not existed
'''
if not os.path.isdir(self.appdata):
print("No app data folder, create one")
#No config, create one
try:
os.mkdir(self.appdata)
except OSError:
print ("Creation of the directory %s failed" % self.appdata)
else:
... |
Create the config folder incase it's not existed
| Create the config folder incase it's not existed | [
"Create",
"the",
"config",
"folder",
"incase",
"it",
"'",
"s",
"not",
"existed"
] | def initFolder(self):
if not os.path.isdir(self.appdata):
print("No app data folder, create one")
try:
os.mkdir(self.appdata)
except OSError:
print ("Creation of the directory %s failed" % self.appdata)
else:
print ("Successfully created the directory %s " % self.appdata) | [
"def",
"initFolder",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"self",
".",
"appdata",
")",
":",
"print",
"(",
"\"No app data folder, create one\"",
")",
"try",
":",
"os",
".",
"mkdir",
"(",
"self",
".",
"appdata",
")",
... | Create the config folder incase it's not existed | [
"Create",
"the",
"config",
"folder",
"incase",
"it",
"'",
"s",
"not",
"existed"
] | [
"'''\n\t\tCreate the config folder incase it's not existed\n\t\t'''",
"#No config, create one",
"#Check local database"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
237601a2ad2721613e41d4f2f6d37ad199ad2ddf | guyfromthesky/OCR-Project | libs/configmanager.py | [
"MIT"
] | Python | Ocr_Tool_Init_Setting | null | def Ocr_Tool_Init_Setting(self):
'''
Init the value for OCR TOOL
'''
Section = 'OCR_TOOL'
config_path = self.Ocr_Tool_Config_Path
if not os.path.isfile(config_path):
config = configparser.ConfigParser()
config.add_section('OCR_TOOL')
with open(config_path, 'w') as configfile:
config.write(co... |
Init the value for OCR TOOL
| Init the value for OCR TOOL | [
"Init",
"the",
"value",
"for",
"OCR",
"TOOL"
] | def Ocr_Tool_Init_Setting(self):
Section = 'OCR_TOOL'
config_path = self.Ocr_Tool_Config_Path
if not os.path.isfile(config_path):
config = configparser.ConfigParser()
config.add_section('OCR_TOOL')
with open(config_path, 'w') as configfile:
config.write(configfile)
config = configparser.ConfigParse... | [
"def",
"Ocr_Tool_Init_Setting",
"(",
"self",
")",
":",
"Section",
"=",
"'OCR_TOOL'",
"config_path",
"=",
"self",
".",
"Ocr_Tool_Config_Path",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"config_path",
")",
":",
"config",
"=",
"configparser",
".",
"Co... | Init the value for OCR TOOL | [
"Init",
"the",
"value",
"for",
"OCR",
"TOOL"
] | [
"'''\n\t\tInit the value for OCR TOOL\n\t\t'''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
237601a2ad2721613e41d4f2f6d37ad199ad2ddf | guyfromthesky/OCR-Project | libs/configmanager.py | [
"MIT"
] | Python | Refresh_Config_Data | null | def Refresh_Config_Data(self):
'''
Reset the config for the application
'''
self.Ocr_Tool_Init_Setting() |
Reset the config for the application
| Reset the config for the application | [
"Reset",
"the",
"config",
"for",
"the",
"application"
] | def Refresh_Config_Data(self):
self.Ocr_Tool_Init_Setting() | [
"def",
"Refresh_Config_Data",
"(",
"self",
")",
":",
"self",
".",
"Ocr_Tool_Init_Setting",
"(",
")"
] | Reset the config for the application | [
"Reset",
"the",
"config",
"for",
"the",
"application"
] | [
"'''\n\t\tReset the config for the application\n\t\t'''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
cb426e217251361c291a9ec10af5899bdec42a8f | guyfromthesky/OCR-Project | libs/tkinter_extension.py | [
"MIT"
] | Python | autofill | null | def autofill(self, delta=0):
"""autocomplete the Combobox, delta may be 0/1/-1 to cycle through possible hits"""
if delta: # need to delete selection otherwise we would fix the current position
self.delete(self.position, END)
else: # set position to end so selection starts where textentry ended
self.positio... | autocomplete the Combobox, delta may be 0/1/-1 to cycle through possible hits | autocomplete the Combobox, delta may be 0/1/-1 to cycle through possible hits | [
"autocomplete",
"the",
"Combobox",
"delta",
"may",
"be",
"0",
"/",
"1",
"/",
"-",
"1",
"to",
"cycle",
"through",
"possible",
"hits"
] | def autofill(self, delta=0):
if delta:
self.delete(self.position, END)
else:
self.position = len(self.get())
_hits = []
for element in self._completion_list:
if self.get().lower() in element:
_hits.append(element)
if _hits != self._hits:
self._hit_index = 0
self._hits=_hits
if _hits ==... | [
"def",
"autofill",
"(",
"self",
",",
"delta",
"=",
"0",
")",
":",
"if",
"delta",
":",
"self",
".",
"delete",
"(",
"self",
".",
"position",
",",
"END",
")",
"else",
":",
"self",
".",
"position",
"=",
"len",
"(",
"self",
".",
"get",
"(",
")",
")"... | autocomplete the Combobox, delta may be 0/1/-1 to cycle through possible hits | [
"autocomplete",
"the",
"Combobox",
"delta",
"may",
"be",
"0",
"/",
"1",
"/",
"-",
"1",
"to",
"cycle",
"through",
"possible",
"hits"
] | [
"\"\"\"autocomplete the Combobox, delta may be 0/1/-1 to cycle through possible hits\"\"\"",
"# need to delete selection otherwise we would fix the current position",
"# set position to end so selection starts where textentry ended",
"# collect hits",
"# Match case insensitively",
"# if we have a new hit ... | [
{
"param": "self",
"type": null
},
{
"param": "delta",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "delta",
"type": null,
"docstring": null,
"docstring_tokens": ... |
cb426e217251361c291a9ec10af5899bdec42a8f | guyfromthesky/OCR-Project | libs/tkinter_extension.py | [
"MIT"
] | Python | autocomplete | null | def autocomplete(self, delta=0):
"""autocomplete the Combobox, delta may be 0/1/-1 to cycle through possible hits"""
if delta: # need to delete selection otherwise we would fix the current position
self.delete(self.position, END)
else: # set position to end so selection starts where textentry ended
self.pos... | autocomplete the Combobox, delta may be 0/1/-1 to cycle through possible hits | autocomplete the Combobox, delta may be 0/1/-1 to cycle through possible hits | [
"autocomplete",
"the",
"Combobox",
"delta",
"may",
"be",
"0",
"/",
"1",
"/",
"-",
"1",
"to",
"cycle",
"through",
"possible",
"hits"
] | def autocomplete(self, delta=0):
if delta:
self.delete(self.position, END)
else:
self.position = len(self.get())
_hits = []
for element in self._completion_list:
if element.lower().startswith(self.get().lower()):
_hits.append(element)
if _hits != self._hits:
self._hit_index = 0
self._hit... | [
"def",
"autocomplete",
"(",
"self",
",",
"delta",
"=",
"0",
")",
":",
"if",
"delta",
":",
"self",
".",
"delete",
"(",
"self",
".",
"position",
",",
"END",
")",
"else",
":",
"self",
".",
"position",
"=",
"len",
"(",
"self",
".",
"get",
"(",
")",
... | autocomplete the Combobox, delta may be 0/1/-1 to cycle through possible hits | [
"autocomplete",
"the",
"Combobox",
"delta",
"may",
"be",
"0",
"/",
"1",
"/",
"-",
"1",
"to",
"cycle",
"through",
"possible",
"hits"
] | [
"\"\"\"autocomplete the Combobox, delta may be 0/1/-1 to cycle through possible hits\"\"\"",
"# need to delete selection otherwise we would fix the current position",
"# set position to end so selection starts where textentry ended",
"# collect hits",
"# Match case insensitively",
"# if we have a new hit ... | [
{
"param": "self",
"type": null
},
{
"param": "delta",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "delta",
"type": null,
"docstring": null,
"docstring_tokens": ... |
cb426e217251361c291a9ec10af5899bdec42a8f | guyfromthesky/OCR-Project | libs/tkinter_extension.py | [
"MIT"
] | Python | handle_keyrelease | null | def handle_keyrelease(self, event):
"""event handler for the keyrelease event on this widget"""
if event.keysym == "BackSpace":
self.delete(self.index(INSERT), END)
self.position = self.index(END)
if event.keysym == "Left":
if self.position < self.index(END): # delete the selection
self.delete(self.p... | event handler for the keyrelease event on this widget | event handler for the keyrelease event on this widget | [
"event",
"handler",
"for",
"the",
"keyrelease",
"event",
"on",
"this",
"widget"
] | def handle_keyrelease(self, event):
if event.keysym == "BackSpace":
self.delete(self.index(INSERT), END)
self.position = self.index(END)
if event.keysym == "Left":
if self.position < self.index(END):
self.delete(self.position, END)
else:
self.position = self.position-1
self.delete(self.pos... | [
"def",
"handle_keyrelease",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"keysym",
"==",
"\"BackSpace\"",
":",
"self",
".",
"delete",
"(",
"self",
".",
"index",
"(",
"INSERT",
")",
",",
"END",
")",
"self",
".",
"position",
"=",
"self",
".... | event handler for the keyrelease event on this widget | [
"event",
"handler",
"for",
"the",
"keyrelease",
"event",
"on",
"this",
"widget"
] | [
"\"\"\"event handler for the keyrelease event on this widget\"\"\"",
"# delete the selection",
"# delete one character",
"# go to end (no selection)",
"#self.autofill()"
] | [
{
"param": "self",
"type": null
},
{
"param": "event",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": ... |
cb426e217251361c291a9ec10af5899bdec42a8f | guyfromthesky/OCR-Project | libs/tkinter_extension.py | [
"MIT"
] | Python | highlight_pattern | null | def highlight_pattern(self, pattern, tag, start="1.0", end="end",
regexp=False):
'''Apply the given tag to all text that matches the given pattern
If 'regexp' is set to True, pattern will be treated as a regular
expression according to Tcl's regular expression syntax.
'''
start = self.index(start)
... | Apply the given tag to all text that matches the given pattern
If 'regexp' is set to True, pattern will be treated as a regular
expression according to Tcl's regular expression syntax.
| Apply the given tag to all text that matches the given pattern
If 'regexp' is set to True, pattern will be treated as a regular
expression according to Tcl's regular expression syntax. | [
"Apply",
"the",
"given",
"tag",
"to",
"all",
"text",
"that",
"matches",
"the",
"given",
"pattern",
"If",
"'",
"regexp",
"'",
"is",
"set",
"to",
"True",
"pattern",
"will",
"be",
"treated",
"as",
"a",
"regular",
"expression",
"according",
"to",
"Tcl",
"'",... | def highlight_pattern(self, pattern, tag, start="1.0", end="end",
regexp=False):
start = self.index(start)
end = self.index(end)
self.mark_set("matchStart", start)
self.mark_set("matchEnd", start)
self.mark_set("searchLimit", end)
count = IntVar()
while True:
index = self.search(pattern, "match... | [
"def",
"highlight_pattern",
"(",
"self",
",",
"pattern",
",",
"tag",
",",
"start",
"=",
"\"1.0\"",
",",
"end",
"=",
"\"end\"",
",",
"regexp",
"=",
"False",
")",
":",
"start",
"=",
"self",
".",
"index",
"(",
"start",
")",
"end",
"=",
"self",
".",
"i... | Apply the given tag to all text that matches the given pattern
If 'regexp' is set to True, pattern will be treated as a regular
expression according to Tcl's regular expression syntax. | [
"Apply",
"the",
"given",
"tag",
"to",
"all",
"text",
"that",
"matches",
"the",
"given",
"pattern",
"If",
"'",
"regexp",
"'",
"is",
"set",
"to",
"True",
"pattern",
"will",
"be",
"treated",
"as",
"a",
"regular",
"expression",
"according",
"to",
"Tcl",
"'",... | [
"'''Apply the given tag to all text that matches the given pattern\n\n\t\tIf 'regexp' is set to True, pattern will be treated as a regular\n\t\texpression according to Tcl's regular expression syntax.\n\t\t'''",
"# degenerate pattern which matches zero-length strings",
"#self.mark_set(\"matchStart\", str('1.'+ ... | [
{
"param": "self",
"type": null
},
{
"param": "pattern",
"type": null
},
{
"param": "tag",
"type": null
},
{
"param": "start",
"type": null
},
{
"param": "end",
"type": null
},
{
"param": "regexp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pattern",
"type": null,
"docstring": null,
"docstring_tokens"... |
cb426e217251361c291a9ec10af5899bdec42a8f | guyfromthesky/OCR-Project | libs/tkinter_extension.py | [
"MIT"
] | Python | highlight_fault_pattern | null | def highlight_fault_pattern(self, pattern, tag, start="1.0", end="end",
regexp=False):
'''Apply the given tag to all text that matches the given pattern
If 'regexp' is set to True, pattern will be treated as a regular
expression according to Tcl's regular expression syntax.
'''
start = self.index(sta... | Apply the given tag to all text that matches the given pattern
If 'regexp' is set to True, pattern will be treated as a regular
expression according to Tcl's regular expression syntax.
| Apply the given tag to all text that matches the given pattern
If 'regexp' is set to True, pattern will be treated as a regular
expression according to Tcl's regular expression syntax. | [
"Apply",
"the",
"given",
"tag",
"to",
"all",
"text",
"that",
"matches",
"the",
"given",
"pattern",
"If",
"'",
"regexp",
"'",
"is",
"set",
"to",
"True",
"pattern",
"will",
"be",
"treated",
"as",
"a",
"regular",
"expression",
"according",
"to",
"Tcl",
"'",... | def highlight_fault_pattern(self, pattern, tag, start="1.0", end="end",
regexp=False):
start = self.index(start)
end = self.index(end)
self.mark_set("matchStart", start)
self.mark_set("matchEnd", start)
self.mark_set("searchLimit", end)
count = IntVar()
while True:
_index_lower = self.search(pa... | [
"def",
"highlight_fault_pattern",
"(",
"self",
",",
"pattern",
",",
"tag",
",",
"start",
"=",
"\"1.0\"",
",",
"end",
"=",
"\"end\"",
",",
"regexp",
"=",
"False",
")",
":",
"start",
"=",
"self",
".",
"index",
"(",
"start",
")",
"end",
"=",
"self",
"."... | Apply the given tag to all text that matches the given pattern
If 'regexp' is set to True, pattern will be treated as a regular
expression according to Tcl's regular expression syntax. | [
"Apply",
"the",
"given",
"tag",
"to",
"all",
"text",
"that",
"matches",
"the",
"given",
"pattern",
"If",
"'",
"regexp",
"'",
"is",
"set",
"to",
"True",
"pattern",
"will",
"be",
"treated",
"as",
"a",
"regular",
"expression",
"according",
"to",
"Tcl",
"'",... | [
"'''Apply the given tag to all text that matches the given pattern\n\n\t\tIf 'regexp' is set to True, pattern will be treated as a regular\n\t\texpression according to Tcl's regular expression syntax.\n\t\t'''",
"# degenerate pattern which matches zero-length strings"
] | [
{
"param": "self",
"type": null
},
{
"param": "pattern",
"type": null
},
{
"param": "tag",
"type": null
},
{
"param": "start",
"type": null
},
{
"param": "end",
"type": null
},
{
"param": "regexp",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pattern",
"type": null,
"docstring": null,
"docstring_tokens"... |
a782a9c45c018c83afb03af736c404a3eb72b19e | Senselegend/MollRooT | opensea_ingest.py | [
"MIT"
] | Python | start_ingest | null | def start_ingest(start_date, end_date, rate_limiting=2):
"""Ingests NFT transactions (backfilling) from the defined time period.
Args:
start_date ([type]): first timestamp when the ingestion should start from
end_date ([type]): final timestamp when the ingestion should finish at
rate_li... | Ingests NFT transactions (backfilling) from the defined time period.
Args:
start_date ([type]): first timestamp when the ingestion should start from
end_date ([type]): final timestamp when the ingestion should finish at
rate_limiting (int, optional): Rate limit for the API. Defaults to 2.
... | Ingests NFT transactions (backfilling) from the defined time period. | [
"Ingests",
"NFT",
"transactions",
"(",
"backfilling",
")",
"from",
"the",
"defined",
"time",
"period",
"."
] | def start_ingest(start_date, end_date, rate_limiting=2):
cursor = conn.cursor()
keep_ingesting = True
print("Start ingesting data between {} and {}".format(start_date, end_date))
while keep_ingesting:
multiple_events = fetch_multiple_events(start_date, end_date, rate_limiting=rate_limiting)
... | [
"def",
"start_ingest",
"(",
"start_date",
",",
"end_date",
",",
"rate_limiting",
"=",
"2",
")",
":",
"cursor",
"=",
"conn",
".",
"cursor",
"(",
")",
"keep_ingesting",
"=",
"True",
"print",
"(",
"\"Start ingesting data between {} and {}\"",
".",
"format",
"(",
... | Ingests NFT transactions (backfilling) from the defined time period. | [
"Ingests",
"NFT",
"transactions",
"(",
"backfilling",
")",
"from",
"the",
"defined",
"time",
"period",
"."
] | [
"\"\"\"Ingests NFT transactions (backfilling) from the defined time period.\n\n Args:\n start_date ([type]): first timestamp when the ingestion should start from\n end_date ([type]): final timestamp when the ingestion should finish at\n rate_limiting (int, optional): Rate limit for the API. ... | [
{
"param": "start_date",
"type": null
},
{
"param": "end_date",
"type": null
},
{
"param": "rate_limiting",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "start_date",
"type": null,
"docstring": "first timestamp when the ingestion should start from",
"docstring_tokens": [
"first",
"timestamp",
"when",
"the",
"ingestion",
"should",
... |
a1b50bbc28098aaef4d857c54b6bd7746e7ab06c | K-Mike/lagury | lagury/service/loggers.py | [
"MIT"
] | Python | logging_timeit | <not_specific> | def logging_timeit(logger, format_str, result_funcs=None):
"""
Timeit logging decorator with argument-based format string
:param logger: info-level logger
:param format_str: format string for logger, use execution time as "_time" format argument
:param result_funcs: dict of "format argument name / ... |
Timeit logging decorator with argument-based format string
:param logger: info-level logger
:param format_str: format string for logger, use execution time as "_time" format argument
:param result_funcs: dict of "format argument name / function of result" pairs
| Timeit logging decorator with argument-based format string | [
"Timeit",
"logging",
"decorator",
"with",
"argument",
"-",
"based",
"format",
"string"
] | def logging_timeit(logger, format_str, result_funcs=None):
result_funcs = result_funcs or {}
def decorator(func):
def wrapper(*args, **kwargs):
started_time = time.time()
result = func(*args, **kwargs)
result_args = {name: res_func(result) for name, res_func in result... | [
"def",
"logging_timeit",
"(",
"logger",
",",
"format_str",
",",
"result_funcs",
"=",
"None",
")",
":",
"result_funcs",
"=",
"result_funcs",
"or",
"{",
"}",
"def",
"decorator",
"(",
"func",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"**",
"kwargs"... | Timeit logging decorator with argument-based format string | [
"Timeit",
"logging",
"decorator",
"with",
"argument",
"-",
"based",
"format",
"string"
] | [
"\"\"\"\n Timeit logging decorator with argument-based format string\n\n :param logger: info-level logger\n :param format_str: format string for logger, use execution time as \"_time\" format argument\n :param result_funcs: dict of \"format argument name / function of result\" pairs\n \"\"\""
] | [
{
"param": "logger",
"type": null
},
{
"param": "format_str",
"type": null
},
{
"param": "result_funcs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "logger",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
"is_optional": null
},
{
"identifier": "format_str",
"type": null,
"docstring": "fo... |
11f966d30c6543c45d61b2e7009c1698c91886fd | Zurnaz/Data_Parsing_Fun | Chandler_Population_Data/generate_sql_inserts.py | [
"MIT"
] | Python | generate_inserts | null | def generate_inserts():
'''rb is for reading a file, and w is for writing'''
FILENAME = "chandlerV2.csv"
cvfile = open(FILENAME, "rb")
reader = csv.reader(cvfile, delimiter=',')
cities_text_file = open("OutputCities.txt", "w")
population_text_file = open("OutputPopulation.txt", "w")
cities_sql = '''INSERT INT... | rb is for reading a file, and w is for writing | rb is for reading a file, and w is for writing | [
"rb",
"is",
"for",
"reading",
"a",
"file",
"and",
"w",
"is",
"for",
"writing"
] | def generate_inserts():
FILENAME = "chandlerV2.csv"
cvfile = open(FILENAME, "rb")
reader = csv.reader(cvfile, delimiter=',')
cities_text_file = open("OutputCities.txt", "w")
population_text_file = open("OutputPopulation.txt", "w")
cities_sql = '''INSERT INTO Cities(CityId, CityName, OtherName, Country, Latitude,... | [
"def",
"generate_inserts",
"(",
")",
":",
"FILENAME",
"=",
"\"chandlerV2.csv\"",
"cvfile",
"=",
"open",
"(",
"FILENAME",
",",
"\"rb\"",
")",
"reader",
"=",
"csv",
".",
"reader",
"(",
"cvfile",
",",
"delimiter",
"=",
"','",
")",
"cities_text_file",
"=",
"op... | rb is for reading a file, and w is for writing | [
"rb",
"is",
"for",
"reading",
"a",
"file",
"and",
"w",
"is",
"for",
"writing"
] | [
"'''rb is for reading a file, and w is for writing'''",
"#check for title row and skip iteration",
"#just to make it more readable",
"#Parsing first few columns for the first table",
"# checks for a duplicate city/country combo and set the id to the first instance",
"#cities_parameters",
"#first 6 colum... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
6b54998f75c7cac9fcc2f1ef33d7e37298594f31 | franktai0808/blind_navigation_rpi | take_face_data.py | [
"MIT"
] | Python | detect_face | <not_specific> | def detect_face(frame):
"""
detect human faces in image using haar-cascade
Args:
frame:
Returns:
coordinates of detected faces
"""
faces = face_cascade.detectMultiScale(frame, 1.3, 2, 0, (20, 20) )
return faces |
detect human faces in image using haar-cascade
Args:
frame:
Returns:
coordinates of detected faces
| detect human faces in image using haar-cascade | [
"detect",
"human",
"faces",
"in",
"image",
"using",
"haar",
"-",
"cascade"
] | def detect_face(frame):
faces = face_cascade.detectMultiScale(frame, 1.3, 2, 0, (20, 20) )
return faces | [
"def",
"detect_face",
"(",
"frame",
")",
":",
"faces",
"=",
"face_cascade",
".",
"detectMultiScale",
"(",
"frame",
",",
"1.3",
",",
"2",
",",
"0",
",",
"(",
"20",
",",
"20",
")",
")",
"return",
"faces"
] | detect human faces in image using haar-cascade | [
"detect",
"human",
"faces",
"in",
"image",
"using",
"haar",
"-",
"cascade"
] | [
"\"\"\"\n detect human faces in image using haar-cascade\n Args:\n frame:\n Returns:\n coordinates of detected faces\n \"\"\""
] | [
{
"param": "frame",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "frame",
"type": null,
"docstring": null,
"docstring_tokens": [
"None"
],
"default": null,
... |
6b54998f75c7cac9fcc2f1ef33d7e37298594f31 | franktai0808/blind_navigation_rpi | take_face_data.py | [
"MIT"
] | Python | recognize_face | <not_specific> | def recognize_face(frame_orginal, faces):
"""
recognize human faces using LBPH features
Args:
frame_orginal:
faces:
Returns:
label of predicted person
"""
predict_label = []
predict_conf = []
for x, y, w, h in faces:
frame_orginal_grayscale = cv2.cvtColor(... |
recognize human faces using LBPH features
Args:
frame_orginal:
faces:
Returns:
label of predicted person
| recognize human faces using LBPH features | [
"recognize",
"human",
"faces",
"using",
"LBPH",
"features"
] | def recognize_face(frame_orginal, faces):
predict_label = []
predict_conf = []
for x, y, w, h in faces:
frame_orginal_grayscale = cv2.cvtColor(frame_orginal[y: y + h, x: x + w], cv2.COLOR_BGR2GRAY)
cv2.imshow("cropped", frame_orginal_grayscale)
predict_tuple = recognizer.predict(fram... | [
"def",
"recognize_face",
"(",
"frame_orginal",
",",
"faces",
")",
":",
"predict_label",
"=",
"[",
"]",
"predict_conf",
"=",
"[",
"]",
"for",
"x",
",",
"y",
",",
"w",
",",
"h",
"in",
"faces",
":",
"frame_orginal_grayscale",
"=",
"cv2",
".",
"cvtColor",
... | recognize human faces using LBPH features | [
"recognize",
"human",
"faces",
"using",
"LBPH",
"features"
] | [
"\"\"\"\n recognize human faces using LBPH features\n Args:\n frame_orginal:\n faces:\n Returns:\n label of predicted person\n \"\"\""
] | [
{
"param": "frame_orginal",
"type": null
},
{
"param": "faces",
"type": null
}
] | {
"returns": [
{
"docstring": "label of predicted person",
"docstring_tokens": [
"label",
"of",
"predicted",
"person"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "frame_orginal",
"type": null,
"docstring": n... |
6b54998f75c7cac9fcc2f1ef33d7e37298594f31 | franktai0808/blind_navigation_rpi | take_face_data.py | [
"MIT"
] | Python | background_subtraction | <not_specific> | def background_subtraction(previous_frame, frame_resized_grayscale, min_area):
"""
This function returns 1 for the frames in which the area
after subtraction with previous frame is greater than minimum area
defined.
Thus expensive computation of human detection face detection
and face recogni... |
This function returns 1 for the frames in which the area
after subtraction with previous frame is greater than minimum area
defined.
Thus expensive computation of human detection face detection
and face recognition is not done on all the frames.
Only the frames undergoing significant amount ... | This function returns 1 for the frames in which the area
after subtraction with previous frame is greater than minimum area
defined.
Thus expensive computation of human detection face detection
and face recognition is not done on all the frames.
Only the frames undergoing significant amount of change (which is controll... | [
"This",
"function",
"returns",
"1",
"for",
"the",
"frames",
"in",
"which",
"the",
"area",
"after",
"subtraction",
"with",
"previous",
"frame",
"is",
"greater",
"than",
"minimum",
"area",
"defined",
".",
"Thus",
"expensive",
"computation",
"of",
"human",
"detec... | def background_subtraction(previous_frame, frame_resized_grayscale, min_area):
frameDelta = cv2.absdiff(previous_frame, frame_resized_grayscale)
thresh = cv2.threshold(frameDelta, 25, 255, cv2.THRESH_BINARY)[1]
thresh = cv2.dilate(thresh, None, iterations=2)
im2, cnts, hierarchy = cv2.findContours(thres... | [
"def",
"background_subtraction",
"(",
"previous_frame",
",",
"frame_resized_grayscale",
",",
"min_area",
")",
":",
"frameDelta",
"=",
"cv2",
".",
"absdiff",
"(",
"previous_frame",
",",
"frame_resized_grayscale",
")",
"thresh",
"=",
"cv2",
".",
"threshold",
"(",
"f... | This function returns 1 for the frames in which the area
after subtraction with previous frame is greater than minimum area
defined. | [
"This",
"function",
"returns",
"1",
"for",
"the",
"frames",
"in",
"which",
"the",
"area",
"after",
"subtraction",
"with",
"previous",
"frame",
"is",
"greater",
"than",
"minimum",
"area",
"defined",
"."
] | [
"\"\"\"\n This function returns 1 for the frames in which the area \n after subtraction with previous frame is greater than minimum area\n defined. \n Thus expensive computation of human detection face detection \n and face recognition is not done on all the frames.\n Only the frames undergoing si... | [
{
"param": "previous_frame",
"type": null
},
{
"param": "frame_resized_grayscale",
"type": null
},
{
"param": "min_area",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "previous_frame",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "frame_resized_grayscale",
"type": null,
"docstring": null... |
746e1acf4f506ea4bfc9b10c507edc1fc56b4a1d | joaofbsm/gsgp-struct | scripts/plot_ind.py | [
"MIT"
] | Python | read_repr | <not_specific> | def read_repr(file_path):
"""Read individual representation from given file.
Arguments:
file_path -- Path to file that stores the individual representation.
"""
with open(file_path, 'r') as f:
freq = f.readline()
repr_ = f.readline()
return freq, repr_ | Read individual representation from given file.
Arguments:
file_path -- Path to file that stores the individual representation.
| Read individual representation from given file.
Arguments:
file_path -- Path to file that stores the individual representation. | [
"Read",
"individual",
"representation",
"from",
"given",
"file",
".",
"Arguments",
":",
"file_path",
"--",
"Path",
"to",
"file",
"that",
"stores",
"the",
"individual",
"representation",
"."
] | def read_repr(file_path):
with open(file_path, 'r') as f:
freq = f.readline()
repr_ = f.readline()
return freq, repr_ | [
"def",
"read_repr",
"(",
"file_path",
")",
":",
"with",
"open",
"(",
"file_path",
",",
"'r'",
")",
"as",
"f",
":",
"freq",
"=",
"f",
".",
"readline",
"(",
")",
"repr_",
"=",
"f",
".",
"readline",
"(",
")",
"return",
"freq",
",",
"repr_"
] | Read individual representation from given file. | [
"Read",
"individual",
"representation",
"from",
"given",
"file",
"."
] | [
"\"\"\"Read individual representation from given file.\n \n Arguments:\n file_path -- Path to file that stores the individual representation.\n \"\"\""
] | [
{
"param": "file_path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file_path",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
746e1acf4f506ea4bfc9b10c507edc1fc56b4a1d | joaofbsm/gsgp-struct | scripts/plot_ind.py | [
"MIT"
] | Python | parse_repr | <not_specific> | def parse_repr(repr_):
"""Parse the string representation of the individual.
Arguments:
repr_ -- String representation of the individual.
"""
functions = set(['+', '-', '*', "AQ"])
labels = {}
edges = []
repr_ = repr_.replace('(', '')
repr_ = repr_.split()
n = 0
... | Parse the string representation of the individual.
Arguments:
repr_ -- String representation of the individual.
| Parse the string representation of the individual.
Arguments:
repr_ -- String representation of the individual. | [
"Parse",
"the",
"string",
"representation",
"of",
"the",
"individual",
".",
"Arguments",
":",
"repr_",
"--",
"String",
"representation",
"of",
"the",
"individual",
"."
] | def parse_repr(repr_):
functions = set(['+', '-', '*', "AQ"])
labels = {}
edges = []
repr_ = repr_.replace('(', '')
repr_ = repr_.split()
n = 0
root = repr_[0]
if root in functions:
labels[n] = (root, "#ff0000")
else:
labels[n] = (root, "#00ff00")
parent_stack = [... | [
"def",
"parse_repr",
"(",
"repr_",
")",
":",
"functions",
"=",
"set",
"(",
"[",
"'+'",
",",
"'-'",
",",
"'*'",
",",
"\"AQ\"",
"]",
")",
"labels",
"=",
"{",
"}",
"edges",
"=",
"[",
"]",
"repr_",
"=",
"repr_",
".",
"replace",
"(",
"'('",
",",
"''... | Parse the string representation of the individual. | [
"Parse",
"the",
"string",
"representation",
"of",
"the",
"individual",
"."
] | [
"\"\"\"Parse the string representation of the individual.\n \n Arguments:\n repr_ -- String representation of the individual.\n \"\"\""
] | [
{
"param": "repr_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "repr_",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
746e1acf4f506ea4bfc9b10c507edc1fc56b4a1d | joaofbsm/gsgp-struct | scripts/plot_ind.py | [
"MIT"
] | Python | visualize_individual | null | def visualize_individual(repr_, freq, dir_path, name):
"""Visualize graphically the tree that represents the individual.
Arguments:
repr_ -- Representation of the individual to be visualized.
"""
dot_dir_path = "{}/dot".format(dir_path)
png_dir_path = "{}/png".format(dir_path)
if ... | Visualize graphically the tree that represents the individual.
Arguments:
repr_ -- Representation of the individual to be visualized.
| Visualize graphically the tree that represents the individual.
Arguments:
repr_ -- Representation of the individual to be visualized. | [
"Visualize",
"graphically",
"the",
"tree",
"that",
"represents",
"the",
"individual",
".",
"Arguments",
":",
"repr_",
"--",
"Representation",
"of",
"the",
"individual",
"to",
"be",
"visualized",
"."
] | def visualize_individual(repr_, freq, dir_path, name):
dot_dir_path = "{}/dot".format(dir_path)
png_dir_path = "{}/png".format(dir_path)
if not os.path.exists(dot_dir_path):
os.makedirs(dot_dir_path)
if not os.path.exists(png_dir_path):
os.makedirs(png_dir_path)
dot_file_path = "{}/{... | [
"def",
"visualize_individual",
"(",
"repr_",
",",
"freq",
",",
"dir_path",
",",
"name",
")",
":",
"dot_dir_path",
"=",
"\"{}/dot\"",
".",
"format",
"(",
"dir_path",
")",
"png_dir_path",
"=",
"\"{}/png\"",
".",
"format",
"(",
"dir_path",
")",
"if",
"not",
"... | Visualize graphically the tree that represents the individual. | [
"Visualize",
"graphically",
"the",
"tree",
"that",
"represents",
"the",
"individual",
"."
] | [
"\"\"\"Visualize graphically the tree that represents the individual.\n \n Arguments:\n repr_ -- Representation of the individual to be visualized.\n \"\"\"",
"# Use HTML like syntax so title can have padding from graph"
] | [
{
"param": "repr_",
"type": null
},
{
"param": "freq",
"type": null
},
{
"param": "dir_path",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "repr_",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "freq",
"type": null,
"docstring": null,
"docstring_tokens": ... |
16df3b17f4e05e600b9a04a15fd461cb421c9b9f | selfemergence/self-taught-neat-multiprocessing | experiments/mario/gym-super-mario-bros-master/gym_super_mario_bros/_roms/decode_target.py | [
"MIT"
] | Python | decode_target | <not_specific> | def decode_target(target, lost_levels):
"""
Return the target area for target world and target stage.
Args:
target_world (None, int): the world to target
target_stage (None, int): the stage to target
lost_levels (bool): whether to use lost levels game
Returns (int):
the... |
Return the target area for target world and target stage.
Args:
target_world (None, int): the world to target
target_stage (None, int): the stage to target
lost_levels (bool): whether to use lost levels game
Returns (int):
the area to target to load the target world and st... | Return the target area for target world and target stage. | [
"Return",
"the",
"target",
"area",
"for",
"target",
"world",
"and",
"target",
"stage",
"."
] | def decode_target(target, lost_levels):
if not isinstance(lost_levels, bool):
raise TypeError('lost_levels must be of type: bool')
if target is None:
return None, None, None
elif not isinstance(target, tuple):
raise TypeError('target must be of type tuple')
target_world, target_... | [
"def",
"decode_target",
"(",
"target",
",",
"lost_levels",
")",
":",
"if",
"not",
"isinstance",
"(",
"lost_levels",
",",
"bool",
")",
":",
"raise",
"TypeError",
"(",
"'lost_levels must be of type: bool'",
")",
"if",
"target",
"is",
"None",
":",
"return",
"None... | Return the target area for target world and target stage. | [
"Return",
"the",
"target",
"area",
"for",
"target",
"world",
"and",
"target",
"stage",
"."
] | [
"\"\"\"\n Return the target area for target world and target stage.\n\n Args:\n target_world (None, int): the world to target\n target_stage (None, int): the stage to target\n lost_levels (bool): whether to use lost levels game\n\n Returns (int):\n the area to target to load the... | [
{
"param": "target",
"type": null
},
{
"param": "lost_levels",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "target",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lost_levels",
"type": null,
"docstring": "whether to use lost lev... |
bab1ad400a0d83a71a340f26da9d81a5874fdbed | selfemergence/self-taught-neat-multiprocessing | mutation.py | [
"MIT"
] | Python | mutate | null | def mutate(genome, config):
"""
Applies connection and structural mutations at proper rate.
Connection Mutations: Uniform Weight Perturbation or Replace Weight Value with Random Value
Structural Mutations: Add Connection and Add Node
:param genome: Genome to be mutated
:param config: Experiments... |
Applies connection and structural mutations at proper rate.
Connection Mutations: Uniform Weight Perturbation or Replace Weight Value with Random Value
Structural Mutations: Add Connection and Add Node
:param genome: Genome to be mutated
:param config: Experiments' configuration file
:return: N... | Applies connection and structural mutations at proper rate.
Connection Mutations: Uniform Weight Perturbation or Replace Weight Value with Random Value
Structural Mutations: Add Connection and Add Node | [
"Applies",
"connection",
"and",
"structural",
"mutations",
"at",
"proper",
"rate",
".",
"Connection",
"Mutations",
":",
"Uniform",
"Weight",
"Perturbation",
"or",
"Replace",
"Weight",
"Value",
"with",
"Random",
"Value",
"Structural",
"Mutations",
":",
"Add",
"Conn... | def mutate(genome, config):
if utils.rand_uni_val() < config.CONNECTION_MUTATION_RATE:
for c_gene in genome.connection_genes:
if utils.rand_uni_val() < config.CONNECTION_PERTURBATION_RATE:
perturb = utils.rand_uni_val() * random.choice([1, -1])
c_gene.weight += pe... | [
"def",
"mutate",
"(",
"genome",
",",
"config",
")",
":",
"if",
"utils",
".",
"rand_uni_val",
"(",
")",
"<",
"config",
".",
"CONNECTION_MUTATION_RATE",
":",
"for",
"c_gene",
"in",
"genome",
".",
"connection_genes",
":",
"if",
"utils",
".",
"rand_uni_val",
"... | Applies connection and structural mutations at proper rate. | [
"Applies",
"connection",
"and",
"structural",
"mutations",
"at",
"proper",
"rate",
"."
] | [
"\"\"\"\n Applies connection and structural mutations at proper rate.\n Connection Mutations: Uniform Weight Perturbation or Replace Weight Value with Random Value\n Structural Mutations: Add Connection and Add Node\n :param genome: Genome to be mutated\n :param config: Experiments' configuration fil... | [
{
"param": "genome",
"type": null
},
{
"param": "config",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "genome",
"type": null,
"docstring": "Genome to be mutated",
"docstring_tokens": [
"Genome",
"to",
... |
791d0a9f4e29cd019816c48ca866704c22f102c6 | selfemergence/self-taught-neat-multiprocessing | population.py | [
"MIT"
] | Python | speciate | <not_specific> | def speciate(self, genome, generation):
"""
Places Genome into proper species - index
:param genome: Genome be speciated
:param generation: Number of generation this speciation is occuring at
:return: None
"""
for species in self.species:
if Species.sp... |
Places Genome into proper species - index
:param genome: Genome be speciated
:param generation: Number of generation this speciation is occuring at
:return: None
| Places Genome into proper species - index | [
"Places",
"Genome",
"into",
"proper",
"species",
"-",
"index"
] | def speciate(self, genome, generation):
for species in self.species:
if Species.species_distance(genome, species.model_genome) <= self.Config.SPECIATION_THRESHOLD:
genome.species = species.id
species.members.append(genome)
return
new_species = ... | [
"def",
"speciate",
"(",
"self",
",",
"genome",
",",
"generation",
")",
":",
"for",
"species",
"in",
"self",
".",
"species",
":",
"if",
"Species",
".",
"species_distance",
"(",
"genome",
",",
"species",
".",
"model_genome",
")",
"<=",
"self",
".",
"Config... | Places Genome into proper species - index | [
"Places",
"Genome",
"into",
"proper",
"species",
"-",
"index"
] | [
"\"\"\"\n Places Genome into proper species - index\n :param genome: Genome be speciated\n :param generation: Number of generation this speciation is occuring at\n :return: None\n \"\"\"",
"# Did not match any current species. Create a new one"
] | [
{
"param": "self",
"type": null
},
{
"param": "genome",
"type": null
},
{
"param": "generation",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
2bf395b51856f40902a450082d5a85194a9399c4 | selfemergence/self-taught-neat-multiprocessing | experiments/mario/gym-super-mario-bros-master/gym_super_mario_bros/_roms/rom_path.py | [
"MIT"
] | Python | rom_path | <not_specific> | def rom_path(lost_levels, rom_mode):
"""
Return the ROM filename for a game and ROM mode.
Args:
lost_levels (bool): whether to use the lost levels ROM
rom_mode (str): the mode of the ROM hack to use as one of:
- 'vanilla'
- 'pixel'
- 'downsample'
... |
Return the ROM filename for a game and ROM mode.
Args:
lost_levels (bool): whether to use the lost levels ROM
rom_mode (str): the mode of the ROM hack to use as one of:
- 'vanilla'
- 'pixel'
- 'downsample'
- 'vanilla'
Returns (str):
... | Return the ROM filename for a game and ROM mode. | [
"Return",
"the",
"ROM",
"filename",
"for",
"a",
"game",
"and",
"ROM",
"mode",
"."
] | def rom_path(lost_levels, rom_mode):
if not isinstance(lost_levels, bool):
raise TypeError('lost_levels must be of type: bool')
try:
rom = _ROM_PATHS[lost_levels][rom_mode]
except KeyError:
raise ValueError('rom_mode ({}) not supported!'.format(rom_mode))
rom = os.path.join(os.pa... | [
"def",
"rom_path",
"(",
"lost_levels",
",",
"rom_mode",
")",
":",
"if",
"not",
"isinstance",
"(",
"lost_levels",
",",
"bool",
")",
":",
"raise",
"TypeError",
"(",
"'lost_levels must be of type: bool'",
")",
"try",
":",
"rom",
"=",
"_ROM_PATHS",
"[",
"lost_leve... | Return the ROM filename for a game and ROM mode. | [
"Return",
"the",
"ROM",
"filename",
"for",
"a",
"game",
"and",
"ROM",
"mode",
"."
] | [
"\"\"\"\n Return the ROM filename for a game and ROM mode.\n\n Args:\n lost_levels (bool): whether to use the lost levels ROM\n rom_mode (str): the mode of the ROM hack to use as one of:\n - 'vanilla'\n - 'pixel'\n - 'downsample'\n - 'vanilla'\n\n R... | [
{
"param": "lost_levels",
"type": null
},
{
"param": "rom_mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lost_levels",
"type": null,
"docstring": "whether to use the lost levels ROM",
"docstring_tokens": [
"whether",
"to",
"use",
"the",
"lost",
"levels",
"ROM"
],
... |
c3450f34af62114ec42057d076ad03f4a7219874 | selfemergence/self-taught-neat-multiprocessing | experiments/mario/gym-super-mario-bros-master/gym_super_mario_bros/_registration.py | [
"MIT"
] | Python | _register_mario_env | null | def _register_mario_env(id, is_random=False, **kwargs):
"""
Register a Super Mario Bros. (1/2) environment with OpenAI Gym.
Args:
id (str): id for the env to register
is_random (bool): whether to use the random levels environment
kwargs (dict): keyword arguments for the SuperMarioBr... |
Register a Super Mario Bros. (1/2) environment with OpenAI Gym.
Args:
id (str): id for the env to register
is_random (bool): whether to use the random levels environment
kwargs (dict): keyword arguments for the SuperMarioBrosEnv initializer
Returns:
None
| Register a Super Mario Bros. (1/2) environment with OpenAI Gym. | [
"Register",
"a",
"Super",
"Mario",
"Bros",
".",
"(",
"1",
"/",
"2",
")",
"environment",
"with",
"OpenAI",
"Gym",
"."
] | def _register_mario_env(id, is_random=False, **kwargs):
if is_random:
entry_point = 'gym_super_mario_bros:SuperMarioBrosRandomStagesEnv'
else:
entry_point = 'gym_super_mario_bros:SuperMarioBrosEnv'
gym.envs.registration.register(
id=id,
entry_point=entry_point,
max_ep... | [
"def",
"_register_mario_env",
"(",
"id",
",",
"is_random",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"if",
"is_random",
":",
"entry_point",
"=",
"'gym_super_mario_bros:SuperMarioBrosRandomStagesEnv'",
"else",
":",
"entry_point",
"=",
"'gym_super_mario_bros:SuperMario... | Register a Super Mario Bros. (1/2) environment with OpenAI Gym. | [
"Register",
"a",
"Super",
"Mario",
"Bros",
".",
"(",
"1",
"/",
"2",
")",
"environment",
"with",
"OpenAI",
"Gym",
"."
] | [
"\"\"\"\n Register a Super Mario Bros. (1/2) environment with OpenAI Gym.\n\n Args:\n id (str): id for the env to register\n is_random (bool): whether to use the random levels environment\n kwargs (dict): keyword arguments for the SuperMarioBrosEnv initializer\n\n Returns:\n Non... | [
{
"param": "id",
"type": null
},
{
"param": "is_random",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "id",
"type": null,
"docstring": "id for the env to register",
"docstring_tokens": [
"id",
"for",
... |
c3450f34af62114ec42057d076ad03f4a7219874 | selfemergence/self-taught-neat-multiprocessing | experiments/mario/gym-super-mario-bros-master/gym_super_mario_bros/_registration.py | [
"MIT"
] | Python | _register_mario_stage_env | null | def _register_mario_stage_env(id, **kwargs):
"""
Register a Super Mario Bros. (1/2) stage environment with OpenAI Gym.
Args:
id (str): id for the env to register
kwargs (dict): keyword arguments for the SuperMarioBrosEnv initializer
Returns:
None
"""
# register the env... |
Register a Super Mario Bros. (1/2) stage environment with OpenAI Gym.
Args:
id (str): id for the env to register
kwargs (dict): keyword arguments for the SuperMarioBrosEnv initializer
Returns:
None
| Register a Super Mario Bros. (1/2) stage environment with OpenAI Gym. | [
"Register",
"a",
"Super",
"Mario",
"Bros",
".",
"(",
"1",
"/",
"2",
")",
"stage",
"environment",
"with",
"OpenAI",
"Gym",
"."
] | def _register_mario_stage_env(id, **kwargs):
gym.envs.registration.register(
id=id,
entry_point='gym_super_mario_bros:SuperMarioBrosEnv',
max_episode_steps=9999999,
reward_threshold=9999999,
kwargs=kwargs,
nondeterministic=True,
) | [
"def",
"_register_mario_stage_env",
"(",
"id",
",",
"**",
"kwargs",
")",
":",
"gym",
".",
"envs",
".",
"registration",
".",
"register",
"(",
"id",
"=",
"id",
",",
"entry_point",
"=",
"'gym_super_mario_bros:SuperMarioBrosEnv'",
",",
"max_episode_steps",
"=",
"999... | Register a Super Mario Bros. (1/2) stage environment with OpenAI Gym. | [
"Register",
"a",
"Super",
"Mario",
"Bros",
".",
"(",
"1",
"/",
"2",
")",
"stage",
"environment",
"with",
"OpenAI",
"Gym",
"."
] | [
"\"\"\"\n Register a Super Mario Bros. (1/2) stage environment with OpenAI Gym.\n\n Args:\n id (str): id for the env to register\n kwargs (dict): keyword arguments for the SuperMarioBrosEnv initializer\n\n Returns:\n None\n\n \"\"\"",
"# register the environment"
] | [
{
"param": "id",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "id",
"type": null,
"docstring": "id for the env to register",
"docstring_tokens": [
"id",
"for",
... |
a804084491cd3d3035470d9c6b4cfc20eef01313 | selfemergence/self-taught-neat-multiprocessing | genome.py | [
"MIT"
] | Python | add_connection_mutation | null | def add_connection_mutation(self):
"""
In the add connection mutation, a single new connection gene is added
connecting two previously unconnected nodes.
"""
# TODO: better algorithm?
potential_inputs = [n.id for n in self.node_genes if n.type != 'output']
potent... |
In the add connection mutation, a single new connection gene is added
connecting two previously unconnected nodes.
| In the add connection mutation, a single new connection gene is added
connecting two previously unconnected nodes. | [
"In",
"the",
"add",
"connection",
"mutation",
"a",
"single",
"new",
"connection",
"gene",
"is",
"added",
"connecting",
"two",
"previously",
"unconnected",
"nodes",
"."
] | def add_connection_mutation(self):
potential_inputs = [n.id for n in self.node_genes if n.type != 'output']
potential_outputs = [n.id for n in self.node_genes if n.type != 'input' and n.type != 'bias']
if len(potential_outputs) is not 0 and len(potential_inputs) is not 0:
node_in_id ... | [
"def",
"add_connection_mutation",
"(",
"self",
")",
":",
"potential_inputs",
"=",
"[",
"n",
".",
"id",
"for",
"n",
"in",
"self",
".",
"node_genes",
"if",
"n",
".",
"type",
"!=",
"'output'",
"]",
"potential_outputs",
"=",
"[",
"n",
".",
"id",
"for",
"n"... | In the add connection mutation, a single new connection gene is added
connecting two previously unconnected nodes. | [
"In",
"the",
"add",
"connection",
"mutation",
"a",
"single",
"new",
"connection",
"gene",
"is",
"added",
"connecting",
"two",
"previously",
"unconnected",
"nodes",
"."
] | [
"\"\"\"\n In the add connection mutation, a single new connection gene is added\n connecting two previously unconnected nodes.\n \"\"\"",
"# TODO: better algorithm?",
"# Add connection"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a804084491cd3d3035470d9c6b4cfc20eef01313 | selfemergence/self-taught-neat-multiprocessing | genome.py | [
"MIT"
] | Python | add_node_mutation | null | def add_node_mutation(self):
"""
This method adds a node by modifying connection genes.
In the add node mutation an existing connection is split and the new node placed where the old
connection used to be. The old connection is disabled and two new connections are added to the genotype.
... |
This method adds a node by modifying connection genes.
In the add node mutation an existing connection is split and the new node placed where the old
connection used to be. The old connection is disabled and two new connections are added to the genotype.
The new connection leading into ... | This method adds a node by modifying connection genes.
In the add node mutation an existing connection is split and the new node placed where the old
connection used to be. The old connection is disabled and two new connections are added to the genotype.
The new connection leading into the new node receives a weight of... | [
"This",
"method",
"adds",
"a",
"node",
"by",
"modifying",
"connection",
"genes",
".",
"In",
"the",
"add",
"node",
"mutation",
"an",
"existing",
"connection",
"is",
"split",
"and",
"the",
"new",
"node",
"placed",
"where",
"the",
"old",
"connection",
"used",
... | def add_node_mutation(self):
new_node = self.add_node_gene('hidden')
existing_connection = self._get_rand_connection_gene()
self.add_connection_gene(existing_connection.in_node_id, new_node.id, weight=1)
self.add_connection_gene(new_node.id, existing_connection.out_node_id, weight=existi... | [
"def",
"add_node_mutation",
"(",
"self",
")",
":",
"new_node",
"=",
"self",
".",
"add_node_gene",
"(",
"'hidden'",
")",
"existing_connection",
"=",
"self",
".",
"_get_rand_connection_gene",
"(",
")",
"self",
".",
"add_connection_gene",
"(",
"existing_connection",
... | This method adds a node by modifying connection genes. | [
"This",
"method",
"adds",
"a",
"node",
"by",
"modifying",
"connection",
"genes",
"."
] | [
"\"\"\"\n This method adds a node by modifying connection genes.\n In the add node mutation an existing connection is split and the new node placed where the old\n connection used to be. The old connection is disabled and two new connections are added to the genotype.\n The new connectio... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a804084491cd3d3035470d9c6b4cfc20eef01313 | selfemergence/self-taught-neat-multiprocessing | genome.py | [
"MIT"
] | Python | creates_cycle | <not_specific> | def creates_cycle(self, node_in_id, node_out_id):
"""
Checks if the addition of a connection gene will create a cycle in the computation graph
:param node_in_id: In node of the connection gene
:param node_out_id: Out node of the connection gene
:return: Boolean value
"""
... |
Checks if the addition of a connection gene will create a cycle in the computation graph
:param node_in_id: In node of the connection gene
:param node_out_id: Out node of the connection gene
:return: Boolean value
| Checks if the addition of a connection gene will create a cycle in the computation graph | [
"Checks",
"if",
"the",
"addition",
"of",
"a",
"connection",
"gene",
"will",
"create",
"a",
"cycle",
"in",
"the",
"computation",
"graph"
] | def creates_cycle(self, node_in_id, node_out_id):
if node_in_id == node_out_id:
return True
visited = {node_out_id}
while True:
num_added = 0
for c_gene in self.connection_genes:
if c_gene.in_node_id in visited and c_gene.out_node_id not in vis... | [
"def",
"creates_cycle",
"(",
"self",
",",
"node_in_id",
",",
"node_out_id",
")",
":",
"if",
"node_in_id",
"==",
"node_out_id",
":",
"return",
"True",
"visited",
"=",
"{",
"node_out_id",
"}",
"while",
"True",
":",
"num_added",
"=",
"0",
"for",
"c_gene",
"in... | Checks if the addition of a connection gene will create a cycle in the computation graph | [
"Checks",
"if",
"the",
"addition",
"of",
"a",
"connection",
"gene",
"will",
"create",
"a",
"cycle",
"in",
"the",
"computation",
"graph"
] | [
"\"\"\"\n Checks if the addition of a connection gene will create a cycle in the computation graph\n :param node_in_id: In node of the connection gene\n :param node_out_id: Out node of the connection gene\n :return: Boolean value\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "node_in_id",
"type": null
},
{
"param": "node_out_id",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
a804084491cd3d3035470d9c6b4cfc20eef01313 | selfemergence/self-taught-neat-multiprocessing | genome.py | [
"MIT"
] | Python | order_units | <not_specific> | def order_units(self, units):
"""
Implements a directed graph topological sort algorithm
Requires an acyclic graph - see _is_valid_connection method
:return: A sorted stack of NodeGene instances
"""
nodes = [u.ref_node for u in units]
visited = set()
orde... |
Implements a directed graph topological sort algorithm
Requires an acyclic graph - see _is_valid_connection method
:return: A sorted stack of NodeGene instances
| Implements a directed graph topological sort algorithm
Requires an acyclic graph - see _is_valid_connection method | [
"Implements",
"a",
"directed",
"graph",
"topological",
"sort",
"algorithm",
"Requires",
"an",
"acyclic",
"graph",
"-",
"see",
"_is_valid_connection",
"method"
] | def order_units(self, units):
nodes = [u.ref_node for u in units]
visited = set()
ordered = []
for n in nodes:
if n not in visited:
self._order_units(n, nodes, ordered, visited)
ordered_units = []
for n in ordered:
for u in units:
... | [
"def",
"order_units",
"(",
"self",
",",
"units",
")",
":",
"nodes",
"=",
"[",
"u",
".",
"ref_node",
"for",
"u",
"in",
"units",
"]",
"visited",
"=",
"set",
"(",
")",
"ordered",
"=",
"[",
"]",
"for",
"n",
"in",
"nodes",
":",
"if",
"n",
"not",
"in... | Implements a directed graph topological sort algorithm
Requires an acyclic graph - see _is_valid_connection method | [
"Implements",
"a",
"directed",
"graph",
"topological",
"sort",
"algorithm",
"Requires",
"an",
"acyclic",
"graph",
"-",
"see",
"_is_valid_connection",
"method"
] | [
"\"\"\"\n Implements a directed graph topological sort algorithm\n Requires an acyclic graph - see _is_valid_connection method\n :return: A sorted stack of NodeGene instances\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "units",
"type": null
}
] | {
"returns": [
{
"docstring": "A sorted stack of NodeGene instances",
"docstring_tokens": [
"A",
"sorted",
"stack",
"of",
"NodeGene",
"instances"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
... |
b84ba6eb0170580739d8925ed15f223ea16a5bba | selfemergence/self-taught-neat-multiprocessing | experiments/mario/gym-nes-mario-bros-master/src/dqn/model.py | [
"MIT"
] | Python | q_function | <not_specific> | def q_function(input_shape, num_actions):
"""Description of the Q-function as Keras model."""
# See also https://github.com/PacktPublishing/Practical-Deep-Reinforcement-Learning/blob/2e16284bb7661a7edd908cefc5fe2cfb55ac57d8/ch07/lib/dqn_model.py#L64
# https://github.com/keras-rl/keras-rl/blob/master/rl/agen... | Description of the Q-function as Keras model. | Description of the Q-function as Keras model. | [
"Description",
"of",
"the",
"Q",
"-",
"function",
"as",
"Keras",
"model",
"."
] | def q_function(input_shape, num_actions):
image_input = Input(shape=input_shape)
out = Conv2D(filters=32, kernel_size=8, strides=(4, 4), padding=padding, activation='relu')(image_input)
out = Conv2D(filters=32, kernel_size=4, strides=(2, 2), padding=padding, activation='relu')(out)
out = Conv2D(filters=... | [
"def",
"q_function",
"(",
"input_shape",
",",
"num_actions",
")",
":",
"image_input",
"=",
"Input",
"(",
"shape",
"=",
"input_shape",
")",
"out",
"=",
"Conv2D",
"(",
"filters",
"=",
"32",
",",
"kernel_size",
"=",
"8",
",",
"strides",
"=",
"(",
"4",
","... | Description of the Q-function as Keras model. | [
"Description",
"of",
"the",
"Q",
"-",
"function",
"as",
"Keras",
"model",
"."
] | [
"\"\"\"Description of the Q-function as Keras model.\"\"\"",
"# See also https://github.com/PacktPublishing/Practical-Deep-Reinforcement-Learning/blob/2e16284bb7661a7edd908cefc5fe2cfb55ac57d8/ch07/lib/dqn_model.py#L64",
"# https://github.com/keras-rl/keras-rl/blob/master/rl/agents/dqn.py",
"# https://github.c... | [
{
"param": "input_shape",
"type": null
},
{
"param": "num_actions",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "input_shape",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "num_actions",
"type": null,
"docstring": null,
"docstr... |
3029d90dd9c48c95fe9912e7084eb7fa2f60ad19 | selfemergence/self-taught-neat-multiprocessing | feed_forward.py | [
"MIT"
] | Python | self_teaching | null | def self_teaching(self, outputs, teaching_outputs):
'''
loss is defined as the difference between output and teaching nodes
weights are updated by backpropagation
'''
# set the action brain in training mode
self.train()
# define optimizer
adam_opt... |
loss is defined as the difference between output and teaching nodes
weights are updated by backpropagation
| loss is defined as the difference between output and teaching nodes
weights are updated by backpropagation | [
"loss",
"is",
"defined",
"as",
"the",
"difference",
"between",
"output",
"and",
"teaching",
"nodes",
"weights",
"are",
"updated",
"by",
"backpropagation"
] | def self_teaching(self, outputs, teaching_outputs):
self.train()
adam_optimizer = torch.optim.Adam(self.parameters(), lr=0.001)
adam_optimizer.zero_grad()
loss = self.loss_function(outputs, teaching_outputs)
loss.backward()
adam_optimizer.step() | [
"def",
"self_teaching",
"(",
"self",
",",
"outputs",
",",
"teaching_outputs",
")",
":",
"self",
".",
"train",
"(",
")",
"adam_optimizer",
"=",
"torch",
".",
"optim",
".",
"Adam",
"(",
"self",
".",
"parameters",
"(",
")",
",",
"lr",
"=",
"0.001",
")",
... | loss is defined as the difference between output and teaching nodes
weights are updated by backpropagation | [
"loss",
"is",
"defined",
"as",
"the",
"difference",
"between",
"output",
"and",
"teaching",
"nodes",
"weights",
"are",
"updated",
"by",
"backpropagation"
] | [
"'''\n loss is defined as the difference between output and teaching nodes\n weights are updated by backpropagation\n '''",
"# set the action brain in training mode",
"# define optimizer",
"#set the gradients to zero before starting to do backpropragation ",
"#Caculate loss",
"#print(... | [
{
"param": "self",
"type": null
},
{
"param": "outputs",
"type": null
},
{
"param": "teaching_outputs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outputs",
"type": null,
"docstring": null,
"docstring_tokens"... |
dfa52c0413b772c04237049820f5f1a8f522472c | selfemergence/self-taught-neat-multiprocessing | experiments/mario/gym-super-mario-bros-master/gym_super_mario_bros/smb_random_stages_env.py | [
"MIT"
] | Python | _select_random_level | null | def _select_random_level(self):
"""Select a random level to use."""
world = self.np_random.randint(1, 9) - 1
stage = self.np_random.randint(1, 5) - 1
self.env = self.envs[world][stage] | Select a random level to use. | Select a random level to use. | [
"Select",
"a",
"random",
"level",
"to",
"use",
"."
] | def _select_random_level(self):
world = self.np_random.randint(1, 9) - 1
stage = self.np_random.randint(1, 5) - 1
self.env = self.envs[world][stage] | [
"def",
"_select_random_level",
"(",
"self",
")",
":",
"world",
"=",
"self",
".",
"np_random",
".",
"randint",
"(",
"1",
",",
"9",
")",
"-",
"1",
"stage",
"=",
"self",
".",
"np_random",
".",
"randint",
"(",
"1",
",",
"5",
")",
"-",
"1",
"self",
".... | Select a random level to use. | [
"Select",
"a",
"random",
"level",
"to",
"use",
"."
] | [
"\"\"\"Select a random level to use.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dfa52c0413b772c04237049820f5f1a8f522472c | selfemergence/self-taught-neat-multiprocessing | experiments/mario/gym-super-mario-bros-master/gym_super_mario_bros/smb_random_stages_env.py | [
"MIT"
] | Python | reset | <not_specific> | def reset(self):
"""
Reset the state of the environment and returns an initial observation.
Returns:
state (np.ndarray): next frame as a result of the given action
"""
# select a new level
self._select_random_level()
# reset the environment
r... |
Reset the state of the environment and returns an initial observation.
Returns:
state (np.ndarray): next frame as a result of the given action
| Reset the state of the environment and returns an initial observation. | [
"Reset",
"the",
"state",
"of",
"the",
"environment",
"and",
"returns",
"an",
"initial",
"observation",
"."
] | def reset(self):
self._select_random_level()
return self.env.reset() | [
"def",
"reset",
"(",
"self",
")",
":",
"self",
".",
"_select_random_level",
"(",
")",
"return",
"self",
".",
"env",
".",
"reset",
"(",
")"
] | Reset the state of the environment and returns an initial observation. | [
"Reset",
"the",
"state",
"of",
"the",
"environment",
"and",
"returns",
"an",
"initial",
"observation",
"."
] | [
"\"\"\"\n Reset the state of the environment and returns an initial observation.\n\n Returns:\n state (np.ndarray): next frame as a result of the given action\n\n \"\"\"",
"# select a new level",
"# reset the environment"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "state (np.ndarray): next frame as a result of the given action",
"docstring_tokens": [
"state",
"(",
"np",
".",
"ndarray",
")",
":",
"next",
"frame",
"as",
"a",
"result",
... |
f8d70b1bb11bc53dcd53ea0d2fbb77be6fc7d176 | gsoxley/OpenMDAO | openmdao/components/ks_comp.py | [
"Apache-2.0"
] | Python | compute | <not_specific> | def compute(self, g, rho=50.0):
"""
Compute the value of the KS function for the given array of constraints.
Parameters
----------
g : ndarray
Array of constraint values, where negative means satisfied and positive means violated.
rho : float
Cons... |
Compute the value of the KS function for the given array of constraints.
Parameters
----------
g : ndarray
Array of constraint values, where negative means satisfied and positive means violated.
rho : float
Constraint Aggregation Factor.
Returns... | Compute the value of the KS function for the given array of constraints.
Parameters
g : ndarray
Array of constraint values, where negative means satisfied and positive means violated.
rho : float
Constraint Aggregation Factor.
Returns
float
Value of KS function. | [
"Compute",
"the",
"value",
"of",
"the",
"KS",
"function",
"for",
"the",
"given",
"array",
"of",
"constraints",
".",
"Parameters",
"g",
":",
"ndarray",
"Array",
"of",
"constraint",
"values",
"where",
"negative",
"means",
"satisfied",
"and",
"positive",
"means",... | def compute(self, g, rho=50.0):
self.rho = rho
g_max = np.max(g)
self.g_diff = g - g_max
self.exponents = np.exp(rho * self.g_diff)
self.summation = np.sum(self.exponents)
KS = g_max + 1.0 / rho * np.log(self.summation)
return KS | [
"def",
"compute",
"(",
"self",
",",
"g",
",",
"rho",
"=",
"50.0",
")",
":",
"self",
".",
"rho",
"=",
"rho",
"g_max",
"=",
"np",
".",
"max",
"(",
"g",
")",
"self",
".",
"g_diff",
"=",
"g",
"-",
"g_max",
"self",
".",
"exponents",
"=",
"np",
"."... | Compute the value of the KS function for the given array of constraints. | [
"Compute",
"the",
"value",
"of",
"the",
"KS",
"function",
"for",
"the",
"given",
"array",
"of",
"constraints",
"."
] | [
"\"\"\"\n Compute the value of the KS function for the given array of constraints.\n\n Parameters\n ----------\n g : ndarray\n Array of constraint values, where negative means satisfied and positive means violated.\n rho : float\n Constraint Aggregation Facto... | [
{
"param": "self",
"type": null
},
{
"param": "g",
"type": null
},
{
"param": "rho",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "g",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
f8d70b1bb11bc53dcd53ea0d2fbb77be6fc7d176 | gsoxley/OpenMDAO | openmdao/components/ks_comp.py | [
"Apache-2.0"
] | Python | derivatives | <not_specific> | def derivatives(self):
"""
Compute elements of [dKS_gd, dKS_drho] based on previously computed values.
Returns
-------
ndarray
Derivative of KS function with respect to parameter values.
"""
dsum_dg = self.rho * self.exponents
dKS_dsum = 1.0 /... |
Compute elements of [dKS_gd, dKS_drho] based on previously computed values.
Returns
-------
ndarray
Derivative of KS function with respect to parameter values.
| Compute elements of [dKS_gd, dKS_drho] based on previously computed values.
Returns
ndarray
Derivative of KS function with respect to parameter values. | [
"Compute",
"elements",
"of",
"[",
"dKS_gd",
"dKS_drho",
"]",
"based",
"on",
"previously",
"computed",
"values",
".",
"Returns",
"ndarray",
"Derivative",
"of",
"KS",
"function",
"with",
"respect",
"to",
"parameter",
"values",
"."
] | def derivatives(self):
dsum_dg = self.rho * self.exponents
dKS_dsum = 1.0 / (self.rho * self.summation)
dKS_dg = dKS_dsum * dsum_dg
dsum_drho = np.sum(self.g_diff * self.exponents)
dKS_drho = dKS_dsum * dsum_drho
return dKS_dg, dKS_drho | [
"def",
"derivatives",
"(",
"self",
")",
":",
"dsum_dg",
"=",
"self",
".",
"rho",
"*",
"self",
".",
"exponents",
"dKS_dsum",
"=",
"1.0",
"/",
"(",
"self",
".",
"rho",
"*",
"self",
".",
"summation",
")",
"dKS_dg",
"=",
"dKS_dsum",
"*",
"dsum_dg",
"dsum... | Compute elements of [dKS_gd, dKS_drho] based on previously computed values. | [
"Compute",
"elements",
"of",
"[",
"dKS_gd",
"dKS_drho",
"]",
"based",
"on",
"previously",
"computed",
"values",
"."
] | [
"\"\"\"\n Compute elements of [dKS_gd, dKS_drho] based on previously computed values.\n\n Returns\n -------\n ndarray\n Derivative of KS function with respect to parameter values.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f8d70b1bb11bc53dcd53ea0d2fbb77be6fc7d176 | gsoxley/OpenMDAO | openmdao/components/ks_comp.py | [
"Apache-2.0"
] | Python | compute_partials | null | def compute_partials(self, inputs, partials):
"""
Compute sub-jacobian parts. The model is assumed to be in an unscaled state.
Parameters
----------
inputs : Vector
unscaled, dimensional input variables read via inputs[key]
partials : Jacobian
sub... |
Compute sub-jacobian parts. The model is assumed to be in an unscaled state.
Parameters
----------
inputs : Vector
unscaled, dimensional input variables read via inputs[key]
partials : Jacobian
sub-jac components written to partials[output_name, input_na... | Compute sub-jacobian parts. The model is assumed to be in an unscaled state.
Parameters
inputs : Vector
unscaled, dimensional input variables read via inputs[key]
partials : Jacobian
sub-jac components written to partials[output_name, input_name] | [
"Compute",
"sub",
"-",
"jacobian",
"parts",
".",
"The",
"model",
"is",
"assumed",
"to",
"be",
"in",
"an",
"unscaled",
"state",
".",
"Parameters",
"inputs",
":",
"Vector",
"unscaled",
"dimensional",
"input",
"variables",
"read",
"via",
"inputs",
"[",
"key",
... | def compute_partials(self, inputs, partials):
derivs = self.derivs
if self.options['lower_flag']:
derivs = -derivs
partials['KS', 'g'] = derivs.flatten() | [
"def",
"compute_partials",
"(",
"self",
",",
"inputs",
",",
"partials",
")",
":",
"derivs",
"=",
"self",
".",
"derivs",
"if",
"self",
".",
"options",
"[",
"'lower_flag'",
"]",
":",
"derivs",
"=",
"-",
"derivs",
"partials",
"[",
"'KS'",
",",
"'g'",
"]",... | Compute sub-jacobian parts. | [
"Compute",
"sub",
"-",
"jacobian",
"parts",
"."
] | [
"\"\"\"\n Compute sub-jacobian parts. The model is assumed to be in an unscaled state.\n\n Parameters\n ----------\n inputs : Vector\n unscaled, dimensional input variables read via inputs[key]\n partials : Jacobian\n sub-jac components written to partials[ou... | [
{
"param": "self",
"type": null
},
{
"param": "inputs",
"type": null
},
{
"param": "partials",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inputs",
"type": null,
"docstring": null,
"docstring_tokens":... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | _get_scope | <not_specific> | def _get_scope(self, excl_sub=None):
"""
Find the input and output variables that are needed for a particular matvec product.
Parameters
----------
excl_sub : <System>
A subsystem whose variables should be excluded from the matvec product.
Returns
--... |
Find the input and output variables that are needed for a particular matvec product.
Parameters
----------
excl_sub : <System>
A subsystem whose variables should be excluded from the matvec product.
Returns
-------
(set, set)
Sets of out... | Find the input and output variables that are needed for a particular matvec product.
Parameters
excl_sub :
A subsystem whose variables should be excluded from the matvec product.
Returns
(set, set)
Sets of output and input variables. | [
"Find",
"the",
"input",
"and",
"output",
"variables",
"that",
"are",
"needed",
"for",
"a",
"particular",
"matvec",
"product",
".",
"Parameters",
"excl_sub",
":",
"A",
"subsystem",
"whose",
"variables",
"should",
"be",
"excluded",
"from",
"the",
"matvec",
"prod... | def _get_scope(self, excl_sub=None):
try:
return self._scope_cache[excl_sub]
except KeyError:
pass
if excl_sub is None:
scope_out = frozenset(self._var_abs_names['output'])
scope_in = frozenset(self._conn_global_abs_in2out).intersection(
... | [
"def",
"_get_scope",
"(",
"self",
",",
"excl_sub",
"=",
"None",
")",
":",
"try",
":",
"return",
"self",
".",
"_scope_cache",
"[",
"excl_sub",
"]",
"except",
"KeyError",
":",
"pass",
"if",
"excl_sub",
"is",
"None",
":",
"scope_out",
"=",
"frozenset",
"(",... | Find the input and output variables that are needed for a particular matvec product. | [
"Find",
"the",
"input",
"and",
"output",
"variables",
"that",
"are",
"needed",
"for",
"a",
"particular",
"matvec",
"product",
"."
] | [
"\"\"\"\n Find the input and output variables that are needed for a particular matvec product.\n\n Parameters\n ----------\n excl_sub : <System>\n A subsystem whose variables should be excluded from the matvec product.\n\n Returns\n -------\n (set, set)\n ... | [
{
"param": "self",
"type": null
},
{
"param": "excl_sub",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "excl_sub",
"type": null,
"docstring": null,
"docstring_tokens... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | _compute_root_scale_factors | <not_specific> | def _compute_root_scale_factors(self):
"""
Compute scale factors for all variables.
Returns
-------
dict
Mapping of each absolute var name to its corresponding scaling factor tuple.
"""
scale_factors = super(Group, self)._compute_root_scale_factors()
... |
Compute scale factors for all variables.
Returns
-------
dict
Mapping of each absolute var name to its corresponding scaling factor tuple.
| Compute scale factors for all variables.
Returns
dict
Mapping of each absolute var name to its corresponding scaling factor tuple. | [
"Compute",
"scale",
"factors",
"for",
"all",
"variables",
".",
"Returns",
"dict",
"Mapping",
"of",
"each",
"absolute",
"var",
"name",
"to",
"its",
"corresponding",
"scaling",
"factor",
"tuple",
"."
] | def _compute_root_scale_factors(self):
scale_factors = super(Group, self)._compute_root_scale_factors()
if self._has_input_scaling:
abs2meta_in = self._var_abs2meta
allprocs_meta_out = self._var_allprocs_abs2meta
for abs_in, abs_out in iteritems(self._conn_global_abs_... | [
"def",
"_compute_root_scale_factors",
"(",
"self",
")",
":",
"scale_factors",
"=",
"super",
"(",
"Group",
",",
"self",
")",
".",
"_compute_root_scale_factors",
"(",
")",
"if",
"self",
".",
"_has_input_scaling",
":",
"abs2meta_in",
"=",
"self",
".",
"_var_abs2met... | Compute scale factors for all variables. | [
"Compute",
"scale",
"factors",
"for",
"all",
"variables",
"."
] | [
"\"\"\"\n Compute scale factors for all variables.\n\n Returns\n -------\n dict\n Mapping of each absolute var name to its corresponding scaling factor tuple.\n \"\"\"",
"# we only perform scaling on local arrays, so skip",
"# TODO: if either ref or ref0 are not sca... | [
{
"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 | _configure | null | def _configure(self):
"""
Configure our model recursively to assign any children settings.
Highest system's settings take precedence.
"""
for subsys in self._subsystems_myproc:
subsys._configure()
if subsys._has_guess:
self._has_guess = T... |
Configure our model recursively to assign any children settings.
Highest system's settings take precedence.
| Configure our model recursively to assign any children settings.
Highest system's settings take precedence. | [
"Configure",
"our",
"model",
"recursively",
"to",
"assign",
"any",
"children",
"settings",
".",
"Highest",
"system",
"'",
"s",
"settings",
"take",
"precedence",
"."
] | def _configure(self):
for subsys in self._subsystems_myproc:
subsys._configure()
if subsys._has_guess:
self._has_guess = True
if subsys.matrix_free:
self.matrix_free = True
self.configure() | [
"def",
"_configure",
"(",
"self",
")",
":",
"for",
"subsys",
"in",
"self",
".",
"_subsystems_myproc",
":",
"subsys",
".",
"_configure",
"(",
")",
"if",
"subsys",
".",
"_has_guess",
":",
"self",
".",
"_has_guess",
"=",
"True",
"if",
"subsys",
".",
"matrix... | Configure our model recursively to assign any children settings. | [
"Configure",
"our",
"model",
"recursively",
"to",
"assign",
"any",
"children",
"settings",
"."
] | [
"\"\"\"\n Configure our model recursively to assign any children settings.\n\n Highest system's settings take precedence.\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 | _check_reconf_update | null | def _check_reconf_update(self, subsys=None):
"""
Check if any subsystem has reconfigured and if so, perform the necessary update setup.
Parameters
----------
subsys : System or None
If not None, check only if the given subsystem has reconfigured.
"""
... |
Check if any subsystem has reconfigured and if so, perform the necessary update setup.
Parameters
----------
subsys : System or None
If not None, check only if the given subsystem has reconfigured.
| Check if any subsystem has reconfigured and if so, perform the necessary update setup.
Parameters
subsys : System or None
If not None, check only if the given subsystem has reconfigured. | [
"Check",
"if",
"any",
"subsystem",
"has",
"reconfigured",
"and",
"if",
"so",
"perform",
"the",
"necessary",
"update",
"setup",
".",
"Parameters",
"subsys",
":",
"System",
"or",
"None",
"If",
"not",
"None",
"check",
"only",
"if",
"the",
"given",
"subsystem",
... | def _check_reconf_update(self, subsys=None):
if subsys is None:
for subsys in self._subgroups_myproc:
if subsys._reconfigured:
reconf = 1
break
else:
reconf = 0
else:
reconf = int(subsys._reconfig... | [
"def",
"_check_reconf_update",
"(",
"self",
",",
"subsys",
"=",
"None",
")",
":",
"if",
"subsys",
"is",
"None",
":",
"for",
"subsys",
"in",
"self",
".",
"_subgroups_myproc",
":",
"if",
"subsys",
".",
"_reconfigured",
":",
"reconf",
"=",
"1",
"break",
"el... | Check if any subsystem has reconfigured and if so, perform the necessary update setup. | [
"Check",
"if",
"any",
"subsystem",
"has",
"reconfigured",
"and",
"if",
"so",
"perform",
"the",
"necessary",
"update",
"setup",
"."
] | [
"\"\"\"\n Check if any subsystem has reconfigured and if so, perform the necessary update setup.\n\n Parameters\n ----------\n subsys : System or None\n If not None, check only if the given subsystem has reconfigured.\n \"\"\"",
"# See if any local subsystem has recon... | [
{
"param": "self",
"type": null
},
{
"param": "subsys",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "subsys",
"type": null,
"docstring": null,
"docstring_tokens":... |
2a34c4f0b9cba5b34b7e52e497b646c869cec523 | gsoxley/OpenMDAO | openmdao/core/group.py | [
"Apache-2.0"
] | Python | _list_states | <not_specific> | def _list_states(self):
"""
Return list of all local states at and below this system.
Returns
-------
list
List of all states.
"""
states = []
for subsys in self._subsystems_myproc:
states.extend(subsys._list_states())
ret... |
Return list of all local states at and below this system.
Returns
-------
list
List of all states.
| Return list of all local states at and below this system.
Returns
list
List of all states. | [
"Return",
"list",
"of",
"all",
"local",
"states",
"at",
"and",
"below",
"this",
"system",
".",
"Returns",
"list",
"List",
"of",
"all",
"states",
"."
] | def _list_states(self):
states = []
for subsys in self._subsystems_myproc:
states.extend(subsys._list_states())
return sorted(states) | [
"def",
"_list_states",
"(",
"self",
")",
":",
"states",
"=",
"[",
"]",
"for",
"subsys",
"in",
"self",
".",
"_subsystems_myproc",
":",
"states",
".",
"extend",
"(",
"subsys",
".",
"_list_states",
"(",
")",
")",
"return",
"sorted",
"(",
"states",
")"
] | Return list of all local states at and below this system. | [
"Return",
"list",
"of",
"all",
"local",
"states",
"at",
"and",
"below",
"this",
"system",
"."
] | [
"\"\"\"\n Return list of all local states at and below this system.\n\n Returns\n -------\n list\n List of all 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 | _list_states_allprocs | <not_specific> | def _list_states_allprocs(self):
"""
Return list of all states at and below this system across all procs.
Returns
-------
list
List of all states.
"""
if MPI:
all_states = set()
byproc = self.comm.allgather(self._list_states())... |
Return list of all states at and below this system across all procs.
Returns
-------
list
List of all states.
| Return list of all states at and below this system across all procs.
Returns
list
List of all states. | [
"Return",
"list",
"of",
"all",
"states",
"at",
"and",
"below",
"this",
"system",
"across",
"all",
"procs",
".",
"Returns",
"list",
"List",
"of",
"all",
"states",
"."
] | def _list_states_allprocs(self):
if MPI:
all_states = set()
byproc = self.comm.allgather(self._list_states())
for proc_states in byproc:
all_states.update(proc_states)
else:
all_states = self._list_states()
return sorted(all_states) | [
"def",
"_list_states_allprocs",
"(",
"self",
")",
":",
"if",
"MPI",
":",
"all_states",
"=",
"set",
"(",
")",
"byproc",
"=",
"self",
".",
"comm",
".",
"allgather",
"(",
"self",
".",
"_list_states",
"(",
")",
")",
"for",
"proc_states",
"in",
"byproc",
":... | Return list of all states at and below this system across all procs. | [
"Return",
"list",
"of",
"all",
"states",
"at",
"and",
"below",
"this",
"system",
"across",
"all",
"procs",
"."
] | [
"\"\"\"\n Return list of all states at and below this system across all procs.\n\n Returns\n -------\n list\n List of all 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 | _setup_var_index_ranges | null | def _setup_var_index_ranges(self, recurse=True):
"""
Compute the division of variables by subsystem.
Parameters
----------
recurse : bool
Whether to call this method in subsystems.
"""
super(Group, self)._setup_var_index_ranges()
nsub_allproc... |
Compute the division of variables by subsystem.
Parameters
----------
recurse : bool
Whether to call this method in subsystems.
| Compute the division of variables by subsystem.
Parameters
recurse : bool
Whether to call this method in subsystems. | [
"Compute",
"the",
"division",
"of",
"variables",
"by",
"subsystem",
".",
"Parameters",
"recurse",
":",
"bool",
"Whether",
"to",
"call",
"this",
"method",
"in",
"subsystems",
"."
] | def _setup_var_index_ranges(self, recurse=True):
super(Group, self)._setup_var_index_ranges()
nsub_allprocs = len(self._subsystems_allprocs)
subsystems_var_range = self._subsystems_var_range = {}
vec_names = self._lin_rel_vec_name_list if self._use_derivatives else self._vec_names
... | [
"def",
"_setup_var_index_ranges",
"(",
"self",
",",
"recurse",
"=",
"True",
")",
":",
"super",
"(",
"Group",
",",
"self",
")",
".",
"_setup_var_index_ranges",
"(",
")",
"nsub_allprocs",
"=",
"len",
"(",
"self",
".",
"_subsystems_allprocs",
")",
"subsystems_var... | Compute the division of variables by subsystem. | [
"Compute",
"the",
"division",
"of",
"variables",
"by",
"subsystem",
"."
] | [
"\"\"\"\n Compute the division of variables by subsystem.\n\n Parameters\n ----------\n recurse : bool\n Whether to call this method in subsystems.\n \"\"\"",
"# First compute these on one processor for each subsystem",
"# Here, we count the number of variables in e... | [
{
"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_var_data | null | def _setup_var_data(self, recurse=True):
"""
Compute the list of abs var names, abs/prom name maps, and metadata dictionaries.
Parameters
----------
recurse : bool
Whether to call this method in subsystems.
"""
super(Group, self)._setup_var_data()
... |
Compute the list of abs var names, abs/prom name maps, and metadata dictionaries.
Parameters
----------
recurse : bool
Whether to call this method in subsystems.
| Compute the list of abs var names, abs/prom name maps, and metadata dictionaries.
Parameters
recurse : bool
Whether to call this method in subsystems. | [
"Compute",
"the",
"list",
"of",
"abs",
"var",
"names",
"abs",
"/",
"prom",
"name",
"maps",
"and",
"metadata",
"dictionaries",
".",
"Parameters",
"recurse",
":",
"bool",
"Whether",
"to",
"call",
"this",
"method",
"in",
"subsystems",
"."
] | def _setup_var_data(self, recurse=True):
super(Group, self)._setup_var_data()
allprocs_abs_names = self._var_allprocs_abs_names
allprocs_discrete = self._var_allprocs_discrete
abs_names = self._var_abs_names
var_discrete = self._var_discrete
allprocs_prom2abs_list = self.... | [
"def",
"_setup_var_data",
"(",
"self",
",",
"recurse",
"=",
"True",
")",
":",
"super",
"(",
"Group",
",",
"self",
")",
".",
"_setup_var_data",
"(",
")",
"allprocs_abs_names",
"=",
"self",
".",
"_var_allprocs_abs_names",
"allprocs_discrete",
"=",
"self",
".",
... | Compute the list of abs var names, abs/prom name maps, and metadata dictionaries. | [
"Compute",
"the",
"list",
"of",
"abs",
"var",
"names",
"abs",
"/",
"prom",
"name",
"maps",
"and",
"metadata",
"dictionaries",
"."
] | [
"\"\"\"\n Compute the list of abs var names, abs/prom name maps, and metadata dictionaries.\n\n Parameters\n ----------\n recurse : bool\n Whether to call this method in subsystems.\n \"\"\"",
"# Recursion",
"# Assemble allprocs_abs2meta and abs2meta",
"# Assemble... | [
{
"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_var_sizes | null | def _setup_var_sizes(self, recurse=True):
"""
Compute the arrays of local variable sizes for all variables/procs on this system.
Parameters
----------
recurse : bool
Whether to call this method in subsystems.
"""
super(Group, self)._setup_var_sizes()
... |
Compute the arrays of local variable sizes for all variables/procs on this system.
Parameters
----------
recurse : bool
Whether to call this method in subsystems.
| Compute the arrays of local variable sizes for all variables/procs on this system.
Parameters
recurse : bool
Whether to call this method in subsystems. | [
"Compute",
"the",
"arrays",
"of",
"local",
"variable",
"sizes",
"for",
"all",
"variables",
"/",
"procs",
"on",
"this",
"system",
".",
"Parameters",
"recurse",
":",
"bool",
"Whether",
"to",
"call",
"this",
"method",
"in",
"subsystems",
"."
] | def _setup_var_sizes(self, recurse=True):
super(Group, self)._setup_var_sizes()
self._var_offsets = None
iproc = self.comm.rank
nproc = self.comm.size
subsystems_proc_range = self._subsystems_proc_range
if recurse:
for subsys in self._subsystems_myproc:
... | [
"def",
"_setup_var_sizes",
"(",
"self",
",",
"recurse",
"=",
"True",
")",
":",
"super",
"(",
"Group",
",",
"self",
")",
".",
"_setup_var_sizes",
"(",
")",
"self",
".",
"_var_offsets",
"=",
"None",
"iproc",
"=",
"self",
".",
"comm",
".",
"rank",
"nproc"... | Compute the arrays of local variable sizes for all variables/procs on this system. | [
"Compute",
"the",
"arrays",
"of",
"local",
"variable",
"sizes",
"for",
"all",
"variables",
"/",
"procs",
"on",
"this",
"system",
"."
] | [
"\"\"\"\n Compute the arrays of local variable sizes for all variables/procs on this system.\n\n Parameters\n ----------\n recurse : bool\n Whether to call this method in subsystems.\n \"\"\"",
"# Recursion",
"# Compute _var_sizes",
"# in this case, we've split th... | [
{
"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_global_connections | null | def _setup_global_connections(self, recurse=True, conns=None):
"""
Compute dict of all connections between this system's inputs and outputs.
The connections come from 4 sources:
1. Implicit connections owned by the current system
2. Explicit connections declared by the current s... |
Compute dict of all connections between this system's inputs and outputs.
The connections come from 4 sources:
1. Implicit connections owned by the current system
2. Explicit connections declared by the current system
3. Explicit connections declared by parent systems
4... | Compute dict of all connections between this system's inputs and outputs.
The connections come from 4 sources:
1. Implicit connections owned by the current system
2. Explicit connections declared by the current system
3. Explicit connections declared by parent systems
4. Implicit / explicit from subsystems
Parameters
... | [
"Compute",
"dict",
"of",
"all",
"connections",
"between",
"this",
"system",
"'",
"s",
"inputs",
"and",
"outputs",
".",
"The",
"connections",
"come",
"from",
"4",
"sources",
":",
"1",
".",
"Implicit",
"connections",
"owned",
"by",
"the",
"current",
"system",
... | def _setup_global_connections(self, recurse=True, conns=None):
global_abs_in2out = self._conn_global_abs_in2out
allprocs_prom2abs_list_in = self._var_allprocs_prom2abs_list['input']
allprocs_prom2abs_list_out = self._var_allprocs_prom2abs_list['output']
abs2meta = self._var_abs2meta
... | [
"def",
"_setup_global_connections",
"(",
"self",
",",
"recurse",
"=",
"True",
",",
"conns",
"=",
"None",
")",
":",
"global_abs_in2out",
"=",
"self",
".",
"_conn_global_abs_in2out",
"allprocs_prom2abs_list_in",
"=",
"self",
".",
"_var_allprocs_prom2abs_list",
"[",
"'... | Compute dict of all connections between this system's inputs and outputs. | [
"Compute",
"dict",
"of",
"all",
"connections",
"between",
"this",
"system",
"'",
"s",
"inputs",
"and",
"outputs",
"."
] | [
"\"\"\"\n Compute dict of all connections between this system's inputs and outputs.\n\n The connections come from 4 sources:\n 1. Implicit connections owned by the current system\n 2. Explicit connections declared by the current system\n 3. Explicit connections declared by parent ... | [
{
"param": "self",
"type": null
},
{
"param": "recurse",
"type": null
},
{
"param": "conns",
"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 | _discrete_transfer | null | def _discrete_transfer(self, isub):
"""
Transfer discrete variables between components. This only occurs in fwd mode.
Parameters
----------
isub : None or int
If None, perform a full transfer.
If int, perform a partial transfer for linear Gauss--Seidel.
... |
Transfer discrete variables between components. This only occurs in fwd mode.
Parameters
----------
isub : None or int
If None, perform a full transfer.
If int, perform a partial transfer for linear Gauss--Seidel.
| Transfer discrete variables between components. This only occurs in fwd mode.
Parameters
isub : None or int
If None, perform a full transfer.
If int, perform a partial transfer for linear Gauss--Seidel. | [
"Transfer",
"discrete",
"variables",
"between",
"components",
".",
"This",
"only",
"occurs",
"in",
"fwd",
"mode",
".",
"Parameters",
"isub",
":",
"None",
"or",
"int",
"If",
"None",
"perform",
"a",
"full",
"transfer",
".",
"If",
"int",
"perform",
"a",
"part... | def _discrete_transfer(self, isub):
comm = self.comm
key = None if isub is None else self._subsystems_allprocs[isub].name
if comm.size == 1:
for src_sys_name, src, tgt_sys_name, tgt in self._discrete_transfers[key]:
tgt_sys = self._loc_subsys_map[tgt_sys_name]
... | [
"def",
"_discrete_transfer",
"(",
"self",
",",
"isub",
")",
":",
"comm",
"=",
"self",
".",
"comm",
"key",
"=",
"None",
"if",
"isub",
"is",
"None",
"else",
"self",
".",
"_subsystems_allprocs",
"[",
"isub",
"]",
".",
"name",
"if",
"comm",
".",
"size",
... | Transfer discrete variables between components. | [
"Transfer",
"discrete",
"variables",
"between",
"components",
"."
] | [
"\"\"\"\n Transfer discrete variables between components. This only occurs in fwd mode.\n\n Parameters\n ----------\n isub : None or int\n If None, perform a full transfer.\n If int, perform a partial transfer for linear Gauss--Seidel.\n \"\"\"",
"# note t... | [
{
"param": "self",
"type": null
},
{
"param": "isub",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "isub",
"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.