#------------------------------------------- fig = plt.figure() n_subplots = len(chans) for c, c_normalised in zip(chans, normalised): subplot_index = chans.index(c) + 1 # hard-coded tweaks for individual appliances if c.name == 'kitchen_lights': # Ignore 50W halogens; only use data after all lights replaced by LEDs c_normalised = c_normalised.crop(datetime.datetime(year=2013, month=4, day=27)) c_normalised.series = c_normalised.series[c_normalised.series > 3] c_normalised.series = c_normalised.series[c_normalised.series < 5000] c = c.crop(c_normalised.series.index[0], c_normalised.series.index[-1]) c.series = c.series[c.series > 3] c.series = c.series[c.series < 5000] # First get unconstrained histogram from which we will # automatically find a sensible range hist, bin_edges = np.histogram(c.series, bins=100) above_threshold = np.where(hist > MINIMUM_BIN_COUNT)[0] if len(above_threshold) < 1: print(c.name, c.chan, " does not have enough data above threshold") print(bin_edges) print(hist) continue min_power = int(round(bin_edges[above_threshold[0]]))
fig = plt.figure() n_subplots = len(chans) for c, c_normalised in zip(chans, normalised): subplot_index = chans.index(c) + 1 # hard-coded tweaks for individual appliances if c.name == 'kitchen_lights': # Ignore 50W halogens; only use data after all lights replaced by LEDs c_normalised = c_normalised.crop( datetime.datetime(year=2013, month=4, day=27)) c_normalised.series = c_normalised.series[c_normalised.series > 3] c_normalised.series = c_normalised.series[c_normalised.series < 5000] c = c.crop(c_normalised.series.index[0], c_normalised.series.index[-1]) c.series = c.series[c.series > 3] c.series = c.series[c.series < 5000] # First get unconstrained histogram from which we will # automatically find a sensible range hist, bin_edges = np.histogram(c.series, bins=100) above_threshold = np.where(hist > MINIMUM_BIN_COUNT)[0] if len(above_threshold) < 1: print(c.name, c.chan, " does not have enough data above threshold") print(bin_edges) print(hist) continue min_power = int(round(bin_edges[above_threshold[0]]))
CHAN_IDS = [14,22] spfl.setup() GRID = False TITLE_Y = 0.75 XTICKS_ON = True LATEX_PDF_OUTPUT_FILENAME = os.path.join(FIGURE_PATH, 'weekly_usage_histograms'+FIGURE_SUFFIX) else: CHAN_IDS = [] CHANS = [] for chan_id in CHAN_IDS: # Get channel data print("Loading channel", chan_id) c = Channel(DATA_DIR, chan_id) c = c.crop(START_DATE, END_DATE) CHANS.append(c) if FIGURE_PRESET == 'boiler seasons': BIN_SIZE = 'T' # D (daily) or H (hourly) or T (minutely) TIMESPAN = 'D' # D (daily) or W (weekly) spfl.setup() GRID = False TITLE_Y = 0.7 XTICKS_ON = True LATEX_PDF_OUTPUT_FILENAME = os.path.join(FIGURE_PATH, 'seasonal_variation'+FIGURE_SUFFIX) print("Loading winter boiler data...") winter_boiler = Channel(DATA_DIR, 2) winter_boiler = winter_boiler.crop(datetime.datetime(year=2013, month=2, day=1), datetime.datetime(year=2013, month=3, day=1))
CHAN_IDS = [14, 22] spfl.setup() GRID = False TITLE_Y = 0.75 XTICKS_ON = True LATEX_PDF_OUTPUT_FILENAME = os.path.join( FIGURE_PATH, 'weekly_usage_histograms' + FIGURE_SUFFIX) else: CHAN_IDS = [] CHANS = [] for chan_id in CHAN_IDS: # Get channel data print("Loading channel", chan_id) c = Channel(DATA_DIR, chan_id) c = c.crop(START_DATE, END_DATE) CHANS.append(c) if FIGURE_PRESET == 'boiler seasons': BIN_SIZE = 'T' # D (daily) or H (hourly) or T (minutely) TIMESPAN = 'D' # D (daily) or W (weekly) spfl.setup() GRID = False TITLE_Y = 0.7 XTICKS_ON = True LATEX_PDF_OUTPUT_FILENAME = os.path.join( FIGURE_PATH, 'seasonal_variation' + FIGURE_SUFFIX) print("Loading winter boiler data...") winter_boiler = Channel(DATA_DIR, 2) winter_boiler = winter_boiler.crop( datetime.datetime(year=2013, month=2, day=1),