Exemple #1
0
 def test_obis_occurrence(self):
     """Test ts compare on obis occurence data."""
     ts_compare(
         "test_data/obis.csv",
         x_key="eventDate",
         y_key_list=["X", "year"],
         savefig=get_test_output_path(
             __file__, "{}.png".format(sys._getframe().f_code.co_name)),
     )
Exemple #2
0
    def test_ccf_plot_on_phased_sines(self):
        from plo7y.plotters.ccf import plotCCF

        x, y1, y2 = _get_testdata_out_of_phase_sines()
        plotCCF(y1,
                y2,
                saveFigPath=get_test_output_path(
                    __file__,
                    sys._getframe().f_code.co_name))
Exemple #3
0
 def test_obis_group_by_species_on_occurrence_status(self):
     """Test ts compare on subset of obis occurence using y_group_by_key."""
     ts_compare(
         "test_data/occurrenceStatus.csv",
         x_key="eventDate",
         y_key="occurrenceStatus",
         y_group_by_key="species",
         savefig=get_test_output_path(
             __file__, "{}.png".format(sys._getframe().f_code.co_name)),
     )
Exemple #4
0
    def test_ccf_scipy_on_phased_sines(self):
        from plo7y.plotters.ccf_scipy import plot

        x, y1, y2 = _get_testdata_noisy_sines()
        plot(
            y1, y2,
            saveFigPath=get_test_output_path(
                __file__, sys._getframe().f_code.co_name
            )
        )
Exemple #5
0
    def test_ccf_scipy_on_noisy_binary(self):
        from plo7y.plotters.ccf_scipy import plot

        y1, y2 = _get_testdata_binary_and_noise()
        plot(
            y1, y2,
            saveFigPath=get_test_output_path(
                __file__, sys._getframe().f_code.co_name
            )
        )
Exemple #6
0
    def test_cross_correlation_on_phased_sines(self):
        from plo7y.plotters.cross_correlation import plot

        x, y1, y2 = _get_testdata_out_of_phase_sines()
        plot(
            x.squeeze().to_numpy(),
            y1.squeeze().to_numpy(),
            y2.squeeze().to_numpy(),
            # dta, exog,
            saveFigPath=get_test_output_path(__file__,
                                             sys._getframe().f_code.co_name))
Exemple #7
0
 def test_many_horizongraph_on_dataframes(self):
     from plo7y.plotters.ts_many_horizongraph import plot
     x = get_test_data("./test_data/generated/linspace_x.csv")
     y1 = get_test_data("./test_data/generated/sine_1.csv")
     y2 = get_test_data("./test_data/generated/sine_2.csv")
     df = pd.concat([x, y1, y2], axis=1)
     print(df)
     plot(df,
          'linspace_x', ['sine_1', 'sine_2'],
          saveFigPath=get_test_output_path(__file__,
                                           sys._getframe().f_code.co_name))
Exemple #8
0
 def test_obis_occurrence_empty(self):
     """Test ts compare on 0-length obis occurence data."""
     with self.assertRaises(AssertionError):
         ts_compare(
             "test_data/obis_empty.csv",
             x_key="eventDate",
             y_key="X",
             y_group_by_key="species",
             savefig=get_test_output_path(
                 __file__, "{}.png".format(sys._getframe().f_code.co_name)),
         )
Exemple #9
0
    def test_tsne_sample_data(self):
        """Test tsne optimization on sample data"""
        from sklearn import datasets
        import pandas as pd
        location, value = datasets.make_circles(n_samples=1000,
                                                factor=.5,
                                                noise=.05)
        df = pd.DataFrame(columns=['var1', 'var2', 'var3', 'score'])
        df['var1'] = location[:, 0]
        df['var2'] = location[:, 1]
        df['var3'] = location[:, 1]  # TODO: other data?
        df['score'] = value

        # import pdb; pdb.set_trace()
        main(df,
             "var1",
             "var2",
             "var3",
             saveFigPath=get_test_output_path(__file__,
                                              sys._getframe().f_code.co_name))
Exemple #10
0
    def test_many_horizongraph_on_lists(self):
        from plo7y.plotters.ts_many_horizongraph import _plot

        _plot([1, 2, 3], [[11, 22, 33], [4, 3, 2]], [1, 2],
              saveFigPath=get_test_output_path(__file__,
                                               sys._getframe().f_code.co_name))