def test_data_velib_simulation(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__",
             LogFile="temp_hal_log2.txt")
        fold = os.path.abspath(os.path.split(__file__)[0])
        data = os.path.join(fold, "data")

        for speed in (10, 15):
            for bike in (1, 2, 3, 5, 10):
                df = DataVelibCollect.to_df(data)
                dfp, dfs = DataVelibCollect.simulate(df,
                                                     bike,
                                                     speed,
                                                     fLOG=fLOG)

                dfp.to_csv("out_simul_bike_nb{0}_sp{1}_path.txt".format(
                    bike, speed),
                           sep="\t",
                           index=False)
                dfs.to_csv("out_simul_bike_nb{0}_sp{1}_data.txt".format(
                    bike, speed),
                           sep="\t",
                           index=False)
                if __name__ != "__main__":
                    return
    def test_data_velib_simulation(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__",
            LogFile="temp_hal_log2.txt")
        fold = os.path.abspath(os.path.split(__file__)[0])
        data = os.path.join(fold, "data")

        for speed in (10, 15):
            for bike in (1, 2, 3, 5, 10):
                df = DataVelibCollect.to_df(data)
                dfp, dfs = DataVelibCollect.simulate(
                    df, bike, speed, fLOG=fLOG)

                dfp.to_csv(
                    "out_simul_bike_nb{0}_sp{1}_path.txt".format(
                        bike,
                        speed),
                    sep="\t",
                    index=False)
                dfs.to_csv(
                    "out_simul_bike_nb{0}_sp{1}_data.txt".format(
                        bike,
                        speed),
                    sep="\t",
                    index=False)
                if __name__ != "__main__":
                    return
    def test_data_velib_animation(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__",
            LogFile="temp_hal_log2.txt")
        fold = os.path.abspath(os.path.split(__file__)[0])
        data = os.path.join(fold, "data")

        if "travis" in sys.executable:
            return

        try:
            from JSAnimation import IPython_display
        except ImportError:
            import pymyinstall
            pymyinstall.ModuleInstall(
                "JSAnimation",
                "github",
                "jakevdp").install(
                temp_folder="c:\\temp")

        df = DataVelibCollect.to_df(data)
        anime = DataVelibCollect.js_animation(df)

        from JSAnimation import HTMLWriter
        wr = HTMLWriter(embed_frames=False)
        anime.save(os.path.join(fold, "out_animation.html"), writer=wr)
Ejemplo n.º 4
0
    def test_data_velib_animation(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__",
             LogFile="temp_hal_log2.txt")
        fold = os.path.abspath(os.path.split(__file__)[0])
        data = os.path.join(fold, "data")

        if "travis" in sys.executable:
            return

        from pymyinstall.installhelper.install_cmd_helper import is_conda_distribution
        if is_conda_distribution():
            # not tested on anaconda
            return

        df = DataVelibCollect.to_df(data)
        DataVelibCollect.js_animation(df)
Ejemplo n.º 5
0
    def test_data_velib_animation(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__",
            LogFile="temp_hal_log2.txt")
        fold = os.path.abspath(os.path.split(__file__)[0])
        data = os.path.join(fold, "data")

        if "travis" in sys.executable:
            return

        from pymyinstall.installhelper.install_cmd_helper import is_conda_distribution
        if is_conda_distribution():
            # not tested on anaconda
            return

        df = DataVelibCollect.to_df(data)
        DataVelibCollect.js_animation(df)
Ejemplo n.º 6
0
    def test_data_velib_contract(self):
        fLOG(__file__,
             self._testMethodName,
             OutputPrint=__name__ == "__main__",
             LogFile="temp_hal_log2.txt")
        fold = os.path.abspath(os.path.split(__file__)[0])
        data = os.path.join(fold, "data")

        df = DataVelibCollect.to_df(data)
        # fLOG(df.head())
        assert len(df) > 0

        stations = df[["name", "lat", "lng"]]
        gr = stations.groupby(["name", "lat", "lng"], as_index=False).sum()
        # fLOG(gr.head())
        assert len(gr) >= 30

        df.to_csv(os.path.join(fold, "out_data.txt"), sep="\t", index=False)
        dt = datetime.datetime(2014, 5, 22, 11, 49, 27, 523164)
        sub = df[df["collect_date"] == dt]
        fig, ax, plt = DataVelibCollect.draw(sub)
    def test_data_velib_contract(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__",
            LogFile="temp_hal_log2.txt")
        fold = os.path.abspath(os.path.split(__file__)[0])
        data = os.path.join(fold, "data")

        df = DataVelibCollect.to_df(data)
        # fLOG(df.head())
        assert len(df) > 0

        stations = df[["name", "lat", "lng"]]
        gr = stations.groupby(["name", "lat", "lng"], as_index=False).sum()
        # fLOG(gr.head())
        assert len(gr) >= 30

        df.to_csv(os.path.join(fold, "out_data.txt"), sep="\t", index=False)
        dt = datetime.datetime(2014, 5, 22, 11, 49, 27, 523164)
        sub = df[df["collect_date"] == dt]
        fig, ax, plt = DataVelibCollect.draw(sub)