当前位置: 首页>>代码示例>>Python>>正文


Python Client.get_activity_streams方法代码示例

本文整理汇总了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)
开发者ID:mrkarlos,项目名称:strava_club,代码行数:33,代码来源:cs_speed.py

示例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)
开发者ID:jurasource,项目名称:strava-analysis,代码行数:32,代码来源:main.py


注:本文中的stravalib.client.Client.get_activity_streams方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。