def plot(self): ''' Plots the used standard load profiles. ''' plots.latexify(fontsize=12, columns=1) #sns.set_context("notebook", font_scale=2, rc={"lines.linewidth": 3}) print("Plot Winter.") ax = self.profiles['Winter'].plot() ax.set_ylabel('Factor') ax.set_xlabel('Time of Day') ax.yaxis.labelpad = 10 print("Plot Summer.") #plt.gca().xaxis.set_major_locator(dates.HourLocator()) #plt.gca().xaxis.set_major_formatter(dates.DateFormatter('%H:%M')) ax = self.profiles['Summer'].plot() ax.set_ylabel('Factor') ax.set_xlabel('Time of Day') ax.yaxis.labelpad = 10 #plt.gca().xaxis.set_major_locator(dates.HourLocator()) #plt.gca().xaxis.set_major_formatter(dates.DateFormatter('%H:%M')) plt.show() i = 1
merge=True) def pretty_name_appliance_names(appliance_name_list): names = [name.replace('_', ' ') for name in appliance_name_list] names = [name[0].upper() + name[1:] for name in names] for old, new in [('Htpc', 'Home theatre PC'), ('Boiler', 'Gas boiler'), ('Air conditioner', 'Air conditioning')]: try: names[names.index(old)] = new except ValueError: pass return names plt.close('all') latexify(columns=2, fig_height=2) fig, axes = plt.subplots(ncols=4, subplot_kw={'aspect':1}) count = 0 for dataset_name, dataset_path in DATASETS.iteritems(): print("\n------------------", dataset_name, "-----------------") top_k = proportions[dataset_name][:K] print(top_k) fracs = top_k.tolist() fracs.append(1.0 - sum(fracs)) labels_raw = top_k.index.tolist() labels_raw.append('others') colors = get_colors_for_labels(labels_raw) pretty_labels = pretty_name_appliance_names(labels_raw) explode = (0.03, 0.03, 0.03, 0.03, 0.03, 0.03) ax = axes[count]
disaggregator_name, t2 - t1)) disaggregate_time[freq][disaggregator_name] = t2 - t1 # Predicted power and states predicted_power[disaggregator_name] = disaggregator.predictions app_ground = test.utility.electric.appliances ground_truth_power = pd.DataFrame({appliance: app_ground[appliance][DISAGG_FEATURE] for appliance in app_ground}) for metric in metrics: results[freq][disaggregator_name][metric] = metric_function[ metric](predicted_power[disaggregator_name], ground_truth_power) results = results['1T'] start = pd.Timestamp("2013-07-27 21:35") end = pd.Timestamp("2013-07-27 22:35") latexify(columns=1) fig, axes = plt.subplots(ncols=3, sharex=True, sharey=True) plot_series(ground_truth_power[('air conditioner', 2)] [start:end] / 1e3, ax=axes[0], color='k', date_format=DATE_FORMAT, linewidth=0.5) plot_series(predicted_power['co'] [('air conditioner', 2)][start:end] / 1e3, ax=axes[1], color='k', date_format=DATE_FORMAT, linewidth=0.5) plot_series(predicted_power['fhmm'] [('air conditioner', 2)][start:end] / 1e3, ax=axes[2], color='k', date_format=DATE_FORMAT, linewidth=0.5) for ax in axes: ax.set_ylim((0, 2)) format_axes(ax) ax.set_xticklabels(['0', ' ', '30', ' ', '60'], rotation=0)
'UKPD': ApplianceName('washing_machine', 1), 'AMPds': ApplianceName('washer', 1), 'Pecan': ApplianceName('washer', 1), } time_datasets = { 'Pecan': [pd.Timestamp("2012-09-05 08:00"), pd.Timestamp("2012-09-05 11:00")], 'REDD': [pd.Timestamp("2011-05-01 17:43"), pd.Timestamp("2011-05-01 23:00")], 'AMPds': [pd.Timestamp("2012-04-02 04:30"), pd.Timestamp("2012-04-02 06:00")], 'iAWE': [pd.Timestamp("2013-07-10 07:22"), pd.Timestamp("2013-07-15 07:30")], 'UKPD': [pd.Timestamp("2013-10-29 10:47"), pd.Timestamp("2013-10-29 12:17")] } count = 0 latexify(columns=1, fig_height=1.5) fig, axes = plt.subplots(ncols=len(DATASETS), sharey=True) if LOAD_DATASETS: electrics = {} for dataset_name, dataset_path in DATASETS.iteritems(): dataset = DataSet() print("Loading", dataset_path) dataset.load_hdf5(dataset_path, [1]) building = dataset.buildings[1] electric = building.utility.electric electric = electric.sum_split_supplies() electrics[dataset_name] = electric for dataset_name, dataset_path in DATASETS.iteritems(): electric = electrics[dataset_name]