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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f4c71071962eddf3776f365a61210c1c80ec0a27 | slowiklukasz/chm_pdal | chm_zd_bckup.py | [
"MIT"
] | Python | dem_extract | null | def dem_extract(lidar_fn, out_fn, stat, in_srs="EPSG:2180", out_srs="EPSG:2178"):
"""Creating DSM and DTM (both trees only) from lidar data"""
start = time.time()
elevation = "DTM" if stat == "min" else "DSM"
print("{} extracting...".format(elevation))
pdal_json = {
"pipeline": [
... | Creating DSM and DTM (both trees only) from lidar data | Creating DSM and DTM (both trees only) from lidar data | [
"Creating",
"DSM",
"and",
"DTM",
"(",
"both",
"trees",
"only",
")",
"from",
"lidar",
"data"
] | def dem_extract(lidar_fn, out_fn, stat, in_srs="EPSG:2180", out_srs="EPSG:2178"):
start = time.time()
elevation = "DTM" if stat == "min" else "DSM"
print("{} extracting...".format(elevation))
pdal_json = {
"pipeline": [
"{}".format(lidar_fn),
{
"type": "fi... | [
"def",
"dem_extract",
"(",
"lidar_fn",
",",
"out_fn",
",",
"stat",
",",
"in_srs",
"=",
"\"EPSG:2180\"",
",",
"out_srs",
"=",
"\"EPSG:2178\"",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"elevation",
"=",
"\"DTM\"",
"if",
"stat",
"==",
"\"min\"... | Creating DSM and DTM (both trees only) from lidar data | [
"Creating",
"DSM",
"and",
"DTM",
"(",
"both",
"trees",
"only",
")",
"from",
"lidar",
"data"
] | [
"\"\"\"Creating DSM and DTM (both trees only) from lidar data\"\"\""
] | [
{
"param": "lidar_fn",
"type": null
},
{
"param": "out_fn",
"type": null
},
{
"param": "stat",
"type": null
},
{
"param": "in_srs",
"type": null
},
{
"param": "out_srs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lidar_fn",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "out_fn",
"type": null,
"docstring": null,
"docstring_toke... |
f4c71071962eddf3776f365a61210c1c80ec0a27 | slowiklukasz/chm_pdal | chm_zd_bckup.py | [
"MIT"
] | Python | chm_calculate | null | def chm_calculate(dtm_fn, dsm_fn, chm_fn):
"""Calculating CHM from DSM and DTM"""
start = time.time()
print("CHM calculating...")
# LOADING DRIVER
driver_tiff = gdal.GetDriverByName("GTiff")
# OPEN DATASET & READ DATA
dtm_ds = gdal.Open(dtm_fn)
dtm_data = dtm_ds.GetRasterBand... | Calculating CHM from DSM and DTM | Calculating CHM from DSM and DTM | [
"Calculating",
"CHM",
"from",
"DSM",
"and",
"DTM"
] | def chm_calculate(dtm_fn, dsm_fn, chm_fn):
start = time.time()
print("CHM calculating...")
driver_tiff = gdal.GetDriverByName("GTiff")
dtm_ds = gdal.Open(dtm_fn)
dtm_data = dtm_ds.GetRasterBand(1).ReadAsArray()
dsm_ds = gdal.Open(dsm_fn)
dsm_data = dsm_ds.GetRasterBand(1).ReadAsArray()
c... | [
"def",
"chm_calculate",
"(",
"dtm_fn",
",",
"dsm_fn",
",",
"chm_fn",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"print",
"(",
"\"CHM calculating...\"",
")",
"driver_tiff",
"=",
"gdal",
".",
"GetDriverByName",
"(",
"\"GTiff\"",
")",
"dtm_ds",
"=... | Calculating CHM from DSM and DTM | [
"Calculating",
"CHM",
"from",
"DSM",
"and",
"DTM"
] | [
"\"\"\"Calculating CHM from DSM and DTM\"\"\"",
"# LOADING DRIVER\r",
"# OPEN DATASET & READ DATA\r",
"# CALCULATE CHM\r",
"# CREATE FILTERED RASTER AND SAVE DATA\r",
"# CLOSING DATASETS\r"
] | [
{
"param": "dtm_fn",
"type": null
},
{
"param": "dsm_fn",
"type": null
},
{
"param": "chm_fn",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dtm_fn",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dsm_fn",
"type": null,
"docstring": null,
"docstring_tokens... |
f4c71071962eddf3776f365a61210c1c80ec0a27 | slowiklukasz/chm_pdal | chm_zd_bckup.py | [
"MIT"
] | Python | chm_segmentation | <not_specific> | def chm_segmentation(chm_array):
"""CHM ata filtering, masking and watershed segmentation.
Idea from https://www.neonscience.org/resources/learning-hub/tutorials/calc-biomass-py"""
start = time.time()
print("Watershed segmentation...")
# APPLYING GAUSSIAN FILTER TO REMOVE WRONG POINTS
ch... | CHM ata filtering, masking and watershed segmentation.
Idea from https://www.neonscience.org/resources/learning-hub/tutorials/calc-biomass-py | CHM ata filtering, masking and watershed segmentation. | [
"CHM",
"ata",
"filtering",
"masking",
"and",
"watershed",
"segmentation",
"."
] | def chm_segmentation(chm_array):
start = time.time()
print("Watershed segmentation...")
chm_array_smooth = ndi.gaussian_filter(chm_array, 1,
mode='constant',
cval=0,
truncate=1)
... | [
"def",
"chm_segmentation",
"(",
"chm_array",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"print",
"(",
"\"Watershed segmentation...\"",
")",
"chm_array_smooth",
"=",
"ndi",
".",
"gaussian_filter",
"(",
"chm_array",
",",
"1",
",",
"mode",
"=",
"'co... | CHM ata filtering, masking and watershed segmentation. | [
"CHM",
"ata",
"filtering",
"masking",
"and",
"watershed",
"segmentation",
"."
] | [
"\"\"\"CHM ata filtering, masking and watershed segmentation.\r\n Idea from https://www.neonscience.org/resources/learning-hub/tutorials/calc-biomass-py\"\"\"",
"# APPLYING GAUSSIAN FILTER TO REMOVE WRONG POINTS\r",
"# CALCULATE LOCAL MAXIMUM POINTS\r",
"# CREATE MASK TO MATCH INPUT ARRAY SIZE\r",
"# IDE... | [
{
"param": "chm_array",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "chm_array",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
92b1956bcdee53beeffefdec8303d9cc05c47832 | slowiklukasz/chm_pdal | chm_calc.py | [
"MIT"
] | Python | dem_extract | null | def dem_extract(lidar_fn, out_fn, stat, in_srs="EPSG:2180", out_srs="EPSG:2178"):
"""Creating DSM and DTM (both trees only) from lidar data"""
start = time.time()
elevation = "DTM" if stat == "min" else "DSM"
print("{} extracting...".format(elevation))
pdal_json = {
"pipeline": [
... | Creating DSM and DTM (both trees only) from lidar data | Creating DSM and DTM (both trees only) from lidar data | [
"Creating",
"DSM",
"and",
"DTM",
"(",
"both",
"trees",
"only",
")",
"from",
"lidar",
"data"
] | def dem_extract(lidar_fn, out_fn, stat, in_srs="EPSG:2180", out_srs="EPSG:2178"):
start = time.time()
elevation = "DTM" if stat == "min" else "DSM"
print("{} extracting...".format(elevation))
pdal_json = {
"pipeline": [
"{}".format(lidar_fn),
{
"type": "... | [
"def",
"dem_extract",
"(",
"lidar_fn",
",",
"out_fn",
",",
"stat",
",",
"in_srs",
"=",
"\"EPSG:2180\"",
",",
"out_srs",
"=",
"\"EPSG:2178\"",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"elevation",
"=",
"\"DTM\"",
"if",
"stat",
"==",
"\"min\"... | Creating DSM and DTM (both trees only) from lidar data | [
"Creating",
"DSM",
"and",
"DTM",
"(",
"both",
"trees",
"only",
")",
"from",
"lidar",
"data"
] | [
"\"\"\"Creating DSM and DTM (both trees only) from lidar data\"\"\"",
"# M-34-64-D-d-2-1-3-1.las\r"
] | [
{
"param": "lidar_fn",
"type": null
},
{
"param": "out_fn",
"type": null
},
{
"param": "stat",
"type": null
},
{
"param": "in_srs",
"type": null
},
{
"param": "out_srs",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "lidar_fn",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "out_fn",
"type": null,
"docstring": null,
"docstring_toke... |
92b1956bcdee53beeffefdec8303d9cc05c47832 | slowiklukasz/chm_pdal | chm_calc.py | [
"MIT"
] | Python | offsets_transform | <not_specific> | def offsets_transform(row_offset, col_offset, transform):
"""Calculating new geotransform for each segment boxboundary"""
new_geotransform = [
transform[0] + (col_offset * transform[1]),
transform[1],
0.0,
transform[3] + (row_offset * transform[5]),
0.0,
t... | Calculating new geotransform for each segment boxboundary | Calculating new geotransform for each segment boxboundary | [
"Calculating",
"new",
"geotransform",
"for",
"each",
"segment",
"boxboundary"
] | def offsets_transform(row_offset, col_offset, transform):
new_geotransform = [
transform[0] + (col_offset * transform[1]),
transform[1],
0.0,
transform[3] + (row_offset * transform[5]),
0.0,
transform[5]
]
return new_geotransform | [
"def",
"offsets_transform",
"(",
"row_offset",
",",
"col_offset",
",",
"transform",
")",
":",
"new_geotransform",
"=",
"[",
"transform",
"[",
"0",
"]",
"+",
"(",
"col_offset",
"*",
"transform",
"[",
"1",
"]",
")",
",",
"transform",
"[",
"1",
"]",
",",
... | Calculating new geotransform for each segment boxboundary | [
"Calculating",
"new",
"geotransform",
"for",
"each",
"segment",
"boxboundary"
] | [
"\"\"\"Calculating new geotransform for each segment boxboundary\"\"\""
] | [
{
"param": "row_offset",
"type": null
},
{
"param": "col_offset",
"type": null
},
{
"param": "transform",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "row_offset",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "col_offset",
"type": null,
"docstring": null,
"docstrin... |
92b1956bcdee53beeffefdec8303d9cc05c47832 | slowiklukasz/chm_pdal | chm_calc.py | [
"MIT"
] | Python | calculate_zstats | <not_specific> | def calculate_zstats(fid, min, max, mean, median, sd, sum, count):
"""Calculating basic statistic, determining maximum height in segment"""
names = ["id", "min", "max", "mean", "median", "sd", "sum", "count"]
featStats = {names[0]: fid,
names[1]: min,
names[2]: max,
... | Calculating basic statistic, determining maximum height in segment | Calculating basic statistic, determining maximum height in segment | [
"Calculating",
"basic",
"statistic",
"determining",
"maximum",
"height",
"in",
"segment"
] | def calculate_zstats(fid, min, max, mean, median, sd, sum, count):
names = ["id", "min", "max", "mean", "median", "sd", "sum", "count"]
featStats = {names[0]: fid,
names[1]: min,
names[2]: max,
names[3]: mean,
names[4]: median,
... | [
"def",
"calculate_zstats",
"(",
"fid",
",",
"min",
",",
"max",
",",
"mean",
",",
"median",
",",
"sd",
",",
"sum",
",",
"count",
")",
":",
"names",
"=",
"[",
"\"id\"",
",",
"\"min\"",
",",
"\"max\"",
",",
"\"mean\"",
",",
"\"median\"",
",",
"\"sd\"",
... | Calculating basic statistic, determining maximum height in segment | [
"Calculating",
"basic",
"statistic",
"determining",
"maximum",
"height",
"in",
"segment"
] | [
"\"\"\"Calculating basic statistic, determining maximum height in segment\"\"\""
] | [
{
"param": "fid",
"type": null
},
{
"param": "min",
"type": null
},
{
"param": "max",
"type": null
},
{
"param": "mean",
"type": null
},
{
"param": "median",
"type": null
},
{
"param": "sd",
"type": null
},
{
"param": "sum",
"type": nul... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fid",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "min",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
9b3ccb6445a55b6392e9373267e62928d1699590 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/tools/sis_authentication.py | [
"MIT"
] | Python | __authenticate_employee | <not_specific> | def __authenticate_employee(name, surname):
"""
Checks if such employee exits when asked at is.cuni.cz/studium/kdojekdo
:param name: name
:param surname: surname
:return: True if such person exists, False otherwise
"""
url = __build_url(is_employee=True, name=name, surname=surname)
page ... |
Checks if such employee exits when asked at is.cuni.cz/studium/kdojekdo
:param name: name
:param surname: surname
:return: True if such person exists, False otherwise
| Checks if such employee exits when asked at is.cuni.cz/studium/kdojekdo | [
"Checks",
"if",
"such",
"employee",
"exits",
"when",
"asked",
"at",
"is",
".",
"cuni",
".",
"cz",
"/",
"studium",
"/",
"kdojekdo"
] | def __authenticate_employee(name, surname):
url = __build_url(is_employee=True, name=name, surname=surname)
page = requests.get(url)
nubmer_of_results = __get_number_of_employees(page=page)
if int(nubmer_of_results) >= 1:
return True
return False | [
"def",
"__authenticate_employee",
"(",
"name",
",",
"surname",
")",
":",
"url",
"=",
"__build_url",
"(",
"is_employee",
"=",
"True",
",",
"name",
"=",
"name",
",",
"surname",
"=",
"surname",
")",
"page",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"n... | Checks if such employee exits when asked at is.cuni.cz/studium/kdojekdo | [
"Checks",
"if",
"such",
"employee",
"exits",
"when",
"asked",
"at",
"is",
".",
"cuni",
".",
"cz",
"/",
"studium",
"/",
"kdojekdo"
] | [
"\"\"\"\n Checks if such employee exits when asked at is.cuni.cz/studium/kdojekdo\n :param name: name\n :param surname: surname\n :return: True if such person exists, False otherwise\n \"\"\""
] | [
{
"param": "name",
"type": null
},
{
"param": "surname",
"type": null
}
] | {
"returns": [
{
"docstring": "True if such person exists, False otherwise",
"docstring_tokens": [
"True",
"if",
"such",
"person",
"exists",
"False",
"otherwise"
],
"type": null
}
],
"raises": [],
"params": [
{
"id... |
9b3ccb6445a55b6392e9373267e62928d1699590 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/tools/sis_authentication.py | [
"MIT"
] | Python | __get_number_of_employees | <not_specific> | def __get_number_of_employees(page):
"""
Searches for number of results at queried page
:param page: queried page with results
:return: number of employees in the results
"""
soup = BeautifulSoup(page.content, 'html.parser')
content = soup.select('#page_div > b:nth-child(3)')
for text in... |
Searches for number of results at queried page
:param page: queried page with results
:return: number of employees in the results
| Searches for number of results at queried page | [
"Searches",
"for",
"number",
"of",
"results",
"at",
"queried",
"page"
] | def __get_number_of_employees(page):
soup = BeautifulSoup(page.content, 'html.parser')
content = soup.select('#page_div > b:nth-child(3)')
for text in content:
for part in text:
return __get_number(part)
return 0 | [
"def",
"__get_number_of_employees",
"(",
"page",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
"page",
".",
"content",
",",
"'html.parser'",
")",
"content",
"=",
"soup",
".",
"select",
"(",
"'#page_div > b:nth-child(3)'",
")",
"for",
"text",
"in",
"content",
":... | Searches for number of results at queried page | [
"Searches",
"for",
"number",
"of",
"results",
"at",
"queried",
"page"
] | [
"\"\"\"\n Searches for number of results at queried page\n :param page: queried page with results\n :return: number of employees in the results\n \"\"\""
] | [
{
"param": "page",
"type": null
}
] | {
"returns": [
{
"docstring": "number of employees in the results",
"docstring_tokens": [
"number",
"of",
"employees",
"in",
"the",
"results"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "page",
"ty... |
9b3ccb6445a55b6392e9373267e62928d1699590 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/tools/sis_authentication.py | [
"MIT"
] | Python | __get_number_of_students | <not_specific> | def __get_number_of_students(page):
"""
Searches for number of results at queried page
:param page: queried page with results
:return: number of students in the results
"""
soup = BeautifulSoup(page.content, 'html.parser')
content = soup.select('#page_div > b:nth-child(3)')
for text in ... |
Searches for number of results at queried page
:param page: queried page with results
:return: number of students in the results
| Searches for number of results at queried page | [
"Searches",
"for",
"number",
"of",
"results",
"at",
"queried",
"page"
] | def __get_number_of_students(page):
soup = BeautifulSoup(page.content, 'html.parser')
content = soup.select('#page_div > b:nth-child(3)')
for text in content:
for part in text:
return __get_number(part)
content = soup.select('#content > table > tr > td.info_text > ul > li')
for ... | [
"def",
"__get_number_of_students",
"(",
"page",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
"page",
".",
"content",
",",
"'html.parser'",
")",
"content",
"=",
"soup",
".",
"select",
"(",
"'#page_div > b:nth-child(3)'",
")",
"for",
"text",
"in",
"content",
":"... | Searches for number of results at queried page | [
"Searches",
"for",
"number",
"of",
"results",
"at",
"queried",
"page"
] | [
"\"\"\"\n Searches for number of results at queried page\n :param page: queried page with results\n :return: number of students in the results\n \"\"\""
] | [
{
"param": "page",
"type": null
}
] | {
"returns": [
{
"docstring": "number of students in the results",
"docstring_tokens": [
"number",
"of",
"students",
"in",
"the",
"results"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "page",
"type... |
d142149a6666a250da6c0118d07756b36e59b9f3 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/queries.py | [
"MIT"
] | Python | _get_user_last_activities | <not_specific> | def _get_user_last_activities(self, user_id: int, activity_types: list, number: int, offset: int = 0):
"""
Returns the last activities of specified types by specified user.
:param user_id: ID of user.
:param activity_types: Types of activities we want to sum to total distance.
:p... |
Returns the last activities of specified types by specified user.
:param user_id: ID of user.
:param activity_types: Types of activities we want to sum to total distance.
:param number: Number of returned activities.
:param offset: Offset of returned activities - default: 0.
... | Returns the last activities of specified types by specified user. | [
"Returns",
"the",
"last",
"activities",
"of",
"specified",
"types",
"by",
"specified",
"user",
"."
] | def _get_user_last_activities(self, user_id: int, activity_types: list, number: int, offset: int = 0):
query = db.session.query(Activity). \
filter(Activity.user_id == user_id,
func.date(Activity.datetime) >= self.SEASON.start_date,
func.date(Activity.datetime) ... | [
"def",
"_get_user_last_activities",
"(",
"self",
",",
"user_id",
":",
"int",
",",
"activity_types",
":",
"list",
",",
"number",
":",
"int",
",",
"offset",
":",
"int",
"=",
"0",
")",
":",
"query",
"=",
"db",
".",
"session",
".",
"query",
"(",
"Activity"... | Returns the last activities of specified types by specified user. | [
"Returns",
"the",
"last",
"activities",
"of",
"specified",
"types",
"by",
"specified",
"user",
"."
] | [
"\"\"\"\n Returns the last activities of specified types by specified user.\n :param user_id: ID of user.\n :param activity_types: Types of activities we want to sum to total distance.\n :param number: Number of returned activities.\n :param offset: Offset of returned activities -... | [
{
"param": "self",
"type": null
},
{
"param": "user_id",
"type": "int"
},
{
"param": "activity_types",
"type": "list"
},
{
"param": "number",
"type": "int"
},
{
"param": "offset",
"type": "int"
}
] | {
"returns": [
{
"docstring": "Total count of activities and list of last activities.",
"docstring_tokens": [
"Total",
"count",
"of",
"activities",
"and",
"list",
"of",
"last",
"activities",
"."
],
"type": null... |
d142149a6666a250da6c0118d07756b36e59b9f3 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/queries.py | [
"MIT"
] | Python | save_new_user_activities | null | def save_new_user_activities(self, user_id: int, activity: Activity):
"""
Saves new activity by user.
:param user_id: ID of user.
:param activity: New activity to be saved.
"""
activity.user_id = user_id
db.session.add(activity)
db.session.commit() |
Saves new activity by user.
:param user_id: ID of user.
:param activity: New activity to be saved.
| Saves new activity by user. | [
"Saves",
"new",
"activity",
"by",
"user",
"."
] | def save_new_user_activities(self, user_id: int, activity: Activity):
activity.user_id = user_id
db.session.add(activity)
db.session.commit() | [
"def",
"save_new_user_activities",
"(",
"self",
",",
"user_id",
":",
"int",
",",
"activity",
":",
"Activity",
")",
":",
"activity",
".",
"user_id",
"=",
"user_id",
"db",
".",
"session",
".",
"add",
"(",
"activity",
")",
"db",
".",
"session",
".",
"commit... | Saves new activity by user. | [
"Saves",
"new",
"activity",
"by",
"user",
"."
] | [
"\"\"\"\n Saves new activity by user.\n :param user_id: ID of user.\n :param activity: New activity to be saved.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "user_id",
"type": "int"
},
{
"param": "activity",
"type": "Activity"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "user_id",
"type": "int",
"docstring": "ID of user.",
"docstri... |
d142149a6666a250da6c0118d07756b36e59b9f3 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/queries.py | [
"MIT"
] | Python | _get_total_distance_by_user | <not_specific> | def _get_total_distance_by_user(self, user_id: int, activity_types: list):
"""
Returns the total distance taken by a specified user in a specified types of activity.
:param user_id: ID of user.
:param activity_types: Types of activities we want to sum to total distance.
:returns:... |
Returns the total distance taken by a specified user in a specified types of activity.
:param user_id: ID of user.
:param activity_types: Types of activities we want to sum to total distance.
:returns: The total distance in kilometres.
| Returns the total distance taken by a specified user in a specified types of activity. | [
"Returns",
"the",
"total",
"distance",
"taken",
"by",
"a",
"specified",
"user",
"in",
"a",
"specified",
"types",
"of",
"activity",
"."
] | def _get_total_distance_by_user(self, user_id: int, activity_types: list):
return db.session.query(func.sum(Activity.distance)). \
filter(Activity.user_id == user_id,
func.date(Activity.datetime) >= self.SEASON.start_date,
func.date(Activity.datetime) <= self.SE... | [
"def",
"_get_total_distance_by_user",
"(",
"self",
",",
"user_id",
":",
"int",
",",
"activity_types",
":",
"list",
")",
":",
"return",
"db",
".",
"session",
".",
"query",
"(",
"func",
".",
"sum",
"(",
"Activity",
".",
"distance",
")",
")",
".",
"filter",... | Returns the total distance taken by a specified user in a specified types of activity. | [
"Returns",
"the",
"total",
"distance",
"taken",
"by",
"a",
"specified",
"user",
"in",
"a",
"specified",
"types",
"of",
"activity",
"."
] | [
"\"\"\"\n Returns the total distance taken by a specified user in a specified types of activity.\n :param user_id: ID of user.\n :param activity_types: Types of activities we want to sum to total distance.\n :returns: The total distance in kilometres.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "user_id",
"type": "int"
},
{
"param": "activity_types",
"type": "list"
}
] | {
"returns": [
{
"docstring": "The total distance in kilometres.",
"docstring_tokens": [
"The",
"total",
"distance",
"in",
"kilometres",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"typ... |
d142149a6666a250da6c0118d07756b36e59b9f3 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/queries.py | [
"MIT"
] | Python | _get_top_users_total_distance_query | <not_specific> | def _get_top_users_total_distance_query(self, activity_types: list):
"""
Returns query for top users in the total distance in specified activity types.
:param activity_types: Types of activities we want to sum to total distance.
:returns: Query returning User and total distance.
... |
Returns query for top users in the total distance in specified activity types.
:param activity_types: Types of activities we want to sum to total distance.
:returns: Query returning User and total distance.
| Returns query for top users in the total distance in specified activity types. | [
"Returns",
"query",
"for",
"top",
"users",
"in",
"the",
"total",
"distance",
"in",
"specified",
"activity",
"types",
"."
] | def _get_top_users_total_distance_query(self, activity_types: list):
total_distances = db.session.query(Activity.user_id.label('user_id'),
func.sum(Activity.distance).label('total_distance')). \
filter(func.date(Activity.datetime) >= self.SEASON.start_date,... | [
"def",
"_get_top_users_total_distance_query",
"(",
"self",
",",
"activity_types",
":",
"list",
")",
":",
"total_distances",
"=",
"db",
".",
"session",
".",
"query",
"(",
"Activity",
".",
"user_id",
".",
"label",
"(",
"'user_id'",
")",
",",
"func",
".",
"sum"... | Returns query for top users in the total distance in specified activity types. | [
"Returns",
"query",
"for",
"top",
"users",
"in",
"the",
"total",
"distance",
"in",
"specified",
"activity",
"types",
"."
] | [
"\"\"\"\n Returns query for top users in the total distance in specified activity types.\n :param activity_types: Types of activities we want to sum to total distance.\n :returns: Query returning User and total distance.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "activity_types",
"type": "list"
}
] | {
"returns": [
{
"docstring": "Query returning User and total distance.",
"docstring_tokens": [
"Query",
"returning",
"User",
"and",
"total",
"distance",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identi... |
d142149a6666a250da6c0118d07756b36e59b9f3 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/queries.py | [
"MIT"
] | Python | _get_top_users_total_distance | <not_specific> | def _get_top_users_total_distance(self, activity_types: list, number: int, offset: int = 0):
"""
Returns top users in the total distance in specified activity types.
:param activity_types: Types of activities we want to sum to total distance.
:param number: Number of users in the top use... |
Returns top users in the total distance in specified activity types.
:param activity_types: Types of activities we want to sum to total distance.
:param number: Number of users in the top users list.
:param offset: Offset of returned activities - default: 0.
:returns: Total coun... | Returns top users in the total distance in specified activity types. | [
"Returns",
"top",
"users",
"in",
"the",
"total",
"distance",
"in",
"specified",
"activity",
"types",
"."
] | def _get_top_users_total_distance(self, activity_types: list, number: int, offset: int = 0):
query = self._get_top_users_total_distance_query(activity_types)
count = query. \
count()
items = query. \
limit(number). \
offset(offset). \
all()
... | [
"def",
"_get_top_users_total_distance",
"(",
"self",
",",
"activity_types",
":",
"list",
",",
"number",
":",
"int",
",",
"offset",
":",
"int",
"=",
"0",
")",
":",
"query",
"=",
"self",
".",
"_get_top_users_total_distance_query",
"(",
"activity_types",
")",
"co... | Returns top users in the total distance in specified activity types. | [
"Returns",
"top",
"users",
"in",
"the",
"total",
"distance",
"in",
"specified",
"activity",
"types",
"."
] | [
"\"\"\"\n Returns top users in the total distance in specified activity types.\n :param activity_types: Types of activities we want to sum to total distance.\n :param number: Number of users in the top users list.\n :param offset: Offset of returned activities - default: 0.\n :ret... | [
{
"param": "self",
"type": null
},
{
"param": "activity_types",
"type": "list"
},
{
"param": "number",
"type": "int"
},
{
"param": "offset",
"type": "int"
}
] | {
"returns": [
{
"docstring": "Total count of users and list of top users and their total distance.",
"docstring_tokens": [
"Total",
"count",
"of",
"users",
"and",
"list",
"of",
"top",
"users",
"and",
"their",
... |
d142149a6666a250da6c0118d07756b36e59b9f3 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/queries.py | [
"MIT"
] | Python | _get_position_total_distance | <not_specific> | def _get_position_total_distance(self, user_id: int, activity_types: list):
"""
Returns position of the current user in the total distance competition in specified activity types.
:param user_id: ID of user.
:param activity_types: Types of activities we want to sum to total distance.
... |
Returns position of the current user in the total distance competition in specified activity types.
:param user_id: ID of user.
:param activity_types: Types of activities we want to sum to total distance.
:returns: Position of user or -1.
| Returns position of the current user in the total distance competition in specified activity types. | [
"Returns",
"position",
"of",
"the",
"current",
"user",
"in",
"the",
"total",
"distance",
"competition",
"in",
"specified",
"activity",
"types",
"."
] | def _get_position_total_distance(self, user_id: int, activity_types: list):
all_users = self._get_top_users_total_distance_query(activity_types).all()
order = 0
for user in all_users:
order = order + 1
if user.User.id == user_id:
return order
retur... | [
"def",
"_get_position_total_distance",
"(",
"self",
",",
"user_id",
":",
"int",
",",
"activity_types",
":",
"list",
")",
":",
"all_users",
"=",
"self",
".",
"_get_top_users_total_distance_query",
"(",
"activity_types",
")",
".",
"all",
"(",
")",
"order",
"=",
... | Returns position of the current user in the total distance competition in specified activity types. | [
"Returns",
"position",
"of",
"the",
"current",
"user",
"in",
"the",
"total",
"distance",
"competition",
"in",
"specified",
"activity",
"types",
"."
] | [
"\"\"\"\n Returns position of the current user in the total distance competition in specified activity types.\n :param user_id: ID of user.\n :param activity_types: Types of activities we want to sum to total distance.\n :returns: Position of user or -1.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "user_id",
"type": "int"
},
{
"param": "activity_types",
"type": "list"
}
] | {
"returns": [
{
"docstring": "Position of user or -1.",
"docstring_tokens": [
"Position",
"of",
"user",
"or",
"-",
"1",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null... |
d142149a6666a250da6c0118d07756b36e59b9f3 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/queries.py | [
"MIT"
] | Python | _get_global_total_distance | <not_specific> | def _get_global_total_distance(self, activity_types: list):
"""
Returns the total distance by all users in specified activity types.
:param activity_types: Types of activities we want to sum to total distance.
:returns: The total distance in kilometres.
"""
return db.sess... |
Returns the total distance by all users in specified activity types.
:param activity_types: Types of activities we want to sum to total distance.
:returns: The total distance in kilometres.
| Returns the total distance by all users in specified activity types. | [
"Returns",
"the",
"total",
"distance",
"by",
"all",
"users",
"in",
"specified",
"activity",
"types",
"."
] | def _get_global_total_distance(self, activity_types: list):
return db.session.query(func.sum(Activity.distance)). \
select_from(User). \
join(User.activities). \
filter(func.date(Activity.datetime) >= self.SEASON.start_date,
func... | [
"def",
"_get_global_total_distance",
"(",
"self",
",",
"activity_types",
":",
"list",
")",
":",
"return",
"db",
".",
"session",
".",
"query",
"(",
"func",
".",
"sum",
"(",
"Activity",
".",
"distance",
")",
")",
".",
"select_from",
"(",
"User",
")",
".",
... | Returns the total distance by all users in specified activity types. | [
"Returns",
"the",
"total",
"distance",
"by",
"all",
"users",
"in",
"specified",
"activity",
"types",
"."
] | [
"\"\"\"\n Returns the total distance by all users in specified activity types.\n :param activity_types: Types of activities we want to sum to total distance.\n :returns: The total distance in kilometres.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "activity_types",
"type": "list"
}
] | {
"returns": [
{
"docstring": "The total distance in kilometres.",
"docstring_tokens": [
"The",
"total",
"distance",
"in",
"kilometres",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"typ... |
d142149a6666a250da6c0118d07756b36e59b9f3 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/queries.py | [
"MIT"
] | Python | _get_challenge_parts | <not_specific> | def _get_challenge_parts(self):
"""
Returns the list of all parts of challenge.
:returns: Dictionary containing names of check points and distances.
"""
query_result = db.session.query(ChallengePart). \
filter(ChallengePart.season_id == self.SEASON.id). \
... |
Returns the list of all parts of challenge.
:returns: Dictionary containing names of check points and distances.
| Returns the list of all parts of challenge. | [
"Returns",
"the",
"list",
"of",
"all",
"parts",
"of",
"challenge",
"."
] | def _get_challenge_parts(self):
query_result = db.session.query(ChallengePart). \
filter(ChallengePart.season_id == self.SEASON.id). \
order_by(ChallengePart.order.asc()). \
all()
result = {}
dist = 0
for item in query_result:
dist += item.... | [
"def",
"_get_challenge_parts",
"(",
"self",
")",
":",
"query_result",
"=",
"db",
".",
"session",
".",
"query",
"(",
"ChallengePart",
")",
".",
"filter",
"(",
"ChallengePart",
".",
"season_id",
"==",
"self",
".",
"SEASON",
".",
"id",
")",
".",
"order_by",
... | Returns the list of all parts of challenge. | [
"Returns",
"the",
"list",
"of",
"all",
"parts",
"of",
"challenge",
"."
] | [
"\"\"\"\n Returns the list of all parts of challenge.\n :returns: Dictionary containing names of check points and distances.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "Dictionary containing names of check points and distances.",
"docstring_tokens": [
"Dictionary",
"containing",
"names",
"of",
"check",
"points",
"and",
"distances",
"."
],
"type": null
... |
dcf26d46b4b5be11a38e52e9a547e7b26362c5f7 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/tools/processor.py | [
"MIT"
] | Python | process_input_data | list | def process_input_data(self, input_file: str) -> list:
"""
Purpose of this method is to iterate over each .xml file
within landing layer, load its content and fetch all
coordinates in order to calculate total distance in Km.
"""
total_distance = 0
activity_durati... |
Purpose of this method is to iterate over each .xml file
within landing layer, load its content and fetch all
coordinates in order to calculate total distance in Km.
| Purpose of this method is to iterate over each .xml file
within landing layer, load its content and fetch all
coordinates in order to calculate total distance in Km. | [
"Purpose",
"of",
"this",
"method",
"is",
"to",
"iterate",
"over",
"each",
".",
"xml",
"file",
"within",
"landing",
"layer",
"load",
"its",
"content",
"and",
"fetch",
"all",
"coordinates",
"in",
"order",
"to",
"calculate",
"total",
"distance",
"in",
"Km",
"... | def process_input_data(self, input_file: str) -> list:
total_distance = 0
activity_duration = None
activity_start = None
try:
input_file = os.path.join(self.LANDING_DIR, input_file)
if Path(input_file).suffix in self.__ALLOWED_EXTENSIONS:
with open... | [
"def",
"process_input_data",
"(",
"self",
",",
"input_file",
":",
"str",
")",
"->",
"list",
":",
"total_distance",
"=",
"0",
"activity_duration",
"=",
"None",
"activity_start",
"=",
"None",
"try",
":",
"input_file",
"=",
"os",
".",
"path",
".",
"join",
"("... | Purpose of this method is to iterate over each .xml file
within landing layer, load its content and fetch all
coordinates in order to calculate total distance in Km. | [
"Purpose",
"of",
"this",
"method",
"is",
"to",
"iterate",
"over",
"each",
".",
"xml",
"file",
"within",
"landing",
"layer",
"load",
"its",
"content",
"and",
"fetch",
"all",
"coordinates",
"in",
"order",
"to",
"calculate",
"total",
"distance",
"in",
"Km",
"... | [
"\"\"\"\n Purpose of this method is to iterate over each .xml file\n within landing layer, load its content and fetch all\n coordinates in order to calculate total distance in Km.\n \"\"\"",
"# Find the child element of tracking point including __namespace",
"# Cut of namespace prefi... | [
{
"param": "self",
"type": null
},
{
"param": "input_file",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_file",
"type": "str",
"docstring": null,
"docstring_tok... |
dcf26d46b4b5be11a38e52e9a547e7b26362c5f7 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/tools/processor.py | [
"MIT"
] | Python | __calculate_total_time | datetime.timedelta | def __calculate_total_time(self, segment: list, namespace: str) -> datetime.timedelta:
"""
Purpose of this method is to calculate the time of the give activity.
:param segment: List of track points.
:param namespace: Namespace to be find in elements.
:return: Total time spent on ... |
Purpose of this method is to calculate the time of the give activity.
:param segment: List of track points.
:param namespace: Namespace to be find in elements.
:return: Total time spent on activity.
| Purpose of this method is to calculate the time of the give activity. | [
"Purpose",
"of",
"this",
"method",
"is",
"to",
"calculate",
"the",
"time",
"of",
"the",
"give",
"activity",
"."
] | def __calculate_total_time(self, segment: list, namespace: str) -> datetime.timedelta:
segment_time = [c_activity.find(namespace + self.__TIME_ELM) for c_activity in segment]
return parser.parse(segment_time[-1].text) - parser.parse(segment_time[0].text) | [
"def",
"__calculate_total_time",
"(",
"self",
",",
"segment",
":",
"list",
",",
"namespace",
":",
"str",
")",
"->",
"datetime",
".",
"timedelta",
":",
"segment_time",
"=",
"[",
"c_activity",
".",
"find",
"(",
"namespace",
"+",
"self",
".",
"__TIME_ELM",
")... | Purpose of this method is to calculate the time of the give activity. | [
"Purpose",
"of",
"this",
"method",
"is",
"to",
"calculate",
"the",
"time",
"of",
"the",
"give",
"activity",
"."
] | [
"\"\"\"\n Purpose of this method is to calculate the time of the give activity.\n :param segment: List of track points.\n :param namespace: Namespace to be find in elements.\n :return: Total time spent on activity.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "segment",
"type": "list"
},
{
"param": "namespace",
"type": "str"
}
] | {
"returns": [
{
"docstring": "Total time spent on activity.",
"docstring_tokens": [
"Total",
"time",
"spent",
"on",
"activity",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null... |
dcf26d46b4b5be11a38e52e9a547e7b26362c5f7 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/tools/processor.py | [
"MIT"
] | Python | __calculate_orthodromic_distance | float | def __calculate_orthodromic_distance(self, segment: list) -> float:
"""
Purpose of this method is to calculate distance between provided
coordinates in order to obtain total distance.
:param segment: List of track points.
:return: Total distance achieved.
"""
buff... |
Purpose of this method is to calculate distance between provided
coordinates in order to obtain total distance.
:param segment: List of track points.
:return: Total distance achieved.
| Purpose of this method is to calculate distance between provided
coordinates in order to obtain total distance. | [
"Purpose",
"of",
"this",
"method",
"is",
"to",
"calculate",
"distance",
"between",
"provided",
"coordinates",
"in",
"order",
"to",
"obtain",
"total",
"distance",
"."
] | def __calculate_orthodromic_distance(self, segment: list) -> float:
buffer = 0
for index in range(len(segment) - 1):
lat1 = radians(float(segment[index].attrib['lat']))
lat2 = radians(float(segment[index + 1].attrib['lat']))
lon1 = radians(float(segment[index].attrib[... | [
"def",
"__calculate_orthodromic_distance",
"(",
"self",
",",
"segment",
":",
"list",
")",
"->",
"float",
":",
"buffer",
"=",
"0",
"for",
"index",
"in",
"range",
"(",
"len",
"(",
"segment",
")",
"-",
"1",
")",
":",
"lat1",
"=",
"radians",
"(",
"float",
... | Purpose of this method is to calculate distance between provided
coordinates in order to obtain total distance. | [
"Purpose",
"of",
"this",
"method",
"is",
"to",
"calculate",
"distance",
"between",
"provided",
"coordinates",
"in",
"order",
"to",
"obtain",
"total",
"distance",
"."
] | [
"\"\"\"\n Purpose of this method is to calculate distance between provided\n coordinates in order to obtain total distance.\n :param segment: List of track points.\n :return: Total distance achieved.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "segment",
"type": "list"
}
] | {
"returns": [
{
"docstring": "Total distance achieved.",
"docstring_tokens": [
"Total",
"distance",
"achieved",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
dcf26d46b4b5be11a38e52e9a547e7b26362c5f7 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/tools/processor.py | [
"MIT"
] | Python | landing_cleanup | null | def landing_cleanup(self, input_file: str):
"""
Purpose of this method is clean up landing zone.
"""
try:
os.remove(os.path.join(self.LANDING_DIR, input_file))
logging.info(f"File {input_file} has been removed successfully.")
except Exception as ex:
... |
Purpose of this method is clean up landing zone.
| Purpose of this method is clean up landing zone. | [
"Purpose",
"of",
"this",
"method",
"is",
"clean",
"up",
"landing",
"zone",
"."
] | def landing_cleanup(self, input_file: str):
try:
os.remove(os.path.join(self.LANDING_DIR, input_file))
logging.info(f"File {input_file} has been removed successfully.")
except Exception as ex:
logging.warning("Deletion was unsuccessful!", ex) | [
"def",
"landing_cleanup",
"(",
"self",
",",
"input_file",
":",
"str",
")",
":",
"try",
":",
"os",
".",
"remove",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"LANDING_DIR",
",",
"input_file",
")",
")",
"logging",
".",
"info",
"(",
"f\"File ... | Purpose of this method is clean up landing zone. | [
"Purpose",
"of",
"this",
"method",
"is",
"clean",
"up",
"landing",
"zone",
"."
] | [
"\"\"\"\n Purpose of this method is clean up landing zone.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "input_file",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_file",
"type": "str",
"docstring": null,
"docstring_tok... |
17720f3769ae9adf341a792144e3045cbe2e103d | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/integrations/utils.py | [
"MIT"
] | Python | save_strava_tokens | null | def save_strava_tokens(auth_code):
''' Acquire authentication and refresh token as well as info about an athlete with an authentication code.
'''
url = 'https://www.strava.com/oauth/token'
data = {
'client_id': current_app.config['STRAVA_CLIENT_ID'],
'client_secret': current_app.config[... | Acquire authentication and refresh token as well as info about an athlete with an authentication code.
| Acquire authentication and refresh token as well as info about an athlete with an authentication code. | [
"Acquire",
"authentication",
"and",
"refresh",
"token",
"as",
"well",
"as",
"info",
"about",
"an",
"athlete",
"with",
"an",
"authentication",
"code",
"."
] | def save_strava_tokens(auth_code):
url = 'https://www.strava.com/oauth/token'
data = {
'client_id': current_app.config['STRAVA_CLIENT_ID'],
'client_secret': current_app.config['STRAVA_CLIENT_SECRET'],
'code': auth_code,
'grant_type': 'authorization_code'
}
response = requ... | [
"def",
"save_strava_tokens",
"(",
"auth_code",
")",
":",
"url",
"=",
"'https://www.strava.com/oauth/token'",
"data",
"=",
"{",
"'client_id'",
":",
"current_app",
".",
"config",
"[",
"'STRAVA_CLIENT_ID'",
"]",
",",
"'client_secret'",
":",
"current_app",
".",
"config"... | Acquire authentication and refresh token as well as info about an athlete with an authentication code. | [
"Acquire",
"authentication",
"and",
"refresh",
"token",
"as",
"well",
"as",
"info",
"about",
"an",
"athlete",
"with",
"an",
"authentication",
"code",
"."
] | [
"''' Acquire authentication and refresh token as well as info about an athlete with an authentication code.\n '''",
"# This is JSON containing access and refresh token as well as athlete info"
] | [
{
"param": "auth_code",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "auth_code",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
17720f3769ae9adf341a792144e3045cbe2e103d | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/integrations/utils.py | [
"MIT"
] | Python | create_activity_from_strava_json | Activity | def create_activity_from_strava_json(activity: dict, user: User, strava_activity_id: int) -> Activity:
"""
Processes json from strava *DetailedActivity* and creates Activity instance
:param activity: json from strava *strava.com/activity/id*
:param user: User that uploaded the activity
:param strava... |
Processes json from strava *DetailedActivity* and creates Activity instance
:param activity: json from strava *strava.com/activity/id*
:param user: User that uploaded the activity
:param strava_activity_id: strava activity id
:return: new Activity ready to save into database
| Processes json from strava *DetailedActivity* and creates Activity instance | [
"Processes",
"json",
"from",
"strava",
"*",
"DetailedActivity",
"*",
"and",
"creates",
"Activity",
"instance"
] | def create_activity_from_strava_json(activity: dict, user: User, strava_activity_id: int) -> Activity:
distance = activity['distance']
time_in_secs = activity['moving_time']
total_time = _get_time(time_in_secs)
elevation = activity['total_elevation_gain'] if not None else 0
activity... | [
"def",
"create_activity_from_strava_json",
"(",
"activity",
":",
"dict",
",",
"user",
":",
"User",
",",
"strava_activity_id",
":",
"int",
")",
"->",
"Activity",
":",
"distance",
"=",
"activity",
"[",
"'distance'",
"]",
"time_in_secs",
"=",
"activity",
"[",
"'m... | Processes json from strava *DetailedActivity* and creates Activity instance | [
"Processes",
"json",
"from",
"strava",
"*",
"DetailedActivity",
"*",
"and",
"creates",
"Activity",
"instance"
] | [
"\"\"\"\n Processes json from strava *DetailedActivity* and creates Activity instance\n :param activity: json from strava *strava.com/activity/id*\n :param user: User that uploaded the activity\n :param strava_activity_id: strava activity id\n :return: new Activity ready to save into database\n \"... | [
{
"param": "activity",
"type": "dict"
},
{
"param": "user",
"type": "User"
},
{
"param": "strava_activity_id",
"type": "int"
}
] | {
"returns": [
{
"docstring": "new Activity ready to save into database",
"docstring_tokens": [
"new",
"Activity",
"ready",
"to",
"save",
"into",
"database"
],
"type": null
}
],
"raises": [],
"params": [
{
"identif... |
62adcd6b070d9fa5847d736dc587a8da9323c816 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | init_db.py | [
"MIT"
] | Python | init | null | def init():
"""
Creates all DB tables and fills Season and ChallengePart
"""
logging.info("Creating DB")
db.drop_all()
db.create_all()
# season = Season(title='ZS 2020/2021',
# start_date=date(year=2020, month=11, day=12),
# end_date=date(year=2020, m... |
Creates all DB tables and fills Season and ChallengePart
| Creates all DB tables and fills Season and ChallengePart | [
"Creates",
"all",
"DB",
"tables",
"and",
"fills",
"Season",
"and",
"ChallengePart"
] | def init():
logging.info("Creating DB")
db.drop_all()
db.create_all()
season = Season(title='ZS 2020/2021',
start_date=date(year=2020, month=11, day=1),
end_date=date(year=2020, month=12, day=20))
db.session.add(season)
db.session.flush()
part = Challe... | [
"def",
"init",
"(",
")",
":",
"logging",
".",
"info",
"(",
"\"Creating DB\"",
")",
"db",
".",
"drop_all",
"(",
")",
"db",
".",
"create_all",
"(",
")",
"season",
"=",
"Season",
"(",
"title",
"=",
"'ZS 2020/2021'",
",",
"start_date",
"=",
"date",
"(",
... | Creates all DB tables and fills Season and ChallengePart | [
"Creates",
"all",
"DB",
"tables",
"and",
"fills",
"Season",
"and",
"ChallengePart"
] | [
"\"\"\"\n Creates all DB tables and fills Season and ChallengePart\n \"\"\"",
"# season = Season(title='ZS 2020/2021',",
"# start_date=date(year=2020, month=11, day=12),",
"# end_date=date(year=2020, month=12, day=20))"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
11441fcb74b658540ce60a417552e8cbb1906ae8 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/session.py | [
"MIT"
] | Python | error | null | def error(self, msg: str):
"""
Saves a new error message to be displayed.
:param msg: Text of the message.
"""
self.error_msgs.append(msg) |
Saves a new error message to be displayed.
:param msg: Text of the message.
| Saves a new error message to be displayed. | [
"Saves",
"a",
"new",
"error",
"message",
"to",
"be",
"displayed",
"."
] | def error(self, msg: str):
self.error_msgs.append(msg) | [
"def",
"error",
"(",
"self",
",",
"msg",
":",
"str",
")",
":",
"self",
".",
"error_msgs",
".",
"append",
"(",
"msg",
")"
] | Saves a new error message to be displayed. | [
"Saves",
"a",
"new",
"error",
"message",
"to",
"be",
"displayed",
"."
] | [
"\"\"\"\n Saves a new error message to be displayed.\n :param msg: Text of the message.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "msg",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "msg",
"type": "str",
"docstring": "Text of the message.",
"do... |
11441fcb74b658540ce60a417552e8cbb1906ae8 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/session.py | [
"MIT"
] | Python | warning | null | def warning(self, msg: str):
"""
Saves a new warning message to be displayed.
:param msg: Text of the message.
"""
self.warning_msgs.append(msg) |
Saves a new warning message to be displayed.
:param msg: Text of the message.
| Saves a new warning message to be displayed. | [
"Saves",
"a",
"new",
"warning",
"message",
"to",
"be",
"displayed",
"."
] | def warning(self, msg: str):
self.warning_msgs.append(msg) | [
"def",
"warning",
"(",
"self",
",",
"msg",
":",
"str",
")",
":",
"self",
".",
"warning_msgs",
".",
"append",
"(",
"msg",
")"
] | Saves a new warning message to be displayed. | [
"Saves",
"a",
"new",
"warning",
"message",
"to",
"be",
"displayed",
"."
] | [
"\"\"\"\n Saves a new warning message to be displayed.\n :param msg: Text of the message.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "msg",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "msg",
"type": "str",
"docstring": "Text of the message.",
"do... |
11441fcb74b658540ce60a417552e8cbb1906ae8 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/session.py | [
"MIT"
] | Python | info | null | def info(self, msg: str):
"""
Saves a new info message to be displayed.
:param msg: Text of the message.
"""
self.info_msgs.append(msg) |
Saves a new info message to be displayed.
:param msg: Text of the message.
| Saves a new info message to be displayed. | [
"Saves",
"a",
"new",
"info",
"message",
"to",
"be",
"displayed",
"."
] | def info(self, msg: str):
self.info_msgs.append(msg) | [
"def",
"info",
"(",
"self",
",",
"msg",
":",
"str",
")",
":",
"self",
".",
"info_msgs",
".",
"append",
"(",
"msg",
")"
] | Saves a new info message to be displayed. | [
"Saves",
"a",
"new",
"info",
"message",
"to",
"be",
"displayed",
"."
] | [
"\"\"\"\n Saves a new info message to be displayed.\n :param msg: Text of the message.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "msg",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "msg",
"type": "str",
"docstring": "Text of the message.",
"do... |
11441fcb74b658540ce60a417552e8cbb1906ae8 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/session.py | [
"MIT"
] | Python | pop_error_msgs | list | def pop_error_msgs(self) -> list:
"""
Gets all error messages to be displayed and clears the list.
:returns: List of the messages.
"""
result = self.error_msgs
self.error_msgs = []
return result |
Gets all error messages to be displayed and clears the list.
:returns: List of the messages.
| Gets all error messages to be displayed and clears the list. | [
"Gets",
"all",
"error",
"messages",
"to",
"be",
"displayed",
"and",
"clears",
"the",
"list",
"."
] | def pop_error_msgs(self) -> list:
result = self.error_msgs
self.error_msgs = []
return result | [
"def",
"pop_error_msgs",
"(",
"self",
")",
"->",
"list",
":",
"result",
"=",
"self",
".",
"error_msgs",
"self",
".",
"error_msgs",
"=",
"[",
"]",
"return",
"result"
] | Gets all error messages to be displayed and clears the list. | [
"Gets",
"all",
"error",
"messages",
"to",
"be",
"displayed",
"and",
"clears",
"the",
"list",
"."
] | [
"\"\"\"\n Gets all error messages to be displayed and clears the list.\n :returns: List of the messages.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "List of the messages.",
"docstring_tokens": [
"List",
"of",
"the",
"messages",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
11441fcb74b658540ce60a417552e8cbb1906ae8 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/session.py | [
"MIT"
] | Python | pop_warning_msgs | list | def pop_warning_msgs(self) -> list:
"""
Gets all warning messages to be displayed and clears the list.
:returns: List of the messages.
"""
result = self.warning_msgs
self.warning_msgs = []
return result |
Gets all warning messages to be displayed and clears the list.
:returns: List of the messages.
| Gets all warning messages to be displayed and clears the list. | [
"Gets",
"all",
"warning",
"messages",
"to",
"be",
"displayed",
"and",
"clears",
"the",
"list",
"."
] | def pop_warning_msgs(self) -> list:
result = self.warning_msgs
self.warning_msgs = []
return result | [
"def",
"pop_warning_msgs",
"(",
"self",
")",
"->",
"list",
":",
"result",
"=",
"self",
".",
"warning_msgs",
"self",
".",
"warning_msgs",
"=",
"[",
"]",
"return",
"result"
] | Gets all warning messages to be displayed and clears the list. | [
"Gets",
"all",
"warning",
"messages",
"to",
"be",
"displayed",
"and",
"clears",
"the",
"list",
"."
] | [
"\"\"\"\n Gets all warning messages to be displayed and clears the list.\n :returns: List of the messages.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "List of the messages.",
"docstring_tokens": [
"List",
"of",
"the",
"messages",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
11441fcb74b658540ce60a417552e8cbb1906ae8 | Matfyz-Developer-Student-Club/matfyz-activity-sport-tracker | mast/session.py | [
"MIT"
] | Python | pop_info_msgs | list | def pop_info_msgs(self) -> list:
"""
Gets all info messages to be displayed and clears the list
:returns: List of the messages.
"""
result = self.info_msgs
self.info_msgs = []
return result |
Gets all info messages to be displayed and clears the list
:returns: List of the messages.
| Gets all info messages to be displayed and clears the list | [
"Gets",
"all",
"info",
"messages",
"to",
"be",
"displayed",
"and",
"clears",
"the",
"list"
] | def pop_info_msgs(self) -> list:
result = self.info_msgs
self.info_msgs = []
return result | [
"def",
"pop_info_msgs",
"(",
"self",
")",
"->",
"list",
":",
"result",
"=",
"self",
".",
"info_msgs",
"self",
".",
"info_msgs",
"=",
"[",
"]",
"return",
"result"
] | Gets all info messages to be displayed and clears the list | [
"Gets",
"all",
"info",
"messages",
"to",
"be",
"displayed",
"and",
"clears",
"the",
"list"
] | [
"\"\"\"\n Gets all info messages to be displayed and clears the list\n :returns: List of the messages.\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "List of the messages.",
"docstring_tokens": [
"List",
"of",
"the",
"messages",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
... |
2c9aeba5466a25e411c66b2a879c417211040b63 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | classifiers/resting_tremor_classifier.py | [
"MIT"
] | Python | extract_tremor_classification_features | <not_specific> | def extract_tremor_classification_features(data_df, current_feature_df, data_channels, fs):
'''
Compute signal features applicable for tremor classification for a given 3 second window.
:param data_df: Raw accelerometer data as Pandas DataFrame. Columns = ['ts', 'x', 'y', 'z']
:param current_feature_df:... |
Compute signal features applicable for tremor classification for a given 3 second window.
:param data_df: Raw accelerometer data as Pandas DataFrame. Columns = ['ts', 'x', 'y', 'z']
:param current_feature_df: Pandas DataFrame of current features to append new features to.
:param data_channels: Data cha... | Compute signal features applicable for tremor classification for a given 3 second window. | [
"Compute",
"signal",
"features",
"applicable",
"for",
"tremor",
"classification",
"for",
"a",
"given",
"3",
"second",
"window",
"."
] | def extract_tremor_classification_features(data_df, current_feature_df, data_channels, fs):
feat_df_range = sf.signal_range(data_df, channels=data_channels)
current_feature_df = current_feature_df.join(feat_df_range, how='outer')
feat_df_rms = sf.signal_rms(data_df, channels=data_channels)
current_featu... | [
"def",
"extract_tremor_classification_features",
"(",
"data_df",
",",
"current_feature_df",
",",
"data_channels",
",",
"fs",
")",
":",
"feat_df_range",
"=",
"sf",
".",
"signal_range",
"(",
"data_df",
",",
"channels",
"=",
"data_channels",
")",
"current_feature_df",
... | Compute signal features applicable for tremor classification for a given 3 second window. | [
"Compute",
"signal",
"features",
"applicable",
"for",
"tremor",
"classification",
"for",
"a",
"given",
"3",
"second",
"window",
"."
] | [
"'''\n Compute signal features applicable for tremor classification for a given 3 second window.\n :param data_df: Raw accelerometer data as Pandas DataFrame. Columns = ['ts', 'x', 'y', 'z']\n :param current_feature_df: Pandas DataFrame of current features to append new features to.\n :param data_channe... | [
{
"param": "data_df",
"type": null
},
{
"param": "current_feature_df",
"type": null
},
{
"param": "data_channels",
"type": null
},
{
"param": "fs",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame of computed features for given window of data.",
"docstring_tokens": [
"Pandas",
"DataFrame",
"of",
"computed",
"features",
"for",
"given",
"window",
"of",
"data",
".... |
2c9aeba5466a25e411c66b2a879c417211040b63 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | classifiers/resting_tremor_classifier.py | [
"MIT"
] | Python | build_rest_tremor_classification_feature_set | <not_specific> | def build_rest_tremor_classification_feature_set(raw_accelerometer_data_df, fs):
'''
Pre-process raw accelerometer data and compute signal based features on pre-processed signal data.
:param raw_accelerometer_data_df: Pandas DataFrame of raw accelerometer data. Columns = ['ts','x','y','z']
:param fs: S... |
Pre-process raw accelerometer data and compute signal based features on pre-processed signal data.
:param raw_accelerometer_data_df: Pandas DataFrame of raw accelerometer data. Columns = ['ts','x','y','z']
:param fs: Sampling rate of raw accelerometer data (float)
:return: Pandas DataFrame of calculat... | Pre-process raw accelerometer data and compute signal based features on pre-processed signal data. | [
"Pre",
"-",
"process",
"raw",
"accelerometer",
"data",
"and",
"compute",
"signal",
"based",
"features",
"on",
"pre",
"-",
"processed",
"signal",
"data",
"."
] | def build_rest_tremor_classification_feature_set(raw_accelerometer_data_df, fs):
final_feature_set = pd.DataFrame()
filtered_data_df = preprocess.band_pass_filter(raw_accelerometer_data_df, fs, [3.5, 7.5],
1, channels=['x', 'y', 'z'])
bp1_headers ... | [
"def",
"build_rest_tremor_classification_feature_set",
"(",
"raw_accelerometer_data_df",
",",
"fs",
")",
":",
"final_feature_set",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"filtered_data_df",
"=",
"preprocess",
".",
"band_pass_filter",
"(",
"raw_accelerometer_data_df",
",",... | Pre-process raw accelerometer data and compute signal based features on pre-processed signal data. | [
"Pre",
"-",
"process",
"raw",
"accelerometer",
"data",
"and",
"compute",
"signal",
"based",
"features",
"on",
"pre",
"-",
"processed",
"signal",
"data",
"."
] | [
"'''\n Pre-process raw accelerometer data and compute signal based features on pre-processed signal data.\n\n :param raw_accelerometer_data_df: Pandas DataFrame of raw accelerometer data. Columns = ['ts','x','y','z']\n :param fs: Sampling rate of raw accelerometer data (float)\n :return: Pandas DataFram... | [
{
"param": "raw_accelerometer_data_df",
"type": null
},
{
"param": "fs",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame of calculated features in 3 second windows.",
"docstring_tokens": [
"Pandas",
"DataFrame",
"of",
"calculated",
"features",
"in",
"3",
"second",
"windows",
"."
],
... |
2c9aeba5466a25e411c66b2a879c417211040b63 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | classifiers/resting_tremor_classifier.py | [
"MIT"
] | Python | initialize_model | <not_specific> | def initialize_model():
'''
Model that can be trained to classify periods of tremor using calculated signal based features.
:return: SciKit Learn Random Forest classifier
'''
from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier()
return model |
Model that can be trained to classify periods of tremor using calculated signal based features.
:return: SciKit Learn Random Forest classifier
| Model that can be trained to classify periods of tremor using calculated signal based features. | [
"Model",
"that",
"can",
"be",
"trained",
"to",
"classify",
"periods",
"of",
"tremor",
"using",
"calculated",
"signal",
"based",
"features",
"."
] | def initialize_model():
from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier()
return model | [
"def",
"initialize_model",
"(",
")",
":",
"from",
"sklearn",
".",
"ensemble",
"import",
"RandomForestClassifier",
"model",
"=",
"RandomForestClassifier",
"(",
")",
"return",
"model"
] | Model that can be trained to classify periods of tremor using calculated signal based features. | [
"Model",
"that",
"can",
"be",
"trained",
"to",
"classify",
"periods",
"of",
"tremor",
"using",
"calculated",
"signal",
"based",
"features",
"."
] | [
"'''\n Model that can be trained to classify periods of tremor using calculated signal based features.\n :return: SciKit Learn Random Forest classifier\n '''"
] | [] | {
"returns": [
{
"docstring": "SciKit Learn Random Forest classifier",
"docstring_tokens": [
"SciKit",
"Learn",
"Random",
"Forest",
"classifier"
],
"type": null
}
],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
f8deb967cc86f6f112740020a048fc57e6aee8ff | NikhilMahadevan/analyze-tremor-bradykinesia-PD | classifiers/hand_movement_classifier.py | [
"MIT"
] | Python | compute_rolling_mean | <not_specific> | def compute_rolling_mean(x, window_length):
'''
Method to compute rolling mean.
:param x: 1D numpy array
:param window_length: Length of window for computing rolling mean. Must be an odd number.
:return: Numpy array with rolling mean values calculated over given window length.
'''
if window_... |
Method to compute rolling mean.
:param x: 1D numpy array
:param window_length: Length of window for computing rolling mean. Must be an odd number.
:return: Numpy array with rolling mean values calculated over given window length.
| Method to compute rolling mean. | [
"Method",
"to",
"compute",
"rolling",
"mean",
"."
] | def compute_rolling_mean(x, window_length):
if window_length % 2 == 0:
print "Window length should be an odd number."
return
y = np.zeros(len(x))
for i in range(len(x)):
if i < window_length/2:
y[i] = np.mean(x[0:i + window_length / 2])
elif len(x) - i < window_le... | [
"def",
"compute_rolling_mean",
"(",
"x",
",",
"window_length",
")",
":",
"if",
"window_length",
"%",
"2",
"==",
"0",
":",
"print",
"\"Window length should be an odd number.\"",
"return",
"y",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
"x",
")",
")",
"for",
... | Method to compute rolling mean. | [
"Method",
"to",
"compute",
"rolling",
"mean",
"."
] | [
"'''\n Method to compute rolling mean.\n :param x: 1D numpy array\n :param window_length: Length of window for computing rolling mean. Must be an odd number.\n :return: Numpy array with rolling mean values calculated over given window length.\n '''"
] | [
{
"param": "x",
"type": null
},
{
"param": "window_length",
"type": null
}
] | {
"returns": [
{
"docstring": "Numpy array with rolling mean values calculated over given window length.",
"docstring_tokens": [
"Numpy",
"array",
"with",
"rolling",
"mean",
"values",
"calculated",
"over",
"given",
"window... |
f8deb967cc86f6f112740020a048fc57e6aee8ff | NikhilMahadevan/analyze-tremor-bradykinesia-PD | classifiers/hand_movement_classifier.py | [
"MIT"
] | Python | compute_rolling_std | <not_specific> | def compute_rolling_std(x, window_length):
'''
Method to compute rolling standard deviation.
:param x: 1D numpy array
:param window_length: Length of window for computing rolling standard deviation. Must be an odd number.
:return: Numpy array with rolling standard deviation values calculated over gi... |
Method to compute rolling standard deviation.
:param x: 1D numpy array
:param window_length: Length of window for computing rolling standard deviation. Must be an odd number.
:return: Numpy array with rolling standard deviation values calculated over given window length.
| Method to compute rolling standard deviation. | [
"Method",
"to",
"compute",
"rolling",
"standard",
"deviation",
"."
] | def compute_rolling_std(x, window_length):
if window_length % 2 == 0:
print "Window length should be an odd number."
return
y = np.zeros(len(x))
for i in range(len(x)):
if i < window_length/2:
y[i] = np.std(x[0:i + window_length / 2])
elif len(x) - i < window_leng... | [
"def",
"compute_rolling_std",
"(",
"x",
",",
"window_length",
")",
":",
"if",
"window_length",
"%",
"2",
"==",
"0",
":",
"print",
"\"Window length should be an odd number.\"",
"return",
"y",
"=",
"np",
".",
"zeros",
"(",
"len",
"(",
"x",
")",
")",
"for",
"... | Method to compute rolling standard deviation. | [
"Method",
"to",
"compute",
"rolling",
"standard",
"deviation",
"."
] | [
"'''\n Method to compute rolling standard deviation.\n :param x: 1D numpy array\n :param window_length: Length of window for computing rolling standard deviation. Must be an odd number.\n :return: Numpy array with rolling standard deviation values calculated over given window length.\n '''"
] | [
{
"param": "x",
"type": null
},
{
"param": "window_length",
"type": null
}
] | {
"returns": [
{
"docstring": "Numpy array with rolling standard deviation values calculated over given window length.",
"docstring_tokens": [
"Numpy",
"array",
"with",
"rolling",
"standard",
"deviation",
"values",
"calculated",
"... |
f8deb967cc86f6f112740020a048fc57e6aee8ff | NikhilMahadevan/analyze-tremor-bradykinesia-PD | classifiers/hand_movement_classifier.py | [
"MIT"
] | Python | detect_hand_movement | <not_specific> | def detect_hand_movement(raw_accelerometer_data_df, fs, window_length=3, threshold=0.01):
'''
Method for detecting hand movement from raw accelerometer data.
:param raw_accelerometer_data_df: Pandas DataFrame with accelerometer axis represented as x, y and z columns
:param fs: Sampling rate (samples/sec... |
Method for detecting hand movement from raw accelerometer data.
:param raw_accelerometer_data_df: Pandas DataFrame with accelerometer axis represented as x, y and z columns
:param fs: Sampling rate (samples/second) of the accelerometer data
:param window_length: Length (in seconds) of the non-overlappi... | Method for detecting hand movement from raw accelerometer data. | [
"Method",
"for",
"detecting",
"hand",
"movement",
"from",
"raw",
"accelerometer",
"data",
"."
] | def detect_hand_movement(raw_accelerometer_data_df, fs, window_length=3, threshold=0.01):
accelerometer_vector_magnitude = np.sqrt((raw_accelerometer_data_df.x**2 + raw_accelerometer_data_df.y**2 + raw_accelerometer_data_df.z**2))
low_pass_cutoff = 3
wn = [low_pass_cutoff * 2 / fs]
[b, a] = signal.iirf... | [
"def",
"detect_hand_movement",
"(",
"raw_accelerometer_data_df",
",",
"fs",
",",
"window_length",
"=",
"3",
",",
"threshold",
"=",
"0.01",
")",
":",
"accelerometer_vector_magnitude",
"=",
"np",
".",
"sqrt",
"(",
"(",
"raw_accelerometer_data_df",
".",
"x",
"**",
... | Method for detecting hand movement from raw accelerometer data. | [
"Method",
"for",
"detecting",
"hand",
"movement",
"from",
"raw",
"accelerometer",
"data",
"."
] | [
"'''\n Method for detecting hand movement from raw accelerometer data.\n :param raw_accelerometer_data_df: Pandas DataFrame with accelerometer axis represented as x, y and z columns\n :param fs: Sampling rate (samples/second) of the accelerometer data\n :param window_length: Length (in seconds) of the n... | [
{
"param": "raw_accelerometer_data_df",
"type": null
},
{
"param": "fs",
"type": null
},
{
"param": "window_length",
"type": null
},
{
"param": "threshold",
"type": null
}
] | {
"returns": [
{
"docstring": "Detected hand movement as numpy array in desired window length",
"docstring_tokens": [
"Detected",
"hand",
"movement",
"as",
"numpy",
"array",
"in",
"desired",
"window",
"length"
],
... |
9d000088dd5c41988e1a6cc52fe57e619e12f2d1 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | signal_preprocessing/preprocess.py | [
"MIT"
] | Python | band_pass_filter | <not_specific> | def band_pass_filter(data_df, sampling_rate, bp_cutoff, order, channels=['X', 'Y', 'Z']):
'''
Band-pass filter a given sensor signal.
:param data_df: dataframe housing sensor signals
:param sampling_rate: sampling rate of signal
:param bp_cutoff: filter cutoffs
:param order: filter order
:p... |
Band-pass filter a given sensor signal.
:param data_df: dataframe housing sensor signals
:param sampling_rate: sampling rate of signal
:param bp_cutoff: filter cutoffs
:param order: filter order
:param channels: channels of signal to filter
:return: dataframe of raw and filtered data
| Band-pass filter a given sensor signal. | [
"Band",
"-",
"pass",
"filter",
"a",
"given",
"sensor",
"signal",
"."
] | def band_pass_filter(data_df, sampling_rate, bp_cutoff, order, channels=['X', 'Y', 'Z']):
data = data_df[channels].values
critical_frequency = [bp_cutoff[0]* 2.0 / sampling_rate, bp_cutoff[1]* 2.0 / sampling_rate]
[b, a] = signal.butter(N=order, Wn=critical_frequency, btype='bandpass', analog=False)
bp_... | [
"def",
"band_pass_filter",
"(",
"data_df",
",",
"sampling_rate",
",",
"bp_cutoff",
",",
"order",
",",
"channels",
"=",
"[",
"'X'",
",",
"'Y'",
",",
"'Z'",
"]",
")",
":",
"data",
"=",
"data_df",
"[",
"channels",
"]",
".",
"values",
"critical_frequency",
"... | Band-pass filter a given sensor signal. | [
"Band",
"-",
"pass",
"filter",
"a",
"given",
"sensor",
"signal",
"."
] | [
"'''\n Band-pass filter a given sensor signal.\n\n :param data_df: dataframe housing sensor signals\n :param sampling_rate: sampling rate of signal\n :param bp_cutoff: filter cutoffs\n :param order: filter order\n :param channels: channels of signal to filter\n :return: dataframe of raw and fil... | [
{
"param": "data_df",
"type": null
},
{
"param": "sampling_rate",
"type": null
},
{
"param": "bp_cutoff",
"type": null
},
{
"param": "order",
"type": null
},
{
"param": "channels",
"type": null
}
] | {
"returns": [
{
"docstring": "dataframe of raw and filtered data",
"docstring_tokens": [
"dataframe",
"of",
"raw",
"and",
"filtered",
"data"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "data_df",
... |
19adb9bf21117f28838be391a5e08670b9413e0d | NikhilMahadevan/analyze-tremor-bradykinesia-PD | classifiers/hand_movement_features.py | [
"MIT"
] | Python | calculate_amplitude_and_smoothness_features | <not_specific> | def calculate_amplitude_and_smoothness_features(raw_accelerometer_data_df, fs):
'''
Function to calculate hand movement amplitude and smoothness of hand movement (jerk metric) from accelerometer data
collected from a wrist worn wearable device.
:param raw_accelerometer_data_df: Pandas DataFrame of raw ... |
Function to calculate hand movement amplitude and smoothness of hand movement (jerk metric) from accelerometer data
collected from a wrist worn wearable device.
:param raw_accelerometer_data_df: Pandas DataFrame of raw accelerometer data. Columns = ['ts', 'x', 'y', 'z']
:param fs: Sampling rate of raw... | Function to calculate hand movement amplitude and smoothness of hand movement (jerk metric) from accelerometer data
collected from a wrist worn wearable device. | [
"Function",
"to",
"calculate",
"hand",
"movement",
"amplitude",
"and",
"smoothness",
"of",
"hand",
"movement",
"(",
"jerk",
"metric",
")",
"from",
"accelerometer",
"data",
"collected",
"from",
"a",
"wrist",
"worn",
"wearable",
"device",
"."
] | def calculate_amplitude_and_smoothness_features(raw_accelerometer_data_df, fs):
filtered_data_df = preprocess.band_pass_filter(raw_accelerometer_data_df, fs, [0.25, 3.5], 4,
channels=['x', 'y', 'z'])
bp_headers = ['x_bp_filt_[0.25, 3.5]', 'y_bp_filt_[0.25, 3.5]', 'z_bp_fi... | [
"def",
"calculate_amplitude_and_smoothness_features",
"(",
"raw_accelerometer_data_df",
",",
"fs",
")",
":",
"filtered_data_df",
"=",
"preprocess",
".",
"band_pass_filter",
"(",
"raw_accelerometer_data_df",
",",
"fs",
",",
"[",
"0.25",
",",
"3.5",
"]",
",",
"4",
","... | Function to calculate hand movement amplitude and smoothness of hand movement (jerk metric) from accelerometer data
collected from a wrist worn wearable device. | [
"Function",
"to",
"calculate",
"hand",
"movement",
"amplitude",
"and",
"smoothness",
"of",
"hand",
"movement",
"(",
"jerk",
"metric",
")",
"from",
"accelerometer",
"data",
"collected",
"from",
"a",
"wrist",
"worn",
"wearable",
"device",
"."
] | [
"'''\n Function to calculate hand movement amplitude and smoothness of hand movement (jerk metric) from accelerometer data\n collected from a wrist worn wearable device.\n\n :param raw_accelerometer_data_df: Pandas DataFrame of raw accelerometer data. Columns = ['ts', 'x', 'y', 'z']\n :param fs: Samplin... | [
{
"param": "raw_accelerometer_data_df",
"type": null
},
{
"param": "fs",
"type": null
}
] | {
"returns": [
{
"docstring": "Computed hand movement amplitude (list) and smoothness of hand movement (jerk metric) (list) in 3 second\nwindows",
"docstring_tokens": [
"Computed",
"hand",
"movement",
"amplitude",
"(",
"list",
")",
"and",... |
db1016a7330a45cd089384dffe9de1a210c1c8ca | NikhilMahadevan/analyze-tremor-bradykinesia-PD | classifiers/gait_classifier.py | [
"MIT"
] | Python | extract_gait_classification_features | <not_specific> | def extract_gait_classification_features(window_data_df, channels, fs):
'''
Extract signal features applicable for gait classification for a given 3 second window of raw accelerometer data.
:param window_data_df: Pandas DataFrame with columns ['ts','x','y','z']
:param channels: Desired channels to run ... |
Extract signal features applicable for gait classification for a given 3 second window of raw accelerometer data.
:param window_data_df: Pandas DataFrame with columns ['ts','x','y','z']
:param channels: Desired channels to run features on (Ex: ['x','y','z'])
:param fs: Sampling rate of raw acceleromet... | Extract signal features applicable for gait classification for a given 3 second window of raw accelerometer data. | [
"Extract",
"signal",
"features",
"applicable",
"for",
"gait",
"classification",
"for",
"a",
"given",
"3",
"second",
"window",
"of",
"raw",
"accelerometer",
"data",
"."
] | def extract_gait_classification_features(window_data_df, channels, fs):
features = pd.DataFrame()
feat_df_signal_entropy = sf.signal_entropy(window_data_df, channels)
feat_df_corr_coef = sf.correlation_coefficient(window_data_df, [['x_bp_filt_[0.25, 3.0]', 'y_bp_filt_[0.25, 3.0]'],
... | [
"def",
"extract_gait_classification_features",
"(",
"window_data_df",
",",
"channels",
",",
"fs",
")",
":",
"features",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"feat_df_signal_entropy",
"=",
"sf",
".",
"signal_entropy",
"(",
"window_data_df",
",",
"channels",
")",
... | Extract signal features applicable for gait classification for a given 3 second window of raw accelerometer data. | [
"Extract",
"signal",
"features",
"applicable",
"for",
"gait",
"classification",
"for",
"a",
"given",
"3",
"second",
"window",
"of",
"raw",
"accelerometer",
"data",
"."
] | [
"'''\n Extract signal features applicable for gait classification for a given 3 second window of raw accelerometer data.\n\n :param window_data_df: Pandas DataFrame with columns ['ts','x','y','z']\n :param channels: Desired channels to run features on (Ex: ['x','y','z'])\n :param fs: Sampling rate of ra... | [
{
"param": "window_data_df",
"type": null
},
{
"param": "channels",
"type": null
},
{
"param": "fs",
"type": null
}
] | {
"returns": [
{
"docstring": "DataFrame of calculated features on 3 second windows for given raw data",
"docstring_tokens": [
"DataFrame",
"of",
"calculated",
"features",
"on",
"3",
"second",
"windows",
"for",
"given",
... |
db1016a7330a45cd089384dffe9de1a210c1c8ca | NikhilMahadevan/analyze-tremor-bradykinesia-PD | classifiers/gait_classifier.py | [
"MIT"
] | Python | build_gait_classification_feature_set | <not_specific> | def build_gait_classification_feature_set(raw_accelerometer_data_df, fs):
'''
Pre-process raw accelerometer data and compute signal based features on data.
:param raw_accelerometer_data_df: Raw accelerometer data in a Pandas DataFrame wth columns = ['ts','x','y','z']
:param fs: Sampling rate of raw acc... |
Pre-process raw accelerometer data and compute signal based features on data.
:param raw_accelerometer_data_df: Raw accelerometer data in a Pandas DataFrame wth columns = ['ts','x','y','z']
:param fs: Sampling rate of raw accelerometer data (Float)
:return: Pandas DataFrame of calculated features for ... | Pre-process raw accelerometer data and compute signal based features on data. | [
"Pre",
"-",
"process",
"raw",
"accelerometer",
"data",
"and",
"compute",
"signal",
"based",
"features",
"on",
"data",
"."
] | def build_gait_classification_feature_set(raw_accelerometer_data_df, fs):
final_feature_cache = pd.DataFrame()
filtered_data_df = preprocess.band_pass_filter(raw_accelerometer_data_df, fs, [0.25, 3.0], 1,
channels=['x', 'y', 'z'])
bp_headers = ['x... | [
"def",
"build_gait_classification_feature_set",
"(",
"raw_accelerometer_data_df",
",",
"fs",
")",
":",
"final_feature_cache",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"filtered_data_df",
"=",
"preprocess",
".",
"band_pass_filter",
"(",
"raw_accelerometer_data_df",
",",
"f... | Pre-process raw accelerometer data and compute signal based features on data. | [
"Pre",
"-",
"process",
"raw",
"accelerometer",
"data",
"and",
"compute",
"signal",
"based",
"features",
"on",
"data",
"."
] | [
"'''\n Pre-process raw accelerometer data and compute signal based features on data.\n\n :param raw_accelerometer_data_df: Raw accelerometer data in a Pandas DataFrame wth columns = ['ts','x','y','z']\n :param fs: Sampling rate of raw accelerometer data (Float)\n :return: Pandas DataFrame of calculated ... | [
{
"param": "raw_accelerometer_data_df",
"type": null
},
{
"param": "fs",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame of calculated features for given raw accelerometer data",
"docstring_tokens": [
"Pandas",
"DataFrame",
"of",
"calculated",
"features",
"for",
"given",
"raw",
"accelerometer",
... |
98d8b5d10fa7de488c2b1ec6308cae0b785eaf74 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | endpoints/filter_classifier_predictions.py | [
"MIT"
] | Python | filter_predictions_by_tree | <not_specific> | def filter_predictions_by_tree(algorithm_predictions):
'''
Filter out predictions based on context.
:param algorithm_predictions: Pandas DataFrame with following columns = ['hand_movement', 'gait', 'tremor_constancy', 'tremor_amplitude', 'hand_movement_amplitude', 'hand_movement_jerk']
:return: Pandas ... |
Filter out predictions based on context.
:param algorithm_predictions: Pandas DataFrame with following columns = ['hand_movement', 'gait', 'tremor_constancy', 'tremor_amplitude', 'hand_movement_amplitude', 'hand_movement_jerk']
:return: Pandas DataFrame of filtered predictions based on context.
| Filter out predictions based on context. | [
"Filter",
"out",
"predictions",
"based",
"on",
"context",
"."
] | def filter_predictions_by_tree(algorithm_predictions):
t_c_filtered = []
t_a_filtered = []
b_a_filtered = []
b_j_filtered = []
h_m_filtered = []
for row in algorithm_predictions.itertuples():
hm_p = row.hand_movement
gait_p = row.gait
trem_c_p = row.tremor_constancy
... | [
"def",
"filter_predictions_by_tree",
"(",
"algorithm_predictions",
")",
":",
"t_c_filtered",
"=",
"[",
"]",
"t_a_filtered",
"=",
"[",
"]",
"b_a_filtered",
"=",
"[",
"]",
"b_j_filtered",
"=",
"[",
"]",
"h_m_filtered",
"=",
"[",
"]",
"for",
"row",
"in",
"algor... | Filter out predictions based on context. | [
"Filter",
"out",
"predictions",
"based",
"on",
"context",
"."
] | [
"'''\n Filter out predictions based on context.\n\n :param algorithm_predictions: Pandas DataFrame with following columns = ['hand_movement', 'gait', 'tremor_constancy', 'tremor_amplitude', 'hand_movement_amplitude', 'hand_movement_jerk']\n :return: Pandas DataFrame of filtered predictions based on context... | [
{
"param": "algorithm_predictions",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame of filtered predictions based on context.",
"docstring_tokens": [
"Pandas",
"DataFrame",
"of",
"filtered",
"predictions",
"based",
"on",
"context",
"."
],
"type": null
... |
8319cacd2873ac2548a0426ed6bdbc6af25aa7aa | NikhilMahadevan/analyze-tremor-bradykinesia-PD | endpoints/resting_tremor_endpoints.py | [
"MIT"
] | Python | compute_tremor_constancy | <not_specific> | def compute_tremor_constancy(tremor_classification_predictions):
'''
Compute tremor constancy for a given set of tremor predictions.
:param tremor_classification_predictions: Tremor predictions as determined by tremor classifier. Binary predictions (1 = tremor, 0 = no tremor)
:return: Percentage of dete... |
Compute tremor constancy for a given set of tremor predictions.
:param tremor_classification_predictions: Tremor predictions as determined by tremor classifier. Binary predictions (1 = tremor, 0 = no tremor)
:return: Percentage of detected tremor
| Compute tremor constancy for a given set of tremor predictions. | [
"Compute",
"tremor",
"constancy",
"for",
"a",
"given",
"set",
"of",
"tremor",
"predictions",
"."
] | def compute_tremor_constancy(tremor_classification_predictions):
return tremor_classification_predictions.count(1)/float(len(tremor_classification_predictions))*100. | [
"def",
"compute_tremor_constancy",
"(",
"tremor_classification_predictions",
")",
":",
"return",
"tremor_classification_predictions",
".",
"count",
"(",
"1",
")",
"/",
"float",
"(",
"len",
"(",
"tremor_classification_predictions",
")",
")",
"*",
"100."
] | Compute tremor constancy for a given set of tremor predictions. | [
"Compute",
"tremor",
"constancy",
"for",
"a",
"given",
"set",
"of",
"tremor",
"predictions",
"."
] | [
"'''\n Compute tremor constancy for a given set of tremor predictions.\n :param tremor_classification_predictions: Tremor predictions as determined by tremor classifier. Binary predictions (1 = tremor, 0 = no tremor)\n :return: Percentage of detected tremor\n '''"
] | [
{
"param": "tremor_classification_predictions",
"type": null
}
] | {
"returns": [
{
"docstring": "Percentage of detected tremor",
"docstring_tokens": [
"Percentage",
"of",
"detected",
"tremor"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "tremor_classification_predictions",
"type"... |
8319cacd2873ac2548a0426ed6bdbc6af25aa7aa | NikhilMahadevan/analyze-tremor-bradykinesia-PD | endpoints/resting_tremor_endpoints.py | [
"MIT"
] | Python | compute_aggregate_tremor_amplitude | <not_specific> | def compute_aggregate_tremor_amplitude(tremor_amplitude_predictions):
'''
Compute an aggregate measure of tremor amplitude for a given set of tremor amplitude predictions.
:param tremor_amplitude_predictions: Computed tremor amplitude
:return: 85th percentile of tremor amplitude predictions.
'''
... |
Compute an aggregate measure of tremor amplitude for a given set of tremor amplitude predictions.
:param tremor_amplitude_predictions: Computed tremor amplitude
:return: 85th percentile of tremor amplitude predictions.
| Compute an aggregate measure of tremor amplitude for a given set of tremor amplitude predictions. | [
"Compute",
"an",
"aggregate",
"measure",
"of",
"tremor",
"amplitude",
"for",
"a",
"given",
"set",
"of",
"tremor",
"amplitude",
"predictions",
"."
] | def compute_aggregate_tremor_amplitude(tremor_amplitude_predictions):
return np.percentile(tremor_amplitude_predictions, 85) | [
"def",
"compute_aggregate_tremor_amplitude",
"(",
"tremor_amplitude_predictions",
")",
":",
"return",
"np",
".",
"percentile",
"(",
"tremor_amplitude_predictions",
",",
"85",
")"
] | Compute an aggregate measure of tremor amplitude for a given set of tremor amplitude predictions. | [
"Compute",
"an",
"aggregate",
"measure",
"of",
"tremor",
"amplitude",
"for",
"a",
"given",
"set",
"of",
"tremor",
"amplitude",
"predictions",
"."
] | [
"'''\n Compute an aggregate measure of tremor amplitude for a given set of tremor amplitude predictions.\n :param tremor_amplitude_predictions: Computed tremor amplitude\n :return: 85th percentile of tremor amplitude predictions.\n '''"
] | [
{
"param": "tremor_amplitude_predictions",
"type": null
}
] | {
"returns": [
{
"docstring": "85th percentile of tremor amplitude predictions.",
"docstring_tokens": [
"85th",
"percentile",
"of",
"tremor",
"amplitude",
"predictions",
"."
],
"type": null
}
],
"raises": [],
"params": [
... |
7ad204ab7b720148141c99c0c26af39c64d42000 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | endpoints/bradykinesia_endpoints.py | [
"MIT"
] | Python | compute_aggregate_hand_movement_amplitude | <not_specific> | def compute_aggregate_hand_movement_amplitude(hand_movement_amplitudes):
'''
Compute aggregate measures of hand movement amplitude.
:param hand_movement_amplitudes: Computed hand movement amplitudes (list)
:return: Average hand movement amplitude
'''
return np.mean(hand_movement_amplitudes) |
Compute aggregate measures of hand movement amplitude.
:param hand_movement_amplitudes: Computed hand movement amplitudes (list)
:return: Average hand movement amplitude
| Compute aggregate measures of hand movement amplitude. | [
"Compute",
"aggregate",
"measures",
"of",
"hand",
"movement",
"amplitude",
"."
] | def compute_aggregate_hand_movement_amplitude(hand_movement_amplitudes):
return np.mean(hand_movement_amplitudes) | [
"def",
"compute_aggregate_hand_movement_amplitude",
"(",
"hand_movement_amplitudes",
")",
":",
"return",
"np",
".",
"mean",
"(",
"hand_movement_amplitudes",
")"
] | Compute aggregate measures of hand movement amplitude. | [
"Compute",
"aggregate",
"measures",
"of",
"hand",
"movement",
"amplitude",
"."
] | [
"'''\n Compute aggregate measures of hand movement amplitude.\n :param hand_movement_amplitudes: Computed hand movement amplitudes (list)\n :return: Average hand movement amplitude\n '''"
] | [
{
"param": "hand_movement_amplitudes",
"type": null
}
] | {
"returns": [
{
"docstring": "Average hand movement amplitude",
"docstring_tokens": [
"Average",
"hand",
"movement",
"amplitude"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "hand_movement_amplitudes",
"type": nul... |
7ad204ab7b720148141c99c0c26af39c64d42000 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | endpoints/bradykinesia_endpoints.py | [
"MIT"
] | Python | compute_aggregate_smoothness_of_hand_movement | <not_specific> | def compute_aggregate_smoothness_of_hand_movement(hand_movement_jerk_predictions):
'''
Compute aggregate measures of smoothness of hand movement (jerk metric).
:param hand_movement_jerk_predictions: Computed jerk metrics (list)
:return: 95th percentile of jerk
'''
return np.percentile(hand_movem... |
Compute aggregate measures of smoothness of hand movement (jerk metric).
:param hand_movement_jerk_predictions: Computed jerk metrics (list)
:return: 95th percentile of jerk
| Compute aggregate measures of smoothness of hand movement (jerk metric). | [
"Compute",
"aggregate",
"measures",
"of",
"smoothness",
"of",
"hand",
"movement",
"(",
"jerk",
"metric",
")",
"."
] | def compute_aggregate_smoothness_of_hand_movement(hand_movement_jerk_predictions):
return np.percentile(hand_movement_jerk_predictions, 95) | [
"def",
"compute_aggregate_smoothness_of_hand_movement",
"(",
"hand_movement_jerk_predictions",
")",
":",
"return",
"np",
".",
"percentile",
"(",
"hand_movement_jerk_predictions",
",",
"95",
")"
] | Compute aggregate measures of smoothness of hand movement (jerk metric). | [
"Compute",
"aggregate",
"measures",
"of",
"smoothness",
"of",
"hand",
"movement",
"(",
"jerk",
"metric",
")",
"."
] | [
"'''\n Compute aggregate measures of smoothness of hand movement (jerk metric).\n :param hand_movement_jerk_predictions: Computed jerk metrics (list)\n :return: 95th percentile of jerk\n '''"
] | [
{
"param": "hand_movement_jerk_predictions",
"type": null
}
] | {
"returns": [
{
"docstring": "95th percentile of jerk",
"docstring_tokens": [
"95th",
"percentile",
"of",
"jerk"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "hand_movement_jerk_predictions",
"type": null,
"... |
7ad204ab7b720148141c99c0c26af39c64d42000 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | endpoints/bradykinesia_endpoints.py | [
"MIT"
] | Python | compute_aggregate_percentage_of_no_hand_movement | <not_specific> | def compute_aggregate_percentage_of_no_hand_movement(hand_movement_predictions):
'''
Compute aggregate value of percentage of no hand movement.
:param hand_movement_predictions: Predicted hand movement - binary predictions (1 = hand movement, 0 = no hand movement).
:return: Percentage of no hand movemen... |
Compute aggregate value of percentage of no hand movement.
:param hand_movement_predictions: Predicted hand movement - binary predictions (1 = hand movement, 0 = no hand movement).
:return: Percentage of no hand movement
| Compute aggregate value of percentage of no hand movement. | [
"Compute",
"aggregate",
"value",
"of",
"percentage",
"of",
"no",
"hand",
"movement",
"."
] | def compute_aggregate_percentage_of_no_hand_movement(hand_movement_predictions):
return (hand_movement_predictions.count(0)/float(len(hand_movement_predictions)))*100. | [
"def",
"compute_aggregate_percentage_of_no_hand_movement",
"(",
"hand_movement_predictions",
")",
":",
"return",
"(",
"hand_movement_predictions",
".",
"count",
"(",
"0",
")",
"/",
"float",
"(",
"len",
"(",
"hand_movement_predictions",
")",
")",
")",
"*",
"100."
] | Compute aggregate value of percentage of no hand movement. | [
"Compute",
"aggregate",
"value",
"of",
"percentage",
"of",
"no",
"hand",
"movement",
"."
] | [
"'''\n Compute aggregate value of percentage of no hand movement.\n :param hand_movement_predictions: Predicted hand movement - binary predictions (1 = hand movement, 0 = no hand movement).\n :return: Percentage of no hand movement\n '''"
] | [
{
"param": "hand_movement_predictions",
"type": null
}
] | {
"returns": [
{
"docstring": "Percentage of no hand movement",
"docstring_tokens": [
"Percentage",
"of",
"no",
"hand",
"movement"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "hand_movement_predictions",
"... |
7ad204ab7b720148141c99c0c26af39c64d42000 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | endpoints/bradykinesia_endpoints.py | [
"MIT"
] | Python | calculate_hand_movement_bout_lengths | <not_specific> | def calculate_hand_movement_bout_lengths(data):
'''
Calculate bout lengths of no hand movement and hand movement
:param data: Predicted hand movement - binary predictions (1 = hand movement, 0 = no hand movement).
:return: bout lengths of no hand movement (list), bout lengths of hand movement (list)
... |
Calculate bout lengths of no hand movement and hand movement
:param data: Predicted hand movement - binary predictions (1 = hand movement, 0 = no hand movement).
:return: bout lengths of no hand movement (list), bout lengths of hand movement (list)
| Calculate bout lengths of no hand movement and hand movement | [
"Calculate",
"bout",
"lengths",
"of",
"no",
"hand",
"movement",
"and",
"hand",
"movement"
] | def calculate_hand_movement_bout_lengths(data):
count_0 = 0
count_1 = 0
no_hand_movement_bouts = []
hand_movement_bouts = []
for idx, i in enumerate(data):
if i == 0:
count_1 = 0
count_0+=1
if idx+1<len(data):
if data[idx+1]==1:
... | [
"def",
"calculate_hand_movement_bout_lengths",
"(",
"data",
")",
":",
"count_0",
"=",
"0",
"count_1",
"=",
"0",
"no_hand_movement_bouts",
"=",
"[",
"]",
"hand_movement_bouts",
"=",
"[",
"]",
"for",
"idx",
",",
"i",
"in",
"enumerate",
"(",
"data",
")",
":",
... | Calculate bout lengths of no hand movement and hand movement | [
"Calculate",
"bout",
"lengths",
"of",
"no",
"hand",
"movement",
"and",
"hand",
"movement"
] | [
"'''\n Calculate bout lengths of no hand movement and hand movement\n :param data: Predicted hand movement - binary predictions (1 = hand movement, 0 = no hand movement).\n :return: bout lengths of no hand movement (list), bout lengths of hand movement (list)\n '''"
] | [
{
"param": "data",
"type": null
}
] | {
"returns": [
{
"docstring": "bout lengths of no hand movement (list), bout lengths of hand movement (list)",
"docstring_tokens": [
"bout",
"lengths",
"of",
"no",
"hand",
"movement",
"(",
"list",
")",
"bout",
"len... |
7ad204ab7b720148141c99c0c26af39c64d42000 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | endpoints/bradykinesia_endpoints.py | [
"MIT"
] | Python | compute_aggregate_length_of_no_hand_movement_bouts | <not_specific> | def compute_aggregate_length_of_no_hand_movement_bouts(hand_movement_predictions):
'''
Compute aggregate length of no hand movement bouts
:param hand_movement_predictions: Predicted hand movement - binary predictions (1 = hand movement, 0 = no hand movement).
:return: Average length of no hand movement ... |
Compute aggregate length of no hand movement bouts
:param hand_movement_predictions: Predicted hand movement - binary predictions (1 = hand movement, 0 = no hand movement).
:return: Average length of no hand movement bout lengths
| Compute aggregate length of no hand movement bouts | [
"Compute",
"aggregate",
"length",
"of",
"no",
"hand",
"movement",
"bouts"
] | def compute_aggregate_length_of_no_hand_movement_bouts(hand_movement_predictions):
no_hand_movement_bouts, _ = calculate_hand_movement_bout_lengths(hand_movement_predictions)
return np.mean(no_hand_movement_bouts) | [
"def",
"compute_aggregate_length_of_no_hand_movement_bouts",
"(",
"hand_movement_predictions",
")",
":",
"no_hand_movement_bouts",
",",
"_",
"=",
"calculate_hand_movement_bout_lengths",
"(",
"hand_movement_predictions",
")",
"return",
"np",
".",
"mean",
"(",
"no_hand_movement_b... | Compute aggregate length of no hand movement bouts | [
"Compute",
"aggregate",
"length",
"of",
"no",
"hand",
"movement",
"bouts"
] | [
"'''\n Compute aggregate length of no hand movement bouts\n :param hand_movement_predictions: Predicted hand movement - binary predictions (1 = hand movement, 0 = no hand movement).\n :return: Average length of no hand movement bout lengths\n '''"
] | [
{
"param": "hand_movement_predictions",
"type": null
}
] | {
"returns": [
{
"docstring": "Average length of no hand movement bout lengths",
"docstring_tokens": [
"Average",
"length",
"of",
"no",
"hand",
"movement",
"bout",
"lengths"
],
"type": null
}
],
"raises": [],
"params... |
7cebad017457140a46a0679ec7694c20122b75a0 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | classifiers/resting_tremor_amplitude_classifier.py | [
"MIT"
] | Python | calculate_tremor_amplitude | <not_specific> | def calculate_tremor_amplitude(raw_accelerometer_data_df, fs):
'''
Calculate tremor amplitude from raw accelerometer data collected from wearable sensor at wrist location.
:param raw_accelerometer_data_df: Pandas DataFrame of raw accelerometer data. Columns = ['ts','x','y','z']
:param fs: Sampling rate ... |
Calculate tremor amplitude from raw accelerometer data collected from wearable sensor at wrist location.
:param raw_accelerometer_data_df: Pandas DataFrame of raw accelerometer data. Columns = ['ts','x','y','z']
:param fs: Sampling rate of raw accelerometer data (float)
:return: Computed tremor amplitu... | Calculate tremor amplitude from raw accelerometer data collected from wearable sensor at wrist location. | [
"Calculate",
"tremor",
"amplitude",
"from",
"raw",
"accelerometer",
"data",
"collected",
"from",
"wearable",
"sensor",
"at",
"wrist",
"location",
"."
] | def calculate_tremor_amplitude(raw_accelerometer_data_df, fs):
filtered_data_df = preprocess.band_pass_filter(raw_accelerometer_data_df, fs, [3.5, 7.5], 3,
channels=['x', 'y', 'z'])
bp_headers = ['x_bp_filt_[3.5, 7.5]', 'y_bp_filt_[3.5, 7.5]', 'z_bp_f... | [
"def",
"calculate_tremor_amplitude",
"(",
"raw_accelerometer_data_df",
",",
"fs",
")",
":",
"filtered_data_df",
"=",
"preprocess",
".",
"band_pass_filter",
"(",
"raw_accelerometer_data_df",
",",
"fs",
",",
"[",
"3.5",
",",
"7.5",
"]",
",",
"3",
",",
"channels",
... | Calculate tremor amplitude from raw accelerometer data collected from wearable sensor at wrist location. | [
"Calculate",
"tremor",
"amplitude",
"from",
"raw",
"accelerometer",
"data",
"collected",
"from",
"wearable",
"sensor",
"at",
"wrist",
"location",
"."
] | [
"'''\n Calculate tremor amplitude from raw accelerometer data collected from wearable sensor at wrist location.\n :param raw_accelerometer_data_df: Pandas DataFrame of raw accelerometer data. Columns = ['ts','x','y','z']\n :param fs: Sampling rate of raw accelerometer data (float)\n :return: Computed tr... | [
{
"param": "raw_accelerometer_data_df",
"type": null
},
{
"param": "fs",
"type": null
}
] | {
"returns": [
{
"docstring": "Computed tremor amplitude in 3 second windows (list)",
"docstring_tokens": [
"Computed",
"tremor",
"amplitude",
"in",
"3",
"second",
"windows",
"(",
"list",
")"
],
"type": null
... |
5c52571fc6522e49af544fae4e8307821bae89b9 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | features/signal_features.py | [
"MIT"
] | Python | histogram | <not_specific> | def histogram(signal_x):
'''
Calculate histogram of sensor signal.
:param signal_x: 1-D numpy array of sensor signal
:return: Histogram bin values, descriptor
'''
descriptor = np.zeros(3)
ncell = np.ceil(np.sqrt(len(signal_x)))
max_val = np.nanmax(signal_x.values)
min_val = np.nan... |
Calculate histogram of sensor signal.
:param signal_x: 1-D numpy array of sensor signal
:return: Histogram bin values, descriptor
| Calculate histogram of sensor signal. | [
"Calculate",
"histogram",
"of",
"sensor",
"signal",
"."
] | def histogram(signal_x):
descriptor = np.zeros(3)
ncell = np.ceil(np.sqrt(len(signal_x)))
max_val = np.nanmax(signal_x.values)
min_val = np.nanmin(signal_x.values)
delta = (max_val - min_val) / (len(signal_x) - 1)
descriptor[0] = min_val - delta / 2
descriptor[1] = max_val + delta / 2
de... | [
"def",
"histogram",
"(",
"signal_x",
")",
":",
"descriptor",
"=",
"np",
".",
"zeros",
"(",
"3",
")",
"ncell",
"=",
"np",
".",
"ceil",
"(",
"np",
".",
"sqrt",
"(",
"len",
"(",
"signal_x",
")",
")",
")",
"max_val",
"=",
"np",
".",
"nanmax",
"(",
... | Calculate histogram of sensor signal. | [
"Calculate",
"histogram",
"of",
"sensor",
"signal",
"."
] | [
"'''\n Calculate histogram of sensor signal.\n\n :param signal_x: 1-D numpy array of sensor signal\n :return: Histogram bin values, descriptor\n '''"
] | [
{
"param": "signal_x",
"type": null
}
] | {
"returns": [
{
"docstring": "Histogram bin values, descriptor",
"docstring_tokens": [
"Histogram",
"bin",
"values",
"descriptor"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "signal_x",
"type": null,
"docst... |
5c52571fc6522e49af544fae4e8307821bae89b9 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | features/signal_features.py | [
"MIT"
] | Python | signal_entropy | <not_specific> | def signal_entropy(signal_df, channels):
'''
Calculate signal entropy of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure signal entropy
:return: Pandas DataFrame housing calculated signal entropy for each signal channe... |
Calculate signal entropy of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure signal entropy
:return: Pandas DataFrame housing calculated signal entropy for each signal channel
| Calculate signal entropy of sensor signals. | [
"Calculate",
"signal",
"entropy",
"of",
"sensor",
"signals",
"."
] | def signal_entropy(signal_df, channels):
signal_entropy_df = pd.DataFrame()
for channel in channels:
data_norm = signal_df[channel]/np.std(signal_df[channel])
h, d = histogram(data_norm)
lowerbound = d[0]
upperbound = d[1]
ncell = int(d[2])
estimate = 0
si... | [
"def",
"signal_entropy",
"(",
"signal_df",
",",
"channels",
")",
":",
"signal_entropy_df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"for",
"channel",
"in",
"channels",
":",
"data_norm",
"=",
"signal_df",
"[",
"channel",
"]",
"/",
"np",
".",
"std",
"(",
"si... | Calculate signal entropy of sensor signals. | [
"Calculate",
"signal",
"entropy",
"of",
"sensor",
"signals",
"."
] | [
"'''\n Calculate signal entropy of sensor signals.\n\n :param signal_df: Pandas DataFrame housing desired sensor signals\n :param channels: channels of signal to measure signal entropy\n :return: Pandas DataFrame housing calculated signal entropy for each signal channel\n '''",
"# Scale the entropy... | [
{
"param": "signal_df",
"type": null
},
{
"param": "channels",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame housing calculated signal entropy for each signal channel",
"docstring_tokens": [
"Pandas",
"DataFrame",
"housing",
"calculated",
"signal",
"entropy",
"for",
"each",
"signal",
... |
5c52571fc6522e49af544fae4e8307821bae89b9 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | features/signal_features.py | [
"MIT"
] | Python | correlation_coefficient | <not_specific> | def correlation_coefficient(signal_df, channels):
'''
Calculate correlation coefficient of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure correlation coefficient
:return: Pandas DataFrame of calculated correlation coe... |
Calculate correlation coefficient of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure correlation coefficient
:return: Pandas DataFrame of calculated correlation coefficient for each signal channel
| Calculate correlation coefficient of sensor signals. | [
"Calculate",
"correlation",
"coefficient",
"of",
"sensor",
"signals",
"."
] | def correlation_coefficient(signal_df, channels):
corr_coef_df = pd.DataFrame()
C = signal_df.corr()
for channel in channels:
corr_coef_df[channel[0] + '_' + channel[1] + '_corr_coef'] = [C[channel[0]][channel[1]]]
return corr_coef_df | [
"def",
"correlation_coefficient",
"(",
"signal_df",
",",
"channels",
")",
":",
"corr_coef_df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"C",
"=",
"signal_df",
".",
"corr",
"(",
")",
"for",
"channel",
"in",
"channels",
":",
"corr_coef_df",
"[",
"channel",
"["... | Calculate correlation coefficient of sensor signals. | [
"Calculate",
"correlation",
"coefficient",
"of",
"sensor",
"signals",
"."
] | [
"'''\n Calculate correlation coefficient of sensor signals.\n\n :param signal_df: Pandas DataFrame housing desired sensor signals\n :param channels: channels of signal to measure correlation coefficient\n :return: Pandas DataFrame of calculated correlation coefficient for each signal channel\n '''"
] | [
{
"param": "signal_df",
"type": null
},
{
"param": "channels",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame of calculated correlation coefficient for each signal channel",
"docstring_tokens": [
"Pandas",
"DataFrame",
"of",
"calculated",
"correlation",
"coefficient",
"for",
"each",
"signal"... |
5c52571fc6522e49af544fae4e8307821bae89b9 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | features/signal_features.py | [
"MIT"
] | Python | signal_rms | <not_specific> | def signal_rms(signal_df, channels):
'''
Calculate root mean square of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure RMS
:return: Pandas DataFrame housing calculated RMS for each signal channel
'''
rms_df = p... |
Calculate root mean square of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure RMS
:return: Pandas DataFrame housing calculated RMS for each signal channel
| Calculate root mean square of sensor signals. | [
"Calculate",
"root",
"mean",
"square",
"of",
"sensor",
"signals",
"."
] | def signal_rms(signal_df, channels):
rms_df = pd.DataFrame()
for channel in channels:
rms_df[channel + '_rms'] = [np.std(signal_df[channel] - signal_df[channel].mean())]
return rms_df | [
"def",
"signal_rms",
"(",
"signal_df",
",",
"channels",
")",
":",
"rms_df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"for",
"channel",
"in",
"channels",
":",
"rms_df",
"[",
"channel",
"+",
"'_rms'",
"]",
"=",
"[",
"np",
".",
"std",
"(",
"signal_df",
"[... | Calculate root mean square of sensor signals. | [
"Calculate",
"root",
"mean",
"square",
"of",
"sensor",
"signals",
"."
] | [
"'''\n Calculate root mean square of sensor signals.\n\n :param signal_df: Pandas DataFrame housing desired sensor signals\n :param channels: channels of signal to measure RMS\n :return: Pandas DataFrame housing calculated RMS for each signal channel\n '''"
] | [
{
"param": "signal_df",
"type": null
},
{
"param": "channels",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame housing calculated RMS for each signal channel",
"docstring_tokens": [
"Pandas",
"DataFrame",
"housing",
"calculated",
"RMS",
"for",
"each",
"signal",
"channel"
],
"type"... |
5c52571fc6522e49af544fae4e8307821bae89b9 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | features/signal_features.py | [
"MIT"
] | Python | signal_range | <not_specific> | def signal_range(signal_df, channels):
'''
Calculate range of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure range
:return: Pandas DataFrame housing calculated range for each signal channel
'''
range_df = pd.D... |
Calculate range of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure range
:return: Pandas DataFrame housing calculated range for each signal channel
| Calculate range of sensor signals. | [
"Calculate",
"range",
"of",
"sensor",
"signals",
"."
] | def signal_range(signal_df, channels):
range_df = pd.DataFrame()
for channel in channels:
range_df[channel + '_range'] = [signal_df[channel].max(skipna=True) - signal_df[channel].min(skipna=True)]
return range_df | [
"def",
"signal_range",
"(",
"signal_df",
",",
"channels",
")",
":",
"range_df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"for",
"channel",
"in",
"channels",
":",
"range_df",
"[",
"channel",
"+",
"'_range'",
"]",
"=",
"[",
"signal_df",
"[",
"channel",
"]",
... | Calculate range of sensor signals. | [
"Calculate",
"range",
"of",
"sensor",
"signals",
"."
] | [
"'''\n Calculate range of sensor signals.\n\n :param signal_df: Pandas DataFrame housing desired sensor signals\n :param channels: channels of signal to measure range\n :return: Pandas DataFrame housing calculated range for each signal channel\n '''"
] | [
{
"param": "signal_df",
"type": null
},
{
"param": "channels",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame housing calculated range for each signal channel",
"docstring_tokens": [
"Pandas",
"DataFrame",
"housing",
"calculated",
"range",
"for",
"each",
"signal",
"channel"
],
"t... |
5c52571fc6522e49af544fae4e8307821bae89b9 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | features/signal_features.py | [
"MIT"
] | Python | iqr_of_autocovariance | <not_specific> | def iqr_of_autocovariance(signal_df, channels):
'''
Calculate interquartile range of autocovariance of sensor signals.
:param signal_df: Pandas DataFrame housing sensor signals
:param channels: channels of signal to obtain IQR of autocovariance
:return: Pandas DataFrame of calculated IQR of aut... |
Calculate interquartile range of autocovariance of sensor signals.
:param signal_df: Pandas DataFrame housing sensor signals
:param channels: channels of signal to obtain IQR of autocovariance
:return: Pandas DataFrame of calculated IQR of autocovariance for each signal channel
| Calculate interquartile range of autocovariance of sensor signals. | [
"Calculate",
"interquartile",
"range",
"of",
"autocovariance",
"of",
"sensor",
"signals",
"."
] | def iqr_of_autocovariance(signal_df, channels):
autocov_range_df = pd.DataFrame()
n_samples = signal_df.shape[0]
for channel in channels:
current_autocov_iqr = stats.iqr(acf(signal_df[channel], unbiased=True, nlags=n_samples/2))
autocov_range_df[channel + '_iqr_of_autocovariance'] = [current... | [
"def",
"iqr_of_autocovariance",
"(",
"signal_df",
",",
"channels",
")",
":",
"autocov_range_df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"n_samples",
"=",
"signal_df",
".",
"shape",
"[",
"0",
"]",
"for",
"channel",
"in",
"channels",
":",
"current_autocov_iqr",
... | Calculate interquartile range of autocovariance of sensor signals. | [
"Calculate",
"interquartile",
"range",
"of",
"autocovariance",
"of",
"sensor",
"signals",
"."
] | [
"'''\n Calculate interquartile range of autocovariance of sensor signals.\n \n :param signal_df: Pandas DataFrame housing sensor signals\n :param channels: channels of signal to obtain IQR of autocovariance\n :return: Pandas DataFrame of calculated IQR of autocovariance for each signal channel\n '... | [
{
"param": "signal_df",
"type": null
},
{
"param": "channels",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame of calculated IQR of autocovariance for each signal channel",
"docstring_tokens": [
"Pandas",
"DataFrame",
"of",
"calculated",
"IQR",
"of",
"autocovariance",
"for",
"each",
"... |
5c52571fc6522e49af544fae4e8307821bae89b9 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | features/signal_features.py | [
"MIT"
] | Python | dominant_frequency | <not_specific> | def dominant_frequency(signal_df, sampling_rate, cutoff, channels):
'''
Calculate dominant frequency of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param sampling_rate: sampling rate of sensor signal
:param cutoff: desired cutoff for filter
:param channels... |
Calculate dominant frequency of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param sampling_rate: sampling rate of sensor signal
:param cutoff: desired cutoff for filter
:param channels: channels of signal to measure dominant frequency
:return: Pandas Data... | Calculate dominant frequency of sensor signals. | [
"Calculate",
"dominant",
"frequency",
"of",
"sensor",
"signals",
"."
] | def dominant_frequency(signal_df, sampling_rate, cutoff, channels):
dominant_freq_df = pd.DataFrame()
for channel in channels:
signal_x = signal_df[channel]
padfactor = 1
dim = signal_x.shape
nfft = 2 ** ((dim[0] * padfactor).bit_length())
freq_hat = np.fft.fftfreq(nfft) ... | [
"def",
"dominant_frequency",
"(",
"signal_df",
",",
"sampling_rate",
",",
"cutoff",
",",
"channels",
")",
":",
"dominant_freq_df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"for",
"channel",
"in",
"channels",
":",
"signal_x",
"=",
"signal_df",
"[",
"channel",
"... | Calculate dominant frequency of sensor signals. | [
"Calculate",
"dominant",
"frequency",
"of",
"sensor",
"signals",
"."
] | [
"'''\n Calculate dominant frequency of sensor signals.\n\n :param signal_df: Pandas DataFrame housing desired sensor signals\n :param sampling_rate: sampling rate of sensor signal\n :param cutoff: desired cutoff for filter\n :param channels: channels of signal to measure dominant frequency\n :retu... | [
{
"param": "signal_df",
"type": null
},
{
"param": "sampling_rate",
"type": null
},
{
"param": "cutoff",
"type": null
},
{
"param": "channels",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame of calculated dominant frequency for each signal channel",
"docstring_tokens": [
"Pandas",
"DataFrame",
"of",
"calculated",
"dominant",
"frequency",
"for",
"each",
"signal",
... |
5c52571fc6522e49af544fae4e8307821bae89b9 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | features/signal_features.py | [
"MIT"
] | Python | mean_cross_rate | <not_specific> | def mean_cross_rate(signal_df, channels):
'''
Compute mean cross rate of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure mean cross rate
:return: Pandas DataFrame housing calculated mean cross rate for each signal chan... |
Compute mean cross rate of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure mean cross rate
:return: Pandas DataFrame housing calculated mean cross rate for each signal channel
| Compute mean cross rate of sensor signals. | [
"Compute",
"mean",
"cross",
"rate",
"of",
"sensor",
"signals",
"."
] | def mean_cross_rate(signal_df, channels):
mean_cross_rate_df = pd.DataFrame()
signal_df_mean = signal_df[channels] - signal_df[channels].mean()
for channel in channels:
MCR = 0
for i in range(len(signal_df_mean) - 1):
if np.sign(signal_df_mean.loc[i, channel]) != np.sign(signal_d... | [
"def",
"mean_cross_rate",
"(",
"signal_df",
",",
"channels",
")",
":",
"mean_cross_rate_df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"signal_df_mean",
"=",
"signal_df",
"[",
"channels",
"]",
"-",
"signal_df",
"[",
"channels",
"]",
".",
"mean",
"(",
")",
"fo... | Compute mean cross rate of sensor signals. | [
"Compute",
"mean",
"cross",
"rate",
"of",
"sensor",
"signals",
"."
] | [
"'''\n Compute mean cross rate of sensor signals.\n\n :param signal_df: Pandas DataFrame housing desired sensor signals\n :param channels: channels of signal to measure mean cross rate\n :return: Pandas DataFrame housing calculated mean cross rate for each signal channel\n '''"
] | [
{
"param": "signal_df",
"type": null
},
{
"param": "channels",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame housing calculated mean cross rate for each signal channel",
"docstring_tokens": [
"Pandas",
"DataFrame",
"housing",
"calculated",
"mean",
"cross",
"rate",
"for",
"each",
"si... |
5c52571fc6522e49af544fae4e8307821bae89b9 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | features/signal_features.py | [
"MIT"
] | Python | range_count_percentage | <not_specific> | def range_count_percentage(signal_df, channels, min_value=-1, max_value=1):
'''
Calculate range count percentage of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure range count percentage
:param min_value: desired minim... |
Calculate range count percentage of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param channels: channels of signal to measure range count percentage
:param min_value: desired minimum value
:param max_value: desired maximum value
:return: Pandas DataFrame ... | Calculate range count percentage of sensor signals. | [
"Calculate",
"range",
"count",
"percentage",
"of",
"sensor",
"signals",
"."
] | def range_count_percentage(signal_df, channels, min_value=-1, max_value=1):
range_count_df = pd.DataFrame()
for channel in channels:
signal_x = signal_df[channel]
current_range_count = tsf.feature_extraction.feature_calculators.range_count(signal_x, min_value, max_value) * 1.0 / len(signal_x)
... | [
"def",
"range_count_percentage",
"(",
"signal_df",
",",
"channels",
",",
"min_value",
"=",
"-",
"1",
",",
"max_value",
"=",
"1",
")",
":",
"range_count_df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"for",
"channel",
"in",
"channels",
":",
"signal_x",
"=",
... | Calculate range count percentage of sensor signals. | [
"Calculate",
"range",
"count",
"percentage",
"of",
"sensor",
"signals",
"."
] | [
"'''\n Calculate range count percentage of sensor signals.\n\n :param signal_df: Pandas DataFrame housing desired sensor signals\n :param channels: channels of signal to measure range count percentage\n :param min_value: desired minimum value\n :param max_value: desired maximum value\n :return: Pa... | [
{
"param": "signal_df",
"type": null
},
{
"param": "channels",
"type": null
},
{
"param": "min_value",
"type": null
},
{
"param": "max_value",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame of calculated range count percentage for each signal channel",
"docstring_tokens": [
"Pandas",
"DataFrame",
"of",
"calculated",
"range",
"count",
"percentage",
"for",
"each",
... |
5c52571fc6522e49af544fae4e8307821bae89b9 | NikhilMahadevan/analyze-tremor-bradykinesia-PD | features/signal_features.py | [
"MIT"
] | Python | jerk_metric | <not_specific> | def jerk_metric(signal_df, sampling_rate, channels):
'''
Calculate jerk of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param sampling_rate: sampling rate of sensor signals
:param channels: channels of sensor signal to compute jerk
:return: Pandas DataFrame... |
Calculate jerk of sensor signals.
:param signal_df: Pandas DataFrame housing desired sensor signals
:param sampling_rate: sampling rate of sensor signals
:param channels: channels of sensor signal to compute jerk
:return: Pandas DataFrame of calculated jerk for each sensor channel
| Calculate jerk of sensor signals. | [
"Calculate",
"jerk",
"of",
"sensor",
"signals",
"."
] | def jerk_metric(signal_df, sampling_rate, channels):
jerk_ratio_df = pd.DataFrame()
dt = 1. / sampling_rate
duration = len(signal_df) * dt
for channel in channels:
amplitude = max(abs(signal_df[channel]))
jerk = signal_df[channel].diff(1) / dt
jerk_squared = jerk ** 2
jer... | [
"def",
"jerk_metric",
"(",
"signal_df",
",",
"sampling_rate",
",",
"channels",
")",
":",
"jerk_ratio_df",
"=",
"pd",
".",
"DataFrame",
"(",
")",
"dt",
"=",
"1.",
"/",
"sampling_rate",
"duration",
"=",
"len",
"(",
"signal_df",
")",
"*",
"dt",
"for",
"chan... | Calculate jerk of sensor signals. | [
"Calculate",
"jerk",
"of",
"sensor",
"signals",
"."
] | [
"'''\n Calculate jerk of sensor signals.\n\n :param signal_df: Pandas DataFrame housing desired sensor signals\n :param sampling_rate: sampling rate of sensor signals\n :param channels: channels of sensor signal to compute jerk\n :return: Pandas DataFrame of calculated jerk for each sensor channel\n ... | [
{
"param": "signal_df",
"type": null
},
{
"param": "sampling_rate",
"type": null
},
{
"param": "channels",
"type": null
}
] | {
"returns": [
{
"docstring": "Pandas DataFrame of calculated jerk for each sensor channel",
"docstring_tokens": [
"Pandas",
"DataFrame",
"of",
"calculated",
"jerk",
"for",
"each",
"sensor",
"channel"
],
"type": null
... |
16a7fe973353fa9aa11b31fe899de3b09f9aea9d | willmuto/image2h | python/image2h.py | [
"CC-BY-4.0"
] | Python | image_data_to_str | <not_specific> | def image_data_to_str(image_data,invert=False, has_alpha=False, primary=[255, 255, 255],
secondary=[], verbose=False):
"""
Converts a PIL.Image object to a data string that is then added to the
header file. String is hex values, lines terminated by "0x0a,\n"
:param image_data PIL.Imag... |
Converts a PIL.Image object to a data string that is then added to the
header file. String is hex values, lines terminated by "0x0a,\n"
:param image_data PIL.Image:
:param invert bool: Invert the on/off colors in the returned data string.
:param has_alpha bool: True of the image uses an alpha channel.... | Converts a PIL.Image object to a data string that is then added to the
header file. String is hex values, lines terminated by "0x0a,\n" | [
"Converts",
"a",
"PIL",
".",
"Image",
"object",
"to",
"a",
"data",
"string",
"that",
"is",
"then",
"added",
"to",
"the",
"header",
"file",
".",
"String",
"is",
"hex",
"values",
"lines",
"terminated",
"by",
"\"",
"0x0a",
"\\",
"n",
"\""
] | def image_data_to_str(image_data,invert=False, has_alpha=False, primary=[255, 255, 255],
secondary=[], verbose=False):
on = C2 if invert else C1
off = C1 if invert else C2
if has_alpha:
primary = primary + [255]
if secondary:
secondary = secondary + [255]
primary =... | [
"def",
"image_data_to_str",
"(",
"image_data",
",",
"invert",
"=",
"False",
",",
"has_alpha",
"=",
"False",
",",
"primary",
"=",
"[",
"255",
",",
"255",
",",
"255",
"]",
",",
"secondary",
"=",
"[",
"]",
",",
"verbose",
"=",
"False",
")",
":",
"on",
... | Converts a PIL.Image object to a data string that is then added to the
header file. | [
"Converts",
"a",
"PIL",
".",
"Image",
"object",
"to",
"a",
"data",
"string",
"that",
"is",
"then",
"added",
"to",
"the",
"header",
"file",
"."
] | [
"\"\"\"\n Converts a PIL.Image object to a data string that is then added to the\n header file. String is hex values, lines terminated by \"0x0a,\\n\"\n\n :param image_data PIL.Image: \n :param invert bool: Invert the on/off colors in the returned data string.\n :param has_alpha bool: True of the image us... | [
{
"param": "image_data",
"type": null
},
{
"param": "invert",
"type": null
},
{
"param": "has_alpha",
"type": null
},
{
"param": "primary",
"type": null
},
{
"param": "secondary",
"type": null
},
{
"param": "verbose",
"type": null
}
] | {
"returns": [
{
"docstring": "A string of hex values.",
"docstring_tokens": [
"A",
"string",
"of",
"hex",
"values",
"."
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "image_data",
"type": null,
... |
60e9900dc7ad7041c4fe01195baf31a622154fba | trestripes-com/mobius | utils.py | [
"ECL-2.0"
] | Python | shift_func | <not_specific> | def shift_func(coords,a,b,c,d):
""" Define the mobius transformation, though backwards """
#turn the first two coordinates into an imaginary number
z = coords[0] + 1j*coords[1]
w = (d*z-b)/(-c*z+a) #the inverse mobius transform
#take the color along for the ride
return real(w),imag(w),coords[2] | Define the mobius transformation, though backwards | Define the mobius transformation, though backwards | [
"Define",
"the",
"mobius",
"transformation",
"though",
"backwards"
] | def shift_func(coords,a,b,c,d):
z = coords[0] + 1j*coords[1]
w = (d*z-b)/(-c*z+a)
return real(w),imag(w),coords[2] | [
"def",
"shift_func",
"(",
"coords",
",",
"a",
",",
"b",
",",
"c",
",",
"d",
")",
":",
"z",
"=",
"coords",
"[",
"0",
"]",
"+",
"1j",
"*",
"coords",
"[",
"1",
"]",
"w",
"=",
"(",
"d",
"*",
"z",
"-",
"b",
")",
"/",
"(",
"-",
"c",
"*",
"z... | Define the mobius transformation, though backwards | [
"Define",
"the",
"mobius",
"transformation",
"though",
"backwards"
] | [
"\"\"\" Define the mobius transformation, though backwards \"\"\"",
"#turn the first two coordinates into an imaginary number",
"#the inverse mobius transform",
"#take the color along for the ride"
] | [
{
"param": "coords",
"type": null
},
{
"param": "a",
"type": null
},
{
"param": "b",
"type": null
},
{
"param": "c",
"type": null
},
{
"param": "d",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "coords",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "a",
"type": null,
"docstring": null,
"docstring_tokens": []... |
ebe5e73b69eec78268d813fa5031d4c90cf08457 | trestripes-com/mobius | mobius_data_augmentation/mobius_transformation.py | [
"ECL-2.0"
] | Python | shift_func | <not_specific> | def shift_func(self, coords,a,b,c,d):
""" Define the moebius transformation, though backwards """
#turn the first two coordinates into an imaginary number
z = coords[0] + 1j*coords[1]
w = (d*z-b)/(-c*z+a) #the inverse mobius transform
#take the color along for the ride
re... | Define the moebius transformation, though backwards | Define the moebius transformation, though backwards | [
"Define",
"the",
"moebius",
"transformation",
"though",
"backwards"
] | def shift_func(self, coords,a,b,c,d):
z = coords[0] + 1j*coords[1]
w = (d*z-b)/(-c*z+a)
return np.real(w),np.imag(w),coords[2] | [
"def",
"shift_func",
"(",
"self",
",",
"coords",
",",
"a",
",",
"b",
",",
"c",
",",
"d",
")",
":",
"z",
"=",
"coords",
"[",
"0",
"]",
"+",
"1j",
"*",
"coords",
"[",
"1",
"]",
"w",
"=",
"(",
"d",
"*",
"z",
"-",
"b",
")",
"/",
"(",
"-",
... | Define the moebius transformation, though backwards | [
"Define",
"the",
"moebius",
"transformation",
"though",
"backwards"
] | [
"\"\"\" Define the moebius transformation, though backwards \"\"\"",
"#turn the first two coordinates into an imaginary number",
"#the inverse mobius transform",
"#take the color along for the ride"
] | [
{
"param": "self",
"type": null
},
{
"param": "coords",
"type": null
},
{
"param": "a",
"type": null
},
{
"param": "b",
"type": null
},
{
"param": "c",
"type": null
},
{
"param": "d",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "coords",
"type": null,
"docstring": null,
"docstring_tokens":... |
6a6a7ee471cf78902df5526bfb0b9287702f26a5 | ericwhyne/datapop | datapop.py | [
"Apache-2.0"
] | Python | fetch_web_data | <not_specific> | def fetch_web_data(url, headers = { 'User-Agent' : 'Magic Browser' }):
'''
Fetches data from a url. Prints message and returns False if failed.
If successful returns dict data
data['raw_html']
data['content_type']
data['page_links']
data['title']
data['cleaned_text']
'''
#... |
Fetches data from a url. Prints message and returns False if failed.
If successful returns dict data
data['raw_html']
data['content_type']
data['page_links']
data['title']
data['cleaned_text']
| Fetches data from a url. Prints message and returns False if failed. | [
"Fetches",
"data",
"from",
"a",
"url",
".",
"Prints",
"message",
"and",
"returns",
"False",
"if",
"failed",
"."
] | def fetch_web_data(url, headers = { 'User-Agent' : 'Magic Browser' }):
data = {}
try:
req = urllib2.Request(url, None, headers)
response = urllib2.urlopen(req)
data['raw_html'] = unicode(response.read(), errors='replace')
data['content_type'] = response.info().getheader('Content-Type')
... | [
"def",
"fetch_web_data",
"(",
"url",
",",
"headers",
"=",
"{",
"'User-Agent'",
":",
"'Magic Browser'",
"}",
")",
":",
"data",
"=",
"{",
"}",
"try",
":",
"req",
"=",
"urllib2",
".",
"Request",
"(",
"url",
",",
"None",
",",
"headers",
")",
"response",
... | Fetches data from a url. | [
"Fetches",
"data",
"from",
"a",
"url",
"."
] | [
"'''\n Fetches data from a url. Prints message and returns False if failed.\n If successful returns dict data\n data['raw_html']\n data['content_type']\n data['page_links']\n data['title']\n data['cleaned_text']\n '''",
"#print \"Fetching web page: \" + url",
"#print \"Content typ... | [
{
"param": "url",
"type": null
},
{
"param": "headers",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "url",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "headers",
"type": null,
"docstring": null,
"docstring_tokens":... |
4129ad383010d0c05148e59a945cf718ed13ac27 | olemartinorg/i3-alternating-layout | alternating_layouts.py | [
"MIT"
] | Python | main | null | def main():
"""
Main function - listen for window focus
changes and call set_layout when focus
changes
"""
opt_list, _ = getopt.getopt(sys.argv[1:], 'hp:')
pid_file = None
for opt in opt_list:
if opt[0] == "-h":
print_help()
sys.exit()
if o... |
Main function - listen for window focus
changes and call set_layout when focus
changes
| Main function - listen for window focus
changes and call set_layout when focus
changes | [
"Main",
"function",
"-",
"listen",
"for",
"window",
"focus",
"changes",
"and",
"call",
"set_layout",
"when",
"focus",
"changes"
] | def main():
opt_list, _ = getopt.getopt(sys.argv[1:], 'hp:')
pid_file = None
for opt in opt_list:
if opt[0] == "-h":
print_help()
sys.exit()
if opt[0] == "-p":
pid_file = opt[1]
if pid_file:
with open(pid_file, 'w') as f:
f.write(st... | [
"def",
"main",
"(",
")",
":",
"opt_list",
",",
"_",
"=",
"getopt",
".",
"getopt",
"(",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
",",
"'hp:'",
")",
"pid_file",
"=",
"None",
"for",
"opt",
"in",
"opt_list",
":",
"if",
"opt",
"[",
"0",
"]",
"==",
... | Main function - listen for window focus
changes and call set_layout when focus
changes | [
"Main",
"function",
"-",
"listen",
"for",
"window",
"focus",
"changes",
"and",
"call",
"set_layout",
"when",
"focus",
"changes"
] | [
"\"\"\"\n Main function - listen for window focus\n changes and call set_layout when focus\n changes\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
2317d27ea0696be02da442e510e4f2b3f0349313 | EagleoutIce/sltx | sltxpkg/dep.py | [
"MIT"
] | Python | detect_driver | str | def detect_driver(idx: str, url: str) -> str:
"""Tries to match the given patterns to [description]
This could be optimized by pre-compile the given patterns.
Args:
idx (str): the current index number for logging
url (str): the url to adapt the driver from
Returns:
(str): The d... | Tries to match the given patterns to [description]
This could be optimized by pre-compile the given patterns.
Args:
idx (str): the current index number for logging
url (str): the url to adapt the driver from
Returns:
(str): The driver key to use
| Tries to match the given patterns to [description]
This could be optimized by pre-compile the given patterns. | [
"Tries",
"to",
"match",
"the",
"given",
"patterns",
"to",
"[",
"description",
"]",
"This",
"could",
"be",
"optimized",
"by",
"pre",
"-",
"compile",
"the",
"given",
"patterns",
"."
] | def detect_driver(idx: str, url: str) -> str:
print_idx(idx, " - Auto-detecting driver...")
for key, patterns in sg.configuration[C_DRIVER_PATTERNS].items():
for pattern in patterns:
if re.search(pattern, url):
return key
print_idx(idx, " ! No driver found...")
sys.ex... | [
"def",
"detect_driver",
"(",
"idx",
":",
"str",
",",
"url",
":",
"str",
")",
"->",
"str",
":",
"print_idx",
"(",
"idx",
",",
"\" - Auto-detecting driver...\"",
")",
"for",
"key",
",",
"patterns",
"in",
"sg",
".",
"configuration",
"[",
"C_DRIVER_PATTERNS",
... | Tries to match the given patterns to [description]
This could be optimized by pre-compile the given patterns. | [
"Tries",
"to",
"match",
"the",
"given",
"patterns",
"to",
"[",
"description",
"]",
"This",
"could",
"be",
"optimized",
"by",
"pre",
"-",
"compile",
"the",
"given",
"patterns",
"."
] | [
"\"\"\"Tries to match the given patterns to [description]\n This could be optimized by pre-compile the given patterns.\n\n Args:\n idx (str): the current index number for logging\n url (str): the url to adapt the driver from\n\n Returns:\n (str): The driver key to use\n \"\"\""
] | [
{
"param": "idx",
"type": "str"
},
{
"param": "url",
"type": "str"
}
] | {
"returns": [
{
"docstring": "The driver key to use",
"docstring_tokens": [
"The",
"driver",
"key",
"to",
"use"
],
"type": "(str)"
}
],
"raises": [],
"params": [
{
"identifier": "idx",
"type": "str",
"docstring": "the... |
2317d27ea0696be02da442e510e4f2b3f0349313 | EagleoutIce/sltx | sltxpkg/dep.py | [
"MIT"
] | Python | split_grab_pattern | Tuple[str, str] | def split_grab_pattern(pattern: str, default_target: str) -> Tuple[str, str]:
"""Performes splits on grab patterns ("source=>target")
will fill in the given default target, if split does not present one
Args:
pattern (str): The pattern to split
default_target (str): The target to be auto... | Performes splits on grab patterns ("source=>target")
will fill in the given default target, if split does not present one
Args:
pattern (str): The pattern to split
default_target (str): The target to be auto-filled if none given
Returns:
(str,str): pattern and pair
| Performes splits on grab patterns ("source=>target")
will fill in the given default target, if split does not present one | [
"Performes",
"splits",
"on",
"grab",
"patterns",
"(",
"\"",
"source",
"=",
">",
"target",
"\"",
")",
"will",
"fill",
"in",
"the",
"given",
"default",
"target",
"if",
"split",
"does",
"not",
"present",
"one"
] | def split_grab_pattern(pattern: str, default_target: str) -> Tuple[str, str]:
parts = pattern.split('=>', 1)
target = default_target if len(parts) == 1 else parts[1]
return parts[0], target | [
"def",
"split_grab_pattern",
"(",
"pattern",
":",
"str",
",",
"default_target",
":",
"str",
")",
"->",
"Tuple",
"[",
"str",
",",
"str",
"]",
":",
"parts",
"=",
"pattern",
".",
"split",
"(",
"'=>'",
",",
"1",
")",
"target",
"=",
"default_target",
"if",
... | Performes splits on grab patterns ("source=>target")
will fill in the given default target, if split does not present one | [
"Performes",
"splits",
"on",
"grab",
"patterns",
"(",
"\"",
"source",
"=",
">",
"target",
"\"",
")",
"will",
"fill",
"in",
"the",
"given",
"default",
"target",
"if",
"split",
"does",
"not",
"present",
"one"
] | [
"\"\"\"Performes splits on grab patterns (\"source=>target\")\n will fill in the given default target, if split does not present one\n\n Args:\n pattern (str): The pattern to split\n default_target (str): The target to be auto-filled if none given\n\n Returns:\n (str,str): pattern a... | [
{
"param": "pattern",
"type": "str"
},
{
"param": "default_target",
"type": "str"
}
] | {
"returns": [
{
"docstring": "pattern and pair",
"docstring_tokens": [
"pattern",
"and",
"pair"
],
"type": "(str,str)"
}
],
"raises": [],
"params": [
{
"identifier": "pattern",
"type": "str",
"docstring": "The pattern to split",
... |
2317d27ea0696be02da442e510e4f2b3f0349313 | EagleoutIce/sltx | sltxpkg/dep.py | [
"MIT"
] | Python | extend_grab_from_local | Tuple[list, list] | def extend_grab_from_local(idx: str, driver_target_dir: str, data: dict) -> Tuple[list, list]:
"""May install extra profiles
This method will check for a local dep file, and if present
check for a profiles key. if present it will check for a selected profile in the data dict.
If so, select it,... | May install extra profiles
This method will check for a local dep file, and if present
check for a profiles key. if present it will check for a selected profile in the data dict.
If so, select it, if none, set the default
Args:
idx (str): index to use in multithreading
driver_t... | May install extra profiles
This method will check for a local dep file, and if present
check for a profiles key. if present it will check for a selected profile in the data dict.
If so, select it, if none, set the default | [
"May",
"install",
"extra",
"profiles",
"This",
"method",
"will",
"check",
"for",
"a",
"local",
"dep",
"file",
"and",
"if",
"present",
"check",
"for",
"a",
"profiles",
"key",
".",
"if",
"present",
"it",
"will",
"check",
"for",
"a",
"selected",
"profile",
... | def extend_grab_from_local(idx: str, driver_target_dir: str, data: dict) -> Tuple[list, list]:
if 'dep' not in data:
dep = sg.DEFAULT_DEPENDENCY
else:
dep = data['dep']
dep_files = glob.glob(os.path.join(driver_target_dir, dep), recursive=True)
if len(dep_files) <= 0:
return [], ... | [
"def",
"extend_grab_from_local",
"(",
"idx",
":",
"str",
",",
"driver_target_dir",
":",
"str",
",",
"data",
":",
"dict",
")",
"->",
"Tuple",
"[",
"list",
",",
"list",
"]",
":",
"if",
"'dep'",
"not",
"in",
"data",
":",
"dep",
"=",
"sg",
".",
"DEFAULT_... | May install extra profiles
This method will check for a local dep file, and if present
check for a profiles key. | [
"May",
"install",
"extra",
"profiles",
"This",
"method",
"will",
"check",
"for",
"a",
"local",
"dep",
"file",
"and",
"if",
"present",
"check",
"for",
"a",
"profiles",
"key",
"."
] | [
"\"\"\"May install extra profiles\n\n This method will check for a local dep file, and if present\n check for a profiles key. if present it will check for a selected profile in the data dict.\n If so, select it, if none, set the default\n Args:\n idx (str): index to use in multithreading... | [
{
"param": "idx",
"type": "str"
},
{
"param": "driver_target_dir",
"type": "str"
},
{
"param": "data",
"type": "dict"
}
] | {
"returns": [
{
"docstring": "(list,list) - a list of additional dependencies in the format 'files, folder'",
"docstring_tokens": [
"(",
"list",
"list",
")",
"-",
"a",
"list",
"of",
"additional",
"dependencies",
"... |
2317d27ea0696be02da442e510e4f2b3f0349313 | EagleoutIce/sltx | sltxpkg/dep.py | [
"MIT"
] | Python | _install_dependencies | <not_specific> | def _install_dependencies(idx: str, dep_dict: dict, target: str, first: bool = False):
"""Will install dependencies in an multi-threaded environment and may be called recursively
Args:
idx (str): The index to be run in (will start with 0)
dep_dict (dict): Dependencies to fetch with this run
... | Will install dependencies in an multi-threaded environment and may be called recursively
Args:
idx (str): The index to be run in (will start with 0)
dep_dict (dict): Dependencies to fetch with this run
target (str): The target directory for the fetch
first (bool, optional): Flag for... | Will install dependencies in an multi-threaded environment and may be called recursively | [
"Will",
"install",
"dependencies",
"in",
"an",
"multi",
"-",
"threaded",
"environment",
"and",
"may",
"be",
"called",
"recursively"
] | def _install_dependencies(idx: str, dep_dict: dict, target: str, first: bool = False):
if 'dependencies' not in dep_dict:
return
with futures.ThreadPoolExecutor(max_workers=sg.args.threads) as pool:
runners = []
for i, dep in enumerate(dep_dict['dependencies']):
runners.appen... | [
"def",
"_install_dependencies",
"(",
"idx",
":",
"str",
",",
"dep_dict",
":",
"dict",
",",
"target",
":",
"str",
",",
"first",
":",
"bool",
"=",
"False",
")",
":",
"if",
"'dependencies'",
"not",
"in",
"dep_dict",
":",
"return",
"with",
"futures",
".",
... | Will install dependencies in an multi-threaded environment and may be called recursively | [
"Will",
"install",
"dependencies",
"in",
"an",
"multi",
"-",
"threaded",
"environment",
"and",
"may",
"be",
"called",
"recursively"
] | [
"\"\"\"Will install dependencies in an multi-threaded environment and may be called recursively\n\n Args:\n idx (str): The index to be run in (will start with 0)\n dep_dict (dict): Dependencies to fetch with this run\n target (str): The target directory for the fetch\n first (bool, op... | [
{
"param": "idx",
"type": "str"
},
{
"param": "dep_dict",
"type": "dict"
},
{
"param": "target",
"type": "str"
},
{
"param": "first",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "idx",
"type": "str",
"docstring": "The index to be run in (will start with 0)",
"docstring_tokens": [
"The",
"index",
"to",
"be",
"run",
"in",
"(",
"will",
... |
2317d27ea0696be02da442e510e4f2b3f0349313 | EagleoutIce/sltx | sltxpkg/dep.py | [
"MIT"
] | Python | _install_dependencies_guard | null | def _install_dependencies_guard():
"""Cheap command line guard which will check for valid keys
"""
if "target" not in sg.dependencies or "dependencies" not in sg.dependencies:
LOGGER.error(
"The dependency-file must supply a 'target' and an 'dependencies' key!")
sys.exit(1) | Cheap command line guard which will check for valid keys
| Cheap command line guard which will check for valid keys | [
"Cheap",
"command",
"line",
"guard",
"which",
"will",
"check",
"for",
"valid",
"keys"
] | def _install_dependencies_guard():
if "target" not in sg.dependencies or "dependencies" not in sg.dependencies:
LOGGER.error(
"The dependency-file must supply a 'target' and an 'dependencies' key!")
sys.exit(1) | [
"def",
"_install_dependencies_guard",
"(",
")",
":",
"if",
"\"target\"",
"not",
"in",
"sg",
".",
"dependencies",
"or",
"\"dependencies\"",
"not",
"in",
"sg",
".",
"dependencies",
":",
"LOGGER",
".",
"error",
"(",
"\"The dependency-file must supply a 'target' and an 'd... | Cheap command line guard which will check for valid keys | [
"Cheap",
"command",
"line",
"guard",
"which",
"will",
"check",
"for",
"valid",
"keys"
] | [
"\"\"\"Cheap command line guard which will check for valid keys\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
2317d27ea0696be02da442e510e4f2b3f0349313 | EagleoutIce/sltx | sltxpkg/dep.py | [
"MIT"
] | Python | _install_dependencies_cleanup | null | def _install_dependencies_cleanup():
"""This will be run after the requested dependencies have been installed.
"""
if sg.configuration[C_CLEANUP]:
LOGGER.info("> Cleaning up the download directory, as set.")
shutil.rmtree(sg.configuration[C_DOWNLOAD_DIR])
LOGGER.info("Loaded: " + str(lo... | This will be run after the requested dependencies have been installed.
| This will be run after the requested dependencies have been installed. | [
"This",
"will",
"be",
"run",
"after",
"the",
"requested",
"dependencies",
"have",
"been",
"installed",
"."
] | def _install_dependencies_cleanup():
if sg.configuration[C_CLEANUP]:
LOGGER.info("> Cleaning up the download directory, as set.")
shutil.rmtree(sg.configuration[C_DOWNLOAD_DIR])
LOGGER.info("Loaded: " + str(loaded))
if not sg.configuration[C_RECURSIVE]:
LOGGER.info("Recursion was dis... | [
"def",
"_install_dependencies_cleanup",
"(",
")",
":",
"if",
"sg",
".",
"configuration",
"[",
"C_CLEANUP",
"]",
":",
"LOGGER",
".",
"info",
"(",
"\"> Cleaning up the download directory, as set.\"",
")",
"shutil",
".",
"rmtree",
"(",
"sg",
".",
"configuration",
"["... | This will be run after the requested dependencies have been installed. | [
"This",
"will",
"be",
"run",
"after",
"the",
"requested",
"dependencies",
"have",
"been",
"installed",
"."
] | [
"\"\"\"This will be run after the requested dependencies have been installed.\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
2317d27ea0696be02da442e510e4f2b3f0349313 | EagleoutIce/sltx | sltxpkg/dep.py | [
"MIT"
] | Python | install_dependencies | None | def install_dependencies(target: str = su.get_sltx_tex_home()) -> None:
"""Download and unpack given dependencies to the given target directory
Args:
target (str, optional): The target folder. Defaults to su.get_sltx_tex_home().
"""
_install_dependencies_guard()
write_to_log("====Dependenc... | Download and unpack given dependencies to the given target directory
Args:
target (str, optional): The target folder. Defaults to su.get_sltx_tex_home().
| Download and unpack given dependencies to the given target directory | [
"Download",
"and",
"unpack",
"given",
"dependencies",
"to",
"the",
"given",
"target",
"directory"
] | def install_dependencies(target: str = su.get_sltx_tex_home()) -> None:
_install_dependencies_guard()
write_to_log("====Dependencies for:" + sg.dependencies["target"] + "\n")
LOGGER.info("\nDependencies for: " + sg.dependencies["target"])
LOGGER.info("Installing to: %s\n", target)
_install_dependenc... | [
"def",
"install_dependencies",
"(",
"target",
":",
"str",
"=",
"su",
".",
"get_sltx_tex_home",
"(",
")",
")",
"->",
"None",
":",
"_install_dependencies_guard",
"(",
")",
"write_to_log",
"(",
"\"====Dependencies for:\"",
"+",
"sg",
".",
"dependencies",
"[",
"\"ta... | Download and unpack given dependencies to the given target directory | [
"Download",
"and",
"unpack",
"given",
"dependencies",
"to",
"the",
"given",
"target",
"directory"
] | [
"\"\"\"Download and unpack given dependencies to the given target directory\n\n Args:\n target (str, optional): The target folder. Defaults to su.get_sltx_tex_home().\n \"\"\""
] | [
{
"param": "target",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "target",
"type": "str",
"docstring": "The target folder. Defaults to su.get_sltx_tex_home().",
"docstring_tokens": [
"The",
"target",
"folder",
".",
"Defaults",
"to",
"su... |
9e596df28d8ec4770129af88b0dcaca751f3c5da | EagleoutIce/sltx | sltxpkg/config.py | [
"MIT"
] | Python | load_configuration | null | def load_configuration(file: str):
"""Apply given configuration file to the sltx config
Args:
file (str): The configuration file to load
"""
y_conf = su.load_yaml(file)
sg.configuration = {**sg.configuration, **y_conf} | Apply given configuration file to the sltx config
Args:
file (str): The configuration file to load
| Apply given configuration file to the sltx config | [
"Apply",
"given",
"configuration",
"file",
"to",
"the",
"sltx",
"config"
] | def load_configuration(file: str):
y_conf = su.load_yaml(file)
sg.configuration = {**sg.configuration, **y_conf} | [
"def",
"load_configuration",
"(",
"file",
":",
"str",
")",
":",
"y_conf",
"=",
"su",
".",
"load_yaml",
"(",
"file",
")",
"sg",
".",
"configuration",
"=",
"{",
"**",
"sg",
".",
"configuration",
",",
"**",
"y_conf",
"}"
] | Apply given configuration file to the sltx config | [
"Apply",
"given",
"configuration",
"file",
"to",
"the",
"sltx",
"config"
] | [
"\"\"\"Apply given configuration file to the sltx config\n\n Args:\n file (str): The configuration file to load\n \"\"\""
] | [
{
"param": "file",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "str",
"docstring": "The configuration file to load",
"docstring_tokens": [
"The",
"configuration",
"file",
"to",
"load"
],
"default": null,
"is_optional... |
9e596df28d8ec4770129af88b0dcaca751f3c5da | EagleoutIce/sltx | sltxpkg/config.py | [
"MIT"
] | Python | load_dependencies_config | dict | def load_dependencies_config(file: str, target: dict) -> dict:
"""Apply given dependency file to the sltx dep list
Args:
file (str): The file to load
target (dict): The target dependency-collection to append it to (won't be modified)
Returns:
dict: The target dict with the added de... | Apply given dependency file to the sltx dep list
Args:
file (str): The file to load
target (dict): The target dependency-collection to append it to (won't be modified)
Returns:
dict: The target dict with the added dependencies
| Apply given dependency file to the sltx dep list | [
"Apply",
"given",
"dependency",
"file",
"to",
"the",
"sltx",
"dep",
"list"
] | def load_dependencies_config(file: str, target: dict) -> dict:
y_dep = su.load_yaml(file)
if 'dependencies' in y_dep:
for dep in y_dep['dependencies']:
dep_data = y_dep['dependencies'][dep]
if 'url' in dep_data:
dep_data['url'] = expand_url(
de... | [
"def",
"load_dependencies_config",
"(",
"file",
":",
"str",
",",
"target",
":",
"dict",
")",
"->",
"dict",
":",
"y_dep",
"=",
"su",
".",
"load_yaml",
"(",
"file",
")",
"if",
"'dependencies'",
"in",
"y_dep",
":",
"for",
"dep",
"in",
"y_dep",
"[",
"'depe... | Apply given dependency file to the sltx dep list | [
"Apply",
"given",
"dependency",
"file",
"to",
"the",
"sltx",
"dep",
"list"
] | [
"\"\"\"Apply given dependency file to the sltx dep list\n\n Args:\n file (str): The file to load\n target (dict): The target dependency-collection to append it to (won't be modified)\n\n Returns:\n dict: The target dict with the added dependencies\n \"\"\""
] | [
{
"param": "file",
"type": "str"
},
{
"param": "target",
"type": "dict"
}
] | {
"returns": [
{
"docstring": "The target dict with the added dependencies",
"docstring_tokens": [
"The",
"target",
"dict",
"with",
"the",
"added",
"dependencies"
],
"type": "dict"
}
],
"raises": [],
"params": [
{
... |
40f3b761c7a5a2348e6b44e1b9b612fe2588fa14 | rahulverma88/ls_python | ls_python/spatialDerivative.py | [
"MIT"
] | Python | upwindFirstENO2 | <not_specific> | def upwindFirstENO2(data,dim,grid):
'''
Second order accurate upwind derivatives using ENO2
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
... |
Second order accurate upwind derivatives using ENO2
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
dim 3 is z (same)
grid: gri... | Second order accurate upwind derivatives using ENO2
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
dim 3 is z (same)
grid object - here is used mainly for storing grid spacing, dx
upwind derivative... | [
"Second",
"order",
"accurate",
"upwind",
"derivatives",
"using",
"ENO2",
"data",
":",
"2d",
"or",
"3d",
"Numpy",
"array",
"dim",
":",
"dimension",
"on",
"which",
"gradients",
"are",
"to",
"be",
"calculated",
"I",
"assume",
"dim",
"0",
"is",
"x",
"-",
">"... | def upwindFirstENO2(data,dim,grid):
if dim == 0:
axis = 1
elif dim == 1:
axis = 0
else:
axis = dim
D1_minus_half = np.diff(data, prepend=1,axis=axis)/grid.dx
D1_minus_3_2 = np.roll(D1_minus_half, 1, axis=axis)
D1_plus_half = np.roll(D1_minus_half, -1, axis=axis)
D1... | [
"def",
"upwindFirstENO2",
"(",
"data",
",",
"dim",
",",
"grid",
")",
":",
"if",
"dim",
"==",
"0",
":",
"axis",
"=",
"1",
"elif",
"dim",
"==",
"1",
":",
"axis",
"=",
"0",
"else",
":",
"axis",
"=",
"dim",
"D1_minus_half",
"=",
"np",
".",
"diff",
... | Second order accurate upwind derivatives using ENO2
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
dim 3 is z (same) | [
"Second",
"order",
"accurate",
"upwind",
"derivatives",
"using",
"ENO2",
"data",
":",
"2d",
"or",
"3d",
"Numpy",
"array",
"dim",
":",
"dimension",
"on",
"which",
"gradients",
"are",
"to",
"be",
"calculated",
"I",
"assume",
"dim",
"0",
"is",
"x",
"-",
">"... | [
"'''\n Second order accurate upwind derivatives using ENO2\n \n data: 2d or 3d Numpy array\n dim: dimension on which gradients are to be calculated\n I assume dim 0 is x -> so axis 1 in a numpy array\n dim 1 is y -> axis 0 in numpy array\n dim 3 is z (same)\n ... | [
{
"param": "data",
"type": null
},
{
"param": "dim",
"type": null
},
{
"param": "grid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dim",
"type": null,
"docstring": null,
"docstring_tokens": []... |
40f3b761c7a5a2348e6b44e1b9b612fe2588fa14 | rahulverma88/ls_python | ls_python/spatialDerivative.py | [
"MIT"
] | Python | upwindFirstENO3 | <not_specific> | def upwindFirstENO3(data,dim,grid):
'''
Third order accurate upwind derivatives
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
dim 3 is ... |
Third order accurate upwind derivatives
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
dim 3 is z (same)
grid: grid object - h... | Third order accurate upwind derivatives
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
dim 3 is z (same)
grid object - here is used mainly for storing grid spacing, dx
upwind derivative phi_{dim}_p... | [
"Third",
"order",
"accurate",
"upwind",
"derivatives",
"data",
":",
"2d",
"or",
"3d",
"Numpy",
"array",
"dim",
":",
"dimension",
"on",
"which",
"gradients",
"are",
"to",
"be",
"calculated",
"I",
"assume",
"dim",
"0",
"is",
"x",
"-",
">",
"so",
"axis",
... | def upwindFirstENO3(data,dim,grid):
if dim == 0:
axis = 1
elif dim == 1:
axis = 0
else:
axis = dim
D1_minus_half = np.diff(data, prepend=1,axis=axis)/grid.dx
D1_minus_3_2 = np.roll(D1_minus_half, 1, axis=axis)
D1_minus_5_2 = np.roll(D1_minus_half, 2, axis=axis)
D1_p... | [
"def",
"upwindFirstENO3",
"(",
"data",
",",
"dim",
",",
"grid",
")",
":",
"if",
"dim",
"==",
"0",
":",
"axis",
"=",
"1",
"elif",
"dim",
"==",
"1",
":",
"axis",
"=",
"0",
"else",
":",
"axis",
"=",
"dim",
"D1_minus_half",
"=",
"np",
".",
"diff",
... | Third order accurate upwind derivatives
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
dim 3 is z (same) | [
"Third",
"order",
"accurate",
"upwind",
"derivatives",
"data",
":",
"2d",
"or",
"3d",
"Numpy",
"array",
"dim",
":",
"dimension",
"on",
"which",
"gradients",
"are",
"to",
"be",
"calculated",
"I",
"assume",
"dim",
"0",
"is",
"x",
"-",
">",
"so",
"axis",
... | [
"'''\n Third order accurate upwind derivatives\n \n data: 2d or 3d Numpy array\n dim: dimension on which gradients are to be calculated\n I assume dim 0 is x -> so axis 1 in a numpy array\n dim 1 is y -> axis 0 in numpy array\n dim 3 is z (same)\n \n grid... | [
{
"param": "data",
"type": null
},
{
"param": "dim",
"type": null
},
{
"param": "grid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dim",
"type": null,
"docstring": null,
"docstring_tokens": []... |
40f3b761c7a5a2348e6b44e1b9b612fe2588fa14 | rahulverma88/ls_python | ls_python/spatialDerivative.py | [
"MIT"
] | Python | upwindFirstWENO5 | <not_specific> | def upwindFirstWENO5(data, dim, grid):
'''
Fifth order accurate weighted ENO derivatives
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
... |
Fifth order accurate weighted ENO derivatives
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
dim 3 is z (same)
grid: grid obje... | Fifth order accurate weighted ENO derivatives
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
dim 3 is z (same)
grid object - here is used mainly for storing grid spacing, dx
upwind derivative phi_{... | [
"Fifth",
"order",
"accurate",
"weighted",
"ENO",
"derivatives",
"data",
":",
"2d",
"or",
"3d",
"Numpy",
"array",
"dim",
":",
"dimension",
"on",
"which",
"gradients",
"are",
"to",
"be",
"calculated",
"I",
"assume",
"dim",
"0",
"is",
"x",
"-",
">",
"so",
... | def upwindFirstWENO5(data, dim, grid):
if dim == 0:
axis = 1
elif dim == 1:
axis = 0
else:
axis = dim
D1_minus_half = np.diff(data, prepend=1,axis=axis)/grid.dx
D1_minus_3_2 = np.roll(D1_minus_half, 1, axis=axis)
D1_minus_5_2 = np.roll(D1_minus_half, 2, axis=axis)
D... | [
"def",
"upwindFirstWENO5",
"(",
"data",
",",
"dim",
",",
"grid",
")",
":",
"if",
"dim",
"==",
"0",
":",
"axis",
"=",
"1",
"elif",
"dim",
"==",
"1",
":",
"axis",
"=",
"0",
"else",
":",
"axis",
"=",
"dim",
"D1_minus_half",
"=",
"np",
".",
"diff",
... | Fifth order accurate weighted ENO derivatives
data: 2d or 3d Numpy array
dim: dimension on which gradients are to be calculated
I assume dim 0 is x -> so axis 1 in a numpy array
dim 1 is y -> axis 0 in numpy array
dim 3 is z (same) | [
"Fifth",
"order",
"accurate",
"weighted",
"ENO",
"derivatives",
"data",
":",
"2d",
"or",
"3d",
"Numpy",
"array",
"dim",
":",
"dimension",
"on",
"which",
"gradients",
"are",
"to",
"be",
"calculated",
"I",
"assume",
"dim",
"0",
"is",
"x",
"-",
">",
"so",
... | [
"'''\n Fifth order accurate weighted ENO derivatives\n \n data: 2d or 3d Numpy array\n dim: dimension on which gradients are to be calculated\n I assume dim 0 is x -> so axis 1 in a numpy array\n dim 1 is y -> axis 0 in numpy array\n dim 3 is z (same)\n \n ... | [
{
"param": "data",
"type": null
},
{
"param": "dim",
"type": null
},
{
"param": "grid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "data",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dim",
"type": null,
"docstring": null,
"docstring_tokens": []... |
d7b11b3f8481c89d57428defaa55dc418b1612e3 | laksh-g/tuition-database-manager | ManagerApp.py | [
"MIT"
] | Python | on_row_press | null | def on_row_press(self, instance_table, instance_row):
'''Called when a table row is clicked.'''
global LAST_NAME
val = instance_row.index / 11
name = self.students[int(val)]
self.all_details.dismiss()
self.root.current = "single_student"
LAST_NAME = name | Called when a table row is clicked. | Called when a table row is clicked. | [
"Called",
"when",
"a",
"table",
"row",
"is",
"clicked",
"."
] | def on_row_press(self, instance_table, instance_row):
global LAST_NAME
val = instance_row.index / 11
name = self.students[int(val)]
self.all_details.dismiss()
self.root.current = "single_student"
LAST_NAME = name | [
"def",
"on_row_press",
"(",
"self",
",",
"instance_table",
",",
"instance_row",
")",
":",
"global",
"LAST_NAME",
"val",
"=",
"instance_row",
".",
"index",
"/",
"11",
"name",
"=",
"self",
".",
"students",
"[",
"int",
"(",
"val",
")",
"]",
"self",
".",
"... | Called when a table row is clicked. | [
"Called",
"when",
"a",
"table",
"row",
"is",
"clicked",
"."
] | [
"'''Called when a table row is clicked.'''"
] | [
{
"param": "self",
"type": null
},
{
"param": "instance_table",
"type": null
},
{
"param": "instance_row",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "instance_table",
"type": null,
"docstring": null,
"docstring_... |
fb2674a3441c84f74cde6e9c712ef3c5f843159a | bhavaniravi/astro | src/astro/sql/operators/sql_decorator.py | [
"Apache-2.0"
] | Python | handle_output_table_schema | <not_specific> | def handle_output_table_schema(self, output_table_name, schema=None):
"""
In postgres, we set the schema in the query itself instead of as a query parameter.
This function adds the necessary {schema}.{table} notation.
:param output_table_name:
:param schema: an optional schema if... |
In postgres, we set the schema in the query itself instead of as a query parameter.
This function adds the necessary {schema}.{table} notation.
:param output_table_name:
:param schema: an optional schema if the output_table has a schema set. Defaults to the temp schema
:return:
... | In postgres, we set the schema in the query itself instead of as a query parameter.
This function adds the necessary {schema}.{table} notation. | [
"In",
"postgres",
"we",
"set",
"the",
"schema",
"in",
"the",
"query",
"itself",
"instead",
"of",
"as",
"a",
"query",
"parameter",
".",
"This",
"function",
"adds",
"the",
"necessary",
"{",
"schema",
"}",
".",
"{",
"table",
"}",
"notation",
"."
] | def handle_output_table_schema(self, output_table_name, schema=None):
schema = schema or SCHEMA
if self.conn_type == "postgres" and self.schema:
output_table_name = schema + "." + output_table_name
elif self.conn_type == "snowflake" and self.schema and "." not in self.sql:
... | [
"def",
"handle_output_table_schema",
"(",
"self",
",",
"output_table_name",
",",
"schema",
"=",
"None",
")",
":",
"schema",
"=",
"schema",
"or",
"SCHEMA",
"if",
"self",
".",
"conn_type",
"==",
"\"postgres\"",
"and",
"self",
".",
"schema",
":",
"output_table_na... | In postgres, we set the schema in the query itself instead of as a query parameter. | [
"In",
"postgres",
"we",
"set",
"the",
"schema",
"in",
"the",
"query",
"itself",
"instead",
"of",
"as",
"a",
"query",
"parameter",
"."
] | [
"\"\"\"\n In postgres, we set the schema in the query itself instead of as a query parameter.\n This function adds the necessary {schema}.{table} notation.\n :param output_table_name:\n :param schema: an optional schema if the output_table has a schema set. Defaults to the temp schema\n ... | [
{
"param": "self",
"type": null
},
{
"param": "output_table_name",
"type": null
},
{
"param": "schema",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
6cc45d8347db7a31995e0813a9362f2d9f41b1ee | bhavaniravi/astro | src/astro/sql/operators/agnostic_save_file.py | [
"Apache-2.0"
] | Python | execute | null | def execute(self, context):
"""Write SQL table to csv/parquet on local/S3/GCS.
Infers SQL database type based on connection.
"""
# Infer db type from `input_conn_id`.
if type(self.input) == Table:
df = self.convert_sql_table_to_dataframe()
elif type(self.inp... | Write SQL table to csv/parquet on local/S3/GCS.
Infers SQL database type based on connection.
| Write SQL table to csv/parquet on local/S3/GCS.
Infers SQL database type based on connection. | [
"Write",
"SQL",
"table",
"to",
"csv",
"/",
"parquet",
"on",
"local",
"/",
"S3",
"/",
"GCS",
".",
"Infers",
"SQL",
"database",
"type",
"based",
"on",
"connection",
"."
] | def execute(self, context):
if type(self.input) == Table:
df = self.convert_sql_table_to_dataframe()
elif type(self.input) == pd.DataFrame:
df = self.input
else:
raise ValueError(
"Expected input_table to be Table or dataframe. Got %s",
... | [
"def",
"execute",
"(",
"self",
",",
"context",
")",
":",
"if",
"type",
"(",
"self",
".",
"input",
")",
"==",
"Table",
":",
"df",
"=",
"self",
".",
"convert_sql_table_to_dataframe",
"(",
")",
"elif",
"type",
"(",
"self",
".",
"input",
")",
"==",
"pd",... | Write SQL table to csv/parquet on local/S3/GCS. | [
"Write",
"SQL",
"table",
"to",
"csv",
"/",
"parquet",
"on",
"local",
"/",
"S3",
"/",
"GCS",
"."
] | [
"\"\"\"Write SQL table to csv/parquet on local/S3/GCS.\n\n Infers SQL database type based on connection.\n \"\"\"",
"# Infer db type from `input_conn_id`.",
"# Write file if overwrite == True or if file doesn't exist."
] | [
{
"param": "self",
"type": null
},
{
"param": "context",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens"... |
6cc45d8347db7a31995e0813a9362f2d9f41b1ee | bhavaniravi/astro | src/astro/sql/operators/agnostic_save_file.py | [
"Apache-2.0"
] | Python | agnostic_write_file | null | def agnostic_write_file(self, df, output_file_path, output_conn_id=None):
"""Write dataframe to csv/parquet files formats
Select output file format based on param output_file_format to class.
"""
transport_params = {
"s3": s3fs_creds,
"gs": gcs_client,
... | Write dataframe to csv/parquet files formats
Select output file format based on param output_file_format to class.
| Write dataframe to csv/parquet files formats
Select output file format based on param output_file_format to class. | [
"Write",
"dataframe",
"to",
"csv",
"/",
"parquet",
"files",
"formats",
"Select",
"output",
"file",
"format",
"based",
"on",
"param",
"output_file_format",
"to",
"class",
"."
] | def agnostic_write_file(self, df, output_file_path, output_conn_id=None):
transport_params = {
"s3": s3fs_creds,
"gs": gcs_client,
"": lambda: None,
}[urlparse(output_file_path).scheme]()
serialiser = {
"parquet": df.to_parquet,
"csv": ... | [
"def",
"agnostic_write_file",
"(",
"self",
",",
"df",
",",
"output_file_path",
",",
"output_conn_id",
"=",
"None",
")",
":",
"transport_params",
"=",
"{",
"\"s3\"",
":",
"s3fs_creds",
",",
"\"gs\"",
":",
"gcs_client",
",",
"\"\"",
":",
"lambda",
":",
"None",... | Write dataframe to csv/parquet files formats
Select output file format based on param output_file_format to class. | [
"Write",
"dataframe",
"to",
"csv",
"/",
"parquet",
"files",
"formats",
"Select",
"output",
"file",
"format",
"based",
"on",
"param",
"output_file_format",
"to",
"class",
"."
] | [
"\"\"\"Write dataframe to csv/parquet files formats\n\n Select output file format based on param output_file_format to class.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "df",
"type": null
},
{
"param": "output_file_path",
"type": null
},
{
"param": "output_conn_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "df",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
6cc45d8347db7a31995e0813a9362f2d9f41b1ee | bhavaniravi/astro | src/astro/sql/operators/agnostic_save_file.py | [
"Apache-2.0"
] | Python | save_file | <not_specific> | def save_file(
output_file_path,
input=None,
output_conn_id=None,
overwrite=False,
output_file_format="csv",
task_id=None,
**kwargs,
):
"""Convert SaveFile into a function. Returns XComArg.
Returns an XComArg object.
:param output_file_path: Path and name of table to create.
... | Convert SaveFile into a function. Returns XComArg.
Returns an XComArg object.
:param output_file_path: Path and name of table to create.
:type output_file_path: str
:param table: Input table name.
:type table: str
:param input_conn_id: Database connection id.
:type input_conn_id: str
:... | Convert SaveFile into a function. | [
"Convert",
"SaveFile",
"into",
"a",
"function",
"."
] | def save_file(
output_file_path,
input=None,
output_conn_id=None,
overwrite=False,
output_file_format="csv",
task_id=None,
**kwargs,
):
task_id = (
task_id if task_id is not None else get_task_id("save_file", output_file_path)
)
return SaveFile(
task_id=task_id,
... | [
"def",
"save_file",
"(",
"output_file_path",
",",
"input",
"=",
"None",
",",
"output_conn_id",
"=",
"None",
",",
"overwrite",
"=",
"False",
",",
"output_file_format",
"=",
"\"csv\"",
",",
"task_id",
"=",
"None",
",",
"**",
"kwargs",
",",
")",
":",
"task_id... | Convert SaveFile into a function. | [
"Convert",
"SaveFile",
"into",
"a",
"function",
"."
] | [
"\"\"\"Convert SaveFile into a function. Returns XComArg.\n\n Returns an XComArg object.\n\n :param output_file_path: Path and name of table to create.\n :type output_file_path: str\n :param table: Input table name.\n :type table: str\n :param input_conn_id: Database connection id.\n :type inpu... | [
{
"param": "output_file_path",
"type": null
},
{
"param": "input",
"type": null
},
{
"param": "output_conn_id",
"type": null
},
{
"param": "overwrite",
"type": null
},
{
"param": "output_file_format",
"type": null
},
{
"param": "task_id",
"type": n... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "output_file_path",
"type": null,
"docstring": "Path and name of table to create.",
"docstring_tokens": [
"Path",
"and",
"name",
"of",
"table",
"to",
"create",
"."... |
951bdb748a28d3defbcba5d8dbc2e774573d2576 | bhavaniravi/astro | tests/operators/test_agnostic_save_file.py | [
"Apache-2.0"
] | Python | _s3fs_creds | <not_specific> | def _s3fs_creds():
# To-do: reuse this method from sql decorator
"""Structure s3fs credentials from Airflow connection.
s3fs enables pandas to write to s3
"""
# To-do: clean-up how S3 creds are passed to s3fs
return {
"key": os.environ["AWS_ACCESS_KEY_ID"],
... | Structure s3fs credentials from Airflow connection.
s3fs enables pandas to write to s3
| Structure s3fs credentials from Airflow connection.
s3fs enables pandas to write to s3 | [
"Structure",
"s3fs",
"credentials",
"from",
"Airflow",
"connection",
".",
"s3fs",
"enables",
"pandas",
"to",
"write",
"to",
"s3"
] | def _s3fs_creds():
return {
"key": os.environ["AWS_ACCESS_KEY_ID"],
"secret": os.environ["AWS_SECRET_ACCESS_KEY"],
} | [
"def",
"_s3fs_creds",
"(",
")",
":",
"return",
"{",
"\"key\"",
":",
"os",
".",
"environ",
"[",
"\"AWS_ACCESS_KEY_ID\"",
"]",
",",
"\"secret\"",
":",
"os",
".",
"environ",
"[",
"\"AWS_SECRET_ACCESS_KEY\"",
"]",
",",
"}"
] | Structure s3fs credentials from Airflow connection. | [
"Structure",
"s3fs",
"credentials",
"from",
"Airflow",
"connection",
"."
] | [
"# To-do: reuse this method from sql decorator",
"\"\"\"Structure s3fs credentials from Airflow connection.\n s3fs enables pandas to write to s3\n \"\"\"",
"# To-do: clean-up how S3 creds are passed to s3fs"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
b6b6456caeb9042595b3bddc7742a8acfd2a3e95 | bhavaniravi/astro | src/astro/sql/operators/agnostic_load_file.py | [
"Apache-2.0"
] | Python | execute | <not_specific> | def execute(self, context):
"""Loads csv/parquet table from local/S3/GCS with Pandas.
Infers SQL database type based on connection then loads table to db.
"""
if self.file_conn_id:
BaseHook.get_connection(self.file_conn_id)
# Retrieve conn type
conn = BaseH... | Loads csv/parquet table from local/S3/GCS with Pandas.
Infers SQL database type based on connection then loads table to db.
| Loads csv/parquet table from local/S3/GCS with Pandas.
Infers SQL database type based on connection then loads table to db. | [
"Loads",
"csv",
"/",
"parquet",
"table",
"from",
"local",
"/",
"S3",
"/",
"GCS",
"with",
"Pandas",
".",
"Infers",
"SQL",
"database",
"type",
"based",
"on",
"connection",
"then",
"loads",
"table",
"to",
"db",
"."
] | def execute(self, context):
if self.file_conn_id:
BaseHook.get_connection(self.file_conn_id)
conn = BaseHook.get_connection(self.output_table.conn_id)
if type(self.output_table) == TempTable:
self.output_table = self.output_table.to_table(
create_table_nam... | [
"def",
"execute",
"(",
"self",
",",
"context",
")",
":",
"if",
"self",
".",
"file_conn_id",
":",
"BaseHook",
".",
"get_connection",
"(",
"self",
".",
"file_conn_id",
")",
"conn",
"=",
"BaseHook",
".",
"get_connection",
"(",
"self",
".",
"output_table",
"."... | Loads csv/parquet table from local/S3/GCS with Pandas. | [
"Loads",
"csv",
"/",
"parquet",
"table",
"from",
"local",
"/",
"S3",
"/",
"GCS",
"with",
"Pandas",
"."
] | [
"\"\"\"Loads csv/parquet table from local/S3/GCS with Pandas.\n\n Infers SQL database type based on connection then loads table to db.\n \"\"\"",
"# Retrieve conn type",
"# Read file with Pandas load method based on `file_type` (S3 or local)."
] | [
{
"param": "self",
"type": null
},
{
"param": "context",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "context",
"type": null,
"docstring": null,
"docstring_tokens"... |
b8ecdb70e156d2cff9137dff019c8cac62dbc540 | wagoodman/coin-games | analysis/graph/bellman_ford.py | [
"MIT"
] | Python | bellman_ford | Tuple[Dict[str, Optional[int]], Dict[str, Optional[int]]] | def bellman_ford(G: Type[nx.DiGraph], source: str, weight_index: str='weight') -> Tuple[Dict[str, Optional[int]], Dict[str, Optional[int]]]:
"""
Computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph (allowing for negative weights).
"""
if source not in G... |
Computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph (allowing for negative weights).
| Computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph (allowing for negative weights). | [
"Computes",
"shortest",
"paths",
"from",
"a",
"single",
"source",
"vertex",
"to",
"all",
"of",
"the",
"other",
"vertices",
"in",
"a",
"weighted",
"digraph",
"(",
"allowing",
"for",
"negative",
"weights",
")",
"."
] | def bellman_ford(G: Type[nx.DiGraph], source: str, weight_index: str='weight') -> Tuple[Dict[str, Optional[int]], Dict[str, Optional[int]]]:
if source not in G:
raise KeyError("Node %s is not found in the graph" % source)
dist = {source: 0}
pred = {source: None}
if len(G) == 1:
return pr... | [
"def",
"bellman_ford",
"(",
"G",
":",
"Type",
"[",
"nx",
".",
"DiGraph",
"]",
",",
"source",
":",
"str",
",",
"weight_index",
":",
"str",
"=",
"'weight'",
")",
"->",
"Tuple",
"[",
"Dict",
"[",
"str",
",",
"Optional",
"[",
"int",
"]",
"]",
",",
"D... | Computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph (allowing for negative weights). | [
"Computes",
"shortest",
"paths",
"from",
"a",
"single",
"source",
"vertex",
"to",
"all",
"of",
"the",
"other",
"vertices",
"in",
"a",
"weighted",
"digraph",
"(",
"allowing",
"for",
"negative",
"weights",
")",
"."
] | [
"\"\"\"\n Computes shortest paths from a single source vertex to all of the other vertices in a weighted digraph (allowing for negative weights).\n \"\"\"",
"# Skip relaxations if the predecessor of u is in the queue."
] | [
{
"param": "G",
"type": "Type[nx.DiGraph]"
},
{
"param": "source",
"type": "str"
},
{
"param": "weight_index",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "G",
"type": "Type[nx.DiGraph]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "source",
"type": "str",
"docstring": null,
"docstr... |
7bf033577ea562b433f186ca0106ced295f58d4d | maneeshdisodia/skills-ml | skills_ml/algorithms/embedding/models.py | [
"MIT"
] | Python | infer_vector | <not_specific> | def infer_vector(self, doc_words, warning=False):
"""
Average all the word-vectors together and ignore the unseen words
Arg:
doc_words (list): a list of tokenized words
Returns:
a vector representing a whole doc/sentence
"""
sum_vector = np.zeros(s... |
Average all the word-vectors together and ignore the unseen words
Arg:
doc_words (list): a list of tokenized words
Returns:
a vector representing a whole doc/sentence
| Average all the word-vectors together and ignore the unseen words
Arg:
doc_words (list): a list of tokenized words | [
"Average",
"all",
"the",
"word",
"-",
"vectors",
"together",
"and",
"ignore",
"the",
"unseen",
"words",
"Arg",
":",
"doc_words",
"(",
"list",
")",
":",
"a",
"list",
"of",
"tokenized",
"words"
] | def infer_vector(self, doc_words, warning=False):
sum_vector = np.zeros(self.vector_size)
words_in_vocab = []
for token in doc_words:
try:
sum_vector += self[token]
words_in_vocab.append(token)
except KeyError as e:
if warni... | [
"def",
"infer_vector",
"(",
"self",
",",
"doc_words",
",",
"warning",
"=",
"False",
")",
":",
"sum_vector",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"vector_size",
")",
"words_in_vocab",
"=",
"[",
"]",
"for",
"token",
"in",
"doc_words",
":",
"try",
"... | Average all the word-vectors together and ignore the unseen words
Arg:
doc_words (list): a list of tokenized words | [
"Average",
"all",
"the",
"word",
"-",
"vectors",
"together",
"and",
"ignore",
"the",
"unseen",
"words",
"Arg",
":",
"doc_words",
"(",
"list",
")",
":",
"a",
"list",
"of",
"tokenized",
"words"
] | [
"\"\"\"\n Average all the word-vectors together and ignore the unseen words\n Arg:\n doc_words (list): a list of tokenized words\n Returns:\n a vector representing a whole doc/sentence\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "doc_words",
"type": null
},
{
"param": "warning",
"type": null
}
] | {
"returns": [
{
"docstring": "a vector representing a whole doc/sentence",
"docstring_tokens": [
"a",
"vector",
"representing",
"a",
"whole",
"doc",
"/",
"sentence"
],
"type": null
}
],
"raises": [],
"params": [
... |
7bf033577ea562b433f186ca0106ced295f58d4d | maneeshdisodia/skills-ml | skills_ml/algorithms/embedding/models.py | [
"MIT"
] | Python | infer_vector | <not_specific> | def infer_vector(self, doc_words, warning=False):
"""
Average all the word-vectors together and ignore the unseen words
"""
sum_vector = np.zeros(self.vector_size)
words_in_vocab = []
for token in doc_words:
try:
sum_vector += self[toke... |
Average all the word-vectors together and ignore the unseen words
| Average all the word-vectors together and ignore the unseen words | [
"Average",
"all",
"the",
"word",
"-",
"vectors",
"together",
"and",
"ignore",
"the",
"unseen",
"words"
] | def infer_vector(self, doc_words, warning=False):
sum_vector = np.zeros(self.vector_size)
words_in_vocab = []
for token in doc_words:
try:
sum_vector += self[token]
words_in_vocab.append(token)
except KeyError as e:
... | [
"def",
"infer_vector",
"(",
"self",
",",
"doc_words",
",",
"warning",
"=",
"False",
")",
":",
"sum_vector",
"=",
"np",
".",
"zeros",
"(",
"self",
".",
"vector_size",
")",
"words_in_vocab",
"=",
"[",
"]",
"for",
"token",
"in",
"doc_words",
":",
"try",
"... | Average all the word-vectors together and ignore the unseen words | [
"Average",
"all",
"the",
"word",
"-",
"vectors",
"together",
"and",
"ignore",
"the",
"unseen",
"words"
] | [
"\"\"\"\n Average all the word-vectors together and ignore the unseen words\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "doc_words",
"type": null
},
{
"param": "warning",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "doc_words",
"type": null,
"docstring": null,
"docstring_token... |
6102144818b3248536abd5be65cf8e3276653f21 | ruvus/auto | src/tools/benchmark_tool/benchmark_tool/metric/kitti_3d_object_detection_metric.py | [
"Apache-2.0"
] | Python | compute_metric | <not_specific> | def compute_metric(self):
"""
Start the computation of the metric.
It uses the official C++ kitti sdk code for the computation, the code is wrapped into a
Python module.
@return: True on success, False on failure
"""
# Remove kitti sdk files from output folder t... |
Start the computation of the metric.
It uses the official C++ kitti sdk code for the computation, the code is wrapped into a
Python module.
@return: True on success, False on failure
| Start the computation of the metric.
It uses the official C++ kitti sdk code for the computation, the code is wrapped into a
Python module. | [
"Start",
"the",
"computation",
"of",
"the",
"metric",
".",
"It",
"uses",
"the",
"official",
"C",
"++",
"kitti",
"sdk",
"code",
"for",
"the",
"computation",
"the",
"code",
"is",
"wrapped",
"into",
"a",
"Python",
"module",
"."
] | def compute_metric(self):
for key in self.OUTPUT_FILES_KITTIOBJEVAL:
file_path = self._output_folder + \
self.OUTPUT_FILES_KITTIOBJEVAL[key]
if os.path.exists(file_path):
os.remove(file_path)
if not kittiobjeval.eval(str(self._ground_truth_folder),... | [
"def",
"compute_metric",
"(",
"self",
")",
":",
"for",
"key",
"in",
"self",
".",
"OUTPUT_FILES_KITTIOBJEVAL",
":",
"file_path",
"=",
"self",
".",
"_output_folder",
"+",
"self",
".",
"OUTPUT_FILES_KITTIOBJEVAL",
"[",
"key",
"]",
"if",
"os",
".",
"path",
".",
... | Start the computation of the metric. | [
"Start",
"the",
"computation",
"of",
"the",
"metric",
"."
] | [
"\"\"\"\n Start the computation of the metric.\n\n It uses the official C++ kitti sdk code for the computation, the code is wrapped into a\n Python module.\n\n @return: True on success, False on failure\n \"\"\"",
"# Remove kitti sdk files from output folder to prevent errors",
... | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "True on success, False on failure",
"docstring_tokens": [
"True",
"on",
"success",
"False",
"on",
"failure"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type"... |
6102144818b3248536abd5be65cf8e3276653f21 | ruvus/auto | src/tools/benchmark_tool/benchmark_tool/metric/kitti_3d_object_detection_metric.py | [
"Apache-2.0"
] | Python | _parse_result_file | <not_specific> | def _parse_result_file(self, result_class):
"""
Parse the kitti sdk result file.
Extract the 41 precision/recall scores and compute the final metric.
@param result_class: The type of the object: car, pedestrian, cyclist
@type result_class: str
@return: True on success,... |
Parse the kitti sdk result file.
Extract the 41 precision/recall scores and compute the final metric.
@param result_class: The type of the object: car, pedestrian, cyclist
@type result_class: str
@return: True on success, False on failure
| Parse the kitti sdk result file.
Extract the 41 precision/recall scores and compute the final metric. | [
"Parse",
"the",
"kitti",
"sdk",
"result",
"file",
".",
"Extract",
"the",
"41",
"precision",
"/",
"recall",
"scores",
"and",
"compute",
"the",
"final",
"metric",
"."
] | def _parse_result_file(self, result_class):
filename = self._output_folder + "/" + \
self.OUTPUT_FILES_KITTIOBJEVAL[result_class]
if os.path.isfile(filename):
try:
file = open(filename, "r")
file_lines = file.readlines()
except Exceptio... | [
"def",
"_parse_result_file",
"(",
"self",
",",
"result_class",
")",
":",
"filename",
"=",
"self",
".",
"_output_folder",
"+",
"\"/\"",
"+",
"self",
".",
"OUTPUT_FILES_KITTIOBJEVAL",
"[",
"result_class",
"]",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"file... | Parse the kitti sdk result file. | [
"Parse",
"the",
"kitti",
"sdk",
"result",
"file",
"."
] | [
"\"\"\"\n Parse the kitti sdk result file.\n\n Extract the 41 precision/recall scores and compute the final metric.\n\n @param result_class: The type of the object: car, pedestrian, cyclist\n @type result_class: str\n @return: True on success, False on failure\n \"\"\"",
... | [
{
"param": "self",
"type": null
},
{
"param": "result_class",
"type": null
}
] | {
"returns": [
{
"docstring": "True on success, False on failure",
"docstring_tokens": [
"True",
"on",
"success",
"False",
"on",
"failure"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type"... |
6102144818b3248536abd5be65cf8e3276653f21 | ruvus/auto | src/tools/benchmark_tool/benchmark_tool/metric/kitti_3d_object_detection_metric.py | [
"Apache-2.0"
] | Python | _compute_precision | <not_specific> | def _compute_precision(self, precision_file_line):
"""
Compute the precision score given the 41 values in the kitti sdk output file.
@param precision_file_line: A string line with 41 values space separated
@type precision_file_line: str
@return: int -1 on Failure, >=0 on succes... |
Compute the precision score given the 41 values in the kitti sdk output file.
@param precision_file_line: A string line with 41 values space separated
@type precision_file_line: str
@return: int -1 on Failure, >=0 on successfully computed metric
| Compute the precision score given the 41 values in the kitti sdk output file. | [
"Compute",
"the",
"precision",
"score",
"given",
"the",
"41",
"values",
"in",
"the",
"kitti",
"sdk",
"output",
"file",
"."
] | def _compute_precision(self, precision_file_line):
values = precision_file_line.rstrip(" \n").split(" ")
if len(values) < 41:
error(self.node, "Expected 41 values for precision.")
return -1
values = [float(i) for i in values]
So we do the same in Python
p... | [
"def",
"_compute_precision",
"(",
"self",
",",
"precision_file_line",
")",
":",
"values",
"=",
"precision_file_line",
".",
"rstrip",
"(",
"\" \\n\"",
")",
".",
"split",
"(",
"\" \"",
")",
"if",
"len",
"(",
"values",
")",
"<",
"41",
":",
"error",
"(",
"se... | Compute the precision score given the 41 values in the kitti sdk output file. | [
"Compute",
"the",
"precision",
"score",
"given",
"the",
"41",
"values",
"in",
"the",
"kitti",
"sdk",
"output",
"file",
"."
] | [
"\"\"\"\n Compute the precision score given the 41 values in the kitti sdk output file.\n\n @param precision_file_line: A string line with 41 values space separated\n @type precision_file_line: str\n @return: int -1 on Failure, >=0 on successfully computed metric\n \"\"\"",
"# ... | [
{
"param": "self",
"type": null
},
{
"param": "precision_file_line",
"type": null
}
] | {
"returns": [
{
"docstring": "1 on Failure, >=0 on successfully computed metric",
"docstring_tokens": [
"1",
"on",
"Failure",
">",
"=",
"0",
"on",
"successfully",
"computed",
"metric"
],
"type": null
}
]... |
7dbdcb9b4b79c088e9cedc0cbedfeeb00ead267b | ruvus/auto | src/tools/benchmark_tool/benchmark_tool/time_estimator/time_estimator_topic.py | [
"Apache-2.0"
] | Python | input_topic_callback | null | def input_topic_callback(self, msg):
"""
Update received time.
Callback function triggered by the reception of a message from the input topic.
@param msg: The topic message
@type msg: The type can vary depending on the listened topic
@return: None
"""
w... |
Update received time.
Callback function triggered by the reception of a message from the input topic.
@param msg: The topic message
@type msg: The type can vary depending on the listened topic
@return: None
| Update received time.
Callback function triggered by the reception of a message from the input topic. | [
"Update",
"received",
"time",
".",
"Callback",
"function",
"triggered",
"by",
"the",
"reception",
"of",
"a",
"message",
"from",
"the",
"input",
"topic",
"."
] | def input_topic_callback(self, msg):
with self.callback_lock:
if self._time_received_input != 0:
warn = "[TimeEstimatorTopic] Input time overwritten by another"\
+ " input message, consider slowing down the rate of " \
+ "the published data to ... | [
"def",
"input_topic_callback",
"(",
"self",
",",
"msg",
")",
":",
"with",
"self",
".",
"callback_lock",
":",
"if",
"self",
".",
"_time_received_input",
"!=",
"0",
":",
"warn",
"=",
"\"[TimeEstimatorTopic] Input time overwritten by another\"",
"+",
"\" input message, c... | Update received time. | [
"Update",
"received",
"time",
"."
] | [
"\"\"\"\n Update received time.\n\n Callback function triggered by the reception of a message from the input topic.\n\n @param msg: The topic message\n @type msg: The type can vary depending on the listened topic\n @return: None\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "msg",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
7dbdcb9b4b79c088e9cedc0cbedfeeb00ead267b | ruvus/auto | src/tools/benchmark_tool/benchmark_tool/time_estimator/time_estimator_topic.py | [
"Apache-2.0"
] | Python | output_topic_callback | null | def output_topic_callback(self, msg):
"""
Compute the time since the last message on the input topic and publish it.
Callback function triggered by the reception of a message from the output topic.
@param msg: The topic message
@type msg: The type can vary depending on the lis... |
Compute the time since the last message on the input topic and publish it.
Callback function triggered by the reception of a message from the output topic.
@param msg: The topic message
@type msg: The type can vary depending on the listened topic
@return: None
| Compute the time since the last message on the input topic and publish it.
Callback function triggered by the reception of a message from the output topic. | [
"Compute",
"the",
"time",
"since",
"the",
"last",
"message",
"on",
"the",
"input",
"topic",
"and",
"publish",
"it",
".",
"Callback",
"function",
"triggered",
"by",
"the",
"reception",
"of",
"a",
"message",
"from",
"the",
"output",
"topic",
"."
] | def output_topic_callback(self, msg):
with self.callback_lock:
if self._time_received_input != 0:
time_now = self.node.get_clock().now().nanoseconds
measure = time_now - self._time_received_input
measure = measure / (1000 * 1000)
publis... | [
"def",
"output_topic_callback",
"(",
"self",
",",
"msg",
")",
":",
"with",
"self",
".",
"callback_lock",
":",
"if",
"self",
".",
"_time_received_input",
"!=",
"0",
":",
"time_now",
"=",
"self",
".",
"node",
".",
"get_clock",
"(",
")",
".",
"now",
"(",
... | Compute the time since the last message on the input topic and publish it. | [
"Compute",
"the",
"time",
"since",
"the",
"last",
"message",
"on",
"the",
"input",
"topic",
"and",
"publish",
"it",
"."
] | [
"\"\"\"\n Compute the time since the last message on the input topic and publish it.\n\n Callback function triggered by the reception of a message from the output topic.\n\n @param msg: The topic message\n @type msg: The type can vary depending on the listened topic\n @return: No... | [
{
"param": "self",
"type": null
},
{
"param": "msg",
"type": null
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
... |
a9d7cf298a23d8039fc240dfeb5faef5a80f9d28 | ruvus/auto | src/tools/benchmark_tool/benchmark_tool/metric/metric.py | [
"Apache-2.0"
] | Python | compute_metric | null | def compute_metric(self):
"""
Start the computation of the metric.
@return: True on success, False on failure
"""
pass |
Start the computation of the metric.
@return: True on success, False on failure
| Start the computation of the metric. | [
"Start",
"the",
"computation",
"of",
"the",
"metric",
"."
] | def compute_metric(self):
pass | [
"def",
"compute_metric",
"(",
"self",
")",
":",
"pass"
] | Start the computation of the metric. | [
"Start",
"the",
"computation",
"of",
"the",
"metric",
"."
] | [
"\"\"\"\n Start the computation of the metric.\n\n @return: True on success, False on failure\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [
{
"docstring": "True on success, False on failure",
"docstring_tokens": [
"True",
"on",
"success",
"False",
"on",
"failure"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type"... |
ec7a488fa565212abd568f3ed69908ab31a18a4a | ruvus/auto | src/mapping/ndt_mapping_nodes/launch/ndt_mapper.launch.py | [
"Apache-2.0"
] | Python | generate_launch_description | <not_specific> | def generate_launch_description():
"""
Launch all nodes required for mapping. This launch file is for pure ndt-mapping.
If odometry is available, remove the static tf publication and add the odometry node(s)
to this launch file.
"""
ndt_mapper_param_file = os.path.join(
get_package_shar... |
Launch all nodes required for mapping. This launch file is for pure ndt-mapping.
If odometry is available, remove the static tf publication and add the odometry node(s)
to this launch file.
| Launch all nodes required for mapping. This launch file is for pure ndt-mapping.
If odometry is available, remove the static tf publication and add the odometry node(s)
to this launch file. | [
"Launch",
"all",
"nodes",
"required",
"for",
"mapping",
".",
"This",
"launch",
"file",
"is",
"for",
"pure",
"ndt",
"-",
"mapping",
".",
"If",
"odometry",
"is",
"available",
"remove",
"the",
"static",
"tf",
"publication",
"and",
"add",
"the",
"odometry",
"n... | def generate_launch_description():
ndt_mapper_param_file = os.path.join(
get_package_share_directory('ndt_mapping_nodes'),
'param/ndt_mapper.param.yaml')
scan_downsampler_param_file = os.path.join(
get_package_share_directory('ndt_mapping_nodes'),
'param/scan_downsampler.param.ya... | [
"def",
"generate_launch_description",
"(",
")",
":",
"ndt_mapper_param_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"get_package_share_directory",
"(",
"'ndt_mapping_nodes'",
")",
",",
"'param/ndt_mapper.param.yaml'",
")",
"scan_downsampler_param_file",
"=",
"os",
"... | Launch all nodes required for mapping. | [
"Launch",
"all",
"nodes",
"required",
"for",
"mapping",
"."
] | [
"\"\"\"\n Launch all nodes required for mapping. This launch file is for pure ndt-mapping.\n\n If odometry is available, remove the static tf publication and add the odometry node(s)\n to this launch file.\n \"\"\"",
"# Arguments",
"# Nodes",
"# This is a hack to make the mapper purely rely on the... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
4ac326b4e2fb52a5ac766b4b9d32c335a94f3641 | ruvus/auto | src/tools/benchmark_tool/benchmark_tool/output_formatter/output_formatter.py | [
"Apache-2.0"
] | Python | start_output_listener | null | def start_output_listener(self, topic):
"""
Start the subscriber on the specified topic and initialize internal structures.
@param topic: The topic to listen for the data
@type topic: str
@return: True on success, False on failure
"""
pass |
Start the subscriber on the specified topic and initialize internal structures.
@param topic: The topic to listen for the data
@type topic: str
@return: True on success, False on failure
| Start the subscriber on the specified topic and initialize internal structures. | [
"Start",
"the",
"subscriber",
"on",
"the",
"specified",
"topic",
"and",
"initialize",
"internal",
"structures",
"."
] | def start_output_listener(self, topic):
pass | [
"def",
"start_output_listener",
"(",
"self",
",",
"topic",
")",
":",
"pass"
] | Start the subscriber on the specified topic and initialize internal structures. | [
"Start",
"the",
"subscriber",
"on",
"the",
"specified",
"topic",
"and",
"initialize",
"internal",
"structures",
"."
] | [
"\"\"\"\n Start the subscriber on the specified topic and initialize internal structures.\n\n @param topic: The topic to listen for the data\n @type topic: str\n @return: True on success, False on failure\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "topic",
"type": null
}
] | {
"returns": [
{
"docstring": "True on success, False on failure",
"docstring_tokens": [
"True",
"on",
"success",
"False",
"on",
"failure"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "self",
"type"... |
4ac326b4e2fb52a5ac766b4b9d32c335a94f3641 | ruvus/auto | src/tools/benchmark_tool/benchmark_tool/output_formatter/output_formatter.py | [
"Apache-2.0"
] | Python | clean_folder | <not_specific> | def clean_folder(folder):
"""
Remove any file or folder into the specified path.
@param folder: The path on filesystem of the folder to clean
@type folder: str
@return: True on success, False on failure
"""
for filename in os.listdir(folder):
file_pa... |
Remove any file or folder into the specified path.
@param folder: The path on filesystem of the folder to clean
@type folder: str
@return: True on success, False on failure
| Remove any file or folder into the specified path. | [
"Remove",
"any",
"file",
"or",
"folder",
"into",
"the",
"specified",
"path",
"."
] | def clean_folder(folder):
for filename in os.listdir(folder):
file_path = os.path.join(folder, filename)
try:
if os.path.isfile(file_path) or os.path.islink(file_path):
os.unlink(file_path)
elif os.path.isdir(file_path):
... | [
"def",
"clean_folder",
"(",
"folder",
")",
":",
"for",
"filename",
"in",
"os",
".",
"listdir",
"(",
"folder",
")",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"folder",
",",
"filename",
")",
"try",
":",
"if",
"os",
".",
"path",
".",... | Remove any file or folder into the specified path. | [
"Remove",
"any",
"file",
"or",
"folder",
"into",
"the",
"specified",
"path",
"."
] | [
"\"\"\"\n Remove any file or folder into the specified path.\n\n @param folder: The path on filesystem of the folder to clean\n @type folder: str\n @return: True on success, False on failure\n \"\"\""
] | [
{
"param": "folder",
"type": null
}
] | {
"returns": [
{
"docstring": "True on success, False on failure",
"docstring_tokens": [
"True",
"on",
"success",
"False",
"on",
"failure"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "folder",
"typ... |
4ac326b4e2fb52a5ac766b4b9d32c335a94f3641 | ruvus/auto | src/tools/benchmark_tool/benchmark_tool/output_formatter/output_formatter.py | [
"Apache-2.0"
] | Python | create_folder | <not_specific> | def create_folder(folder):
"""
Create the specified folder and subfolder if the path does not exist.
@param folder: The path on filesystem to be created
@type folder: str
@return: True on success, False on failure
"""
if not os.path.isdir(folder):
tr... |
Create the specified folder and subfolder if the path does not exist.
@param folder: The path on filesystem to be created
@type folder: str
@return: True on success, False on failure
| Create the specified folder and subfolder if the path does not exist. | [
"Create",
"the",
"specified",
"folder",
"and",
"subfolder",
"if",
"the",
"path",
"does",
"not",
"exist",
"."
] | def create_folder(folder):
if not os.path.isdir(folder):
try:
os.makedirs(folder)
except Exception:
return False
return True | [
"def",
"create_folder",
"(",
"folder",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"folder",
")",
":",
"try",
":",
"os",
".",
"makedirs",
"(",
"folder",
")",
"except",
"Exception",
":",
"return",
"False",
"return",
"True"
] | Create the specified folder and subfolder if the path does not exist. | [
"Create",
"the",
"specified",
"folder",
"and",
"subfolder",
"if",
"the",
"path",
"does",
"not",
"exist",
"."
] | [
"\"\"\"\n Create the specified folder and subfolder if the path does not exist.\n\n @param folder: The path on filesystem to be created\n @type folder: str\n @return: True on success, False on failure\n \"\"\""
] | [
{
"param": "folder",
"type": null
}
] | {
"returns": [
{
"docstring": "True on success, False on failure",
"docstring_tokens": [
"True",
"on",
"success",
"False",
"on",
"failure"
],
"type": null
}
],
"raises": [],
"params": [
{
"identifier": "folder",
"typ... |
efd2aadcf5a7a3b18a2ae28f0af1b457fbd887ac | ruvus/auto | src/planning/global_velocity_planner/launch/avp_core.launch.py | [
"Apache-2.0"
] | Python | generate_launch_description | <not_specific> | def generate_launch_description():
"""
Launch all nodes defined in the architecture for Milestone 3 of the AVP 2020 Demo.
More details about what is included can
be found at https://gitlab.com/autowarefoundation/autoware.auto/AutowareAuto/-/milestones/25.
"""
avp_demo_pkg_prefix = get_package_s... |
Launch all nodes defined in the architecture for Milestone 3 of the AVP 2020 Demo.
More details about what is included can
be found at https://gitlab.com/autowarefoundation/autoware.auto/AutowareAuto/-/milestones/25.
| Launch all nodes defined in the architecture for Milestone 3 of the AVP 2020 Demo. | [
"Launch",
"all",
"nodes",
"defined",
"in",
"the",
"architecture",
"for",
"Milestone",
"3",
"of",
"the",
"AVP",
"2020",
"Demo",
"."
] | def generate_launch_description():
avp_demo_pkg_prefix = get_package_share_directory('autoware_demos')
autoware_launch_pkg_prefix = get_package_share_directory('autoware_auto_launch')
global_vel_planner_prefix = get_package_share_directory('global_velocity_planner')
euclidean_cluster_param_file = os.pat... | [
"def",
"generate_launch_description",
"(",
")",
":",
"avp_demo_pkg_prefix",
"=",
"get_package_share_directory",
"(",
"'autoware_demos'",
")",
"autoware_launch_pkg_prefix",
"=",
"get_package_share_directory",
"(",
"'autoware_auto_launch'",
")",
"global_vel_planner_prefix",
"=",
... | Launch all nodes defined in the architecture for Milestone 3 of the AVP 2020 Demo. | [
"Launch",
"all",
"nodes",
"defined",
"in",
"the",
"architecture",
"for",
"Milestone",
"3",
"of",
"the",
"AVP",
"2020",
"Demo",
"."
] | [
"\"\"\"\n Launch all nodes defined in the architecture for Milestone 3 of the AVP 2020 Demo.\n\n More details about what is included can\n be found at https://gitlab.com/autowarefoundation/autoware.auto/AutowareAuto/-/milestones/25.\n \"\"\"",
"# Arguments",
"# Nodes",
"# point cloud fusion runner... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
53a34a6e5e6c840a399e0c17132a1fbe9c545ca4 | ruvus/auto | tools/clang_complete/wrapper.py | [
"Apache-2.0"
] | Python | wrapper | null | def wrapper():
"""Update .clang_complete and forward call"""
cache = os.path.join(find_root(), ".clang_complete")
binary = os.path.basename(__file__)
addargs = set()
args = iter(sys.argv[1:])
for arg in args:
if arg.startswith('-D'):
addargs.add('-D{}'.format(arg[2:] or nex... | Update .clang_complete and forward call | Update .clang_complete and forward call | [
"Update",
".",
"clang_complete",
"and",
"forward",
"call"
] | def wrapper():
cache = os.path.join(find_root(), ".clang_complete")
binary = os.path.basename(__file__)
addargs = set()
args = iter(sys.argv[1:])
for arg in args:
if arg.startswith('-D'):
addargs.add('-D{}'.format(arg[2:] or next(args)))
elif arg.startswith('-I'):
... | [
"def",
"wrapper",
"(",
")",
":",
"cache",
"=",
"os",
".",
"path",
".",
"join",
"(",
"find_root",
"(",
")",
",",
"\".clang_complete\"",
")",
"binary",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"__file__",
")",
"addargs",
"=",
"set",
"(",
")",
"a... | Update .clang_complete and forward call | [
"Update",
".",
"clang_complete",
"and",
"forward",
"call"
] | [
"\"\"\"Update .clang_complete and forward call\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
44f98a072977a49a6f1db9c85fe71ed6ca366d68 | ruvus/auto | src/control/motion_model_testing_simulator/motion_model_testing_simulator/minisim.py | [
"Apache-2.0"
] | Python | evaluate_dynamics | SerdeInterface | def evaluate_dynamics(
self, current_state: SerdeInterface, current_command: SerdeInterface
) -> SerdeInterface:
"""
Return the derivative of current state.
Given current_command is being applied to the system inputs.
""" |
Return the derivative of current state.
Given current_command is being applied to the system inputs.
| Return the derivative of current state.
Given current_command is being applied to the system inputs. | [
"Return",
"the",
"derivative",
"of",
"current",
"state",
".",
"Given",
"current_command",
"is",
"being",
"applied",
"to",
"the",
"system",
"inputs",
"."
] | def evaluate_dynamics(
self, current_state: SerdeInterface, current_command: SerdeInterface
) -> SerdeInterface: | [
"def",
"evaluate_dynamics",
"(",
"self",
",",
"current_state",
":",
"SerdeInterface",
",",
"current_command",
":",
"SerdeInterface",
")",
"->",
"SerdeInterface",
":"
] | Return the derivative of current state. | [
"Return",
"the",
"derivative",
"of",
"current",
"state",
"."
] | [
"\"\"\"\n Return the derivative of current state.\n\n Given current_command is being applied to the system inputs.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "current_state",
"type": "SerdeInterface"
},
{
"param": "current_command",
"type": "SerdeInterface"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "current_state",
"type": "SerdeInterface",
"docstring": null,
... |
44f98a072977a49a6f1db9c85fe71ed6ca366d68 | ruvus/auto | src/control/motion_model_testing_simulator/motion_model_testing_simulator/minisim.py | [
"Apache-2.0"
] | Python | evaluate_dynamics_serialized | np.ndarray | def evaluate_dynamics_serialized(
self, current_state: np.ndarray, current_command: np.ndarray
) -> np.ndarray:
"""
Return the derivative of current state.
Given current_command is being applied to the system inputs.
This can just be a wrapper call to evaluate_dynamics.
... |
Return the derivative of current state.
Given current_command is being applied to the system inputs.
This can just be a wrapper call to evaluate_dynamics.
| Return the derivative of current state.
Given current_command is being applied to the system inputs.
This can just be a wrapper call to evaluate_dynamics. | [
"Return",
"the",
"derivative",
"of",
"current",
"state",
".",
"Given",
"current_command",
"is",
"being",
"applied",
"to",
"the",
"system",
"inputs",
".",
"This",
"can",
"just",
"be",
"a",
"wrapper",
"call",
"to",
"evaluate_dynamics",
"."
] | def evaluate_dynamics_serialized(
self, current_state: np.ndarray, current_command: np.ndarray
) -> np.ndarray: | [
"def",
"evaluate_dynamics_serialized",
"(",
"self",
",",
"current_state",
":",
"np",
".",
"ndarray",
",",
"current_command",
":",
"np",
".",
"ndarray",
")",
"->",
"np",
".",
"ndarray",
":"
] | Return the derivative of current state. | [
"Return",
"the",
"derivative",
"of",
"current",
"state",
"."
] | [
"\"\"\"\n Return the derivative of current state.\n\n Given current_command is being applied to the system inputs.\n This can just be a wrapper call to evaluate_dynamics.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "current_state",
"type": "np.ndarray"
},
{
"param": "current_command",
"type": "np.ndarray"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "current_state",
"type": "np.ndarray",
"docstring": null,
"doc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.