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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f062b1a02e9a5efd81d0b477bba7ca6425061f4f | vtisler/stock_martket_forecast | swagger_server/models/predict_response.py | [
"MIT"
] | Python | indicator | null | def indicator(self, indicator: float):
"""Sets the indicator of this PredictResponse.
:param indicator: The indicator of this PredictResponse.
:type indicator: float
"""
self._indicator = indicator | Sets the indicator of this PredictResponse.
:param indicator: The indicator of this PredictResponse.
:type indicator: float
| Sets the indicator of this PredictResponse. | [
"Sets",
"the",
"indicator",
"of",
"this",
"PredictResponse",
"."
] | def indicator(self, indicator: float):
self._indicator = indicator | [
"def",
"indicator",
"(",
"self",
",",
"indicator",
":",
"float",
")",
":",
"self",
".",
"_indicator",
"=",
"indicator"
] | Sets the indicator of this PredictResponse. | [
"Sets",
"the",
"indicator",
"of",
"this",
"PredictResponse",
"."
] | [
"\"\"\"Sets the indicator of this PredictResponse.\n\n\n :param indicator: The indicator of this PredictResponse.\n :type indicator: float\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "indicator",
"type": "float"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "indicator",
"type": "float",
"docstring": "The indicator of this Pr... |
f09c3f0be03bfd46db2b9c88aeb95e9296ae5e99 | vtisler/stock_martket_forecast | swagger_server/controllers/list_models_controller.py | [
"MIT"
] | Python | list_models_get | <not_specific> | def list_models_get(): # noqa: E501
"""Reruns list of models from model storage
# noqa: E501
:rtype: List[ModelInfo]
"""
return 'do some magic!' | Reruns list of models from model storage
# noqa: E501
:rtype: List[ModelInfo]
| Reruns list of models from model storage
noqa: E501 | [
"Reruns",
"list",
"of",
"models",
"from",
"model",
"storage",
"noqa",
":",
"E501"
] | def list_models_get():
"""Reruns list of models from model storage
:rtype: List[ModelInfo]
"""
return 'do some magic!' | [
"def",
"list_models_get",
"(",
")",
":",
"return",
"'do some magic!'"
] | Reruns list of models from model storage
noqa: E501 | [
"Reruns",
"list",
"of",
"models",
"from",
"model",
"storage",
"noqa",
":",
"E501"
] | [
"# noqa: E501",
"\"\"\"Reruns list of models from model storage\n\n # noqa: E501\n\n\n :rtype: List[ModelInfo]\n \"\"\""
] | [] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "List[ModelInfo]"
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
1591502b49316a4be7ad9c91de258929d4a570e2 | brianbruggeman/lose-7drl | lose/utils/algorithms/distances.py | [
"Apache-2.0"
] | Python | manhattan_distance | <not_specific> | def manhattan_distance(x, y):
"""Calculates the distance between x and y using the manhattan
formula.
This seems slower than euclidean and it is the least accurate
Args:
x (point): a point in space
y (point): a point in space
Returns:
int: the distance calculated between ... | Calculates the distance between x and y using the manhattan
formula.
This seems slower than euclidean and it is the least accurate
Args:
x (point): a point in space
y (point): a point in space
Returns:
int: the distance calculated between point x and point y
| Calculates the distance between x and y using the manhattan
formula.
This seems slower than euclidean and it is the least accurate | [
"Calculates",
"the",
"distance",
"between",
"x",
"and",
"y",
"using",
"the",
"manhattan",
"formula",
".",
"This",
"seems",
"slower",
"than",
"euclidean",
"and",
"it",
"is",
"the",
"least",
"accurate"
] | def manhattan_distance(x, y):
diffs = [abs((xval or 0) - (yval or 0)) for xval, yval in lzip(x, y)]
return sum(diffs) | [
"def",
"manhattan_distance",
"(",
"x",
",",
"y",
")",
":",
"diffs",
"=",
"[",
"abs",
"(",
"(",
"xval",
"or",
"0",
")",
"-",
"(",
"yval",
"or",
"0",
")",
")",
"for",
"xval",
",",
"yval",
"in",
"lzip",
"(",
"x",
",",
"y",
")",
"]",
"return",
... | Calculates the distance between x and y using the manhattan
formula. | [
"Calculates",
"the",
"distance",
"between",
"x",
"and",
"y",
"using",
"the",
"manhattan",
"formula",
"."
] | [
"\"\"\"Calculates the distance between x and y using the manhattan\n formula.\n\n This seems slower than euclidean and it is the least accurate\n\n Args:\n x (point): a point in space\n y (point): a point in space\n\n Returns:\n int: the distance calculated between point x and poin... | [
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
}
] | {
"returns": [
{
"docstring": "the distance calculated between point x and point y",
"docstring_tokens": [
"the",
"distance",
"calculated",
"between",
"point",
"x",
"and",
"point",
"y"
],
"type": "int"
}
],
"ra... |
1591502b49316a4be7ad9c91de258929d4a570e2 | brianbruggeman/lose-7drl | lose/utils/algorithms/distances.py | [
"Apache-2.0"
] | Python | euclidean_distance | <not_specific> | def euclidean_distance(x, y):
"""Calculates the distance between x and y using the euclidean
formula.
This should be the most accurate distance formula.
Args:
x (point): a point in space
y (point): a point in space
Returns:
float: the distance calculated between point x a... | Calculates the distance between x and y using the euclidean
formula.
This should be the most accurate distance formula.
Args:
x (point): a point in space
y (point): a point in space
Returns:
float: the distance calculated between point x and point y
| Calculates the distance between x and y using the euclidean
formula.
This should be the most accurate distance formula. | [
"Calculates",
"the",
"distance",
"between",
"x",
"and",
"y",
"using",
"the",
"euclidean",
"formula",
".",
"This",
"should",
"be",
"the",
"most",
"accurate",
"distance",
"formula",
"."
] | def euclidean_distance(x, y):
distance = 0
diffs = [abs((xval or 0) - (yval or 0)) for xval, yval in lzip(x, y)]
distance = math.sqrt(sum(diff**2 for diff in diffs))
return distance | [
"def",
"euclidean_distance",
"(",
"x",
",",
"y",
")",
":",
"distance",
"=",
"0",
"diffs",
"=",
"[",
"abs",
"(",
"(",
"xval",
"or",
"0",
")",
"-",
"(",
"yval",
"or",
"0",
")",
")",
"for",
"xval",
",",
"yval",
"in",
"lzip",
"(",
"x",
",",
"y",
... | Calculates the distance between x and y using the euclidean
formula. | [
"Calculates",
"the",
"distance",
"between",
"x",
"and",
"y",
"using",
"the",
"euclidean",
"formula",
"."
] | [
"\"\"\"Calculates the distance between x and y using the euclidean\n formula.\n\n This should be the most accurate distance formula.\n\n Args:\n x (point): a point in space\n y (point): a point in space\n\n Returns:\n float: the distance calculated between point x and point y\n ... | [
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
}
] | {
"returns": [
{
"docstring": "the distance calculated between point x and point y",
"docstring_tokens": [
"the",
"distance",
"calculated",
"between",
"point",
"x",
"and",
"point",
"y"
],
"type": "float"
}
],
"... |
1591502b49316a4be7ad9c91de258929d4a570e2 | brianbruggeman/lose-7drl | lose/utils/algorithms/distances.py | [
"Apache-2.0"
] | Python | octagonal_distance | <not_specific> | def octagonal_distance(x, y):
"""Calculates the distance between x and y using the octagonal
formula.
This is a very fast and fairly accurate approximation of the
euclidean distance formula.
See: http://www.flipcode.com/archives/Fast_Approximate_Distance_Functions.shtml
Args:
x (point)... | Calculates the distance between x and y using the octagonal
formula.
This is a very fast and fairly accurate approximation of the
euclidean distance formula.
See: http://www.flipcode.com/archives/Fast_Approximate_Distance_Functions.shtml
Args:
x (point): a point in space
y (point):... | Calculates the distance between x and y using the octagonal
formula.
This is a very fast and fairly accurate approximation of the
euclidean distance formula. | [
"Calculates",
"the",
"distance",
"between",
"x",
"and",
"y",
"using",
"the",
"octagonal",
"formula",
".",
"This",
"is",
"a",
"very",
"fast",
"and",
"fairly",
"accurate",
"approximation",
"of",
"the",
"euclidean",
"distance",
"formula",
"."
] | def octagonal_distance(x, y):
distance = 0
diffs = [abs((xval or 0) - (yval or 0)) for xval, yval in lzip(x, y)]
if len(diffs) != 2:
raise TypeError('This distance is only valid in 2D')
diff_min = min(diffs)
diff_max = max(diffs)
approximation = diff_max * 1007 + diff_min * 441
corre... | [
"def",
"octagonal_distance",
"(",
"x",
",",
"y",
")",
":",
"distance",
"=",
"0",
"diffs",
"=",
"[",
"abs",
"(",
"(",
"xval",
"or",
"0",
")",
"-",
"(",
"yval",
"or",
"0",
")",
")",
"for",
"xval",
",",
"yval",
"in",
"lzip",
"(",
"x",
",",
"y",
... | Calculates the distance between x and y using the octagonal
formula. | [
"Calculates",
"the",
"distance",
"between",
"x",
"and",
"y",
"using",
"the",
"octagonal",
"formula",
"."
] | [
"\"\"\"Calculates the distance between x and y using the octagonal\n formula.\n\n This is a very fast and fairly accurate approximation of the\n euclidean distance formula.\n See: http://www.flipcode.com/archives/Fast_Approximate_Distance_Functions.shtml\n\n Args:\n x (point): a point in space... | [
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
}
] | {
"returns": [
{
"docstring": "the distance calculated between point x and point y",
"docstring_tokens": [
"the",
"distance",
"calculated",
"between",
"point",
"x",
"and",
"point",
"y"
],
"type": "int"
}
],
"ra... |
1591502b49316a4be7ad9c91de258929d4a570e2 | brianbruggeman/lose-7drl | lose/utils/algorithms/distances.py | [
"Apache-2.0"
] | Python | log_distance | <not_specific> | def log_distance(x, y, func=None, k=None):
"""Calculates the distance between x and y using the octagonal
formula.
This wraps a distance function with a log output. If no distance
function is provided, then euclidean is used.
Args:
x (point): a point in space
y (point): a point in... | Calculates the distance between x and y using the octagonal
formula.
This wraps a distance function with a log output. If no distance
function is provided, then euclidean is used.
Args:
x (point): a point in space
y (point): a point in space
func (callback): returning the log... | Calculates the distance between x and y using the octagonal
formula.
This wraps a distance function with a log output. If no distance
function is provided, then euclidean is used. | [
"Calculates",
"the",
"distance",
"between",
"x",
"and",
"y",
"using",
"the",
"octagonal",
"formula",
".",
"This",
"wraps",
"a",
"distance",
"function",
"with",
"a",
"log",
"output",
".",
"If",
"no",
"distance",
"function",
"is",
"provided",
"then",
"euclidea... | def log_distance(x, y, func=None, k=None):
if k is None:
k = 1.2
if func is None:
func = octagonal_distance
distance = func(x, y)
if distance == 0:
distance = 1 / 10**10
logged_distance = 6 * math.log(distance)
return logged_distance | [
"def",
"log_distance",
"(",
"x",
",",
"y",
",",
"func",
"=",
"None",
",",
"k",
"=",
"None",
")",
":",
"if",
"k",
"is",
"None",
":",
"k",
"=",
"1.2",
"if",
"func",
"is",
"None",
":",
"func",
"=",
"octagonal_distance",
"distance",
"=",
"func",
"(",... | Calculates the distance between x and y using the octagonal
formula. | [
"Calculates",
"the",
"distance",
"between",
"x",
"and",
"y",
"using",
"the",
"octagonal",
"formula",
"."
] | [
"\"\"\"Calculates the distance between x and y using the octagonal\n formula.\n\n This wraps a distance function with a log output. If no distance\n function is provided, then euclidean is used.\n\n Args:\n x (point): a point in space\n y (point): a point in space\n func (callback)... | [
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "func",
"type": null
},
{
"param": "k",
"type": null
}
] | {
"returns": [
{
"docstring": "the distance calculated between point x and point y",
"docstring_tokens": [
"the",
"distance",
"calculated",
"between",
"point",
"x",
"and",
"point",
"y"
],
"type": "int"
}
],
"ra... |
72208a02cd8b5369a548fc9d35668215cd5e0bae | brianbruggeman/lose-7drl | setup.py | [
"Apache-2.0"
] | Python | strip_versions | <not_specific> | def strip_versions(requirement):
'''Strips out version information from package
Args:
requirement(str): an example of a
Returns:
str: Just the package name
'''
# Use the naive approach until we need some regex magic
pragma = None
if ';' in requirement:
requirement, ... | Strips out version information from package
Args:
requirement(str): an example of a
Returns:
str: Just the package name
| Strips out version information from package | [
"Strips",
"out",
"version",
"information",
"from",
"package"
] | def strip_versions(requirement):
pragma = None
if ';' in requirement:
requirement, pragma = requirement.split(';')
if pragma:
if eval(pragma.strip()):
requirement = requirement.rstrip(' <>=.,1234567890')
else:
requirement = ''
return requirement | [
"def",
"strip_versions",
"(",
"requirement",
")",
":",
"pragma",
"=",
"None",
"if",
"';'",
"in",
"requirement",
":",
"requirement",
",",
"pragma",
"=",
"requirement",
".",
"split",
"(",
"';'",
")",
"if",
"pragma",
":",
"if",
"eval",
"(",
"pragma",
".",
... | Strips out version information from package | [
"Strips",
"out",
"version",
"information",
"from",
"package"
] | [
"'''Strips out version information from package\n\n Args:\n requirement(str): an example of a\n\n Returns:\n str: Just the package name\n '''",
"# Use the naive approach until we need some regex magic"
] | [
{
"param": "requirement",
"type": null
}
] | {
"returns": [
{
"docstring": "Just the package name",
"docstring_tokens": [
"Just",
"the",
"package",
"name"
],
"type": "str"
}
],
"raises": [],
"params": [
{
"identifier": "requirement",
"type": null,
"docstring": "an exampl... |
4fbadcf113bca60eb63a7ca8f90ec13d71d7d31a | brianbruggeman/lose-7drl | lose/utils/algorithms/pathing.py | [
"Apache-2.0"
] | Python | dijkstra | null | def dijkstra(graph, start, target=None, cost_func=None, include_diagonals=None):
"""Implementation of dijkstra's algorithm as a generator.
This one uses a priority queue for a stack.
See: https://en.wikipedia.org/wiki/Dijkstra's_algorithm
Args:
graph (list): a set of nodes
start (node... | Implementation of dijkstra's algorithm as a generator.
This one uses a priority queue for a stack.
See: https://en.wikipedia.org/wiki/Dijkstra's_algorithm
Args:
graph (list): a set of nodes
start (node): the starting position
target (node): the ending position; None means all node... | Implementation of dijkstra's algorithm as a generator.
This one uses a priority queue for a stack.
| [
"Implementation",
"of",
"dijkstra",
"'",
"s",
"algorithm",
"as",
"a",
"generator",
".",
"This",
"one",
"uses",
"a",
"priority",
"queue",
"for",
"a",
"stack",
"."
] | def dijkstra(graph, start, target=None, cost_func=None, include_diagonals=None):
cost_func = cost_func or log_distance
queue = []
heapq.heapify(queue)
costs = {start: 0}
heapq.heappush(queue, (costs[start], start))
yield (costs[start], start)
while queue:
node_cost, node = heapq.heap... | [
"def",
"dijkstra",
"(",
"graph",
",",
"start",
",",
"target",
"=",
"None",
",",
"cost_func",
"=",
"None",
",",
"include_diagonals",
"=",
"None",
")",
":",
"cost_func",
"=",
"cost_func",
"or",
"log_distance",
"queue",
"=",
"[",
"]",
"heapq",
".",
"heapify... | Implementation of dijkstra's algorithm as a generator. | [
"Implementation",
"of",
"dijkstra",
"'",
"s",
"algorithm",
"as",
"a",
"generator",
"."
] | [
"\"\"\"Implementation of dijkstra's algorithm as a generator.\n\n This one uses a priority queue for a stack.\n\n See: https://en.wikipedia.org/wiki/Dijkstra's_algorithm\n\n Args:\n graph (list): a set of nodes\n start (node): the starting position\n target (node): the ending position;... | [
{
"param": "graph",
"type": null
},
{
"param": "start",
"type": null
},
{
"param": "target",
"type": null
},
{
"param": "cost_func",
"type": null
},
{
"param": "include_diagonals",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "graph",
"type": null,
"docstring": "a set of nodes",
"docstring_tokens": [
"a",
"set",
"of"... |
1b7c214df73541449ca4f1f5e5710f436d505cfc | JustinLaureano/SunnyCast | functions.py | [
"MIT"
] | Python | create_menu_bar | null | def create_menu_bar(window):
"""Draw menu bar to the main window."""
menubar = Menu(window)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="Open")
filemenu.add_command(label="Save")
filemenu.add_separator()
filemenu.add_command(label="Exit")
menubar.add_cascade(label="Fil... | Draw menu bar to the main window. | Draw menu bar to the main window. | [
"Draw",
"menu",
"bar",
"to",
"the",
"main",
"window",
"."
] | def create_menu_bar(window):
menubar = Menu(window)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="Open")
filemenu.add_command(label="Save")
filemenu.add_separator()
filemenu.add_command(label="Exit")
menubar.add_cascade(label="File", menu=filemenu) | [
"def",
"create_menu_bar",
"(",
"window",
")",
":",
"menubar",
"=",
"Menu",
"(",
"window",
")",
"filemenu",
"=",
"Menu",
"(",
"menubar",
",",
"tearoff",
"=",
"0",
")",
"filemenu",
".",
"add_command",
"(",
"label",
"=",
"\"Open\"",
")",
"filemenu",
".",
... | Draw menu bar to the main window. | [
"Draw",
"menu",
"bar",
"to",
"the",
"main",
"window",
"."
] | [
"\"\"\"Draw menu bar to the main window.\"\"\""
] | [
{
"param": "window",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "window",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1b7c214df73541449ca4f1f5e5710f436d505cfc | JustinLaureano/SunnyCast | functions.py | [
"MIT"
] | Python | add_video | null | def add_video(eplist, playlist, current_playlist, var):
"""Add video to playlist being created."""
current = eplist.get(ACTIVE)
playlist.insert(END, current)
current_playlist.append(current) # adds the video to playback list.
var.set(1) | Add video to playlist being created. | Add video to playlist being created. | [
"Add",
"video",
"to",
"playlist",
"being",
"created",
"."
] | def add_video(eplist, playlist, current_playlist, var):
current = eplist.get(ACTIVE)
playlist.insert(END, current)
current_playlist.append(current)
var.set(1) | [
"def",
"add_video",
"(",
"eplist",
",",
"playlist",
",",
"current_playlist",
",",
"var",
")",
":",
"current",
"=",
"eplist",
".",
"get",
"(",
"ACTIVE",
")",
"playlist",
".",
"insert",
"(",
"END",
",",
"current",
")",
"current_playlist",
".",
"append",
"(... | Add video to playlist being created. | [
"Add",
"video",
"to",
"playlist",
"being",
"created",
"."
] | [
"\"\"\"Add video to playlist being created.\"\"\"",
"# adds the video to playback list."
] | [
{
"param": "eplist",
"type": null
},
{
"param": "playlist",
"type": null
},
{
"param": "current_playlist",
"type": null
},
{
"param": "var",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eplist",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "playlist",
"type": null,
"docstring": null,
"docstring_toke... |
1b7c214df73541449ca4f1f5e5710f436d505cfc | JustinLaureano/SunnyCast | functions.py | [
"MIT"
] | Python | move_up_list | null | def move_up_list(playlist):
"""Move highlighted video file up on the playlist."""
current = playlist.index(ACTIVE)
if current != 0:
playlist.insert(current - 1, playlist.get(current))
playlist.delete(current + 1) | Move highlighted video file up on the playlist. | Move highlighted video file up on the playlist. | [
"Move",
"highlighted",
"video",
"file",
"up",
"on",
"the",
"playlist",
"."
] | def move_up_list(playlist):
current = playlist.index(ACTIVE)
if current != 0:
playlist.insert(current - 1, playlist.get(current))
playlist.delete(current + 1) | [
"def",
"move_up_list",
"(",
"playlist",
")",
":",
"current",
"=",
"playlist",
".",
"index",
"(",
"ACTIVE",
")",
"if",
"current",
"!=",
"0",
":",
"playlist",
".",
"insert",
"(",
"current",
"-",
"1",
",",
"playlist",
".",
"get",
"(",
"current",
")",
")... | Move highlighted video file up on the playlist. | [
"Move",
"highlighted",
"video",
"file",
"up",
"on",
"the",
"playlist",
"."
] | [
"\"\"\"Move highlighted video file up on the playlist.\"\"\""
] | [
{
"param": "playlist",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "playlist",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1b7c214df73541449ca4f1f5e5710f436d505cfc | JustinLaureano/SunnyCast | functions.py | [
"MIT"
] | Python | move_down_list | null | def move_down_list(playlist):
"""Move highlighted video file down on the playlist."""
current = playlist.index(ACTIVE)
if current != playlist.index(-1):
playlist.insert(current + 2, playlist.get(current))
playlist.delete(current) | Move highlighted video file down on the playlist. | Move highlighted video file down on the playlist. | [
"Move",
"highlighted",
"video",
"file",
"down",
"on",
"the",
"playlist",
"."
] | def move_down_list(playlist):
current = playlist.index(ACTIVE)
if current != playlist.index(-1):
playlist.insert(current + 2, playlist.get(current))
playlist.delete(current) | [
"def",
"move_down_list",
"(",
"playlist",
")",
":",
"current",
"=",
"playlist",
".",
"index",
"(",
"ACTIVE",
")",
"if",
"current",
"!=",
"playlist",
".",
"index",
"(",
"-",
"1",
")",
":",
"playlist",
".",
"insert",
"(",
"current",
"+",
"2",
",",
"pla... | Move highlighted video file down on the playlist. | [
"Move",
"highlighted",
"video",
"file",
"down",
"on",
"the",
"playlist",
"."
] | [
"\"\"\"Move highlighted video file down on the playlist.\"\"\""
] | [
{
"param": "playlist",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "playlist",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1b7c214df73541449ca4f1f5e5710f436d505cfc | JustinLaureano/SunnyCast | functions.py | [
"MIT"
] | Python | run_program | null | def run_program(var, playlist, ep_dir):
"""Run the program depending on the player option selected."""
option_chosen = var.get()
if option_chosen == 1:
# Create file path for videos in playlist.
new_string = ''
for file in playlist:
new_string += '%s%s ' % (ep_dir, file)... | Run the program depending on the player option selected. | Run the program depending on the player option selected. | [
"Run",
"the",
"program",
"depending",
"on",
"the",
"player",
"option",
"selected",
"."
] | def run_program(var, playlist, ep_dir):
option_chosen = var.get()
if option_chosen == 1:
new_string = ''
for file in playlist:
new_string += '%s%s ' % (ep_dir, file)
new_string = new_string.rstrip()
new_string = new_string.replace(' ', '\ ')
new_string = new_s... | [
"def",
"run_program",
"(",
"var",
",",
"playlist",
",",
"ep_dir",
")",
":",
"option_chosen",
"=",
"var",
".",
"get",
"(",
")",
"if",
"option_chosen",
"==",
"1",
":",
"new_string",
"=",
"''",
"for",
"file",
"in",
"playlist",
":",
"new_string",
"+=",
"'%... | Run the program depending on the player option selected. | [
"Run",
"the",
"program",
"depending",
"on",
"the",
"player",
"option",
"selected",
"."
] | [
"\"\"\"Run the program depending on the player option selected.\"\"\"",
"# Create file path for videos in playlist.",
"# Run the playlist.",
"# Play the shuffle episode list."
] | [
{
"param": "var",
"type": null
},
{
"param": "playlist",
"type": null
},
{
"param": "ep_dir",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "var",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "playlist",
"type": null,
"docstring": null,
"docstring_tokens"... |
e62ebafe84e5e1873057ad6dae0ab5fbcccbd923 | at-peter/epymarl | src/runners/episode_runner.py | [
"Apache-2.0"
] | Python | run | <not_specific> | def run(self, test_mode=False):
'''
Items that have been added by me:
* current_episode_agent_returns
'''
self.reset()
# this clears the agent returns list every episode.
# TODO: Works
current_episode_agent_returns = [0]*self.args.n_agents
termina... |
Items that have been added by me:
* current_episode_agent_returns
| Items that have been added by me:
current_episode_agent_returns | [
"Items",
"that",
"have",
"been",
"added",
"by",
"me",
":",
"current_episode_agent_returns"
] | def run(self, test_mode=False):
self.reset()
current_episode_agent_returns = [0]*self.args.n_agents
terminated = False
episode_return = 0
self.mac.init_hidden(batch_size=self.batch_size)
while not terminated:
pre_transition_data = {
"state": [s... | [
"def",
"run",
"(",
"self",
",",
"test_mode",
"=",
"False",
")",
":",
"self",
".",
"reset",
"(",
")",
"current_episode_agent_returns",
"=",
"[",
"0",
"]",
"*",
"self",
".",
"args",
".",
"n_agents",
"terminated",
"=",
"False",
"episode_return",
"=",
"0",
... | Items that have been added by me:
current_episode_agent_returns | [
"Items",
"that",
"have",
"been",
"added",
"by",
"me",
":",
"current_episode_agent_returns"
] | [
"'''\n Items that have been added by me:\n * current_episode_agent_returns\n '''",
"# this clears the agent returns list every episode. ",
"# TODO: Works",
"# Pass the entire batch of experiences up till now to the agents",
"# Receive the actions for each agent at this timestep in a bat... | [
{
"param": "self",
"type": null
},
{
"param": "test_mode",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "test_mode",
"type": null,
"docstring": null,
"docstring_token... |
c5dc8de72d7ca4a20c798816f41d3e7ea856aafe | at-peter/epymarl | src/search.py | [
"Apache-2.0"
] | Python | single | null | def single(combos, index):
"""Runs a single hyperparameter combination
INDEX is the index of the combination to run in the generated combination list
"""
config = combos[index]
cmd = "python main.py " + " ".join([c for c in config if c.startswith("--")]) + " with " + " ".join([c for c in config if ... | Runs a single hyperparameter combination
INDEX is the index of the combination to run in the generated combination list
| Runs a single hyperparameter combination
INDEX is the index of the combination to run in the generated combination list | [
"Runs",
"a",
"single",
"hyperparameter",
"combination",
"INDEX",
"is",
"the",
"index",
"of",
"the",
"combination",
"to",
"run",
"in",
"the",
"generated",
"combination",
"list"
] | def single(combos, index):
config = combos[index]
cmd = "python main.py " + " ".join([c for c in config if c.startswith("--")]) + " with " + " ".join([c for c in config if not c.startswith("--")])
print(cmd)
work(cmd) | [
"def",
"single",
"(",
"combos",
",",
"index",
")",
":",
"config",
"=",
"combos",
"[",
"index",
"]",
"cmd",
"=",
"\"python main.py \"",
"+",
"\" \"",
".",
"join",
"(",
"[",
"c",
"for",
"c",
"in",
"config",
"if",
"c",
".",
"startswith",
"(",
"\"--\"",
... | Runs a single hyperparameter combination
INDEX is the index of the combination to run in the generated combination list | [
"Runs",
"a",
"single",
"hyperparameter",
"combination",
"INDEX",
"is",
"the",
"index",
"of",
"the",
"combination",
"to",
"run",
"in",
"the",
"generated",
"combination",
"list"
] | [
"\"\"\"Runs a single hyperparameter combination\n INDEX is the index of the combination to run in the generated combination list\n \"\"\""
] | [
{
"param": "combos",
"type": null
},
{
"param": "index",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "combos",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "index",
"type": null,
"docstring": null,
"docstring_tokens"... |
89784121f5bfbb678c186d442ee3e33bda0f077d | apokhr/PumpProbe-analysis | GUI/TransientsWidgets.py | [
"MIT"
] | Python | initUI | null | def initUI(self):
"""Create the layout, adding central widget, layout style and status
bar. """
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
layout = QG.QGridLayout() # create a grid for subWidgets
layout.setSpaci... | Create the layout, adding central widget, layout style and status
bar. | Create the layout, adding central widget, layout style and status
bar. | [
"Create",
"the",
"layout",
"adding",
"central",
"widget",
"layout",
"style",
"and",
"status",
"bar",
"."
] | def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
layout = QG.QGridLayout()
layout.setSpacing(10)
self.setLayout(layout)
self.centralWidget = TransientAnalysisWidget()
layout.addWidget(self.centralWi... | [
"def",
"initUI",
"(",
"self",
")",
":",
"self",
".",
"setWindowTitle",
"(",
"self",
".",
"title",
")",
"self",
".",
"setGeometry",
"(",
"self",
".",
"left",
",",
"self",
".",
"top",
",",
"self",
".",
"width",
",",
"self",
".",
"height",
")",
"layou... | Create the layout, adding central widget, layout style and status
bar. | [
"Create",
"the",
"layout",
"adding",
"central",
"widget",
"layout",
"style",
"and",
"status",
"bar",
"."
] | [
"\"\"\"Create the layout, adding central widget, layout style and status\r\n bar. \"\"\"",
"# create a grid for subWidgets\r"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
89784121f5bfbb678c186d442ee3e33bda0f077d | apokhr/PumpProbe-analysis | GUI/TransientsWidgets.py | [
"MIT"
] | Python | import_multiple_files | null | def import_multiple_files(self): # todo: Improve! Rethink importing method
"""
Import multiple files to analysis program.
for now only overwrites, adding append function soon.
"""
filename = self.openFileNameDialog()
append = False
self.data.import_files(f... |
Import multiple files to analysis program.
for now only overwrites, adding append function soon.
| Import multiple files to analysis program.
for now only overwrites, adding append function soon. | [
"Import",
"multiple",
"files",
"to",
"analysis",
"program",
".",
"for",
"now",
"only",
"overwrites",
"adding",
"append",
"function",
"soon",
"."
] | def import_multiple_files(self):
filename = self.openFileNameDialog()
append = False
self.data.import_files(filename, append)
print(self.data)
self.refresh_transient_list()
self.plot_all_transients() | [
"def",
"import_multiple_files",
"(",
"self",
")",
":",
"filename",
"=",
"self",
".",
"openFileNameDialog",
"(",
")",
"append",
"=",
"False",
"self",
".",
"data",
".",
"import_files",
"(",
"filename",
",",
"append",
")",
"print",
"(",
"self",
".",
"data",
... | Import multiple files to analysis program. | [
"Import",
"multiple",
"files",
"to",
"analysis",
"program",
"."
] | [
"# todo: Improve! Rethink importing method\r",
"\"\"\"\r\n Import multiple files to analysis program.\r\n for now only overwrites, adding append function soon.\r\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
89784121f5bfbb678c186d442ee3e33bda0f077d | apokhr/PumpProbe-analysis | GUI/TransientsWidgets.py | [
"MIT"
] | Python | refresh_transient_list | null | def refresh_transient_list(self):
""" refresh list of transients reported in list_widget"""
# for n, transient in enumerate(self.data):
# self.transientData_list.clear()
self.transientData_list.addItem('test') | refresh list of transients reported in list_widget | refresh list of transients reported in list_widget | [
"refresh",
"list",
"of",
"transients",
"reported",
"in",
"list_widget"
] | def refresh_transient_list(self):
self.transientData_list.addItem('test') | [
"def",
"refresh_transient_list",
"(",
"self",
")",
":",
"self",
".",
"transientData_list",
".",
"addItem",
"(",
"'test'",
")"
] | refresh list of transients reported in list_widget | [
"refresh",
"list",
"of",
"transients",
"reported",
"in",
"list_widget"
] | [
"\"\"\" refresh list of transients reported in list_widget\"\"\"",
"# for n, transient in enumerate(self.data):\r",
"# self.transientData_list.clear()\r"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
89784121f5bfbb678c186d442ee3e33bda0f077d | apokhr/PumpProbe-analysis | GUI/TransientsWidgets.py | [
"MIT"
] | Python | plotScanData | null | def plotScanData(self): # todo: translate for TransientsSet()
""" clears the graph and plots a fresh graph from scanData"""
self.plotWidget.clear()
x = self.scanData.time
y = self.scanData.trace
self.plot = self.plotWidget.plot(x, y, pen=(255, 0, 0)) | clears the graph and plots a fresh graph from scanData | clears the graph and plots a fresh graph from scanData | [
"clears",
"the",
"graph",
"and",
"plots",
"a",
"fresh",
"graph",
"from",
"scanData"
] | def plotScanData(self):
self.plotWidget.clear()
x = self.scanData.time
y = self.scanData.trace
self.plot = self.plotWidget.plot(x, y, pen=(255, 0, 0)) | [
"def",
"plotScanData",
"(",
"self",
")",
":",
"self",
".",
"plotWidget",
".",
"clear",
"(",
")",
"x",
"=",
"self",
".",
"scanData",
".",
"time",
"y",
"=",
"self",
".",
"scanData",
".",
"trace",
"self",
".",
"plot",
"=",
"self",
".",
"plotWidget",
"... | clears the graph and plots a fresh graph from scanData | [
"clears",
"the",
"graph",
"and",
"plots",
"a",
"fresh",
"graph",
"from",
"scanData"
] | [
"# todo: translate for TransientsSet()\r",
"\"\"\" clears the graph and plots a fresh graph from scanData\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
89784121f5bfbb678c186d442ee3e33bda0f077d | apokhr/PumpProbe-analysis | GUI/TransientsWidgets.py | [
"MIT"
] | Python | saveasCSV | null | def saveasCSV(self): # todo: translate for TransientsSet()
"""save object rrScan() to csv"""
savedir = rr.getFolder()
print(savedir)
self.scanData.export_file_csv(savedir) | save object rrScan() to csv | save object rrScan() to csv | [
"save",
"object",
"rrScan",
"()",
"to",
"csv"
] | def saveasCSV(self):
savedir = rr.getFolder()
print(savedir)
self.scanData.export_file_csv(savedir) | [
"def",
"saveasCSV",
"(",
"self",
")",
":",
"savedir",
"=",
"rr",
".",
"getFolder",
"(",
")",
"print",
"(",
"savedir",
")",
"self",
".",
"scanData",
".",
"export_file_csv",
"(",
"savedir",
")"
] | save object rrScan() to csv | [
"save",
"object",
"rrScan",
"()",
"to",
"csv"
] | [
"# todo: translate for TransientsSet()\r",
"\"\"\"save object rrScan() to csv\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
89784121f5bfbb678c186d442ee3e33bda0f077d | apokhr/PumpProbe-analysis | GUI/TransientsWidgets.py | [
"MIT"
] | Python | shift_time_scale | null | def shift_time_scale(self): # todo: translate for TransientsSet(), is it really useful?
"""shift time of scan by timeZero, value given in the QLineEdit shift_time_scale"""
txt = self.shiftTimeZero_input.text()
num = float(txt)
self.timeZero = num
self.scanData.shift_time(se... | shift time of scan by timeZero, value given in the QLineEdit shift_time_scale | shift time of scan by timeZero, value given in the QLineEdit shift_time_scale | [
"shift",
"time",
"of",
"scan",
"by",
"timeZero",
"value",
"given",
"in",
"the",
"QLineEdit",
"shift_time_scale"
] | def shift_time_scale(self):
txt = self.shiftTimeZero_input.text()
num = float(txt)
self.timeZero = num
self.scanData.shift_time(self.timeZero)
self.plotScanData() | [
"def",
"shift_time_scale",
"(",
"self",
")",
":",
"txt",
"=",
"self",
".",
"shiftTimeZero_input",
".",
"text",
"(",
")",
"num",
"=",
"float",
"(",
"txt",
")",
"self",
".",
"timeZero",
"=",
"num",
"self",
".",
"scanData",
".",
"shift_time",
"(",
"self",... | shift time of scan by timeZero, value given in the QLineEdit shift_time_scale | [
"shift",
"time",
"of",
"scan",
"by",
"timeZero",
"value",
"given",
"in",
"the",
"QLineEdit",
"shift_time_scale"
] | [
"# todo: translate for TransientsSet(), is it really useful?\r",
"\"\"\"shift time of scan by timeZero, value given in the QLineEdit shift_time_scale\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
89784121f5bfbb678c186d442ee3e33bda0f077d | apokhr/PumpProbe-analysis | GUI/TransientsWidgets.py | [
"MIT"
] | Python | filter_data_lowpass | null | def filter_data_lowpass(self): # todo: translate for TransientsSet(), is it really useful?
"""get filter frequency from textbox and apply the filter to a single scan"""
freq = float(self.filterLowPassFreq.text())
self.scanData.trace = self.scanData.rawtrace
nyqfreq = self.scanData.n... | get filter frequency from textbox and apply the filter to a single scan | get filter frequency from textbox and apply the filter to a single scan | [
"get",
"filter",
"frequency",
"from",
"textbox",
"and",
"apply",
"the",
"filter",
"to",
"a",
"single",
"scan"
] | def filter_data_lowpass(self):
freq = float(self.filterLowPassFreq.text())
self.scanData.trace = self.scanData.rawtrace
nyqfreq = self.scanData.nyqistFreq()
if freq != 0 and freq < nyqfreq:
cutfactor = freq / nyqfreq
self.scanData.filter_low_pass(cutHigh=cutfact... | [
"def",
"filter_data_lowpass",
"(",
"self",
")",
":",
"freq",
"=",
"float",
"(",
"self",
".",
"filterLowPassFreq",
".",
"text",
"(",
")",
")",
"self",
".",
"scanData",
".",
"trace",
"=",
"self",
".",
"scanData",
".",
"rawtrace",
"nyqfreq",
"=",
"self",
... | get filter frequency from textbox and apply the filter to a single scan | [
"get",
"filter",
"frequency",
"from",
"textbox",
"and",
"apply",
"the",
"filter",
"to",
"a",
"single",
"scan"
] | [
"# todo: translate for TransientsSet(), is it really useful?\r",
"\"\"\"get filter frequency from textbox and apply the filter to a single scan\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
89784121f5bfbb678c186d442ee3e33bda0f077d | apokhr/PumpProbe-analysis | GUI/TransientsWidgets.py | [
"MIT"
] | Python | clearPlot | null | def clearPlot(self): # todo: translate for TransientsSet(), is it really useful?
"""clears all graphs from plot, after asking confermation"""
reply = QW.QMessageBox.question(self, 'Message',
"Are you sure you want to clear the graph completely?", QW.QMessageBo... | clears all graphs from plot, after asking confermation | clears all graphs from plot, after asking confermation | [
"clears",
"all",
"graphs",
"from",
"plot",
"after",
"asking",
"confermation"
] | def clearPlot(self):
reply = QW.QMessageBox.question(self, 'Message',
"Are you sure you want to clear the graph completely?", QW.QMessageBox.Yes |
QW.QMessageBox.No, QW.QMessageBox.No)
if reply == QW.QMessageBox.Yes:
... | [
"def",
"clearPlot",
"(",
"self",
")",
":",
"reply",
"=",
"QW",
".",
"QMessageBox",
".",
"question",
"(",
"self",
",",
"'Message'",
",",
"\"Are you sure you want to clear the graph completely?\"",
",",
"QW",
".",
"QMessageBox",
".",
"Yes",
"|",
"QW",
".",
"QMes... | clears all graphs from plot, after asking confermation | [
"clears",
"all",
"graphs",
"from",
"plot",
"after",
"asking",
"confermation"
] | [
"# todo: translate for TransientsSet(), is it really useful?\r",
"\"\"\"clears all graphs from plot, after asking confermation\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
89784121f5bfbb678c186d442ee3e33bda0f077d | apokhr/PumpProbe-analysis | GUI/TransientsWidgets.py | [
"MIT"
] | Python | plotDataTest | null | def plotDataTest(self): # todo: translate for TransientsSet(), is it really useful?
""" plot a test curve in the plot widget"""
x = np.arange(0, 1000, 1)
noise = np.random.normal(0, 1, 1000) / 1
y = np.sin(x / 10) + noise
self.plot = self.plotWidget.plot(x, y, color='g') | plot a test curve in the plot widget | plot a test curve in the plot widget | [
"plot",
"a",
"test",
"curve",
"in",
"the",
"plot",
"widget"
] | def plotDataTest(self):
x = np.arange(0, 1000, 1)
noise = np.random.normal(0, 1, 1000) / 1
y = np.sin(x / 10) + noise
self.plot = self.plotWidget.plot(x, y, color='g') | [
"def",
"plotDataTest",
"(",
"self",
")",
":",
"x",
"=",
"np",
".",
"arange",
"(",
"0",
",",
"1000",
",",
"1",
")",
"noise",
"=",
"np",
".",
"random",
".",
"normal",
"(",
"0",
",",
"1",
",",
"1000",
")",
"/",
"1",
"y",
"=",
"np",
".",
"sin",... | plot a test curve in the plot widget | [
"plot",
"a",
"test",
"curve",
"in",
"the",
"plot",
"widget"
] | [
"# todo: translate for TransientsSet(), is it really useful?\r",
"\"\"\" plot a test curve in the plot widget\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
89784121f5bfbb678c186d442ee3e33bda0f077d | apokhr/PumpProbe-analysis | GUI/TransientsWidgets.py | [
"MIT"
] | Python | saveasCSV | null | def saveasCSV(self):
"""save object rrScan() to csv"""
savedir = rr.getFolder()
print(savedir)
self.scanData.export_file_csv(savedir) | save object rrScan() to csv | save object rrScan() to csv | [
"save",
"object",
"rrScan",
"()",
"to",
"csv"
] | def saveasCSV(self):
savedir = rr.getFolder()
print(savedir)
self.scanData.export_file_csv(savedir) | [
"def",
"saveasCSV",
"(",
"self",
")",
":",
"savedir",
"=",
"rr",
".",
"getFolder",
"(",
")",
"print",
"(",
"savedir",
")",
"self",
".",
"scanData",
".",
"export_file_csv",
"(",
"savedir",
")"
] | save object rrScan() to csv | [
"save",
"object",
"rrScan",
"()",
"to",
"csv"
] | [
"\"\"\"save object rrScan() to csv\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af2894771640ab15399eb8b9d5c583f510e3bd3b | apokhr/PumpProbe-analysis | GUI/rrWidgets.py | [
"MIT"
] | Python | shiftTimeZero | null | def shiftTimeZero(self):
'''shift time of scan by timeZero, value given in the QLineEdit shift_time_scale'''
txt = self.shiftTimeZero_input.text()
num = float(txt)
self.timeZero = num
self.scanData.shiftTime(self.timeZero)
self.plotScanData() | shift time of scan by timeZero, value given in the QLineEdit shift_time_scale | shift time of scan by timeZero, value given in the QLineEdit shift_time_scale | [
"shift",
"time",
"of",
"scan",
"by",
"timeZero",
"value",
"given",
"in",
"the",
"QLineEdit",
"shift_time_scale"
] | def shiftTimeZero(self):
txt = self.shiftTimeZero_input.text()
num = float(txt)
self.timeZero = num
self.scanData.shiftTime(self.timeZero)
self.plotScanData() | [
"def",
"shiftTimeZero",
"(",
"self",
")",
":",
"txt",
"=",
"self",
".",
"shiftTimeZero_input",
".",
"text",
"(",
")",
"num",
"=",
"float",
"(",
"txt",
")",
"self",
".",
"timeZero",
"=",
"num",
"self",
".",
"scanData",
".",
"shiftTime",
"(",
"self",
"... | shift time of scan by timeZero, value given in the QLineEdit shift_time_scale | [
"shift",
"time",
"of",
"scan",
"by",
"timeZero",
"value",
"given",
"in",
"the",
"QLineEdit",
"shift_time_scale"
] | [
"'''shift time of scan by timeZero, value given in the QLineEdit shift_time_scale'''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af2894771640ab15399eb8b9d5c583f510e3bd3b | apokhr/PumpProbe-analysis | GUI/rrWidgets.py | [
"MIT"
] | Python | applyFilter | null | def applyFilter(self):
'''get filter frequency from textbox and apply the filter to a single scan'''
freq = float(self.filterLowPassFreq.text())
self.scanData.trace = self.scanData.rawtrace
nyqfreq = self.scanData.nyqistFreq()
if freq != 0 and freq < nyqfreq:
... | get filter frequency from textbox and apply the filter to a single scan | get filter frequency from textbox and apply the filter to a single scan | [
"get",
"filter",
"frequency",
"from",
"textbox",
"and",
"apply",
"the",
"filter",
"to",
"a",
"single",
"scan"
] | def applyFilter(self):
freq = float(self.filterLowPassFreq.text())
self.scanData.trace = self.scanData.rawtrace
nyqfreq = self.scanData.nyqistFreq()
if freq != 0 and freq < nyqfreq:
cutfactor = freq / nyqfreq
self.scanData.filterit(cutHigh=cutfactor)
self.... | [
"def",
"applyFilter",
"(",
"self",
")",
":",
"freq",
"=",
"float",
"(",
"self",
".",
"filterLowPassFreq",
".",
"text",
"(",
")",
")",
"self",
".",
"scanData",
".",
"trace",
"=",
"self",
".",
"scanData",
".",
"rawtrace",
"nyqfreq",
"=",
"self",
".",
"... | get filter frequency from textbox and apply the filter to a single scan | [
"get",
"filter",
"frequency",
"from",
"textbox",
"and",
"apply",
"the",
"filter",
"to",
"a",
"single",
"scan"
] | [
"'''get filter frequency from textbox and apply the filter to a single scan'''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af2894771640ab15399eb8b9d5c583f510e3bd3b | apokhr/PumpProbe-analysis | GUI/rrWidgets.py | [
"MIT"
] | Python | plotScanData | null | def plotScanData(self):
""" clears the graph and plots a fresh graph from scanData"""
self.plotWidget.clear()
x = self.scanData.time
y = self.scanData.trace
self.plot = self.plotWidget.plot(x,y, pen=(255,0,0)) | clears the graph and plots a fresh graph from scanData | clears the graph and plots a fresh graph from scanData | [
"clears",
"the",
"graph",
"and",
"plots",
"a",
"fresh",
"graph",
"from",
"scanData"
] | def plotScanData(self):
self.plotWidget.clear()
x = self.scanData.time
y = self.scanData.trace
self.plot = self.plotWidget.plot(x,y, pen=(255,0,0)) | [
"def",
"plotScanData",
"(",
"self",
")",
":",
"self",
".",
"plotWidget",
".",
"clear",
"(",
")",
"x",
"=",
"self",
".",
"scanData",
".",
"time",
"y",
"=",
"self",
".",
"scanData",
".",
"trace",
"self",
".",
"plot",
"=",
"self",
".",
"plotWidget",
"... | clears the graph and plots a fresh graph from scanData | [
"clears",
"the",
"graph",
"and",
"plots",
"a",
"fresh",
"graph",
"from",
"scanData"
] | [
"\"\"\" clears the graph and plots a fresh graph from scanData\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af2894771640ab15399eb8b9d5c583f510e3bd3b | apokhr/PumpProbe-analysis | GUI/rrWidgets.py | [
"MIT"
] | Python | clearPlot | null | def clearPlot(self):
"""clears all graphs from plot, after asking confermation"""
reply = qw.QMessageBox.question(self, 'Message',
"Are you sure you want to clear the graph completely?", qw.QMessageBox.Yes |
qw.QMessageBox.No, qw.QMessageBox.No)
if reply == qw.QMes... | clears all graphs from plot, after asking confermation | clears all graphs from plot, after asking confermation | [
"clears",
"all",
"graphs",
"from",
"plot",
"after",
"asking",
"confermation"
] | def clearPlot(self):
reply = qw.QMessageBox.question(self, 'Message',
"Are you sure you want to clear the graph completely?", qw.QMessageBox.Yes |
qw.QMessageBox.No, qw.QMessageBox.No)
if reply == qw.QMessageBox.Yes:
self.plotWidget.clear() | [
"def",
"clearPlot",
"(",
"self",
")",
":",
"reply",
"=",
"qw",
".",
"QMessageBox",
".",
"question",
"(",
"self",
",",
"'Message'",
",",
"\"Are you sure you want to clear the graph completely?\"",
",",
"qw",
".",
"QMessageBox",
".",
"Yes",
"|",
"qw",
".",
"QMes... | clears all graphs from plot, after asking confermation | [
"clears",
"all",
"graphs",
"from",
"plot",
"after",
"asking",
"confermation"
] | [
"\"\"\"clears all graphs from plot, after asking confermation\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af2894771640ab15399eb8b9d5c583f510e3bd3b | apokhr/PumpProbe-analysis | GUI/rrWidgets.py | [
"MIT"
] | Python | plotDataTest | null | def plotDataTest(self):
""" plot a test curve in the plot widget"""
x = np.arange(0,1000,1)
noise = np.random.normal(0,1,1000)/1
y = np.sin(x/10)+noise
self.plot = self.plotWidget.plot(x,y, color='g') | plot a test curve in the plot widget | plot a test curve in the plot widget | [
"plot",
"a",
"test",
"curve",
"in",
"the",
"plot",
"widget"
] | def plotDataTest(self):
x = np.arange(0,1000,1)
noise = np.random.normal(0,1,1000)/1
y = np.sin(x/10)+noise
self.plot = self.plotWidget.plot(x,y, color='g') | [
"def",
"plotDataTest",
"(",
"self",
")",
":",
"x",
"=",
"np",
".",
"arange",
"(",
"0",
",",
"1000",
",",
"1",
")",
"noise",
"=",
"np",
".",
"random",
".",
"normal",
"(",
"0",
",",
"1",
",",
"1000",
")",
"/",
"1",
"y",
"=",
"np",
".",
"sin",... | plot a test curve in the plot widget | [
"plot",
"a",
"test",
"curve",
"in",
"the",
"plot",
"widget"
] | [
"\"\"\" plot a test curve in the plot widget\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af2894771640ab15399eb8b9d5c583f510e3bd3b | apokhr/PumpProbe-analysis | GUI/rrWidgets.py | [
"MIT"
] | Python | importFile | null | def importFile(self):
'''import a single file form either .mat or .txt (csv) format'''
self.scanData = rr.rrScan()
filename = self.openFileNameDialog()
self.scanData.importFile(filename)
self.scanData.initParameters()
self.fetchMetadata()
self.plotScanData(... | import a single file form either .mat or .txt (csv) format | import a single file form either .mat or .txt (csv) format | [
"import",
"a",
"single",
"file",
"form",
"either",
".",
"mat",
"or",
".",
"txt",
"(",
"csv",
")",
"format"
] | def importFile(self):
self.scanData = rr.rrScan()
filename = self.openFileNameDialog()
self.scanData.importFile(filename)
self.scanData.initParameters()
self.fetchMetadata()
self.plotScanData() | [
"def",
"importFile",
"(",
"self",
")",
":",
"self",
".",
"scanData",
"=",
"rr",
".",
"rrScan",
"(",
")",
"filename",
"=",
"self",
".",
"openFileNameDialog",
"(",
")",
"self",
".",
"scanData",
".",
"importFile",
"(",
"filename",
")",
"self",
".",
"scanD... | import a single file form either .mat or .txt (csv) format | [
"import",
"a",
"single",
"file",
"form",
"either",
".",
"mat",
"or",
".",
"txt",
"(",
"csv",
")",
"format"
] | [
"'''import a single file form either .mat or .txt (csv) format'''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af2894771640ab15399eb8b9d5c583f510e3bd3b | apokhr/PumpProbe-analysis | GUI/rrWidgets.py | [
"MIT"
] | Python | saveasCSV | null | def saveasCSV(self):
'''save object rrScan() to csv'''
savedir = rr.getFolder()
print(savedir)
self.scanData.exportCSV(savedir) | save object rrScan() to csv | save object rrScan() to csv | [
"save",
"object",
"rrScan",
"()",
"to",
"csv"
] | def saveasCSV(self):
savedir = rr.getFolder()
print(savedir)
self.scanData.exportCSV(savedir) | [
"def",
"saveasCSV",
"(",
"self",
")",
":",
"savedir",
"=",
"rr",
".",
"getFolder",
"(",
")",
"print",
"(",
"savedir",
")",
"self",
".",
"scanData",
".",
"exportCSV",
"(",
"savedir",
")"
] | save object rrScan() to csv | [
"save",
"object",
"rrScan",
"()",
"to",
"csv"
] | [
"'''save object rrScan() to csv'''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | calc_energy_densities | null | def calc_energy_densities(self, rep_rate=283000):
""" recalculate metadata depending on given parameters.
it calculates energy densities
"""
beams = ['pump', 'probe', 'destruction']
for beam in beams:
if getattr(self, (beam + '_spot')) is None:
pa... | recalculate metadata depending on given parameters.
it calculates energy densities
| recalculate metadata depending on given parameters.
it calculates energy densities | [
"recalculate",
"metadata",
"depending",
"on",
"given",
"parameters",
".",
"it",
"calculates",
"energy",
"densities"
] | def calc_energy_densities(self, rep_rate=283000):
beams = ['pump', 'probe', 'destruction']
for beam in beams:
if getattr(self, (beam + '_spot')) is None:
pass
else:
power = getattr(self, (beam + '_power'))
spot = getattr(self, (beam... | [
"def",
"calc_energy_densities",
"(",
"self",
",",
"rep_rate",
"=",
"283000",
")",
":",
"beams",
"=",
"[",
"'pump'",
",",
"'probe'",
",",
"'destruction'",
"]",
"for",
"beam",
"in",
"beams",
":",
"if",
"getattr",
"(",
"self",
",",
"(",
"beam",
"+",
"'_sp... | recalculate metadata depending on given parameters. | [
"recalculate",
"metadata",
"depending",
"on",
"given",
"parameters",
"."
] | [
"\"\"\" recalculate metadata depending on given parameters.\n it calculates energy densities\n \"\"\"",
"# pump has half reprate (darkcontrol)"
] | [
{
"param": "self",
"type": null
},
{
"param": "rep_rate",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rep_rate",
"type": null,
"docstring": null,
"docstring_tokens... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | input_attribute | null | def input_attribute(self, attribute_name, value):
"""
manually input values for metadata attributes
:param attribute_name: name of parameter or attribute
:param value: value to assign to parameter
"""
setattr(self, attribute_name, value) |
manually input values for metadata attributes
:param attribute_name: name of parameter or attribute
:param value: value to assign to parameter
| manually input values for metadata attributes | [
"manually",
"input",
"values",
"for",
"metadata",
"attributes"
] | def input_attribute(self, attribute_name, value):
setattr(self, attribute_name, value) | [
"def",
"input_attribute",
"(",
"self",
",",
"attribute_name",
",",
"value",
")",
":",
"setattr",
"(",
"self",
",",
"attribute_name",
",",
"value",
")"
] | manually input values for metadata attributes | [
"manually",
"input",
"values",
"for",
"metadata",
"attributes"
] | [
"\"\"\"\n manually input values for metadata attributes\n :param attribute_name: name of parameter or attribute\n :param value: value to assign to parameter\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "attribute_name",
"type": null
},
{
"param": "value",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "attribute_name",
"type": null,
"docstring": "name of parameter or a... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | log_it | null | def log_it(self, keyword, overwrite=False, *args, **kargs):
"""
Generate log entry for analysis_log.
creates a key with given key in analysis_log, making it:
- boolean if no other args or kargs are given, flips previous values written in log
- list if *args ar... |
Generate log entry for analysis_log.
creates a key with given key in analysis_log, making it:
- boolean if no other args or kargs are given, flips previous values written in log
- list if *args are passed
- dictionary if **kargs are passed
... | Generate log entry for analysis_log.
creates a key with given key in analysis_log, making it:
boolean if no other args or kargs are given, flips previous values written in log
list if *args are passed
dictionary if **kargs are passed
if overwrite is False, it appends values on previous logs,
if True, it obviously overw... | [
"Generate",
"log",
"entry",
"for",
"analysis_log",
".",
"creates",
"a",
"key",
"with",
"given",
"key",
"in",
"analysis_log",
"making",
"it",
":",
"boolean",
"if",
"no",
"other",
"args",
"or",
"kargs",
"are",
"given",
"flips",
"previous",
"values",
"written",... | def log_it(self, keyword, overwrite=False, *args, **kargs):
if kargs or args:
if kargs:
entry = {}
for key in kargs:
entry[key] = kargs[key]
if args:
entry = []
for arg in args:
entry.appe... | [
"def",
"log_it",
"(",
"self",
",",
"keyword",
",",
"overwrite",
"=",
"False",
",",
"*",
"args",
",",
"**",
"kargs",
")",
":",
"if",
"kargs",
"or",
"args",
":",
"if",
"kargs",
":",
"entry",
"=",
"{",
"}",
"for",
"key",
"in",
"kargs",
":",
"entry",... | Generate log entry for analysis_log. | [
"Generate",
"log",
"entry",
"for",
"analysis_log",
"."
] | [
"\"\"\"\n Generate log entry for analysis_log.\n creates a key with given key in analysis_log, making it:\n - boolean if no other args or kargs are given, flips previous values written in log\n - list if *args are passed\n - dictionary if **kargs are pa... | [
{
"param": "self",
"type": null
},
{
"param": "keyword",
"type": null
},
{
"param": "overwrite",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "keyword",
"type": null,
"docstring": null,
"docstring_tokens"... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | give_name | null | def give_name(self):
"""Define name attribute as material_date."""
if self.key_parameter is None:
self.key_parameter = input('What is the Key parameter for basename? ')
if self.description is None:
self.description = input('Add brief description for file name: ')
... | Define name attribute as material_date. | Define name attribute as material_date. | [
"Define",
"name",
"attribute",
"as",
"material_date",
"."
] | def give_name(self):
if self.key_parameter is None:
self.key_parameter = input('What is the Key parameter for basename? ')
if self.description is None:
self.description = input('Add brief description for file name: ')
self.name = (str(self.material) + '_' +
... | [
"def",
"give_name",
"(",
"self",
")",
":",
"if",
"self",
".",
"key_parameter",
"is",
"None",
":",
"self",
".",
"key_parameter",
"=",
"input",
"(",
"'What is the Key parameter for basename? '",
")",
"if",
"self",
".",
"description",
"is",
"None",
":",
"self",
... | Define name attribute as material_date. | [
"Define",
"name",
"attribute",
"as",
"material_date",
"."
] | [
"\"\"\"Define name attribute as material_date.\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | import_file | null | def import_file(self, filepath, cleanData=True, key_parameter=None, description=None, silent=True, **kwargs):
"""
Imports a file, .mat or .csv, using self.import_file_mat() and self.import_file_csv methods respectively.
:param filepath
path to file
:param cleanData:
... |
Imports a file, .mat or .csv, using self.import_file_mat() and self.import_file_csv methods respectively.
:param filepath
path to file
:param cleanData:
run the cleanData method, including fltering, baseline removal, setting timezero and others.
:param key_parame... | Imports a file, .mat or .csv, using self.import_file_mat() and self.import_file_csv methods respectively.
:param filepath
path to file
:param cleanData:
run the cleanData method, including fltering, baseline removal, setting timezero and others.
:param key_parameter
sets the key parameter
:param description
brief descr... | [
"Imports",
"a",
"file",
".",
"mat",
"or",
".",
"csv",
"using",
"self",
".",
"import_file_mat",
"()",
"and",
"self",
".",
"import_file_csv",
"methods",
"respectively",
".",
":",
"param",
"filepath",
"path",
"to",
"file",
":",
"param",
"cleanData",
":",
"run... | def import_file(self, filepath, cleanData=True, key_parameter=None, description=None, silent=True, **kwargs):
try:
ext = os.path.splitext(filepath)[-1].lower()
basename = os.path.basename(filepath)
if ext == '.mat':
try:
self.import_file_... | [
"def",
"import_file",
"(",
"self",
",",
"filepath",
",",
"cleanData",
"=",
"True",
",",
"key_parameter",
"=",
"None",
",",
"description",
"=",
"None",
",",
"silent",
"=",
"True",
",",
"**",
"kwargs",
")",
":",
"try",
":",
"ext",
"=",
"os",
".",
"path... | Imports a file, .mat or .csv, using self.import_file_mat() and self.import_file_csv methods respectively. | [
"Imports",
"a",
"file",
".",
"mat",
"or",
".",
"csv",
"using",
"self",
".",
"import_file_mat",
"()",
"and",
"self",
".",
"import_file_csv",
"methods",
"respectively",
"."
] | [
"\"\"\"\n Imports a file, .mat or .csv, using self.import_file_mat() and self.import_file_csv methods respectively.\n :param filepath\n path to file\n :param cleanData:\n run the cleanData method, including fltering, baseline removal, setting timezero and others.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "filepath",
"type": null
},
{
"param": "cleanData",
"type": null
},
{
"param": "key_parameter",
"type": null
},
{
"param": "description",
"type": null
},
{
"param": "silent",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filepath",
"type": null,
"docstring": null,
"docstring_tokens... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | import_file_mat | null | def import_file_mat(self, filepath):
"""Import data from a raw .mat file generated by redred software.
extracts data about raw_time raw_trace and R0.
"""
self.original_filepath = filepath
data = spio.loadmat(filepath)
try: # if it finds the right data structure
... | Import data from a raw .mat file generated by redred software.
extracts data about raw_time raw_trace and R0.
| Import data from a raw .mat file generated by redred software.
extracts data about raw_time raw_trace and R0. | [
"Import",
"data",
"from",
"a",
"raw",
".",
"mat",
"file",
"generated",
"by",
"redred",
"software",
".",
"extracts",
"data",
"about",
"raw_time",
"raw_trace",
"and",
"R0",
"."
] | def import_file_mat(self, filepath):
self.original_filepath = filepath
data = spio.loadmat(filepath)
try:
self.raw_time = data['Daten'][2]
self.raw_trace = data['Daten'][0]
self.R0 = data['DC'][0][0]
metadataDict = utils.get_metadata_from_name(fi... | [
"def",
"import_file_mat",
"(",
"self",
",",
"filepath",
")",
":",
"self",
".",
"original_filepath",
"=",
"filepath",
"data",
"=",
"spio",
".",
"loadmat",
"(",
"filepath",
")",
"try",
":",
"self",
".",
"raw_time",
"=",
"data",
"[",
"'Daten'",
"]",
"[",
... | Import data from a raw .mat file generated by redred software. | [
"Import",
"data",
"from",
"a",
"raw",
".",
"mat",
"file",
"generated",
"by",
"redred",
"software",
"."
] | [
"\"\"\"Import data from a raw .mat file generated by redred software.\n extracts data about raw_time raw_trace and R0.\n\n \"\"\"",
"# if it finds the right data structure",
"# get all metadata from name",
"# todo: add eventual non scripted parameters",
"# write metadata to relative attributes... | [
{
"param": "self",
"type": null
},
{
"param": "filepath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filepath",
"type": null,
"docstring": null,
"docstring_tokens... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | import_file_csv | null | def import_file_csv(self, filepath):
"""
Import data from a .txt file containing metadata in the header.
Metadata should be coded as variable names from this class:
material, date, pump_power, temperature, probe_polarization etc...
Data expected is 4 couloms: raw_time, raw_t... |
Import data from a .txt file containing metadata in the header.
Metadata should be coded as variable names from this class:
material, date, pump_power, temperature, probe_polarization etc...
Data expected is 4 couloms: raw_time, raw_trace, time, trace.
filepath should full... | Import data from a .txt file containing metadata in the header.
Metadata should be coded as variable names from this class:
material, date, pump_power, temperature, probe_polarization etc
Data expected is 4 couloms: raw_time, raw_trace, time, trace.
filepath should full path to file as string. | [
"Import",
"data",
"from",
"a",
".",
"txt",
"file",
"containing",
"metadata",
"in",
"the",
"header",
".",
"Metadata",
"should",
"be",
"coded",
"as",
"variable",
"names",
"from",
"this",
"class",
":",
"material",
"date",
"pump_power",
"temperature",
"probe_polar... | def import_file_csv(self, filepath):
attributes = self.__dict__
parameters = []
for attribute in attributes:
if attribute not in self.DATA_ATTRIBUTES:
parameters.append(attribute)
with open(filepath, 'r') as f:
n = 0
for l in f:
... | [
"def",
"import_file_csv",
"(",
"self",
",",
"filepath",
")",
":",
"attributes",
"=",
"self",
".",
"__dict__",
"parameters",
"=",
"[",
"]",
"for",
"attribute",
"in",
"attributes",
":",
"if",
"attribute",
"not",
"in",
"self",
".",
"DATA_ATTRIBUTES",
":",
"pa... | Import data from a .txt file containing metadata in the header. | [
"Import",
"data",
"from",
"a",
".",
"txt",
"file",
"containing",
"metadata",
"in",
"the",
"header",
"."
] | [
"\"\"\"\n Import data from a .txt file containing metadata in the header.\n\n Metadata should be coded as variable names from this class:\n material, date, pump_power, temperature, probe_polarization etc...\n Data expected is 4 couloms: raw_time, raw_trace, time, trace.\n\n fi... | [
{
"param": "self",
"type": null
},
{
"param": "filepath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filepath",
"type": null,
"docstring": null,
"docstring_tokens... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | export_file_csv | null | def export_file_csv(self, directory):
"""
save Transient() to a .txt file in csv format (data)
Metadata header is in tab separated values, generated as 'name': 'value' 'unit'
data is comma separated values, as raw_time, raw_trace, time, trace.
Metadata is obtained from get_metad... |
save Transient() to a .txt file in csv format (data)
Metadata header is in tab separated values, generated as 'name': 'value' 'unit'
data is comma separated values, as raw_time, raw_trace, time, trace.
Metadata is obtained from get_metadata(), resulting in all non0 parameters available... |
Metadata is obtained from get_metadata(), resulting in all non0 parameters available. | [
"Metadata",
"is",
"obtained",
"from",
"get_metadata",
"()",
"resulting",
"in",
"all",
"non0",
"parameters",
"available",
"."
] | def export_file_csv(self, directory):
print('Exporting {0}'.format(self.name))
metadata = self.get_metadata()
logDict = metadata.pop('analysis_log', None)
logDict.pop('', None)
name = metadata.pop('name', None)
original_filepath = metadata.pop('original_filepath', Non... | [
"def",
"export_file_csv",
"(",
"self",
",",
"directory",
")",
":",
"print",
"(",
"'Exporting {0}'",
".",
"format",
"(",
"self",
".",
"name",
")",
")",
"metadata",
"=",
"self",
".",
"get_metadata",
"(",
")",
"logDict",
"=",
"metadata",
".",
"pop",
"(",
... | save Transient() to a .txt file in csv format (data)
Metadata header is in tab separated values, generated as 'name': 'value' 'unit'
data is comma separated values, as raw_time, raw_trace, time, trace. | [
"save",
"Transient",
"()",
"to",
"a",
".",
"txt",
"file",
"in",
"csv",
"format",
"(",
"data",
")",
"Metadata",
"header",
"is",
"in",
"tab",
"separated",
"values",
"generated",
"as",
"'",
"name",
"'",
":",
"'",
"value",
"'",
"'",
"unit",
"'",
"data",
... | [
"\"\"\"\n save Transient() to a .txt file in csv format (data)\n Metadata header is in tab separated values, generated as 'name': 'value' 'unit'\n data is comma separated values, as raw_time, raw_trace, time, trace.\n\n Metadata is obtained from get_metadata(), resulting in all non0 para... | [
{
"param": "self",
"type": null
},
{
"param": "directory",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "directory",
"type": null,
"docstring": null,
"docstring_token... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | clean_data | null | def clean_data(self, cropTimeScale=True, shiftTime=0, flipTime=True, removeDC=True, filterLowPass=True,
flipTrace=False):
"""Perform a standard set of data cleaning, good for quick plotting and test purposes."""
if cropTimeScale:
self.crop_time_scale()
if shiftTime... | Perform a standard set of data cleaning, good for quick plotting and test purposes. | Perform a standard set of data cleaning, good for quick plotting and test purposes. | [
"Perform",
"a",
"standard",
"set",
"of",
"data",
"cleaning",
"good",
"for",
"quick",
"plotting",
"and",
"test",
"purposes",
"."
] | def clean_data(self, cropTimeScale=True, shiftTime=0, flipTime=True, removeDC=True, filterLowPass=True,
flipTrace=False):
if cropTimeScale:
self.crop_time_scale()
if shiftTime:
self.shift_time(shiftTime)
if filterLowPass:
self.filter_low_pas... | [
"def",
"clean_data",
"(",
"self",
",",
"cropTimeScale",
"=",
"True",
",",
"shiftTime",
"=",
"0",
",",
"flipTime",
"=",
"True",
",",
"removeDC",
"=",
"True",
",",
"filterLowPass",
"=",
"True",
",",
"flipTrace",
"=",
"False",
")",
":",
"if",
"cropTimeScale... | Perform a standard set of data cleaning, good for quick plotting and test purposes. | [
"Perform",
"a",
"standard",
"set",
"of",
"data",
"cleaning",
"good",
"for",
"quick",
"plotting",
"and",
"test",
"purposes",
"."
] | [
"\"\"\"Perform a standard set of data cleaning, good for quick plotting and test purposes.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "cropTimeScale",
"type": null
},
{
"param": "shiftTime",
"type": null
},
{
"param": "flipTime",
"type": null
},
{
"param": "removeDC",
"type": null
},
{
"param": "filterLowPass",
"type": null
},
{
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cropTimeScale",
"type": null,
"docstring": null,
"docstring_t... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | crop_time_scale | null | def crop_time_scale(self): # todo: fix the overwriting issue
"""chops time scale to the monotonous central behaviour, deleting the wierd ends.
ATTENTION: overwrites self.time and self.trace, deleting any previous changes"""
# clear previous time and trace, and the analysis log since it goes lo... | chops time scale to the monotonous central behaviour, deleting the wierd ends.
ATTENTION: overwrites self.time and self.trace, deleting any previous changes | chops time scale to the monotonous central behaviour, deleting the wierd ends. | [
"chops",
"time",
"scale",
"to",
"the",
"monotonous",
"central",
"behaviour",
"deleting",
"the",
"wierd",
"ends",
"."
] | def crop_time_scale(self):
self.analysis_log = {}
self.time = []
self.trace = []
maxT = max(self.raw_time)
minT = min(self.raw_time)
if self.raw_time[0] < self.raw_time[1]:
start = 0
while self.raw_time[start] < maxT:
start +=... | [
"def",
"crop_time_scale",
"(",
"self",
")",
":",
"self",
".",
"analysis_log",
"=",
"{",
"}",
"self",
".",
"time",
"=",
"[",
"]",
"self",
".",
"trace",
"=",
"[",
"]",
"maxT",
"=",
"max",
"(",
"self",
".",
"raw_time",
")",
"minT",
"=",
"min",
"(",
... | chops time scale to the monotonous central behaviour, deleting the wierd ends. | [
"chops",
"time",
"scale",
"to",
"the",
"monotonous",
"central",
"behaviour",
"deleting",
"the",
"wierd",
"ends",
"."
] | [
"# todo: fix the overwriting issue",
"\"\"\"chops time scale to the monotonous central behaviour, deleting the wierd ends.\n ATTENTION: overwrites self.time and self.trace, deleting any previous changes\"\"\"",
"# clear previous time and trace, and the analysis log since it goes lost",
"# reset log",
... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | shift_time | null | def shift_time(self, tshift):
""" Shift time scale by tshift. Changes time zero
writes to analysis_log the shifted value, or increases it if already present"""
self.time = np.array(self.time) - tshift
self.log_it('Shift Time', tshift) | Shift time scale by tshift. Changes time zero
writes to analysis_log the shifted value, or increases it if already present | Shift time scale by tshift. Changes time zero
writes to analysis_log the shifted value, or increases it if already present | [
"Shift",
"time",
"scale",
"by",
"tshift",
".",
"Changes",
"time",
"zero",
"writes",
"to",
"analysis_log",
"the",
"shifted",
"value",
"or",
"increases",
"it",
"if",
"already",
"present"
] | def shift_time(self, tshift):
self.time = np.array(self.time) - tshift
self.log_it('Shift Time', tshift) | [
"def",
"shift_time",
"(",
"self",
",",
"tshift",
")",
":",
"self",
".",
"time",
"=",
"np",
".",
"array",
"(",
"self",
".",
"time",
")",
"-",
"tshift",
"self",
".",
"log_it",
"(",
"'Shift Time'",
",",
"tshift",
")"
] | Shift time scale by tshift. | [
"Shift",
"time",
"scale",
"by",
"tshift",
"."
] | [
"\"\"\" Shift time scale by tshift. Changes time zero\n writes to analysis_log the shifted value, or increases it if already present\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tshift",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tshift",
"type": null,
"docstring": null,
"docstring_tokens":... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | flip_time | null | def flip_time(self):
""" Flip time scale: t = -t
also reverts order in the array"""
self.time = self.time[::-1]
self.time = -np.array(self.time)
self.trace = self.trace[::-1]
self.log_it('Flip Time') | Flip time scale: t = -t
also reverts order in the array | Flip time scale: t = -t
also reverts order in the array | [
"Flip",
"time",
"scale",
":",
"t",
"=",
"-",
"t",
"also",
"reverts",
"order",
"in",
"the",
"array"
] | def flip_time(self):
self.time = self.time[::-1]
self.time = -np.array(self.time)
self.trace = self.trace[::-1]
self.log_it('Flip Time') | [
"def",
"flip_time",
"(",
"self",
")",
":",
"self",
".",
"time",
"=",
"self",
".",
"time",
"[",
":",
":",
"-",
"1",
"]",
"self",
".",
"time",
"=",
"-",
"np",
".",
"array",
"(",
"self",
".",
"time",
")",
"self",
".",
"trace",
"=",
"self",
".",
... | Flip time scale: t = -t
also reverts order in the array | [
"Flip",
"time",
"scale",
":",
"t",
"=",
"-",
"t",
"also",
"reverts",
"order",
"in",
"the",
"array"
] | [
"\"\"\" Flip time scale: t = -t\n also reverts order in the array\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | remove_DC_offset | null | def remove_DC_offset(self, window=40): # todo: change range in case of flipped scan!!!
"""Remove DC offset.
offset is caluclated with 40 points (~700fs) taken at negative time delays.
such delay is at the end of the scan in raw data, or at the beginning
if scan was reverted by flip_time... | Remove DC offset.
offset is caluclated with 40 points (~700fs) taken at negative time delays.
such delay is at the end of the scan in raw data, or at the beginning
if scan was reverted by flip_time | Remove DC offset.
offset is caluclated with 40 points (~700fs) taken at negative time delays.
such delay is at the end of the scan in raw data, or at the beginning
if scan was reverted by flip_time | [
"Remove",
"DC",
"offset",
".",
"offset",
"is",
"caluclated",
"with",
"40",
"points",
"(",
"~700fs",
")",
"taken",
"at",
"negative",
"time",
"delays",
".",
"such",
"delay",
"is",
"at",
"the",
"end",
"of",
"the",
"scan",
"in",
"raw",
"data",
"or",
"at",
... | def remove_DC_offset(self, window=40):
try:
reverted = self.analysis_log['Flip Time']
except KeyError:
reverted = False
if reverted:
shift = np.average(self.trace[0:window:1])
else:
tpoints = len(self.time)
shift = np.average(... | [
"def",
"remove_DC_offset",
"(",
"self",
",",
"window",
"=",
"40",
")",
":",
"try",
":",
"reverted",
"=",
"self",
".",
"analysis_log",
"[",
"'Flip Time'",
"]",
"except",
"KeyError",
":",
"reverted",
"=",
"False",
"if",
"reverted",
":",
"shift",
"=",
"np",... | Remove DC offset. | [
"Remove",
"DC",
"offset",
"."
] | [
"# todo: change range in case of flipped scan!!!",
"\"\"\"Remove DC offset.\n offset is caluclated with 40 points (~700fs) taken at negative time delays.\n such delay is at the end of the scan in raw data, or at the beginning\n if scan was reverted by flip_time \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "window",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "window",
"type": null,
"docstring": null,
"docstring_tokens":... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | normalize_to_parameter | null | def normalize_to_parameter(self, parameter):
""" Normalize scan by dividing by its pump power value"""
if getattr(self, parameter):
if getattr(self, parameter) != 0:
self.trace = self.trace / getattr(self, parameter)
else:
print('Normalization failed: inva... | Normalize scan by dividing by its pump power value | Normalize scan by dividing by its pump power value | [
"Normalize",
"scan",
"by",
"dividing",
"by",
"its",
"pump",
"power",
"value"
] | def normalize_to_parameter(self, parameter):
if getattr(self, parameter):
if getattr(self, parameter) != 0:
self.trace = self.trace / getattr(self, parameter)
else:
print('Normalization failed: invalid parameter name')
logkey = 'Normalized by ' + parameter... | [
"def",
"normalize_to_parameter",
"(",
"self",
",",
"parameter",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"parameter",
")",
":",
"if",
"getattr",
"(",
"self",
",",
"parameter",
")",
"!=",
"0",
":",
"self",
".",
"trace",
"=",
"self",
".",
"trace",
... | Normalize scan by dividing by its pump power value | [
"Normalize",
"scan",
"by",
"dividing",
"by",
"its",
"pump",
"power",
"value"
] | [
"\"\"\" Normalize scan by dividing by its pump power value\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "parameter",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "parameter",
"type": null,
"docstring": null,
"docstring_token... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | quickplot | null | def quickplot(self, xlabel='Time [ps]', ylabel='Trace', fntsize=15, title='Transient', clear=False, raw=False):
"""Generates a quick simple plot with matplotlib """
if clear: plt.clf()
quickplotfig = plt.figure(num=1)
ax = quickplotfig.add_subplot(111)
if raw:
ax.plot... | Generates a quick simple plot with matplotlib | Generates a quick simple plot with matplotlib | [
"Generates",
"a",
"quick",
"simple",
"plot",
"with",
"matplotlib"
] | def quickplot(self, xlabel='Time [ps]', ylabel='Trace', fntsize=15, title='Transient', clear=False, raw=False):
if clear: plt.clf()
quickplotfig = plt.figure(num=1)
ax = quickplotfig.add_subplot(111)
if raw:
ax.plot(self.raw_time, self.raw_trace, 'o')
else:
... | [
"def",
"quickplot",
"(",
"self",
",",
"xlabel",
"=",
"'Time [ps]'",
",",
"ylabel",
"=",
"'Trace'",
",",
"fntsize",
"=",
"15",
",",
"title",
"=",
"'Transient'",
",",
"clear",
"=",
"False",
",",
"raw",
"=",
"False",
")",
":",
"if",
"clear",
":",
"plt",... | Generates a quick simple plot with matplotlib | [
"Generates",
"a",
"quick",
"simple",
"plot",
"with",
"matplotlib"
] | [
"\"\"\"Generates a quick simple plot with matplotlib \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "xlabel",
"type": null
},
{
"param": "ylabel",
"type": null
},
{
"param": "fntsize",
"type": null
},
{
"param": "title",
"type": null
},
{
"param": "clear",
"type": null
},
{
"param": "raw",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xlabel",
"type": null,
"docstring": null,
"docstring_tokens":... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | update_transients_metadata | null | def update_transients_metadata(self):
""" assign metadata from multitransient object to each scan"""
for scan in self.transients:
scan.key_parameter = self.key_parameter
scan.description = self.description
scan.series_name = self.series_name
scan.material ... | assign metadata from multitransient object to each scan | assign metadata from multitransient object to each scan | [
"assign",
"metadata",
"from",
"multitransient",
"object",
"to",
"each",
"scan"
] | def update_transients_metadata(self):
for scan in self.transients:
scan.key_parameter = self.key_parameter
scan.description = self.description
scan.series_name = self.series_name
scan.material = self.material | [
"def",
"update_transients_metadata",
"(",
"self",
")",
":",
"for",
"scan",
"in",
"self",
".",
"transients",
":",
"scan",
".",
"key_parameter",
"=",
"self",
".",
"key_parameter",
"scan",
".",
"description",
"=",
"self",
".",
"description",
"scan",
".",
"serie... | assign metadata from multitransient object to each scan | [
"assign",
"metadata",
"from",
"multitransient",
"object",
"to",
"each",
"scan"
] | [
"\"\"\" assign metadata from multitransient object to each scan\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | import_files | null | def import_files(self, files, append=False, key_parameter=None, description=None):
"""imports any series of data files. Files can be:
- string of full path of a single scan
- list of full paths of a single scan
- folder from which all files will be imported
... | imports any series of data files. Files can be:
- string of full path of a single scan
- list of full paths of a single scan
- folder from which all files will be imported
- append : if true, appends new scans to object, if false overwrites.
| imports any series of data files. Files can be:
string of full path of a single scan
list of full paths of a single scan
folder from which all files will be imported
append : if true, appends new scans to object, if false overwrites. | [
"imports",
"any",
"series",
"of",
"data",
"files",
".",
"Files",
"can",
"be",
":",
"string",
"of",
"full",
"path",
"of",
"a",
"single",
"scan",
"list",
"of",
"full",
"paths",
"of",
"a",
"single",
"scan",
"folder",
"from",
"which",
"all",
"files",
"will... | def import_files(self, files, append=False, key_parameter=None, description=None):
if not append:
self.transients = []
if isinstance(files, str):
self.transients.append(Transient(key_parameter=key_parameter, description=description))
self.transients[-1].import_file(... | [
"def",
"import_files",
"(",
"self",
",",
"files",
",",
"append",
"=",
"False",
",",
"key_parameter",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"if",
"not",
"append",
":",
"self",
".",
"transients",
"=",
"[",
"]",
"if",
"isinstance",
"(",
... | imports any series of data files. | [
"imports",
"any",
"series",
"of",
"data",
"files",
"."
] | [
"\"\"\"imports any series of data files. Files can be:\n - string of full path of a single scan\n - list of full paths of a single scan\n - folder from which all files will be imported\n - append : if true, appends new scans to object, if false overwrites.\n ... | [
{
"param": "self",
"type": null
},
{
"param": "files",
"type": null
},
{
"param": "append",
"type": null
},
{
"param": "key_parameter",
"type": null
},
{
"param": "description",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "files",
"type": null,
"docstring": null,
"docstring_tokens": ... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | saveas_csv | null | def saveas_csv(self, directory=None): # todo: implement dynamic paramter choosing option
""" creates a directory inside the given directory where it will save all data in csv format."""
if directory is None:
directory = utils.choose_folder('C:/Users/sagustss/py_code/DATA')
save_dir ... | creates a directory inside the given directory where it will save all data in csv format. | creates a directory inside the given directory where it will save all data in csv format. | [
"creates",
"a",
"directory",
"inside",
"the",
"given",
"directory",
"where",
"it",
"will",
"save",
"all",
"data",
"in",
"csv",
"format",
"."
] | def saveas_csv(self, directory=None):
if directory is None:
directory = utils.choose_folder('C:/Users/sagustss/py_code/DATA')
save_dir = directory + '/' + self.series_name + '_' + self.key_parameter + '/'
if os.path.exists(save_dir):
n = 1
new_save_dir = sav... | [
"def",
"saveas_csv",
"(",
"self",
",",
"directory",
"=",
"None",
")",
":",
"if",
"directory",
"is",
"None",
":",
"directory",
"=",
"utils",
".",
"choose_folder",
"(",
"'C:/Users/sagustss/py_code/DATA'",
")",
"save_dir",
"=",
"directory",
"+",
"'/'",
"+",
"se... | creates a directory inside the given directory where it will save all data in csv format. | [
"creates",
"a",
"directory",
"inside",
"the",
"given",
"directory",
"where",
"it",
"will",
"save",
"all",
"data",
"in",
"csv",
"format",
"."
] | [
"# todo: implement dynamic paramter choosing option",
"\"\"\" creates a directory inside the given directory where it will save all data in csv format.\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "directory",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "directory",
"type": null,
"docstring": null,
"docstring_token... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | quickplot | <not_specific> | def quickplot(self, figure=1):
""" simple plot of a list of transients """ # todo: move to transients.py -> under multitransients()
fig = plt.figure(num=figure)
plt.clf()
ax = fig.add_subplot(111)
ax.set_xlabel('Time [ps]', fontsize=18)
ax.set_ylabel('Differential Reflec... | simple plot of a list of transients | simple plot of a list of transients | [
"simple",
"plot",
"of",
"a",
"list",
"of",
"transients"
] | def quickplot(self, figure=1):
fig = plt.figure(num=figure)
plt.clf()
ax = fig.add_subplot(111)
ax.set_xlabel('Time [ps]', fontsize=18)
ax.set_ylabel('Differential Reflectivity', fontsize=18)
ax.set_title(self.series_name, fontsize=26)
ax.tick_params(axis='x', lab... | [
"def",
"quickplot",
"(",
"self",
",",
"figure",
"=",
"1",
")",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
"num",
"=",
"figure",
")",
"plt",
".",
"clf",
"(",
")",
"ax",
"=",
"fig",
".",
"add_subplot",
"(",
"111",
")",
"ax",
".",
"set_xlabel",
"... | simple plot of a list of transients | [
"simple",
"plot",
"of",
"a",
"list",
"of",
"transients"
] | [
"\"\"\" simple plot of a list of transients \"\"\"",
"# todo: move to transients.py -> under multitransients()",
"# todo: make nice color iteration, that follows parameter value"
] | [
{
"param": "self",
"type": null
},
{
"param": "figure",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "figure",
"type": null,
"docstring": null,
"docstring_tokens":... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | quickplot_OLD | <not_specific> | def quickplot_OLD(self):
""" simple plot of a list of transients """
fig = plt.figure(num=516542)
plt.clf() #
ax = fig.add_subplot(111)
ax.set_xlabel('Time [ps]', fontsize=18)
ax.set_ylabel('Differential Reflectivity', fontsize=18)
ax.set_title(self.series_name, ... | simple plot of a list of transients | simple plot of a list of transients | [
"simple",
"plot",
"of",
"a",
"list",
"of",
"transients"
] | def quickplot_OLD(self):
fig = plt.figure(num=516542)
plt.clf()
ax = fig.add_subplot(111)
ax.set_xlabel('Time [ps]', fontsize=18)
ax.set_ylabel('Differential Reflectivity', fontsize=18)
ax.set_title(self.series_name, fontsize=26)
ax.tick_params(axis='x', labelsi... | [
"def",
"quickplot_OLD",
"(",
"self",
")",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
"num",
"=",
"516542",
")",
"plt",
".",
"clf",
"(",
")",
"ax",
"=",
"fig",
".",
"add_subplot",
"(",
"111",
")",
"ax",
".",
"set_xlabel",
"(",
"'Time [ps]'",
",",
... | simple plot of a list of transients | [
"simple",
"plot",
"of",
"a",
"list",
"of",
"transients"
] | [
"\"\"\" simple plot of a list of transients \"\"\"",
"#",
"# while key_parameter_range % 10 != 0:",
"# n *=10",
"# key_parameter_range * n",
"# colorlist = cm.rainbow(np.logspace(0,3,1000)) / 100",
"# l = str(scn[i].temperature) + 'K'"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | rrPlot3d | null | def rrPlot3d(self, Yparameter='Sample Orientation', title='3dplot', Xlabel='Time, ps',
Zlabel='Kerr rotation (mrad)',
colormap='viridis'): # todo: correct to new TransientsSet() class system
'''plot 3d graf with time on X trace on Z and selected parametr on Y '''
# cre... | plot 3d graf with time on X trace on Z and selected parametr on Y | plot 3d graf with time on X trace on Z and selected parametr on Y | [
"plot",
"3d",
"graf",
"with",
"time",
"on",
"X",
"trace",
"on",
"Z",
"and",
"selected",
"parametr",
"on",
"Y"
] | def rrPlot3d(self, Yparameter='Sample Orientation', title='3dplot', Xlabel='Time, ps',
Zlabel='Kerr rotation (mrad)',
colormap='viridis'):
time = []
trace = []
ypar = []
for item in self.transients:
time.append(item.time)
trace.... | [
"def",
"rrPlot3d",
"(",
"self",
",",
"Yparameter",
"=",
"'Sample Orientation'",
",",
"title",
"=",
"'3dplot'",
",",
"Xlabel",
"=",
"'Time, ps'",
",",
"Zlabel",
"=",
"'Kerr rotation (mrad)'",
",",
"colormap",
"=",
"'viridis'",
")",
":",
"time",
"=",
"[",
"]",... | plot 3d graf with time on X trace on Z and selected parametr on Y | [
"plot",
"3d",
"graf",
"with",
"time",
"on",
"X",
"trace",
"on",
"Z",
"and",
"selected",
"parametr",
"on",
"Y"
] | [
"# todo: correct to new TransientsSet() class system",
"'''plot 3d graf with time on X trace on Z and selected parametr on Y '''",
"# create 3 lists of X Y Z data",
"# for every scan object takes values",
"# on Y axis will be chosen parameter which exist in scan object",
"# Make proper arrays from lists w... | [
{
"param": "self",
"type": null
},
{
"param": "Yparameter",
"type": null
},
{
"param": "title",
"type": null
},
{
"param": "Xlabel",
"type": null
},
{
"param": "Zlabel",
"type": null
},
{
"param": "colormap",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "Yparameter",
"type": null,
"docstring": null,
"docstring_toke... |
4a26d9883adda9b724e5bc544c38e43e2e27af1f | apokhr/PumpProbe-analysis | lib/transient.py | [
"MIT"
] | Python | fit_transients | <not_specific> | def fit_transients(self, fit_function, parameters, fit_from=0, fit_to=0, method='curve_fit', ext_plot=None,
print_results=True, recursive_optimization=False, colorlist=None, saveDir=None):
"""
Fit given model to a series of Transients.
:param fit_function:
... |
Fit given model to a series of Transients.
:param fit_function:
Model which will be fitted to the data
:param parameters: list, (list of lists - no longer supported)
Initial parameters for the given function
:param fit_from: int
Minimum from whic... | Fit given model to a series of Transients. | [
"Fit",
"given",
"model",
"to",
"a",
"series",
"of",
"Transients",
"."
] | def fit_transients(self, fit_function, parameters, fit_from=0, fit_to=0, method='curve_fit', ext_plot=None,
print_results=True, recursive_optimization=False, colorlist=None, saveDir=None):
if ext_plot is None:
fig = plt.figure('Fit of transients')
plt.clf()
... | [
"def",
"fit_transients",
"(",
"self",
",",
"fit_function",
",",
"parameters",
",",
"fit_from",
"=",
"0",
",",
"fit_to",
"=",
"0",
",",
"method",
"=",
"'curve_fit'",
",",
"ext_plot",
"=",
"None",
",",
"print_results",
"=",
"True",
",",
"recursive_optimization... | Fit given model to a series of Transients. | [
"Fit",
"given",
"model",
"to",
"a",
"series",
"of",
"Transients",
"."
] | [
"\"\"\"\n Fit given model to a series of Transients.\n :param fit_function:\n Model which will be fitted to the data\n :param parameters: list, (list of lists - no longer supported)\n Initial parameters for the given function\n :param fit_from: int\n ... | [
{
"param": "self",
"type": null
},
{
"param": "fit_function",
"type": null
},
{
"param": "parameters",
"type": null
},
{
"param": "fit_from",
"type": null
},
{
"param": "fit_to",
"type": null
},
{
"param": "method",
"type": null
},
{
"param... | {
"returns": [
{
"docstring": "dict\ndictionary with transient label as key and fit optimized parameters as values",
"docstring_tokens": [
"dict",
"dictionary",
"with",
"transient",
"label",
"as",
"key",
"and",
"fit",
"opt... |
95a1fc4a9dabf9d7d390fd29c59ab5c2340c7264 | apokhr/PumpProbe-analysis | rrTransientAnalysis.py | [
"MIT"
] | Python | quickplot_list | <not_specific> | def quickplot_list(transient_list, title, dependence):
""" simple plot of a list of transients """ # todo: move to transients.py -> under multitransients()
fig = plt.figure(num=1)
plt.clf()
ax = fig.add_subplot(111)
ax.set_xlabel('Time [ps]', fontsize=18)
ax.set_ylabel('Differential Reflectivit... | simple plot of a list of transients | simple plot of a list of transients | [
"simple",
"plot",
"of",
"a",
"list",
"of",
"transients"
] | def quickplot_list(transient_list, title, dependence):
fig = plt.figure(num=1)
plt.clf()
ax = fig.add_subplot(111)
ax.set_xlabel('Time [ps]', fontsize=18)
ax.set_ylabel('Differential Reflectivity', fontsize=18)
ax.set_title('Fitted Scans', fontsize=26)
ax.tick_params(axis='x', labelsize=12)
... | [
"def",
"quickplot_list",
"(",
"transient_list",
",",
"title",
",",
"dependence",
")",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
"num",
"=",
"1",
")",
"plt",
".",
"clf",
"(",
")",
"ax",
"=",
"fig",
".",
"add_subplot",
"(",
"111",
")",
"ax",
".",
... | simple plot of a list of transients | [
"simple",
"plot",
"of",
"a",
"list",
"of",
"transients"
] | [
"\"\"\" simple plot of a list of transients \"\"\"",
"# todo: move to transients.py -> under multitransients()",
"# todo: make nice color iteration, that follows parameter value",
"# using gcd didnt work, or the function for it is buggy",
"# colorlist_length, color_step = get_parameter_min_max_minstep(trans... | [
{
"param": "transient_list",
"type": null
},
{
"param": "title",
"type": null
},
{
"param": "dependence",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "transient_list",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "title",
"type": null,
"docstring": null,
"docstring... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | main | null | def main():
""" use a test file to test most funnctions in this file
now set for norm_to_pump
"""
# testfile = 'RuCl3-Pr-0.5mW-Pu-1.5mW-T-007.0k-1kAVG.mat'
# testpath = '..//test_data//'
# savepath = "E://DATA//RuCl3//"
#
# singlefile = testpath + testfile
#
# scns = rrScans()
# filelist... | use a test file to test most funnctions in this file
now set for norm_to_pump
| use a test file to test most funnctions in this file
now set for norm_to_pump | [
"use",
"a",
"test",
"file",
"to",
"test",
"most",
"funnctions",
"in",
"this",
"file",
"now",
"set",
"for",
"norm_to_pump"
] | def main():
singlefile = testpath + testfile
scns = rrScans()
filelist = ['RuCl3-Pr-0.5mW-Pu-1.5mW-T-005.0k-1kAVG.mat',
'RuCl3-Pr-0.5mW-Pu-1.5mW-T-006.0k-1kAVG.mat']
filelist2 = ['RuCl3-Pr-0.5mW-Pu-1.5mW-T-007.0k-1kAVG.mat',
'RuCl3-Pr-0.5mW-Pu-1.5mW-T-008.0k-1kAVG.mat']
... | [
"def",
"main",
"(",
")",
":",
"testmat",
"=",
"'RuCl3-Pr-0.5mW-Pu-1.5mW-T-005.0k-1kAVG.mat'",
"testcsv",
"=",
"'RuCl3- 2017-04-19 17.33.14 Pump1.5mW Temp7.0K.txt'",
"testpath",
"=",
"'..//test_scripts//test_data//'",
"savepath",
"=",
"\"E://DATA//RuCl3//\"",
"matfile",
"=",
"te... | use a test file to test most funnctions in this file
now set for norm_to_pump | [
"use",
"a",
"test",
"file",
"to",
"test",
"most",
"funnctions",
"in",
"this",
"file",
"now",
"set",
"for",
"norm_to_pump"
] | [
"\"\"\" use a test file to test most funnctions in this file\n now set for norm_to_pump\n \"\"\"",
"# testfile = 'RuCl3-Pr-0.5mW-Pu-1.5mW-T-007.0k-1kAVG.mat'",
"# testpath = '..//test_data//'",
"# savepath = \"E://DATA//RuCl3//\"",
"#",
"# singlefile = testpath + testfile",
"#",
"# ... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | initParameters | null | def initParameters(self):
""" Create a a dictionary of all parameters and a nameID for the scan"""
self.parameters = {'Pump Power': [self.pumpPw,'mW'],
'Probe Power': [self.probePw,'mW'],
'Destruction Power': [self.destrPw,'mW'],
... | Create a a dictionary of all parameters and a nameID for the scan | Create a a dictionary of all parameters and a nameID for the scan | [
"Create",
"a",
"a",
"dictionary",
"of",
"all",
"parameters",
"and",
"a",
"nameID",
"for",
"the",
"scan"
] | def initParameters(self):
self.parameters = {'Pump Power': [self.pumpPw,'mW'],
'Probe Power': [self.probePw,'mW'],
'Destruction Power': [self.destrPw,'mW'],
'Pump Spot': [self.pumpSp,'mum'],
'Pump polariz... | [
"def",
"initParameters",
"(",
"self",
")",
":",
"self",
".",
"parameters",
"=",
"{",
"'Pump Power'",
":",
"[",
"self",
".",
"pumpPw",
",",
"'mW'",
"]",
",",
"'Probe Power'",
":",
"[",
"self",
".",
"probePw",
",",
"'mW'",
"]",
",",
"'Destruction Power'",
... | Create a a dictionary of all parameters and a nameID for the scan | [
"Create",
"a",
"a",
"dictionary",
"of",
"all",
"parameters",
"and",
"a",
"nameID",
"for",
"the",
"scan"
] | [
"\"\"\" Create a a dictionary of all parameters and a nameID for the scan\"\"\"",
"# generate scanID"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | pushMetadata | null | def pushMetadata(self, dict):
"""
Import metadata from dictionary.
Dictionary keys must be proper names, ex: "Pump Power", not PumpPw
"""
self.pumpPw = dict['PumpPower']
self.probePw = dict['Probe Power']
self.destrPw = dict['Destruction Power']
self.pumpS... |
Import metadata from dictionary.
Dictionary keys must be proper names, ex: "Pump Power", not PumpPw
| Import metadata from dictionary.
Dictionary keys must be proper names, ex: "Pump Power", not PumpPw | [
"Import",
"metadata",
"from",
"dictionary",
".",
"Dictionary",
"keys",
"must",
"be",
"proper",
"names",
"ex",
":",
"\"",
"Pump",
"Power",
"\"",
"not",
"PumpPw"
] | def pushMetadata(self, dict):
self.pumpPw = dict['PumpPower']
self.probePw = dict['Probe Power']
self.destrPw = dict['Destruction Power']
self.pumpSp = dict['Pump Spot Size']
self.probeSp = dict['Probe Spot Size']
self.temperature = dict['Temperature']
self.date =... | [
"def",
"pushMetadata",
"(",
"self",
",",
"dict",
")",
":",
"self",
".",
"pumpPw",
"=",
"dict",
"[",
"'PumpPower'",
"]",
"self",
".",
"probePw",
"=",
"dict",
"[",
"'Probe Power'",
"]",
"self",
".",
"destrPw",
"=",
"dict",
"[",
"'Destruction Power'",
"]",
... | Import metadata from dictionary. | [
"Import",
"metadata",
"from",
"dictionary",
"."
] | [
"\"\"\"\n Import metadata from dictionary.\n Dictionary keys must be proper names, ex: \"Pump Power\", not PumpPw\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "dict",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dict",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | chopEnds | null | def chopEnds(self):
'''chops time scale to the monotonous central behaviour, deleting the wierd ends.
to be implemented still needs to modify also the trace array, or it wont work'''
maxT = max(self.time)
minT = min(self.time)
if self.time[0]<self.time[1]:
start=0
... | chops time scale to the monotonous central behaviour, deleting the wierd ends.
to be implemented still needs to modify also the trace array, or it wont work | chops time scale to the monotonous central behaviour, deleting the wierd ends.
to be implemented still needs to modify also the trace array, or it wont work | [
"chops",
"time",
"scale",
"to",
"the",
"monotonous",
"central",
"behaviour",
"deleting",
"the",
"wierd",
"ends",
".",
"to",
"be",
"implemented",
"still",
"needs",
"to",
"modify",
"also",
"the",
"trace",
"array",
"or",
"it",
"wont",
"work"
] | def chopEnds(self):
maxT = max(self.time)
minT = min(self.time)
if self.time[0]<self.time[1]:
start=0
while self.time[start] < maxT:
start += 1
end = start
while self.time[end] > minT:
end += 1
print('Fro... | [
"def",
"chopEnds",
"(",
"self",
")",
":",
"maxT",
"=",
"max",
"(",
"self",
".",
"time",
")",
"minT",
"=",
"min",
"(",
"self",
".",
"time",
")",
"if",
"self",
".",
"time",
"[",
"0",
"]",
"<",
"self",
".",
"time",
"[",
"1",
"]",
":",
"start",
... | chops time scale to the monotonous central behaviour, deleting the wierd ends. | [
"chops",
"time",
"scale",
"to",
"the",
"monotonous",
"central",
"behaviour",
"deleting",
"the",
"wierd",
"ends",
"."
] | [
"'''chops time scale to the monotonous central behaviour, deleting the wierd ends.\n to be implemented still needs to modify also the trace array, or it wont work'''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | flipTime | null | def flipTime(self):
""" Flip time scale: t = -t
does not revert the list order"""
self.time = -self.time
#self.time = self.time[::-1]
#self.trace = self.trace[::-1]
self.analysisHistory.append('flip time') | Flip time scale: t = -t
does not revert the list order | Flip time scale: t = -t
does not revert the list order | [
"Flip",
"time",
"scale",
":",
"t",
"=",
"-",
"t",
"does",
"not",
"revert",
"the",
"list",
"order"
] | def flipTime(self):
self.time = -self.time
self.analysisHistory.append('flip time') | [
"def",
"flipTime",
"(",
"self",
")",
":",
"self",
".",
"time",
"=",
"-",
"self",
".",
"time",
"self",
".",
"analysisHistory",
".",
"append",
"(",
"'flip time'",
")"
] | Flip time scale: t = -t
does not revert the list order | [
"Flip",
"time",
"scale",
":",
"t",
"=",
"-",
"t",
"does",
"not",
"revert",
"the",
"list",
"order"
] | [
"\"\"\" Flip time scale: t = -t\n does not revert the list order\"\"\"",
"#self.time = self.time[::-1]",
"#self.trace = self.trace[::-1]"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | filterit | null | def filterit(self, cutHigh = 0.1, order = 2):
""" apply simple low pass filter to data"""
b, a = spsignal.butter(order, cutHigh, 'low', analog= False)
self.trace = spsignal.lfilter(b,a,self.rawtrace)
self.filter = cutHigh
self.analysisHistory.append('filter') | apply simple low pass filter to data | apply simple low pass filter to data | [
"apply",
"simple",
"low",
"pass",
"filter",
"to",
"data"
] | def filterit(self, cutHigh = 0.1, order = 2):
b, a = spsignal.butter(order, cutHigh, 'low', analog= False)
self.trace = spsignal.lfilter(b,a,self.rawtrace)
self.filter = cutHigh
self.analysisHistory.append('filter') | [
"def",
"filterit",
"(",
"self",
",",
"cutHigh",
"=",
"0.1",
",",
"order",
"=",
"2",
")",
":",
"b",
",",
"a",
"=",
"spsignal",
".",
"butter",
"(",
"order",
",",
"cutHigh",
",",
"'low'",
",",
"analog",
"=",
"False",
")",
"self",
".",
"trace",
"=",
... | apply simple low pass filter to data | [
"apply",
"simple",
"low",
"pass",
"filter",
"to",
"data"
] | [
"\"\"\" apply simple low pass filter to data\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "cutHigh",
"type": null
},
{
"param": "order",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cutHigh",
"type": null,
"docstring": null,
"docstring_tokens"... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | normToPump | null | def normToPump(self):
""" Normalize scan by dividing by its pump power value"""
if self.pumpPw != 0:
self.trace = self.trace / self.pumpPw
self.analysisHistory.append('normalized to PumpPw') | Normalize scan by dividing by its pump power value | Normalize scan by dividing by its pump power value | [
"Normalize",
"scan",
"by",
"dividing",
"by",
"its",
"pump",
"power",
"value"
] | def normToPump(self):
if self.pumpPw != 0:
self.trace = self.trace / self.pumpPw
self.analysisHistory.append('normalized to PumpPw') | [
"def",
"normToPump",
"(",
"self",
")",
":",
"if",
"self",
".",
"pumpPw",
"!=",
"0",
":",
"self",
".",
"trace",
"=",
"self",
".",
"trace",
"/",
"self",
".",
"pumpPw",
"self",
".",
"analysisHistory",
".",
"append",
"(",
"'normalized to PumpPw'",
")"
] | Normalize scan by dividing by its pump power value | [
"Normalize",
"scan",
"by",
"dividing",
"by",
"its",
"pump",
"power",
"value"
] | [
"\"\"\" Normalize scan by dividing by its pump power value\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | quickplot | null | def quickplot(self, xlabel='Time, ps',
ylabel='Kerr rotation', fntsize=20,
title='Time depandance of the pump induced Kerr rotation',
clear=False):
"""Generates a quick simple plot with matplotlib """
if clear: plt.clf()
quickplotfig=plt.figu... | Generates a quick simple plot with matplotlib | Generates a quick simple plot with matplotlib | [
"Generates",
"a",
"quick",
"simple",
"plot",
"with",
"matplotlib"
] | def quickplot(self, xlabel='Time, ps',
ylabel='Kerr rotation', fntsize=20,
title='Time depandance of the pump induced Kerr rotation',
clear=False):
if clear: plt.clf()
quickplotfig=plt.figure(num=1)
ax=quickplotfig.add_subplot(111)
ax... | [
"def",
"quickplot",
"(",
"self",
",",
"xlabel",
"=",
"'Time, ps'",
",",
"ylabel",
"=",
"'Kerr rotation'",
",",
"fntsize",
"=",
"20",
",",
"title",
"=",
"'Time depandance of the pump induced Kerr rotation'",
",",
"clear",
"=",
"False",
")",
":",
"if",
"clear",
... | Generates a quick simple plot with matplotlib | [
"Generates",
"a",
"quick",
"simple",
"plot",
"with",
"matplotlib"
] | [
"\"\"\"Generates a quick simple plot with matplotlib \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "xlabel",
"type": null
},
{
"param": "ylabel",
"type": null
},
{
"param": "fntsize",
"type": null
},
{
"param": "title",
"type": null
},
{
"param": "clear",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xlabel",
"type": null,
"docstring": null,
"docstring_tokens":... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | importFile | null | def importFile(self,file):
'''imports a file, csv or .mat'''
try:
ext = os.path.splitext(file)[-1].lower()
if ext == '.mat':
if os.path.basename(file).lower() != 't-cal.mat':
self.importRawFile(file)
else:
pr... | imports a file, csv or .mat | imports a file, csv or .mat | [
"imports",
"a",
"file",
"csv",
"or",
".",
"mat"
] | def importFile(self,file):
try:
ext = os.path.splitext(file)[-1].lower()
if ext == '.mat':
if os.path.basename(file).lower() != 't-cal.mat':
self.importRawFile(file)
else:
print('Ignored t-cal.mat')
elif ... | [
"def",
"importFile",
"(",
"self",
",",
"file",
")",
":",
"try",
":",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"file",
")",
"[",
"-",
"1",
"]",
".",
"lower",
"(",
")",
"if",
"ext",
"==",
"'.mat'",
":",
"if",
"os",
".",
"path",
".",... | imports a file, csv or .mat | [
"imports",
"a",
"file",
"csv",
"or",
".",
"mat"
] | [
"'''imports a file, csv or .mat'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | importRawFile | null | def importRawFile(self, file):
"""Import data from a raw .mat file generated by redred software.
Also fetches some metadata form file name through name_to_info().
Very mutch not universal.
Needs improvement"""
print('WARNING: rrScan.importRawFile() needs some improvement...')
... | Import data from a raw .mat file generated by redred software.
Also fetches some metadata form file name through name_to_info().
Very mutch not universal.
Needs improvement | Import data from a raw .mat file generated by redred software.
Also fetches some metadata form file name through name_to_info().
Very mutch not universal.
Needs improvement | [
"Import",
"data",
"from",
"a",
"raw",
".",
"mat",
"file",
"generated",
"by",
"redred",
"software",
".",
"Also",
"fetches",
"some",
"metadata",
"form",
"file",
"name",
"through",
"name_to_info",
"()",
".",
"Very",
"mutch",
"not",
"universal",
".",
"Needs",
... | def importRawFile(self, file):
print('WARNING: rrScan.importRawFile() needs some improvement...')
data = sp.io.loadmat(file)
try:
self.time = data['Daten'][2]
self.rawtrace = data['Daten'][0]
self.trace = self.rawtrace
self.R0 = data['DC'][0][0]
... | [
"def",
"importRawFile",
"(",
"self",
",",
"file",
")",
":",
"print",
"(",
"'WARNING: rrScan.importRawFile() needs some improvement...'",
")",
"data",
"=",
"sp",
".",
"io",
".",
"loadmat",
"(",
"file",
")",
"try",
":",
"self",
".",
"time",
"=",
"data",
"[",
... | Import data from a raw .mat file generated by redred software. | [
"Import",
"data",
"from",
"a",
"raw",
".",
"mat",
"file",
"generated",
"by",
"redred",
"software",
"."
] | [
"\"\"\"Import data from a raw .mat file generated by redred software.\n Also fetches some metadata form file name through name_to_info().\n Very mutch not universal.\n\n Needs improvement\"\"\"",
"#print(self.material)"
] | [
{
"param": "self",
"type": null
},
{
"param": "file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | importCSV | null | def importCSV(self,file):
"""
Read a CSV containing rrScan() data, and assign to self all the data
file should be a string of the whole path of the file
Could do with some improvement.
"""
print('WARNING: import_file_csv() needs some improvement...')
try:
... |
Read a CSV containing rrScan() data, and assign to self all the data
file should be a string of the whole path of the file
Could do with some improvement.
| Read a CSV containing rrScan() data, and assign to self all the data
file should be a string of the whole path of the file
Could do with some improvement. | [
"Read",
"a",
"CSV",
"containing",
"rrScan",
"()",
"data",
"and",
"assign",
"to",
"self",
"all",
"the",
"data",
"file",
"should",
"be",
"a",
"string",
"of",
"the",
"whole",
"path",
"of",
"the",
"file",
"Could",
"do",
"with",
"some",
"improvement",
"."
] | def importCSV(self,file):
print('WARNING: import_file_csv() needs some improvement...')
try:
f = open(file, 'r')
if f:
metacounter=0
for l in f:
metacounter+=1
line = l.split('\t')
if 'Mat... | [
"def",
"importCSV",
"(",
"self",
",",
"file",
")",
":",
"print",
"(",
"'WARNING: import_file_csv() needs some improvement...'",
")",
"try",
":",
"f",
"=",
"open",
"(",
"file",
",",
"'r'",
")",
"if",
"f",
":",
"metacounter",
"=",
"0",
"for",
"l",
"in",
"f... | Read a CSV containing rrScan() data, and assign to self all the data
file should be a string of the whole path of the file | [
"Read",
"a",
"CSV",
"containing",
"rrScan",
"()",
"data",
"and",
"assign",
"to",
"self",
"all",
"the",
"data",
"file",
"should",
"be",
"a",
"string",
"of",
"the",
"whole",
"path",
"of",
"the",
"file"
] | [
"\"\"\"\n Read a CSV containing rrScan() data, and assign to self all the data\n file should be a string of the whole path of the file\n\n Could do with some improvement.\n \"\"\"",
"# skip metadata section then import array of data"
] | [
{
"param": "self",
"type": null
},
{
"param": "file",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | exportCSV_old | null | def exportCSV_old(self, directory):
"""
save rrScan() to a file. it overwrites anything it finds
Metadata is obtained from get_metadata(), resulting in all non0
parameters available.
"""
file = open(directory + self.filename + '.txt', 'w+')
# Material:
... |
save rrScan() to a file. it overwrites anything it finds
Metadata is obtained from get_metadata(), resulting in all non0
parameters available.
| save rrScan() to a file. it overwrites anything it finds
Metadata is obtained from get_metadata(), resulting in all non0
parameters available. | [
"save",
"rrScan",
"()",
"to",
"a",
"file",
".",
"it",
"overwrites",
"anything",
"it",
"finds",
"Metadata",
"is",
"obtained",
"from",
"get_metadata",
"()",
"resulting",
"in",
"all",
"non0",
"parameters",
"available",
"."
] | def exportCSV_old(self, directory):
file = open(directory + self.filename + '.txt', 'w+')
file.write('Material:\t' + str(self.material) + '\n')
file.write('Date:\t' + self.date + '\n')
file.write('------- Parameters -------\n\n')
for key in self.parameters:
if self.pa... | [
"def",
"exportCSV_old",
"(",
"self",
",",
"directory",
")",
":",
"file",
"=",
"open",
"(",
"directory",
"+",
"self",
".",
"filename",
"+",
"'.txt'",
",",
"'w+'",
")",
"file",
".",
"write",
"(",
"'Material:\\t'",
"+",
"str",
"(",
"self",
".",
"material"... | save rrScan() to a file. | [
"save",
"rrScan",
"()",
"to",
"a",
"file",
"."
] | [
"\"\"\"\n save rrScan() to a file. it overwrites anything it finds\n\n Metadata is obtained from get_metadata(), resulting in all non0\n parameters available.\n \"\"\"",
"# Material:",
"# Date:",
"# Parameters",
"#filter info",
"#data"
] | [
{
"param": "self",
"type": null
},
{
"param": "directory",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "directory",
"type": null,
"docstring": null,
"docstring_token... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | fetchMetadata | <not_specific> | def fetchMetadata(self):
'''Create a Dictionary of all metadata from all single scans'''
metadata = self.scans[0].fetchMetadata()
for key in metadata:
metadata[key] = [metadata[key]]
skip = True
# construct a dictionary containing all metadata
for scan in self... | Create a Dictionary of all metadata from all single scans | Create a Dictionary of all metadata from all single scans | [
"Create",
"a",
"Dictionary",
"of",
"all",
"metadata",
"from",
"all",
"single",
"scans"
] | def fetchMetadata(self):
metadata = self.scans[0].fetchMetadata()
for key in metadata:
metadata[key] = [metadata[key]]
skip = True
for scan in self.scans:
if not skip:
md = scan.fetchMetadata()
for key in metadata:
... | [
"def",
"fetchMetadata",
"(",
"self",
")",
":",
"metadata",
"=",
"self",
".",
"scans",
"[",
"0",
"]",
".",
"fetchMetadata",
"(",
")",
"for",
"key",
"in",
"metadata",
":",
"metadata",
"[",
"key",
"]",
"=",
"[",
"metadata",
"[",
"key",
"]",
"]",
"skip... | Create a Dictionary of all metadata from all single scans | [
"Create",
"a",
"Dictionary",
"of",
"all",
"metadata",
"from",
"all",
"single",
"scans"
] | [
"'''Create a Dictionary of all metadata from all single scans'''",
"# construct a dictionary containing all metadata"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | importFiles | null | def importFiles(self, files, append=False):
'''imports any series of data files
files can be:
string of full path of a single scan
list of full paths of a single scan
folder from which all files will be imported
if append is true, it appends the... | imports any series of data files
files can be:
string of full path of a single scan
list of full paths of a single scan
folder from which all files will be imported
if append is true, it appends the imported files at end of rrScans list
| imports any series of data files
files can be:
string of full path of a single scan
list of full paths of a single scan
folder from which all files will be imported
if append is true, it appends the imported files at end of rrScans list | [
"imports",
"any",
"series",
"of",
"data",
"files",
"files",
"can",
"be",
":",
"string",
"of",
"full",
"path",
"of",
"a",
"single",
"scan",
"list",
"of",
"full",
"paths",
"of",
"a",
"single",
"scan",
"folder",
"from",
"which",
"all",
"files",
"will",
"b... | def importFiles(self, files, append=False):
if not append:
self.scans = []
if isinstance(files, str):
self.scans.append(rrScan())
self.scans[-1].import_single_file(files)
print('Imported file' + files)
elif isinstance(files, list):
for... | [
"def",
"importFiles",
"(",
"self",
",",
"files",
",",
"append",
"=",
"False",
")",
":",
"if",
"not",
"append",
":",
"self",
".",
"scans",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"files",
",",
"str",
")",
":",
"self",
".",
"scans",
".",
"append",
... | imports any series of data files
files can be:
string of full path of a single scan
list of full paths of a single scan
folder from which all files will be imported
if append is true, it appends the imported files at end of rrScans list | [
"imports",
"any",
"series",
"of",
"data",
"files",
"files",
"can",
"be",
":",
"string",
"of",
"full",
"path",
"of",
"a",
"single",
"scan",
"list",
"of",
"full",
"paths",
"of",
"a",
"single",
"scan",
"folder",
"from",
"which",
"all",
"files",
"will",
"b... | [
"'''imports any series of data files\n files can be:\n string of full path of a single scan\n list of full paths of a single scan\n folder from which all files will be imported\n if append is true, it appends the imported files at end of rrScans list\n ... | [
{
"param": "self",
"type": null
},
{
"param": "files",
"type": null
},
{
"param": "append",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "files",
"type": null,
"docstring": null,
"docstring_tokens": ... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | update_scanList | null | def update_scanList(self):
''' update the list of names of the single scans in self.scans'''
self.scanList = []
for i in range(len(self.scans)):
self.scanList.append(self.scans[i].filename) | update the list of names of the single scans in self.scans | update the list of names of the single scans in self.scans | [
"update",
"the",
"list",
"of",
"names",
"of",
"the",
"single",
"scans",
"in",
"self",
".",
"scans"
] | def update_scanList(self):
self.scanList = []
for i in range(len(self.scans)):
self.scanList.append(self.scans[i].filename) | [
"def",
"update_scanList",
"(",
"self",
")",
":",
"self",
".",
"scanList",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
".",
"scans",
")",
")",
":",
"self",
".",
"scanList",
".",
"append",
"(",
"self",
".",
"scans",
"[",
"i",... | update the list of names of the single scans in self.scans | [
"update",
"the",
"list",
"of",
"names",
"of",
"the",
"single",
"scans",
"in",
"self",
".",
"scans"
] | [
"''' update the list of names of the single scans in self.scans'''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | addfilenamesfromfolder | null | def addfilenamesfromfolder(self, directory):
'''add filenames from selected folder to the list of the files to read'''
newnames= os.listdir(directory)
for item in newnames:
self.addfilename(directory + item) | add filenames from selected folder to the list of the files to read | add filenames from selected folder to the list of the files to read | [
"add",
"filenames",
"from",
"selected",
"folder",
"to",
"the",
"list",
"of",
"the",
"files",
"to",
"read"
] | def addfilenamesfromfolder(self, directory):
newnames= os.listdir(directory)
for item in newnames:
self.addfilename(directory + item) | [
"def",
"addfilenamesfromfolder",
"(",
"self",
",",
"directory",
")",
":",
"newnames",
"=",
"os",
".",
"listdir",
"(",
"directory",
")",
"for",
"item",
"in",
"newnames",
":",
"self",
".",
"addfilename",
"(",
"directory",
"+",
"item",
")"
] | add filenames from selected folder to the list of the files to read | [
"add",
"filenames",
"from",
"selected",
"folder",
"to",
"the",
"list",
"of",
"the",
"files",
"to",
"read"
] | [
"'''add filenames from selected folder to the list of the files to read'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "directory",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "directory",
"type": null,
"docstring": null,
"docstring_token... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | choosefile | null | def choosefile(self):
'''open dialog window to choose file to be added to the list of the files to read'''
root = tk.Tk()
root.withdraw()
filenames = filedialog.askopenfilenames()
for item in filenames:
self.addfilename(item) | open dialog window to choose file to be added to the list of the files to read | open dialog window to choose file to be added to the list of the files to read | [
"open",
"dialog",
"window",
"to",
"choose",
"file",
"to",
"be",
"added",
"to",
"the",
"list",
"of",
"the",
"files",
"to",
"read"
] | def choosefile(self):
root = tk.Tk()
root.withdraw()
filenames = filedialog.askopenfilenames()
for item in filenames:
self.addfilename(item) | [
"def",
"choosefile",
"(",
"self",
")",
":",
"root",
"=",
"tk",
".",
"Tk",
"(",
")",
"root",
".",
"withdraw",
"(",
")",
"filenames",
"=",
"filedialog",
".",
"askopenfilenames",
"(",
")",
"for",
"item",
"in",
"filenames",
":",
"self",
".",
"addfilename",... | open dialog window to choose file to be added to the list of the files to read | [
"open",
"dialog",
"window",
"to",
"choose",
"file",
"to",
"be",
"added",
"to",
"the",
"list",
"of",
"the",
"files",
"to",
"read"
] | [
"'''open dialog window to choose file to be added to the list of the files to read'''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | choosefilesfromfolder | null | def choosefilesfromfolder(self):
'''open dialog window to choose folder with file to be added to the list of the files to read'''
root = tk.Tk()
root.withdraw()
dataDir = filedialog.askdirectory(initialdir = 'E://')
self.addfilenamesfromfolder(dataDir) | open dialog window to choose folder with file to be added to the list of the files to read | open dialog window to choose folder with file to be added to the list of the files to read | [
"open",
"dialog",
"window",
"to",
"choose",
"folder",
"with",
"file",
"to",
"be",
"added",
"to",
"the",
"list",
"of",
"the",
"files",
"to",
"read"
] | def choosefilesfromfolder(self):
root = tk.Tk()
root.withdraw()
dataDir = filedialog.askdirectory(initialdir = 'E://')
self.addfilenamesfromfolder(dataDir) | [
"def",
"choosefilesfromfolder",
"(",
"self",
")",
":",
"root",
"=",
"tk",
".",
"Tk",
"(",
")",
"root",
".",
"withdraw",
"(",
")",
"dataDir",
"=",
"filedialog",
".",
"askdirectory",
"(",
"initialdir",
"=",
"'E://'",
")",
"self",
".",
"addfilenamesfromfolder... | open dialog window to choose folder with file to be added to the list of the files to read | [
"open",
"dialog",
"window",
"to",
"choose",
"folder",
"with",
"file",
"to",
"be",
"added",
"to",
"the",
"list",
"of",
"the",
"files",
"to",
"read"
] | [
"'''open dialog window to choose folder with file to be added to the list of the files to read'''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | importselectedfiles | null | def importselectedfiles(self, plot=False):
'''import all files from the list of names '''
for item in self.filenames:
scan=rrScan()
scan.importRawFile(item)
if plot: scan.quickplot()
self.scans.append(scan) | import all files from the list of names | import all files from the list of names | [
"import",
"all",
"files",
"from",
"the",
"list",
"of",
"names"
] | def importselectedfiles(self, plot=False):
for item in self.filenames:
scan=rrScan()
scan.importRawFile(item)
if plot: scan.quickplot()
self.scans.append(scan) | [
"def",
"importselectedfiles",
"(",
"self",
",",
"plot",
"=",
"False",
")",
":",
"for",
"item",
"in",
"self",
".",
"filenames",
":",
"scan",
"=",
"rrScan",
"(",
")",
"scan",
".",
"importRawFile",
"(",
"item",
")",
"if",
"plot",
":",
"scan",
".",
"quic... | import all files from the list of names | [
"import",
"all",
"files",
"from",
"the",
"list",
"of",
"names"
] | [
"'''import all files from the list of names '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "plot",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "plot",
"type": null,
"docstring": null,
"docstring_tokens": [... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | rrPlot3d | null | def rrPlot3d(self, Yparameter='Sample Orientation', title='3dplot', Xlabel= 'Time, ps', Zlabel='Kerr rotation (mrad)', colormap='viridis'):
'''plot 3d graf with time on X trace on Z and selected parametr on Y '''
#create 3 lists of X Y Z data
time=[]
trace=[]
ypar=[]
#for... | plot 3d graf with time on X trace on Z and selected parametr on Y | plot 3d graf with time on X trace on Z and selected parametr on Y | [
"plot",
"3d",
"graf",
"with",
"time",
"on",
"X",
"trace",
"on",
"Z",
"and",
"selected",
"parametr",
"on",
"Y"
] | def rrPlot3d(self, Yparameter='Sample Orientation', title='3dplot', Xlabel= 'Time, ps', Zlabel='Kerr rotation (mrad)', colormap='viridis'):
time=[]
trace=[]
ypar=[]
for item in self.scans:
time.append(item.time)
trace.append(item.trace)
ypar.append(ite... | [
"def",
"rrPlot3d",
"(",
"self",
",",
"Yparameter",
"=",
"'Sample Orientation'",
",",
"title",
"=",
"'3dplot'",
",",
"Xlabel",
"=",
"'Time, ps'",
",",
"Zlabel",
"=",
"'Kerr rotation (mrad)'",
",",
"colormap",
"=",
"'viridis'",
")",
":",
"time",
"=",
"[",
"]",... | plot 3d graf with time on X trace on Z and selected parametr on Y | [
"plot",
"3d",
"graf",
"with",
"time",
"on",
"X",
"trace",
"on",
"Z",
"and",
"selected",
"parametr",
"on",
"Y"
] | [
"'''plot 3d graf with time on X trace on Z and selected parametr on Y '''",
"#create 3 lists of X Y Z data",
"#for every scan object takes values",
"#on Y axis will be chosen parameter which exist in scan object",
"#Make proper arrays from lists with data"
] | [
{
"param": "self",
"type": null
},
{
"param": "Yparameter",
"type": null
},
{
"param": "title",
"type": null
},
{
"param": "Xlabel",
"type": null
},
{
"param": "Zlabel",
"type": null
},
{
"param": "colormap",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "Yparameter",
"type": null,
"docstring": null,
"docstring_toke... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | import_file | <not_specific> | def import_file(filename, content = 'Daten'):
"""Import data aquired with RedRed software
returns data as [time,trace]"""
MData = sp.io.loadmat(filename) #load matlab file
output = []
if filename == 't-cal.mat':
pass
else:
try :
output = MData[content]
exce... | Import data aquired with RedRed software
returns data as [time,trace] | Import data aquired with RedRed software
returns data as [time,trace] | [
"Import",
"data",
"aquired",
"with",
"RedRed",
"software",
"returns",
"data",
"as",
"[",
"time",
"trace",
"]"
] | def import_file(filename, content = 'Daten'):
MData = sp.io.loadmat(filename)
output = []
if filename == 't-cal.mat':
pass
else:
try :
output = MData[content]
except KeyError:
print('KeyError: \nNo key "' + content + '" found in ' + filename)
i... | [
"def",
"import_file",
"(",
"filename",
",",
"content",
"=",
"'Daten'",
")",
":",
"MData",
"=",
"sp",
".",
"io",
".",
"loadmat",
"(",
"filename",
")",
"output",
"=",
"[",
"]",
"if",
"filename",
"==",
"'t-cal.mat'",
":",
"pass",
"else",
":",
"try",
":"... | Import data aquired with RedRed software
returns data as [time,trace] | [
"Import",
"data",
"aquired",
"with",
"RedRed",
"software",
"returns",
"data",
"as",
"[",
"time",
"trace",
"]"
] | [
"\"\"\"Import data aquired with RedRed software\n returns data as [time,trace]\"\"\"",
"#load matlab file",
"#assign time axis",
"#assgin data axis"
] | [
{
"param": "filename",
"type": null
},
{
"param": "content",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "content",
"type": null,
"docstring": null,
"docstring_tok... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | timezero_shift | <not_specific> | def timezero_shift(timeData, timeZero = 0, reverse = 'False'):
"""Shift the 0 offset of a time trace, returns [new time trace] and [time shift]
Some time its better to define time shift from one trace and aply it to athers,
since max or min value could be different, like in my case
-> You can define t... | Shift the 0 offset of a time trace, returns [new time trace] and [time shift]
Some time its better to define time shift from one trace and aply it to athers,
since max or min value could be different, like in my case
-> You can define the time shift with a single line (timeshift = max(TimeData))
and f... | Shift the 0 offset of a time trace, returns [new time trace] and [time shift]
Some time its better to define time shift from one trace and aply it to athers,
since max or min value could be different, like in my case
> You can define the time shift with a single line (timeshift = max(TimeData))
and feed it to this fun... | [
"Shift",
"the",
"0",
"offset",
"of",
"a",
"time",
"trace",
"returns",
"[",
"new",
"time",
"trace",
"]",
"and",
"[",
"time",
"shift",
"]",
"Some",
"time",
"its",
"better",
"to",
"define",
"time",
"shift",
"from",
"one",
"trace",
"and",
"aply",
"it",
"... | def timezero_shift(timeData, timeZero = 0, reverse = 'False'):
timeData = timeData - timeZero
if reverse:
timeData = -timeData
return(timeData) | [
"def",
"timezero_shift",
"(",
"timeData",
",",
"timeZero",
"=",
"0",
",",
"reverse",
"=",
"'False'",
")",
":",
"timeData",
"=",
"timeData",
"-",
"timeZero",
"if",
"reverse",
":",
"timeData",
"=",
"-",
"timeData",
"return",
"(",
"timeData",
")"
] | Shift the 0 offset of a time trace, returns [new time trace] and [time shift]
Some time its better to define time shift from one trace and aply it to athers,
since max or min value could be different, like in my case | [
"Shift",
"the",
"0",
"offset",
"of",
"a",
"time",
"trace",
"returns",
"[",
"new",
"time",
"trace",
"]",
"and",
"[",
"time",
"shift",
"]",
"Some",
"time",
"its",
"better",
"to",
"define",
"time",
"shift",
"from",
"one",
"trace",
"and",
"aply",
"it",
"... | [
"\"\"\"Shift the 0 offset of a time trace, returns [new time trace] and [time shift]\n\n Some time its better to define time shift from one trace and aply it to athers,\n since max or min value could be different, like in my case\n\n -> You can define the time shift with a single line (timeshift = max(Time... | [
{
"param": "timeData",
"type": null
},
{
"param": "timeZero",
"type": null
},
{
"param": "reverse",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "timeData",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timeZero",
"type": null,
"docstring": null,
"docstring_to... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | quick_filter | <not_specific> | def quick_filter(trace, order = 2, cutfreq = 0.1):
""" apply simple low pass filter to data"""
b, a = sp.signal.butter(order, cutfreq, 'low', analog= False)
filtered_trace = sp.signal.lfilter(b,a,trace)
return(filtered_trace) | apply simple low pass filter to data | apply simple low pass filter to data | [
"apply",
"simple",
"low",
"pass",
"filter",
"to",
"data"
] | def quick_filter(trace, order = 2, cutfreq = 0.1):
b, a = sp.signal.butter(order, cutfreq, 'low', analog= False)
filtered_trace = sp.signal.lfilter(b,a,trace)
return(filtered_trace) | [
"def",
"quick_filter",
"(",
"trace",
",",
"order",
"=",
"2",
",",
"cutfreq",
"=",
"0.1",
")",
":",
"b",
",",
"a",
"=",
"sp",
".",
"signal",
".",
"butter",
"(",
"order",
",",
"cutfreq",
",",
"'low'",
",",
"analog",
"=",
"False",
")",
"filtered_trace... | apply simple low pass filter to data | [
"apply",
"simple",
"low",
"pass",
"filter",
"to",
"data"
] | [
"\"\"\" apply simple low pass filter to data\"\"\""
] | [
{
"param": "trace",
"type": null
},
{
"param": "order",
"type": null
},
{
"param": "cutfreq",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "trace",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "order",
"type": null,
"docstring": null,
"docstring_tokens":... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | file_to_dict | <not_specific> | def file_to_dict(filepath):
"""
Convert file into Dictionary containing scan info and data
if file is not valid returns an empty dictionary
"""
DataDict = {}
filename = os.path.basename(filepath)
#print(filename)
ext = os.path.splitext(filename)[-1].lower()
if ext == ".mat" and no... |
Convert file into Dictionary containing scan info and data
if file is not valid returns an empty dictionary
| Convert file into Dictionary containing scan info and data
if file is not valid returns an empty dictionary | [
"Convert",
"file",
"into",
"Dictionary",
"containing",
"scan",
"info",
"and",
"data",
"if",
"file",
"is",
"not",
"valid",
"returns",
"an",
"empty",
"dictionary"
] | def file_to_dict(filepath):
DataDict = {}
filename = os.path.basename(filepath)
ext = os.path.splitext(filename)[-1].lower()
if ext == ".mat" and not filename == 't-cal':
DataDict = name_to_info(filepath)
DataDict['data'] = import_file(filepath)
return(DataDict) | [
"def",
"file_to_dict",
"(",
"filepath",
")",
":",
"DataDict",
"=",
"{",
"}",
"filename",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filepath",
")",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"[",
"-",
"1",
"]",
".",
... | Convert file into Dictionary containing scan info and data
if file is not valid returns an empty dictionary | [
"Convert",
"file",
"into",
"Dictionary",
"containing",
"scan",
"info",
"and",
"data",
"if",
"file",
"is",
"not",
"valid",
"returns",
"an",
"empty",
"dictionary"
] | [
"\"\"\"\n Convert file into Dictionary containing scan info and data\n\n if file is not valid returns an empty dictionary\n \"\"\"",
"#print(filename)"
] | [
{
"param": "filepath",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "filepath",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | dir_to_dict | <not_specific> | def dir_to_dict(sourceDirectory, fileRange = [0,0]):
""" Generate a dictionary containing info from file name and data"""
#select all files if range is [0,0]
if fileRange == [0,0] or fileRange[1]<fileRange[0]:
fileRange[1] = len(sourceDirectory)
# pick scans to work on
fileNames = os.lis... | Generate a dictionary containing info from file name and data | Generate a dictionary containing info from file name and data | [
"Generate",
"a",
"dictionary",
"containing",
"info",
"from",
"file",
"name",
"and",
"data"
] | def dir_to_dict(sourceDirectory, fileRange = [0,0]):
if fileRange == [0,0] or fileRange[1]<fileRange[0]:
fileRange[1] = len(sourceDirectory)
fileNames = os.listdir(sourceDirectory)[fileRange[0]:fileRange[1]]
DataDict = {}
nGood, nBad = 0,0
for item in fileNames:
filepath = sourceDire... | [
"def",
"dir_to_dict",
"(",
"sourceDirectory",
",",
"fileRange",
"=",
"[",
"0",
",",
"0",
"]",
")",
":",
"if",
"fileRange",
"==",
"[",
"0",
",",
"0",
"]",
"or",
"fileRange",
"[",
"1",
"]",
"<",
"fileRange",
"[",
"0",
"]",
":",
"fileRange",
"[",
"1... | Generate a dictionary containing info from file name and data | [
"Generate",
"a",
"dictionary",
"containing",
"info",
"from",
"file",
"name",
"and",
"data"
] | [
"\"\"\" Generate a dictionary containing info from file name and data\"\"\"",
"#select all files if range is [0,0]",
"# pick scans to work on",
"#if not os.path.isdir(filepath) and",
"#returns nothing if file was not datafile.mat"
] | [
{
"param": "sourceDirectory",
"type": null
},
{
"param": "fileRange",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sourceDirectory",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fileRange",
"type": null,
"docstring": null,
"docs... |
4027fa8fa256618d17ed6424b7d456a69e71b661 | apokhr/PumpProbe-analysis | lib/redred.py | [
"MIT"
] | Python | norm_to_pump | <not_specific> | def norm_to_pump(dataDict):
""" Divide all curves in dataDict by it's pump power value"""
dataDictNorm = dataDict
norm = []
for key in dataDict:
norm = dataDict[key]['data'][1] / dataDict[key]['Pump Power']#dataDict[key]['Pump Power']
#rest = norm-dataDict[key]['data'][1][1]
data... | Divide all curves in dataDict by it's pump power value | Divide all curves in dataDict by it's pump power value | [
"Divide",
"all",
"curves",
"in",
"dataDict",
"by",
"it",
"'",
"s",
"pump",
"power",
"value"
] | def norm_to_pump(dataDict):
dataDictNorm = dataDict
norm = []
for key in dataDict:
norm = dataDict[key]['data'][1] / dataDict[key]['Pump Power']
dataDictNorm[key]['data'][1] = norm
return(dataDictNorm) | [
"def",
"norm_to_pump",
"(",
"dataDict",
")",
":",
"dataDictNorm",
"=",
"dataDict",
"norm",
"=",
"[",
"]",
"for",
"key",
"in",
"dataDict",
":",
"norm",
"=",
"dataDict",
"[",
"key",
"]",
"[",
"'data'",
"]",
"[",
"1",
"]",
"/",
"dataDict",
"[",
"key",
... | Divide all curves in dataDict by it's pump power value | [
"Divide",
"all",
"curves",
"in",
"dataDict",
"by",
"it",
"'",
"s",
"pump",
"power",
"value"
] | [
"\"\"\" Divide all curves in dataDict by it's pump power value\"\"\"",
"#dataDict[key]['Pump Power']",
"#rest = norm-dataDict[key]['data'][1][1]",
"#print('rest: '+str(rest))"
] | [
{
"param": "dataDict",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dataDict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33a9674f8d9102cd2f9fdebefcb0959736c8e6c6 | movermeyer/setupext-gitversion | setupext/gitversion.py | [
"BSD-3-Clause"
] | Python | _partition_version | <not_specific> | def _partition_version(segments):
"""Partition a version list into public and local parts."""
needle = len(segments)
for index, segment in enumerate(segments):
try:
int(segment)
except ValueError:
needle = index
break
return '.'.join(segments[:needle])... | Partition a version list into public and local parts. | Partition a version list into public and local parts. | [
"Partition",
"a",
"version",
"list",
"into",
"public",
"and",
"local",
"parts",
"."
] | def _partition_version(segments):
needle = len(segments)
for index, segment in enumerate(segments):
try:
int(segment)
except ValueError:
needle = index
break
return '.'.join(segments[:needle]), '.'.join(segments[needle:]) | [
"def",
"_partition_version",
"(",
"segments",
")",
":",
"needle",
"=",
"len",
"(",
"segments",
")",
"for",
"index",
",",
"segment",
"in",
"enumerate",
"(",
"segments",
")",
":",
"try",
":",
"int",
"(",
"segment",
")",
"except",
"ValueError",
":",
"needle... | Partition a version list into public and local parts. | [
"Partition",
"a",
"version",
"list",
"into",
"public",
"and",
"local",
"parts",
"."
] | [
"\"\"\"Partition a version list into public and local parts.\"\"\""
] | [
{
"param": "segments",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "segments",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f00c3ebcc95ba48f91e8213d840dd44c64f51b84 | D-B-Miller/ThermalEventCamera | Scripts/src/thermalraw.py | [
"MIT"
] | Python | start | null | def start(self):
"""
Start threaded reading of the device
"""
self.__stop = False
self.__thread.start() |
Start threaded reading of the device
| Start threaded reading of the device | [
"Start",
"threaded",
"reading",
"of",
"the",
"device"
] | def start(self):
self.__stop = False
self.__thread.start() | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"__stop",
"=",
"False",
"self",
".",
"__thread",
".",
"start",
"(",
")"
] | Start threaded reading of the device | [
"Start",
"threaded",
"reading",
"of",
"the",
"device"
] | [
"\"\"\"\n Start threaded reading of the device\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f00c3ebcc95ba48f91e8213d840dd44c64f51b84 | D-B-Miller/ThermalEventCamera | Scripts/src/thermalraw.py | [
"MIT"
] | Python | stop | null | def stop(self):
"""
Set stop flag for thread and wait for it to finish
"""
self.__stop = True
self.__thread.join() |
Set stop flag for thread and wait for it to finish
| Set stop flag for thread and wait for it to finish | [
"Set",
"stop",
"flag",
"for",
"thread",
"and",
"wait",
"for",
"it",
"to",
"finish"
] | def stop(self):
self.__stop = True
self.__thread.join() | [
"def",
"stop",
"(",
"self",
")",
":",
"self",
".",
"__stop",
"=",
"True",
"self",
".",
"__thread",
".",
"join",
"(",
")"
] | Set stop flag for thread and wait for it to finish | [
"Set",
"stop",
"flag",
"for",
"thread",
"and",
"wait",
"for",
"it",
"to",
"finish"
] | [
"\"\"\"\n Set stop flag for thread and wait for it to finish\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
f00c3ebcc95ba48f91e8213d840dd44c64f51b84 | D-B-Miller/ThermalEventCamera | Scripts/src/thermalraw.py | [
"MIT"
] | Python | update | <not_specific> | def update(self):
"""
Read from device if it's open and update the out and signs
array
The class runs this program in a thread for continuous updates
"""
# loop while flag is false
while(not self.__stop):
# if the device is closed break fr... |
Read from device if it's open and update the out and signs
array
The class runs this program in a thread for continuous updates
| Read from device if it's open and update the out and signs
array
The class runs this program in a thread for continuous updates | [
"Read",
"from",
"device",
"if",
"it",
"'",
"s",
"open",
"and",
"update",
"the",
"out",
"and",
"signs",
"array",
"The",
"class",
"runs",
"this",
"program",
"in",
"a",
"thread",
"for",
"continuous",
"updates"
] | def update(self):
while(not self.__stop):
if self.dev.closed:
print("Cannot read from device! Device closed!")
return
else:
self.data = self.dev.read(self.__size)
if not self.__last:
self.__last = self.da... | [
"def",
"update",
"(",
"self",
")",
":",
"while",
"(",
"not",
"self",
".",
"__stop",
")",
":",
"if",
"self",
".",
"dev",
".",
"closed",
":",
"print",
"(",
"\"Cannot read from device! Device closed!\"",
")",
"return",
"else",
":",
"self",
".",
"data",
"=",... | Read from device if it's open and update the out and signs
array | [
"Read",
"from",
"device",
"if",
"it",
"'",
"s",
"open",
"and",
"update",
"the",
"out",
"and",
"signs",
"array"
] | [
"\"\"\"\n Read from device if it's open and update the out and signs\n array\n\n The class runs this program in a thread for continuous updates\n \"\"\"",
"# loop while flag is false",
"# if the device is closed break from loop",
"# read data",
"# if this is the first... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
df277d35adfe69f7e079ea1b969341b835351f87 | AxelTLarsson/robot-localisation | robot_localisation/robot.py | [
"MIT"
] | Python | surrounding | <not_specific> | def surrounding(pos):
"""
Return a random adjacent position to 'pos'.
"""
x, y = pos
choices = [(x-1, y-1), (x-1, y), (x-1, y+1), (x, y-1), (x, y+1),
(x+1, y-1), (x+1, y), (x+1, y+1)]
return choices[np.random.randint(len(choices))] |
Return a random adjacent position to 'pos'.
| Return a random adjacent position to 'pos'. | [
"Return",
"a",
"random",
"adjacent",
"position",
"to",
"'",
"pos",
"'",
"."
] | def surrounding(pos):
x, y = pos
choices = [(x-1, y-1), (x-1, y), (x-1, y+1), (x, y-1), (x, y+1),
(x+1, y-1), (x+1, y), (x+1, y+1)]
return choices[np.random.randint(len(choices))] | [
"def",
"surrounding",
"(",
"pos",
")",
":",
"x",
",",
"y",
"=",
"pos",
"choices",
"=",
"[",
"(",
"x",
"-",
"1",
",",
"y",
"-",
"1",
")",
",",
"(",
"x",
"-",
"1",
",",
"y",
")",
",",
"(",
"x",
"-",
"1",
",",
"y",
"+",
"1",
")",
",",
... | Return a random adjacent position to 'pos'. | [
"Return",
"a",
"random",
"adjacent",
"position",
"to",
"'",
"pos",
"'",
"."
] | [
"\"\"\"\n Return a random adjacent position to 'pos'.\n \"\"\""
] | [
{
"param": "pos",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pos",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
df277d35adfe69f7e079ea1b969341b835351f87 | AxelTLarsson/robot-localisation | robot_localisation/robot.py | [
"MIT"
] | Python | next_surrounding | <not_specific> | def next_surrounding(pos):
"""
Return a random next-adjacent position to 'pos'.
"""
x, y = pos
choices = [(x-2, y-2), (x-2, y-1), (x-2, y), (x-2, y+1), (x-2, y+2),
(x-1, y-2), (x-1, y+2), (x, y-2), (x, y+2), (x+1, y-2),
(x+1, y+2), (x+2, y-2)... |
Return a random next-adjacent position to 'pos'.
| Return a random next-adjacent position to 'pos'. | [
"Return",
"a",
"random",
"next",
"-",
"adjacent",
"position",
"to",
"'",
"pos",
"'",
"."
] | def next_surrounding(pos):
x, y = pos
choices = [(x-2, y-2), (x-2, y-1), (x-2, y), (x-2, y+1), (x-2, y+2),
(x-1, y-2), (x-1, y+2), (x, y-2), (x, y+2), (x+1, y-2),
(x+1, y+2), (x+2, y-2), (x+2, y-1), (x+2, y), (x+2, y+1),
(x+2, y+2)]
return... | [
"def",
"next_surrounding",
"(",
"pos",
")",
":",
"x",
",",
"y",
"=",
"pos",
"choices",
"=",
"[",
"(",
"x",
"-",
"2",
",",
"y",
"-",
"2",
")",
",",
"(",
"x",
"-",
"2",
",",
"y",
"-",
"1",
")",
",",
"(",
"x",
"-",
"2",
",",
"y",
")",
",... | Return a random next-adjacent position to 'pos'. | [
"Return",
"a",
"random",
"next",
"-",
"adjacent",
"position",
"to",
"'",
"pos",
"'",
"."
] | [
"\"\"\"\n Return a random next-adjacent position to 'pos'.\n \"\"\""
] | [
{
"param": "pos",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pos",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d7b9e65b24ed0eb60e85997d2f2db269c3612120 | AxelTLarsson/robot-localisation | robot_localisation/main.py | [
"MIT"
] | Python | help_text | <not_specific> | def help_text():
"""
Return a helpful text explaining usage of the program.
"""
return """
------------------------------- HMM Filtering ---------------------------------
Type a command to get started. Type 'quit' or 'q' to quit.
Valid commands (all commands are case insensitive):
ENTER ... |
Return a helpful text explaining usage of the program.
| Return a helpful text explaining usage of the program. | [
"Return",
"a",
"helpful",
"text",
"explaining",
"usage",
"of",
"the",
"program",
"."
] | def help_text():
return """
------------------------------- HMM Filtering ---------------------------------
Type a command to get started. Type 'quit' or 'q' to quit.
Valid commands (all commands are case insensitive):
ENTER move the robot one step further in the simulation,
... | [
"def",
"help_text",
"(",
")",
":",
"return",
"\"\"\"\n------------------------------- HMM Filtering ---------------------------------\nType a command to get started. Type 'quit' or 'q' to quit.\n\nValid commands (all commands are case insensitive):\n ENTER move the robot one step fu... | Return a helpful text explaining usage of the program. | [
"Return",
"a",
"helpful",
"text",
"explaining",
"usage",
"of",
"the",
"program",
"."
] | [
"\"\"\"\n Return a helpful text explaining usage of the program.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d7b9e65b24ed0eb60e85997d2f2db269c3612120 | AxelTLarsson/robot-localisation | robot_localisation/main.py | [
"MIT"
] | Python | manhattan | <not_specific> | def manhattan(pos1, pos2):
"""
Calculate the Manhattan distance between pos1 and pos2.
"""
x1, y1 = pos1
x2, y2 = pos2
return abs(x1-x2) + abs(y1-y2) |
Calculate the Manhattan distance between pos1 and pos2.
| Calculate the Manhattan distance between pos1 and pos2. | [
"Calculate",
"the",
"Manhattan",
"distance",
"between",
"pos1",
"and",
"pos2",
"."
] | def manhattan(pos1, pos2):
x1, y1 = pos1
x2, y2 = pos2
return abs(x1-x2) + abs(y1-y2) | [
"def",
"manhattan",
"(",
"pos1",
",",
"pos2",
")",
":",
"x1",
",",
"y1",
"=",
"pos1",
"x2",
",",
"y2",
"=",
"pos2",
"return",
"abs",
"(",
"x1",
"-",
"x2",
")",
"+",
"abs",
"(",
"y1",
"-",
"y2",
")"
] | Calculate the Manhattan distance between pos1 and pos2. | [
"Calculate",
"the",
"Manhattan",
"distance",
"between",
"pos1",
"and",
"pos2",
"."
] | [
"\"\"\"\n Calculate the Manhattan distance between pos1 and pos2.\n \"\"\""
] | [
{
"param": "pos1",
"type": null
},
{
"param": "pos2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pos1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pos2",
"type": null,
"docstring": null,
"docstring_tokens": [... |
87ba28ee096957fdb03e1cb5f5353b1b7d9a85c1 | AxelTLarsson/robot-localisation | robot_localisation/hmm_filter.py | [
"MIT"
] | Python | belief_matrix | <not_specific> | def belief_matrix(self):
"""
Store the belief matrix as a property
"""
return self._belief_matrix |
Store the belief matrix as a property
| Store the belief matrix as a property | [
"Store",
"the",
"belief",
"matrix",
"as",
"a",
"property"
] | def belief_matrix(self):
return self._belief_matrix | [
"def",
"belief_matrix",
"(",
"self",
")",
":",
"return",
"self",
".",
"_belief_matrix"
] | Store the belief matrix as a property | [
"Store",
"the",
"belief",
"matrix",
"as",
"a",
"property"
] | [
"\"\"\"\n Store the belief matrix as a property\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
87ba28ee096957fdb03e1cb5f5353b1b7d9a85c1 | AxelTLarsson/robot-localisation | robot_localisation/hmm_filter.py | [
"MIT"
] | Python | belief_matrix | null | def belief_matrix(self, value: np.ndarray):
"""
Always perform normalisation when setting the belief matrix
:param value: non-normalised array for the belief matrix
"""
self._belief_matrix = value / np.sum(value) |
Always perform normalisation when setting the belief matrix
:param value: non-normalised array for the belief matrix
| Always perform normalisation when setting the belief matrix | [
"Always",
"perform",
"normalisation",
"when",
"setting",
"the",
"belief",
"matrix"
] | def belief_matrix(self, value: np.ndarray):
self._belief_matrix = value / np.sum(value) | [
"def",
"belief_matrix",
"(",
"self",
",",
"value",
":",
"np",
".",
"ndarray",
")",
":",
"self",
".",
"_belief_matrix",
"=",
"value",
"/",
"np",
".",
"sum",
"(",
"value",
")"
] | Always perform normalisation when setting the belief matrix | [
"Always",
"perform",
"normalisation",
"when",
"setting",
"the",
"belief",
"matrix"
] | [
"\"\"\"\n Always perform normalisation when setting the belief matrix\n\n :param value: non-normalised array for the belief matrix\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "value",
"type": "np.ndarray"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "np.ndarray",
"docstring": "non-normalised array fo... |
a8a6c489f778158ad623d1f54cfb9e4c7a163cf1 | AxelTLarsson/robot-localisation | tests/robot_test.py | [
"MIT"
] | Python | assert_pose_north_of | null | def assert_pose_north_of(self, pose1, pose2):
"""
Assert that pose1 is ONE step north of pose2.
"""
x1, y1, _ = pose1
x2, y2, _ = pose2
self.assertEqual(x1 - x2, -1)
self.assertEqual(y1, y2) |
Assert that pose1 is ONE step north of pose2.
| Assert that pose1 is ONE step north of pose2. | [
"Assert",
"that",
"pose1",
"is",
"ONE",
"step",
"north",
"of",
"pose2",
"."
] | def assert_pose_north_of(self, pose1, pose2):
x1, y1, _ = pose1
x2, y2, _ = pose2
self.assertEqual(x1 - x2, -1)
self.assertEqual(y1, y2) | [
"def",
"assert_pose_north_of",
"(",
"self",
",",
"pose1",
",",
"pose2",
")",
":",
"x1",
",",
"y1",
",",
"_",
"=",
"pose1",
"x2",
",",
"y2",
",",
"_",
"=",
"pose2",
"self",
".",
"assertEqual",
"(",
"x1",
"-",
"x2",
",",
"-",
"1",
")",
"self",
".... | Assert that pose1 is ONE step north of pose2. | [
"Assert",
"that",
"pose1",
"is",
"ONE",
"step",
"north",
"of",
"pose2",
"."
] | [
"\"\"\"\n Assert that pose1 is ONE step north of pose2.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pose1",
"type": null
},
{
"param": "pose2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pose1",
"type": null,
"docstring": null,
"docstring_tokens": ... |
a8a6c489f778158ad623d1f54cfb9e4c7a163cf1 | AxelTLarsson/robot-localisation | tests/robot_test.py | [
"MIT"
] | Python | assert_pose_east_of | null | def assert_pose_east_of(self, pose1, pose2):
"""
Assert that pose1 is ONE step east of pose2.
"""
x1, y1, _ = pose1
x2, y2, _ = pose2
self.assertEqual(y1 - y2, 1)
self.assertEqual(x1, x2) |
Assert that pose1 is ONE step east of pose2.
| Assert that pose1 is ONE step east of pose2. | [
"Assert",
"that",
"pose1",
"is",
"ONE",
"step",
"east",
"of",
"pose2",
"."
] | def assert_pose_east_of(self, pose1, pose2):
x1, y1, _ = pose1
x2, y2, _ = pose2
self.assertEqual(y1 - y2, 1)
self.assertEqual(x1, x2) | [
"def",
"assert_pose_east_of",
"(",
"self",
",",
"pose1",
",",
"pose2",
")",
":",
"x1",
",",
"y1",
",",
"_",
"=",
"pose1",
"x2",
",",
"y2",
",",
"_",
"=",
"pose2",
"self",
".",
"assertEqual",
"(",
"y1",
"-",
"y2",
",",
"1",
")",
"self",
".",
"as... | Assert that pose1 is ONE step east of pose2. | [
"Assert",
"that",
"pose1",
"is",
"ONE",
"step",
"east",
"of",
"pose2",
"."
] | [
"\"\"\"\n Assert that pose1 is ONE step east of pose2.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pose1",
"type": null
},
{
"param": "pose2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pose1",
"type": null,
"docstring": null,
"docstring_tokens": ... |
a8a6c489f778158ad623d1f54cfb9e4c7a163cf1 | AxelTLarsson/robot-localisation | tests/robot_test.py | [
"MIT"
] | Python | assert_pose_south_of | null | def assert_pose_south_of(self, pose1, pose2):
"""
Assert that pose1 is ONE step south of pose2.
"""
x1, y1, _ = pose1
x2, y2, _ = pose2
self.assertEqual(x1 - x2, 1)
self.assertEqual(y1, y2) |
Assert that pose1 is ONE step south of pose2.
| Assert that pose1 is ONE step south of pose2. | [
"Assert",
"that",
"pose1",
"is",
"ONE",
"step",
"south",
"of",
"pose2",
"."
] | def assert_pose_south_of(self, pose1, pose2):
x1, y1, _ = pose1
x2, y2, _ = pose2
self.assertEqual(x1 - x2, 1)
self.assertEqual(y1, y2) | [
"def",
"assert_pose_south_of",
"(",
"self",
",",
"pose1",
",",
"pose2",
")",
":",
"x1",
",",
"y1",
",",
"_",
"=",
"pose1",
"x2",
",",
"y2",
",",
"_",
"=",
"pose2",
"self",
".",
"assertEqual",
"(",
"x1",
"-",
"x2",
",",
"1",
")",
"self",
".",
"a... | Assert that pose1 is ONE step south of pose2. | [
"Assert",
"that",
"pose1",
"is",
"ONE",
"step",
"south",
"of",
"pose2",
"."
] | [
"\"\"\"\n Assert that pose1 is ONE step south of pose2.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pose1",
"type": null
},
{
"param": "pose2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pose1",
"type": null,
"docstring": null,
"docstring_tokens": ... |
a8a6c489f778158ad623d1f54cfb9e4c7a163cf1 | AxelTLarsson/robot-localisation | tests/robot_test.py | [
"MIT"
] | Python | assert_pose_west_of | null | def assert_pose_west_of(self, pose1, pose2):
"""
Assert that pose1 is ONE step west of pose2.
"""
x1, y1, _ = pose1
x2, y2, _ = pose2
self.assertEqual(y1 - y2, -1)
self.assertEqual(x1, x2) |
Assert that pose1 is ONE step west of pose2.
| Assert that pose1 is ONE step west of pose2. | [
"Assert",
"that",
"pose1",
"is",
"ONE",
"step",
"west",
"of",
"pose2",
"."
] | def assert_pose_west_of(self, pose1, pose2):
x1, y1, _ = pose1
x2, y2, _ = pose2
self.assertEqual(y1 - y2, -1)
self.assertEqual(x1, x2) | [
"def",
"assert_pose_west_of",
"(",
"self",
",",
"pose1",
",",
"pose2",
")",
":",
"x1",
",",
"y1",
",",
"_",
"=",
"pose1",
"x2",
",",
"y2",
",",
"_",
"=",
"pose2",
"self",
".",
"assertEqual",
"(",
"y1",
"-",
"y2",
",",
"-",
"1",
")",
"self",
"."... | Assert that pose1 is ONE step west of pose2. | [
"Assert",
"that",
"pose1",
"is",
"ONE",
"step",
"west",
"of",
"pose2",
"."
] | [
"\"\"\"\n Assert that pose1 is ONE step west of pose2.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pose1",
"type": null
},
{
"param": "pose2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pose1",
"type": null,
"docstring": null,
"docstring_tokens": ... |
891fbb3db345b49bb1e7a4d27fe239b8ea4f580e | AxelTLarsson/robot-localisation | robot_localisation/grid.py | [
"MIT"
] | Python | index_to_pose | <not_specific> | def index_to_pose(self, id):
"""
Convert a numerical index to corresponding pose.
E.g. index_to_pose(5) = (0, 1, North) where North is a Heading
"""
return (int((id / 4) // self.shape[1]), # row
int((id / 4) % self.shape[1]), # column
Heading(id... |
Convert a numerical index to corresponding pose.
E.g. index_to_pose(5) = (0, 1, North) where North is a Heading
| Convert a numerical index to corresponding pose. | [
"Convert",
"a",
"numerical",
"index",
"to",
"corresponding",
"pose",
"."
] | def index_to_pose(self, id):
return (int((id / 4) // self.shape[1]),
int((id / 4) % self.shape[1]),
Heading(id % 4)) | [
"def",
"index_to_pose",
"(",
"self",
",",
"id",
")",
":",
"return",
"(",
"int",
"(",
"(",
"id",
"/",
"4",
")",
"//",
"self",
".",
"shape",
"[",
"1",
"]",
")",
",",
"int",
"(",
"(",
"id",
"/",
"4",
")",
"%",
"self",
".",
"shape",
"[",
"1",
... | Convert a numerical index to corresponding pose. | [
"Convert",
"a",
"numerical",
"index",
"to",
"corresponding",
"pose",
"."
] | [
"\"\"\"\n Convert a numerical index to corresponding pose.\n\n E.g. index_to_pose(5) = (0, 1, North) where North is a Heading\n \"\"\"",
"# row",
"# column"
] | [
{
"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": [],... |
891fbb3db345b49bb1e7a4d27fe239b8ea4f580e | AxelTLarsson/robot-localisation | robot_localisation/grid.py | [
"MIT"
] | Python | pose_to_index | <not_specific> | def pose_to_index(self, pose):
"""
Translate a pose of type (x, y, Heading) to a numerical index that can
be used with the transition matrix.
E.g. pose_to_index((0,1,N)) = 5 where N is a Heading
"""
# compute square_nbr as row-major on the grid, first grid is nbr 0
... |
Translate a pose of type (x, y, Heading) to a numerical index that can
be used with the transition matrix.
E.g. pose_to_index((0,1,N)) = 5 where N is a Heading
| Translate a pose of type (x, y, Heading) to a numerical index that can
be used with the transition matrix.
| [
"Translate",
"a",
"pose",
"of",
"type",
"(",
"x",
"y",
"Heading",
")",
"to",
"a",
"numerical",
"index",
"that",
"can",
"be",
"used",
"with",
"the",
"transition",
"matrix",
"."
] | def pose_to_index(self, pose):
cols = self.shape[1]
x, y, h = pose
square_nbr = x * cols + y
return square_nbr * 4 + int(h) | [
"def",
"pose_to_index",
"(",
"self",
",",
"pose",
")",
":",
"cols",
"=",
"self",
".",
"shape",
"[",
"1",
"]",
"x",
",",
"y",
",",
"h",
"=",
"pose",
"square_nbr",
"=",
"x",
"*",
"cols",
"+",
"y",
"return",
"square_nbr",
"*",
"4",
"+",
"int",
"("... | Translate a pose of type (x, y, Heading) to a numerical index that can
be used with the transition matrix. | [
"Translate",
"a",
"pose",
"of",
"type",
"(",
"x",
"y",
"Heading",
")",
"to",
"a",
"numerical",
"index",
"that",
"can",
"be",
"used",
"with",
"the",
"transition",
"matrix",
"."
] | [
"\"\"\"\n Translate a pose of type (x, y, Heading) to a numerical index that can\n be used with the transition matrix.\n\n E.g. pose_to_index((0,1,N)) = 5 where N is a Heading\n \"\"\"",
"# compute square_nbr as row-major on the grid, first grid is nbr 0"
] | [
{
"param": "self",
"type": null
},
{
"param": "pose",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pose",
"type": null,
"docstring": null,
"docstring_tokens": [... |
75bd40a3e2ff768f114d61ccd25b5e9e952bd0a4 | reprise-bliss/reprise | reprise/repository.py | [
"Apache-2.0"
] | Python | add | null | def add(self, filename):
''' add a package to this repository '''
if not os.path.exists(filename):
raise FileNotFoundError(
"[Errno 2] No such file or directory: " + repr(filename))
reprise.reprepro.include_deb(self.path, filename) | add a package to this repository | add a package to this repository | [
"add",
"a",
"package",
"to",
"this",
"repository"
] | def add(self, filename):
if not os.path.exists(filename):
raise FileNotFoundError(
"[Errno 2] No such file or directory: " + repr(filename))
reprise.reprepro.include_deb(self.path, filename) | [
"def",
"add",
"(",
"self",
",",
"filename",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"filename",
")",
":",
"raise",
"FileNotFoundError",
"(",
"\"[Errno 2] No such file or directory: \"",
"+",
"repr",
"(",
"filename",
")",
")",
"reprise",... | add a package to this repository | [
"add",
"a",
"package",
"to",
"this",
"repository"
] | [
"''' add a package to this repository '''"
] | [
{
"param": "self",
"type": null
},
{
"param": "filename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "filename",
"type": null,
"docstring": null,
"docstring_tokens... |
75bd40a3e2ff768f114d61ccd25b5e9e952bd0a4 | reprise-bliss/reprise | reprise/repository.py | [
"Apache-2.0"
] | Python | reinitialize | null | def reinitialize(self):
''' re-add the packages in a broken repository '''
packages = glob.glob(os.path.join(
self.path, "**/**/**/**/**/*.deb"))
for i in packages:
self.add(i) | re-add the packages in a broken repository | re-add the packages in a broken repository | [
"re",
"-",
"add",
"the",
"packages",
"in",
"a",
"broken",
"repository"
] | def reinitialize(self):
packages = glob.glob(os.path.join(
self.path, "**/**/**/**/**/*.deb"))
for i in packages:
self.add(i) | [
"def",
"reinitialize",
"(",
"self",
")",
":",
"packages",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"path",
",",
"\"**/**/**/**/**/*.deb\"",
")",
")",
"for",
"i",
"in",
"packages",
":",
"self",
".",
"add",
"(",
... | re-add the packages in a broken repository | [
"re",
"-",
"add",
"the",
"packages",
"in",
"a",
"broken",
"repository"
] | [
"''' re-add the packages in a broken repository '''"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a86a25a0efce0668cfb73178d60449f8731154cd | redapple/peewee | pwiz.py | [
"MIT"
] | Python | connect | null | def connect(self, database, **connect):
"""
Open a connection to the given database, passing along any keyword
arguments.
"""
conn_class = self.get_conn_class()
self.conn = conn_class(database, **connect)
try:
self.conn.connect()
except:
... |
Open a connection to the given database, passing along any keyword
arguments.
| Open a connection to the given database, passing along any keyword
arguments. | [
"Open",
"a",
"connection",
"to",
"the",
"given",
"database",
"passing",
"along",
"any",
"keyword",
"arguments",
"."
] | def connect(self, database, **connect):
conn_class = self.get_conn_class()
self.conn = conn_class(database, **connect)
try:
self.conn.connect()
except:
err('error connecting to %s' % database)
raise | [
"def",
"connect",
"(",
"self",
",",
"database",
",",
"**",
"connect",
")",
":",
"conn_class",
"=",
"self",
".",
"get_conn_class",
"(",
")",
"self",
".",
"conn",
"=",
"conn_class",
"(",
"database",
",",
"**",
"connect",
")",
"try",
":",
"self",
".",
"... | Open a connection to the given database, passing along any keyword
arguments. | [
"Open",
"a",
"connection",
"to",
"the",
"given",
"database",
"passing",
"along",
"any",
"keyword",
"arguments",
"."
] | [
"\"\"\"\n Open a connection to the given database, passing along any keyword\n arguments.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "database",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "database",
"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.