예제 #1
0
 def spline(self, smooth=0):
     with NamedTemporaryFile() as f:
         bootstrap_file(f, m(V), '5', mm(DEV), configurator=default)
         args, db = bootstrap_file(f, m(V), '5', 'constants', '--set',
                                   SRTM1_DIR, '/home/andrew/archive/srtm1')
         constants(args, db)
         with db.session_context() as s:
             yield spline_elevation_from_constant(log, s, smooth=smooth)
예제 #2
0
 def spline(self, smooth=0):
     user = random_test_user()
     bootstrap_db(user, m(V), '5', mm(DEV), configurator=default)
     config = bootstrap_db(user, m(V), '5', 'constants', 'set',
                           SRTM1_DIR_CNAME, '~/.ch2/permanent/srtm1',
                           mm(FORCE))
     constants(config)
     with config.db.session_context() as s:
         yield spline_elevation_from_constant(s, smooth=smooth)
예제 #3
0
 def bilinear(self):
     user = random_test_user()
     bootstrap_db(user, m(V), '5', mm(DEV), configurator=default)
     config = bootstrap_db(user, m(V), '5', 'constants', 'set',
                           SRTM1_DIR_CNAME, '/home/andrew/archive/srtm1',
                           mm(FORCE))
     constants(config)
     with config.db.session_context() as s:
         yield bilinear_elevation_from_constant(s)
예제 #4
0
 def bilinear(self):
     with NamedTemporaryFile() as f:
         bootstrap_file(f, m(V), '5', mm(DEV), configurator=default)
         args, sys, db = bootstrap_file(f, m(V), '5', 'constants', 'set',
                                        SRTM1_DIR,
                                        '/home/andrew/archive/srtm1')
         constants(args, sys, db)
         with db.session_context() as s:
             yield bilinear_elevation_from_constant(s)
예제 #5
0
 def spline(self, smooth=0):
     with TemporaryDirectory() as f:
         bootstrap_dir(f, m(V), '5', mm(DEV), configurator=default)
         args, data = bootstrap_dir(f, m(V), '5', 'constants', 'set',
                                    SRTM1_DIR_CNAME,
                                    '/home/andrew/archive/srtm1', mm(FORCE))
         constants(args, data)
         with data.db.session_context() as s:
             yield spline_elevation_from_constant(s, smooth=smooth)
예제 #6
0
    def test_constant(self):
        with NamedTemporaryFile() as f:

            bootstrap_file(f, m(V), '5', mm(DEV), configurator=default)

            args, sys, db = bootstrap_file(f, m(V), '5', 'constants', 'set',
                                           'FTHR.%', '154')
            constants(args, sys, db)
            args, sys, db = bootstrap_file(f, m(V), '5', 'constants', 'show',
                                           'FTHR.%')
            constants(args, sys, db)
            args, sys, db = bootstrap_file(
                f, m(V), '5', mm(DEV), 'activities', mm(FAST),
                'data/test/source/personal/2018-03-04-qdp.fit')
            activities(args, sys, db)

            with db.session_context() as s:
                stats = activity_statistics(s,
                                            LATITUDE,
                                            LONGITUDE,
                                            SPHERICAL_MERCATOR_X,
                                            SPHERICAL_MERCATOR_Y,
                                            DISTANCE,
                                            ELEVATION,
                                            SPEED,
                                            CADENCE,
                                            HEART_RATE,
                                            local_time='2018-03-04 07:16:33',
                                            activity_group_name='Bike',
                                            with_timespan=True)
                stats.describe()

                sepn = pd.Series(stats.index).diff().median()  # 7 secs
                start = stats.index.min()  # 2018-03-04 10:16:33+00:00
                finish = stats.index.max()  # 2018-03-04 16:34:51+00:00
                even = pd.DataFrame({'keep': True},
                                    index=pd.date_range(start=start,
                                                        end=finish,
                                                        freq=sepn))
                both = stats.join(even, how='outer', sort=True)
                both.interpolate(method='index',
                                 limit_area='inside',
                                 inplace=True)
                both = both.loc[both['keep'] == True].drop(columns=['keep'])
                both = both.loc[both[TIMESPAN_ID].isin(
                    stats[TIMESPAN_ID].unique())]
                both.describe()