本文整理汇总了Python中stravalib.client.Client.get_activity_streams方法的典型用法代码示例。如果您正苦于以下问题:Python Client.get_activity_streams方法的具体用法?Python Client.get_activity_streams怎么用?Python Client.get_activity_streams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stravalib.client.Client
的用法示例。
在下文中一共展示了Client.get_activity_streams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from stravalib.client import Client [as 别名]
# 或者: from stravalib.client.Client import get_activity_streams [as 别名]
activity_ids.append(ra.id)
print activity_ids
for activity_id in activity_ids:
act = client.get_activity(activity_id)
print act.name, act.type, act.athlete.firstname, act.athlete.lastname
if (act.gear == None and act.calories == None):
print 'Summary Activity'
else:
print 'Detailed Activity'
if False:
#act_streams = client.get_activity_streams(activity_id, types=['velocity_smooth','grade_smooth'], resolution='high')
act_streams = client.get_activity_streams(activity_id, types=['velocity_smooth','grade_smooth'])
print (act_streams)
vs = act_streams['velocity_smooth']
gs = act_streams['grade_smooth']
dst = act_streams['distance']
#print (vs.data)
vs_sorted = vs.data
vs_sorted.sort()
#print vs_sorted
p_25th = percentile(vs_sorted, 0.25)
p_50th = percentile(vs_sorted, 0.50)
p_75th = percentile(vs_sorted, 0.75)
p_90th = percentile(vs_sorted, 0.9)
print 'Activity ID: {}'.format(activity_id)
示例2: for
# 需要导入模块: from stravalib.client import Client [as 别名]
# 或者: from stravalib.client.Client import get_activity_streams [as 别名]
# Download some activities
print "Downloading activities from {0:%d %b %Y}".format(from_date)
acts = client.get_activities(after=from_date)
for act in acts:
total += 1
if act.type != "Run" or act.average_heartrate is None:
continue
count += 1
# Get the full data streams
streams = client.get_activity_streams(act.id, types=stream_filter)
sdf = pd.DataFrame(dict((stype, stream.data) for (stype, stream) in streams.iteritems()))
if "latlng" in stream_filter:
sdf["lat"] = [a[0] for a in sdf.latlng]
sdf["lng"] = [a[1] for a in sdf.latlng]
del sdf["latlng"]
detail_fname = join(output_detail_dir, "{0}.json".format(act.id))
sdf.to_json(detail_fname)
# with open(join(output_detail_dir, "{0}.p".format(act.id)), "wb") as f:
# pickle.dump(sdf, f, 2)
print "{0} on {1:%d %b %Y} [kudos {2}]".format(act.name, act.start_date, act.kudos_count)
print "\tHR: {0}".format(act.average_heartrate)