示例#1
0
    def test_plot_devices(self):
        from pyadlml.dataset.plot.devices import hist_counts, heatmap_trigger_one_day, heatmap_trigger_time,\
           hist_on_off, boxplot_on_duration, heatmap_cross_correlation, hist_trigger_time_diff

        df = self.data.df_devices
        lst = self.data.lst_devices

        hist_counts(df)
        hist_counts(df_dev=df, lst_dev=lst)

        heatmap_trigger_one_day(df)
        heatmap_trigger_one_day(df, lst_dev=lst)

        heatmap_trigger_time(df)
        heatmap_trigger_time(df, lst_dev=lst)

        hist_trigger_time_diff(df)

        hist_on_off(df)
        hist_on_off(df, lst_dev=lst)

        boxplot_on_duration(df)
        boxplot_on_duration(df, lst_dev=lst)

        heatmap_cross_correlation(df)
        heatmap_cross_correlation(df, lst_dev=lst)
示例#2
0
def gen_plots_devices(dataset, data):
    from pyadlml.dataset.plot.devices import hist_trigger_time_diff, boxplot_on_duration, \
        heatmap_trigger_one_day, heatmap_trigger_time, heatmap_cross_correlation, \
        hist_on_off, hist_counts

    sub_path = dataset.name + '/plots/'
    path = settings.MEDIA_ROOT + sub_path

    try:
        hist_trigger_time_diff_filename = 'hist_trigger_time_diff.png'
        path_to_hist_trigger_time_diff = path + hist_trigger_time_diff_filename
        hist_trigger_time_diff(data.df_devices,
                               file_path=path_to_hist_trigger_time_diff)
        dataset.plot_hist_trigger_time_diff = sub_path + hist_trigger_time_diff_filename
    except:
        pass

    try:
        heatmap_trigger_time_filename = 'heatmap_trigger_time.png'
        path_to_heatmap_trigger_time = path + heatmap_trigger_time_filename
        heatmap_trigger_time(data.df_devices,
                             file_path=path_to_heatmap_trigger_time)
        dataset.plot_heatmap_trigger_time = sub_path + heatmap_trigger_time_filename
    except:
        pass

    try:
        heatmap_trigger_one_day_filename = 'heatmap_trigger_one_day.png'
        path_to_heatmap_trigger_one_day = path + heatmap_trigger_one_day_filename
        heatmap_trigger_one_day(data.df_devices,
                                file_path=path_to_heatmap_trigger_one_day)
        dataset.plot_heatmap_trigger_one_day = sub_path + heatmap_trigger_one_day_filename
    except:
        pass

    try:
        hist_counts_filename = 'hist_counts.png'
        path_to_hist_counts = path + hist_counts_filename
        hist_counts(data.df_devices, file_path=path_to_hist_counts)
        dataset.plot_hist_counts = sub_path + hist_counts_filename
    except:
        pass

    #assign_plot_obj('boxplot_on_duration.png', boxplot_on_duration, dataset.plot_boxplot_on_duration,
    #                    path, sub_path, data.df_devices)
    #assign_plot_obj('hist_on_off.png', hist_on_off, dataset.plot_hist_on_off,
    #                    path, sub_path, data.df_devices)

    dataset.save()
示例#3
0
def gen_plots_devices(dataset, data):
    from pyadlml.dataset.plot.devices import hist_trigger_time_diff, boxplot_on_duration, \
        heatmap_trigger_one_day, heatmap_trigger_time, heatmap_cross_correlation, \
        hist_on_off, hist_counts

    sub_path = dataset.name + '/plots/'
    path = settings.MEDIA_ROOT + sub_path

    try:
        hist_trigger_time_diff_filename = settings.PLOT_DEV_HIST_TRIG_TIME_FN
        path_to_hist_trigger_time_diff = path + hist_trigger_time_diff_filename
        hist_trigger_time_diff(data.df_devices,
                               file_path=path_to_hist_trigger_time_diff)
        dataset.plot_hist_trigger_time_diff = sub_path + hist_trigger_time_diff_filename
        logger.info('created hist_trigger_time_diff')
    except:
        logger.error("couldn't create hist_trigger_time_diff")

    try:
        heatmap_trigger_time_filename = settings.PLOT_DEV_HM_TRIG_TIME_FN
        path_to_heatmap_trigger_time = path + heatmap_trigger_time_filename
        heatmap_trigger_time(data.df_devices,
                             file_path=path_to_heatmap_trigger_time)
        dataset.plot_heatmap_trigger_time = sub_path + heatmap_trigger_time_filename
        logger.info('created heatmap_trigger_time')
    except:
        logger.error("couldn't create heatmap_trigger_time")

    try:
        heatmap_trigger_one_day_filename = settings.PLOT_DEV_HM_TRIG_ONE_DAY_FN
        path_to_heatmap_trigger_one_day = path + heatmap_trigger_one_day_filename
        heatmap_trigger_one_day(data.df_devices,
                                file_path=path_to_heatmap_trigger_one_day)
        dataset.plot_heatmap_trigger_one_day = sub_path + heatmap_trigger_one_day_filename
        logger.info('created heatmap_trigger_one_day')
    except:
        logger.error("couldn't create heatmap_trigger_one_day")

    try:
        hist_counts_filename = settings.PLOT_DEV_HIST_COUNTS_FN
        path_to_hist_counts = path + hist_counts_filename
        hist_counts(data.df_devices, file_path=path_to_hist_counts)
        dataset.plot_hist_counts = sub_path + hist_counts_filename
        logger.info('created hist_counts')
    except:
        logger.error("couldn't create hist_counts")

    try:
        hist_counts_filename = settings.PLOT_DEV_HIST_ON_OFF_FN
        path_to_hist_counts = path + hist_counts_filename
        hist_on_off(data.df_devices, file_path=path_to_hist_counts)
        dataset.plot_hist_on_off = sub_path + hist_counts_filename
        logger.info('created hist_on_off')
    except:
        logger.error("couldn't create hist_on_off")

    try:
        hist_counts_filename = settings.PLOT_DEV_BP_ON_DUR_FN
        path_to_hist_counts = path + hist_counts_filename
        boxplot_on_duration(data.df_devices, file_path=path_to_hist_counts)
        dataset.plot_boxplot_on_duration = sub_path + hist_counts_filename
        logger.info('created boxplot_on_duration')
    except:
        logger.error("couldn't create boxplot_on_duration")

    try:
        hist_counts_filename = settings.PLOT_DEV_HM_CROSS_CORR_FN
        path_to_hist_counts = path + hist_counts_filename
        heatmap_cross_correlation(data.df_devices,
                                  file_path=path_to_hist_counts)
        dataset.plot_heatmap_cross_correlation = sub_path + hist_counts_filename
        logger.info('created heatmap_cross_correlation')
    except:
        logger.error("couldn't create heatmap_cross_correlation")

    dataset.save()