def preprocess_redd(building, freq): building.utility.electric = building.utility.electric.sum_split_supplies() building = prepb.downsample(building, rule=freq) building = prepb.fill_appliance_gaps(building) building = prepb.drop_missing_mains(building) building = prepb.make_common_index(building) building.utility.electric.mains[(1, 1)].rename( columns={Measurement('power', 'apparent'): Measurement('power', 'active')}, inplace=True) building = prepb.filter_top_k_appliances(building, k=6) return building
def preprocess_iawe(building, freq): building.utility.electric = building.utility.electric.sum_split_supplies() building = prepb.filter_out_implausible_values( building, Measurement('voltage', ''), 160, 260) building = prepb.filter_datetime(building, '7-13-2013', '8-4-2013') building = prepb.downsample(building, rule=freq) building = prepb.fill_appliance_gaps(building) building = prepb.prepend_append_zeros( building, '7-13-2013', '8-4-2013', freq, 'Asia/Kolkata') building = prepb.drop_missing_mains(building) building = prepb.make_common_index(building) building = prepb.filter_top_k_appliances(building, k=6) return building
building, Measurement('voltage', ''), 160, 260) # optional. (required for iAWE) Note that this will remove motor as it does not have # any data in this period building = prepb.filter_datetime( building, '7-13-2013', '8-4-2013') # 2. downsample mains, circuits and appliances building = prepb.downsample(building, rule='1T') # 3. Fill large gaps in appliances with zeros and forward-fill small gaps building = prepb.fill_appliance_gaps(building) # optional. (required for iAWE) building = prepb.prepend_append_zeros( building, '7-13-2013', '8-4-2013', '1T', 'Asia/Kolkata') # 4. Drop missing samples from mains building = prepb.drop_missing_mains(building) # TODO: for some datasets (e.g. UKPD), we'll have to find a common index # for the subset of the appliances we want to use. # 5. Find intersection of mains and appliance datetime indicies building = prepb.make_common_index(building) # 6. Contiguous blocks of datetimes # could use nilmtk.stats.electricity.single.periods_with_sufficient_samples ? # plot_missing_samples_using_bitmap(building.utility.electric)