Creating the dataset in nilmtk format


In [1]:
from nilmtk.dataset_converters.iawe.convert_iawe import  convert_iawe 
convert_iawe("/home/nipun/Copy/Dataset/", "/home/nipun/Desktop/iawe.h5")


Loading  1
Loading  2
Loading  3
Loading  4
Loading  5
Loading  6
Loading  7
Loading  8
Loading  9
Loading  10
Loading  11
Loading  12
Done converting YAML metadata to HDF5!
Done converting iAWE to HDF5!
/home/nipun/anaconda/lib/python2.7/site-packages/pandas/io/parsers.py:1139: DtypeWarning: Columns (1,2,3,4,5,6,7) have mixed types. Specify dtype option on import or set low_memory=False.
  data = self._reader.read(nrows)

In [1]:
from nilmtk import DataSet

In [2]:
iawe = DataSet("/home/nipun/Copy/Dataset/iawe.h5")

In [3]:
iawe.buildings[1].elec


Out[3]:
MeterGroup(meters=
  ElecMeter(instance=1, building=1, dataset='iAWE', site_meter, appliances=[])
  ElecMeter(instance=2, building=1, dataset='iAWE', site_meter, appliances=[])
  ElecMeter(instance=3, building=1, dataset='iAWE', appliances=[Appliance(type='fridge', instance=1)])
  ElecMeter(instance=4, building=1, dataset='iAWE', appliances=[Appliance(type='air conditioner', instance=1)])
  ElecMeter(instance=5, building=1, dataset='iAWE', appliances=[Appliance(type='air conditioner', instance=2)])
  ElecMeter(instance=6, building=1, dataset='iAWE', appliances=[Appliance(type='washing machine', instance=1)])
  ElecMeter(instance=7, building=1, dataset='iAWE', appliances=[Appliance(type='computer', instance=1)])
  ElecMeter(instance=8, building=1, dataset='iAWE', appliances=[Appliance(type='clothes iron', instance=1)])
  ElecMeter(instance=9, building=1, dataset='iAWE', appliances=[Appliance(type='unknown', instance=1)])
  ElecMeter(instance=10, building=1, dataset='iAWE', appliances=[Appliance(type='television', instance=1)])
  ElecMeter(instance=11, building=1, dataset='iAWE', appliances=[Appliance(type='wet appliance', instance=1)])
  ElecMeter(instance=12, building=1, dataset='iAWE', appliances=[Appliance(type='motor', instance=1)])
)

In [4]:
%matplotlib inline

In [5]:
iawe.buildings[1].elec.draw_wiring_graph()



In [6]:
elec = iawe.buildings[1].elec

In [7]:
elec.mains().good_sections()


/home/nipun/git/nilmtk/nilmtk/metergroup.py:730: UserWarning: As a quick implementation we only get Good Sections from the first meter in the meter group.  We should really return the intersection of the good sections for all meters.  This will be fixed...
  warn("As a quick implementation we only get Good Sections from"
Out[7]:
[TimeFrame(start='2013-05-24 05:30:00+05:30', end='2013-05-24 07:13:35+05:30', empty=False),
 TimeFrame(start='2013-05-24 09:07:19+05:30', end='2013-05-25 12:07:19+05:30', empty=False),
 TimeFrame(start='2013-05-25 13:38:35+05:30', end='2013-05-25 14:08:06+05:30', empty=False),
 TimeFrame(start='2013-05-25 14:36:51+05:30', end='2013-05-25 18:06:43+05:30', empty=False),
 TimeFrame(start='2013-05-25 19:07:08+05:30', end='2013-05-26 00:56:38+05:30', empty=False),
 TimeFrame(start='2013-05-26 01:50:55+05:30', end='2013-05-26 15:55:34+05:30', empty=False),
 TimeFrame(start='2013-05-26 16:18:08+05:30', end='2013-05-26 23:37:08+05:30', empty=False),
 TimeFrame(start='2013-05-27 00:12:16+05:30', end='2013-05-27 11:02:20+05:30', empty=False),
 TimeFrame(start='2013-05-27 11:25:28+05:30', end='2013-05-27 18:13:53+05:30', empty=False),
 TimeFrame(start='2013-05-27 18:26:24+05:30', end='2013-05-27 18:45:21+05:30', empty=False),
 TimeFrame(start='2013-05-27 19:25:30+05:30', end='2013-05-28 00:21:33+05:30', empty=False),
 TimeFrame(start='2013-05-28 00:39:35+05:30', end='2013-05-28 07:58:23+05:30', empty=False),
 TimeFrame(start='2013-05-28 08:47:21+05:30', end='2013-05-28 08:47:24+05:30', empty=False),
 TimeFrame(start='2013-05-28 08:52:49+05:30', end='2013-05-28 16:11:30+05:30', empty=False),
 TimeFrame(start='2013-05-28 16:25:35+05:30', end='2013-05-28 16:55:35+05:30', empty=False),
 TimeFrame(start='2013-05-28 17:10:37+05:30', end='2013-05-28 17:28:32+05:30', empty=False),
 TimeFrame(start='2013-05-28 18:21:51+05:30', end='2013-05-29 06:08:37+05:30', empty=False),
 TimeFrame(start='2013-05-29 06:32:54+05:30', end='2013-05-30 01:08:55+05:30', empty=False),
 TimeFrame(start='2013-05-30 02:38:09+05:30', end='2013-05-30 22:36:55+05:30', empty=False),
 TimeFrame(start='2013-05-30 23:22:40+05:30', end='2013-05-31 09:55:55+05:30', empty=False),
 TimeFrame(start='2013-05-31 11:53:57+05:30', end='2013-05-31 17:49:39+05:30', empty=False),
 TimeFrame(start='2013-05-31 18:11:54+05:30', end='2013-06-01 07:55:15+05:30', empty=False),
 TimeFrame(start='2013-06-01 08:11:46+05:30', end='2013-06-01 08:21:47+05:30', empty=False),
 TimeFrame(start='2013-06-01 10:25:35+05:30', end='2013-06-01 11:41:46+05:30', empty=False),
 TimeFrame(start='2013-06-01 11:52:40+05:30', end='2013-06-01 12:05:10+05:30', empty=False),
 TimeFrame(start='2013-06-01 12:16:04+05:30', end='2013-06-01 22:09:20+05:30', empty=False),
 TimeFrame(start='2013-06-02 06:49:00+05:30', end='2013-06-03 09:04:50+05:30', empty=False),
 TimeFrame(start='2013-06-03 09:47:22+05:30', end='2013-06-03 09:47:45+05:30', empty=False),
 TimeFrame(start='2013-06-03 10:10:47+05:30', end='2013-06-04 10:02:26+05:30', empty=False),
 TimeFrame(start='2013-06-04 12:03:12+05:30', end='2013-06-04 13:03:15+05:30', empty=False),
 TimeFrame(start='2013-06-04 13:18:17+05:30', end='2013-06-04 13:46:25+05:30', empty=False),
 TimeFrame(start='2013-06-04 14:43:57+05:30', end='2013-06-04 17:31:41+05:30', empty=False),
 TimeFrame(start='2013-06-04 18:16:09+05:30', end='2013-06-05 01:23:05+05:30', empty=False),
 TimeFrame(start='2013-06-05 02:46:30+05:30', end='2013-06-05 23:23:05+05:30', empty=False),
 TimeFrame(start='2013-06-06 04:43:05+05:30', end='2013-06-06 06:41:39+05:30', empty=False),
 TimeFrame(start='2013-06-06 08:13:12+05:30', end='2013-06-06 13:31:45+05:30', empty=False),
 TimeFrame(start='2013-06-06 15:12:30+05:30', end='2013-06-06 19:24:42+05:30', empty=False),
 TimeFrame(start='2013-06-06 23:23:51+05:30', end='2013-06-07 06:02:33+05:30', empty=False),
 TimeFrame(start='2013-06-07 07:00:03+05:30', end='2013-06-07 08:32:44+05:30', empty=False),
 TimeFrame(start='2013-06-07 08:41:28+05:30', end='2013-06-08 12:35:47+05:30', empty=False),
 TimeFrame(start='2013-06-08 13:19:04+05:30', end='2013-06-08 13:41:49+05:30', empty=False),
 TimeFrame(start='2013-06-08 15:02:19+05:30', end='2013-06-08 16:26:21+05:30', empty=False),
 TimeFrame(start='2013-06-08 16:46:14+05:30', end='2013-06-08 20:37:18+05:30', empty=False),
 TimeFrame(start='2013-06-08 22:27:43+05:30', end='2013-06-08 23:39:15+05:30', empty=False),
 TimeFrame(start='2013-06-09 00:16:27+05:30', end='2013-06-09 08:07:47+05:30', empty=False),
 TimeFrame(start='2013-06-09 08:46:02+05:30', end='2013-06-09 10:13:52+05:30', empty=False),
 TimeFrame(start='2013-06-09 11:10:56+05:30', end='2013-06-09 17:05:41+05:30', empty=False),
 TimeFrame(start='2013-06-09 17:27:56+05:30', end='2013-06-09 18:17:50+05:30', empty=False),
 TimeFrame(start='2013-06-09 18:37:24+05:30', end='2013-06-09 22:28:20+05:30', empty=False),
 TimeFrame(start='2013-06-10 00:22:41+05:30', end='2013-06-10 17:32:23+05:30', empty=False),
 TimeFrame(start='2013-06-10 18:03:17+05:30', end='2013-06-10 18:21:17+05:30', empty=False),
 TimeFrame(start='2013-06-10 18:57:56+05:30', end='2013-06-11 00:15:39+05:30', empty=False),
 TimeFrame(start='2013-06-11 02:42:00+05:30', end='2013-06-11 07:04:25+05:30', empty=False),
 TimeFrame(start='2013-06-11 07:34:03+05:30', end='2013-06-11 18:13:21+05:30', empty=False),
 TimeFrame(start='2013-06-11 18:48:46+05:30', end='2013-06-12 13:31:31+05:30', empty=False),
 TimeFrame(start='2013-06-12 13:43:09+05:30', end='2013-06-12 14:18:30+05:30', empty=False),
 TimeFrame(start='2013-06-12 16:13:30+05:30', end='2013-06-12 20:07:40+05:30', empty=False),
 TimeFrame(start='2013-06-12 20:39:26+05:30', end='2013-06-14 14:43:50+05:30', empty=False),
 TimeFrame(start='2013-06-14 15:04:10+05:30', end='2013-06-16 13:38:05+05:30', empty=False),
 TimeFrame(start='2013-06-16 16:28:22+05:30', end='2013-06-16 17:35:15+05:30', empty=False),
 TimeFrame(start='2013-06-16 20:52:08+05:30', end='2013-06-16 22:19:17+05:30', empty=False),
 TimeFrame(start='2013-06-16 22:41:03+05:30', end='2013-06-19 10:57:51+05:30', empty=False),
 TimeFrame(start='2013-06-19 14:29:42+05:30', end='2013-06-19 20:28:10+05:30', empty=False),
 TimeFrame(start='2013-06-19 20:59:48+05:30', end='2013-06-20 14:18:00+05:30', empty=False),
 TimeFrame(start='2013-06-20 14:37:49+05:30', end='2013-06-22 00:22:18+05:30', empty=False),
 TimeFrame(start='2013-06-22 01:25:27+05:30', end='2013-06-22 22:39:14+05:30', empty=False),
 TimeFrame(start='2013-06-23 00:09:59+05:30', end='2013-06-23 00:14:19+05:30', empty=False),
 TimeFrame(start='2013-06-23 00:36:38+05:30', end='2013-06-25 10:33:56+05:30', empty=False),
 TimeFrame(start='2013-06-25 11:36:00+05:30', end='2013-06-26 10:45:34+05:30', empty=False),
 TimeFrame(start='2013-06-26 13:20:26+05:30', end='2013-06-26 17:23:01+05:30', empty=False),
 TimeFrame(start='2013-06-26 17:36:39+05:30', end='2013-06-26 19:29:57+05:30', empty=False),
 TimeFrame(start='2013-06-26 19:36:37+05:30', end='2013-06-26 19:55:02+05:30', empty=False),
 TimeFrame(start='2013-06-26 20:03:42+05:30', end='2013-06-28 09:40:24+05:30', empty=False),
 TimeFrame(start='2013-06-28 10:14:31+05:30', end='2013-07-01 14:28:57+05:30', empty=False),
 TimeFrame(start='2013-07-01 15:22:33+05:30', end='2013-07-02 04:31:28+05:30', empty=False),
 TimeFrame(start='2013-07-02 05:29:38+05:30', end='2013-07-03 08:42:38+05:30', empty=False),
 TimeFrame(start='2013-07-03 08:55:51+05:30', end='2013-07-04 10:12:17+05:30', empty=False),
 TimeFrame(start='2013-07-04 10:20:22+05:30', end='2013-07-05 14:28:12+05:30', empty=False),
 TimeFrame(start='2013-07-05 14:38:59+05:30', end='2013-07-05 18:40:26+05:30', empty=False),
 TimeFrame(start='2013-07-05 19:31:50+05:30', end='2013-07-06 06:23:01+05:30', empty=False),
 TimeFrame(start='2013-07-06 07:15:25+05:30', end='2013-07-06 10:59:03+05:30', empty=False),
 TimeFrame(start='2013-07-06 11:05:37+05:30', end='2013-07-06 12:05:39+05:30', empty=False),
 TimeFrame(start='2013-07-06 12:20:56+05:30', end='2013-07-06 12:35:56+05:30', empty=False),
 TimeFrame(start='2013-07-06 12:47:21+05:30', end='2013-07-06 13:17:57+05:30', empty=False),
 TimeFrame(start='2013-07-06 13:48:48+05:30', end='2013-07-06 15:16:06+05:30', empty=False),
 TimeFrame(start='2013-07-06 15:37:15+05:30', end='2013-07-06 17:56:26+05:30', empty=False),
 TimeFrame(start='2013-07-06 18:15:37+05:30', end='2013-07-09 11:45:03+05:30', empty=False),
 TimeFrame(start='2013-07-09 13:22:46+05:30', end='2013-07-11 23:00:06+05:30', empty=False),
 TimeFrame(start='2013-07-12 01:01:55+05:30', end='2013-07-12 10:41:01+05:30', empty=False),
 TimeFrame(start='2013-07-12 17:40:31+05:30', end='2013-07-13 05:00:34+05:30', empty=False),
 TimeFrame(start='2013-07-13 06:31:29+05:30', end='2013-07-14 11:56:17+05:30', empty=False),
 TimeFrame(start='2013-07-14 12:48:08+05:30', end='2013-07-17 00:36:02+05:30', empty=False),
 TimeFrame(start='2013-07-17 00:46:40+05:30', end='2013-07-18 10:20:31+05:30', empty=False),
 TimeFrame(start='2013-07-18 10:31:10+05:30', end='2013-07-20 09:50:07+05:30', empty=False),
 TimeFrame(start='2013-07-20 09:56:46+05:30', end='2013-07-20 11:12:13+05:30', empty=False),
 TimeFrame(start='2013-07-20 11:25:10+05:30', end='2013-07-22 01:15:18+05:30', empty=False),
 TimeFrame(start='2013-07-22 02:01:45+05:30', end='2013-07-24 23:22:40+05:30', empty=False),
 TimeFrame(start='2013-07-24 23:39:26+05:30', end='2013-07-25 10:28:30+05:30', empty=False),
 TimeFrame(start='2013-07-25 11:08:23+05:30', end='2013-07-27 10:35:55+05:30', empty=False),
 TimeFrame(start='2013-07-27 11:14:34+05:30', end='2013-07-29 01:37:31+05:30', empty=False),
 TimeFrame(start='2013-07-29 03:24:09+05:30', end='2013-07-30 14:27:06+05:30', empty=False),
 TimeFrame(start='2013-07-30 14:46:54+05:30', end='2013-08-03 03:49:56+05:30', empty=False),
 TimeFrame(start='2013-08-03 06:08:35+05:30', end='2013-08-04 00:29:13+05:30', empty=False),
 TimeFrame(start='2013-08-04 01:47:45+05:30', end='2013-08-04 11:33:47+05:30', empty=False),
 TimeFrame(start='2013-08-04 12:20:03+05:30', end='2013-08-05 21:03:16+05:30', empty=False)]

In [7]:
import time

In [13]:
from pycallgraph import PyCallGraph
from pycallgraph.output import GraphvizOutput

graphviz = GraphvizOutput(output_file='filter_none.png')

In [15]:
with PyCallGraph(output=graphviz):
    elec.mains().power_series_all_data().head()

In [16]:
from IPython.display import Image
Image('filter_none.png')


Out[16]:

In [8]:
mains = elec.mains()

In [9]:
mains_good_sections = mains.good_sections()

In [10]:
mains_energy = mains.total_energy(sections=mains_good_sections)


/home/nipun/git/nilmtk/nilmtk/preprocessing/clip.py:50: RuntimeWarning: No measurement limits for ('frequency', '').
  warn('No measurement limits for {}.'.format(measurement), RuntimeWarning)
/home/nipun/git/nilmtk/nilmtk/preprocessing/clip.py:50: RuntimeWarning: No measurement limits for ('voltage', '').
  warn('No measurement limits for {}.'.format(measurement), RuntimeWarning)
/home/nipun/git/nilmtk/nilmtk/preprocessing/clip.py:50: RuntimeWarning: No measurement limits for ('pf', '').
  warn('No measurement limits for {}.'.format(measurement), RuntimeWarning)
/home/nipun/git/nilmtk/nilmtk/preprocessing/clip.py:50: RuntimeWarning: No measurement limits for ('current', '').
  warn('No measurement limits for {}.'.format(measurement), RuntimeWarning)

In [11]:
mains.dataframe_of_meters()


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-11-737041b3fe7e> in <module>()
----> 1 mains.dataframe_of_meters()

/home/nipun/git/nilmtk/nilmtk/metergroup.pyc in dataframe_of_meters(self, rule)
    648         mains = self.mains()
    649         mains_good_sections = mains.good_sections()
--> 650         mains_energy = mains.total_energy(sections=mains_good_sections)
    651         energy_ac_type = select_best_ac_type(mains_energy.keys())
    652         energy_threshold = mains_energy[energy_ac_type] * 0.05

/home/nipun/git/nilmtk/nilmtk/metergroup.pyc in total_energy(self, **load_kwargs)
    547 
    548         meter_energies = self._collect_stats_on_all_meters(
--> 549             load_kwargs, 'total_energy', full_results)
    550 
    551         if meter_energies:

/home/nipun/git/nilmtk/nilmtk/metergroup.pyc in _collect_stats_on_all_meters(self, load_kwargs, func, full_results)
    562         for meter in self.meters:
    563             single_stat = getattr(meter, func)(full_results=full_results,
--> 564                                                **load_kwargs)
    565             collected_stats.append(single_stat)
    566             if (full_results and len(self.meters) > 1 and

/home/nipun/git/nilmtk/nilmtk/elecmeter.pyc in total_energy(self, **loader_kwargs)
    345         clipped = Clip(source_node)
    346         total_energy = TotalEnergy(clipped)
--> 347         total_energy.run()
    348         if full_results:
    349             return total_energy.results

/home/nipun/git/nilmtk/nilmtk/node.pyc in run(self)
     38         """Pulls data through the pipeline.  Useful if we just want to calculate 
     39         some stats."""
---> 40         for _ in self.process():
     41             pass
     42 

/home/nipun/git/nilmtk/nilmtk/stats/totalenergy.pyc in process(self)
     27         for chunk in self.upstream.process():
     28             energy = get_total_energy(chunk, max_sample_period)
---> 29             self.results.append(chunk.timeframe, energy)
     30             yield chunk
     31 

/home/nipun/git/nilmtk/nilmtk/stats/totalenergyresults.pyc in append(self, timeframe, new_results)
     21             raise KeyError('new_results must be a combination of ' +
     22                            str(AC_TYPES))
---> 23         super(TotalEnergyResults, self).append(timeframe, new_results)
     24 
     25     def unify(self, other):

/home/nipun/git/nilmtk/nilmtk/results.pyc in append(self, timeframe, new_results)
     61             if not intersect.empty:
     62                 raise ValueError("Periods overlap: " + str(tf) + 
---> 63                                  " " + str(timeframe))
     64 
     65         row = pd.DataFrame(index=[timeframe.start],

ValueError: Periods overlap: TimeFrame(start='2013-06-25 15:54:30+05:30', end='2013-06-26 10:45:34+05:30', empty=False) TimeFrame(start='2013-06-25 15:54:42+05:30', end='2013-06-26 10:45:34+05:30', empty=False)
> /home/nipun/git/nilmtk/nilmtk/results.py(63)append()
     62                 raise ValueError("Periods overlap: " + str(tf) + 
---> 63                                  " " + str(timeframe))
     64 

ipdb> ?

Documented commands (type help <topic>):
========================================
EOF    bt         cont      enable  jump  pdef    psource  run      unt   
a      c          continue  exit    l     pdoc    q        s        until 
alias  cl         d         h       list  pfile   quit     step     up    
args   clear      debug     help    n     pinfo   r        tbreak   w     
b      commands   disable   ignore  next  pinfo2  restart  u        whatis
break  condition  down      j       p     pp      return   unalias  where 

Miscellaneous help topics:
==========================
exec  pdb

Undocumented commands:
======================
retval  rv

ipdb> p mains_good_sections
*** NameError: NameError("name 'mains_good_sections' is not defined",)
ipdb> q

In [ ]:


In [11]:
import time
start = time.time()
print elec.proportion_of_energy_submetered()
end = time.time()
print end - start, "s"


Getting total energy for ('fridge', 1)
  total energy = active      80.463459
reactive    52.435464
apparent    97.008218
dtype: float64
Getting total energy for ('television', 1)
  total energy = active      10.926226
reactive     0.000116
apparent    11.651691
dtype: float64
Getting total energy for ('wet appliance', 1)
  total energy = active      0.543758
reactive    2.040104
apparent    2.249115
dtype: float64
Getting total energy for ('washing machine', 1)
  total energy = active      1.842086
reactive    0.008720
apparent    1.860645
dtype: float64
Getting total energy for ('air conditioner', 1)
  total energy = active      191.952256
reactive     39.911030
apparent    196.658907
dtype: float64
Getting total energy for ('clothes iron', 1)
  total energy = active      0.786596
reactive    0.000328
apparent    0.806191
dtype: float64
Getting total energy for ('computer', 1)
  total energy = active      23.358390
reactive     0.001638
apparent    41.373663
dtype: float64
Getting total energy for ('air conditioner', 2)
  total energy = active      194.012510
reactive     33.438748
apparent    197.279263
dtype: float64
Getting total energy for ('motor', 1)
  total energy = active    1.047471
dtype: float64
Getting total energy for ('unknown', 1)
  total energy = active      0.556922
reactive    0.208699
apparent    0.635201
dtype: float64
Using AC type 'active' from mains.
0.370032075004
163.649049997 s

In [12]:
start = time.time()
elec.total_energy()
end  = time.time()

In [9]:
print elec.total_energy()


active      1897.730371
reactive     262.570156
apparent    2009.394436
dtype: float64

In [13]:
print end - start


7.19227719307

In [17]:
mains = elec.mains()

In [20]:
m = mains.meters[1]

In [22]:
m.power_series_all_data()


Out[22]:
2013-05-24 05:30:00+05:30    282.744995
2013-05-24 05:30:01+05:30    288.757996
2013-05-24 05:30:02+05:30    288.757996
2013-05-24 05:30:03+05:30    297.394012
2013-05-24 05:30:04+05:30    303.722992
2013-05-24 05:30:05+05:30    297.273987
2013-05-24 05:30:06+05:30    297.330994
2013-05-24 05:30:07+05:30    297.330994
2013-05-24 05:30:08+05:30    282.475006
2013-05-24 05:30:09+05:30    282.580994
2013-05-24 05:30:10+05:30    282.899994
2013-05-24 05:30:11+05:30    282.915985
2013-05-24 05:30:12+05:30    283.238007
2013-05-24 05:30:13+05:30    283.238007
2013-05-24 05:30:14+05:30    283.174011
...
2013-08-05 21:02:46+05:30    696.109985
2013-08-05 21:02:49+05:30    696.047974
2013-08-05 21:02:50+05:30    695.791992
2013-08-05 21:02:53+05:30    695.333008
2013-08-05 21:02:54+05:30    695.291992
2013-08-05 21:02:57+05:30    695.656982
2013-08-05 21:02:58+05:30    695.742004
2013-08-05 21:03:01+05:30    696.257019
2013-08-05 21:03:04+05:30    696.877991
2013-08-05 21:03:07+05:30    696.685974
2013-08-05 21:03:09+05:30    696.762024
2013-08-05 21:03:10+05:30    696.864990
2013-08-05 21:03:11+05:30    696.864990
2013-08-05 21:03:12+05:30    697.007996
2013-08-05 21:03:15+05:30    697.237976
Name: (power, active), Length: 4391004

In [23]:
m.total_energy()


Out[23]:
active      1005.572193
reactive      96.815441
apparent    1043.941205
dtype: float64

In [10]:
import time
start  =  time.time()
elec.fraction_per_meter()
end  =  time.time()


/home/nipun/git/nilmtk/nilmtk/preprocessing/clip.py:50: RuntimeWarning: No measurement limits for ('frequency', '').
  warn('No measurement limits for {}.'.format(measurement), RuntimeWarning)
/home/nipun/git/nilmtk/nilmtk/preprocessing/clip.py:50: RuntimeWarning: No measurement limits for ('voltage', '').
  warn('No measurement limits for {}.'.format(measurement), RuntimeWarning)
/home/nipun/git/nilmtk/nilmtk/preprocessing/clip.py:50: RuntimeWarning: No measurement limits for ('pf', '').
  warn('No measurement limits for {}.'.format(measurement), RuntimeWarning)
/home/nipun/git/nilmtk/nilmtk/preprocessing/clip.py:50: RuntimeWarning: No measurement limits for ('current', '').
  warn('No measurement limits for {}.'.format(measurement), RuntimeWarning)

In [14]:
print elec.fraction_per_meter()


12/12 ElecMeter(instance=12, building=1, dataset='iAWE', appliances=[Appliance(type='motor', instance=1)])1                     NaN
2                     NaN
3                     NaN
4                     NaN
5                     NaN
6                     NaN
7                     NaN
8                     NaN
9                     NaN
10                    NaN
11                    NaN
12                    NaN
(1, 1, iAWE)     0.192552
(2, 1, iAWE)     0.519530
(3, 1, iAWE)     0.049750
(4, 1, iAWE)     0.103877
(5, 1, iAWE)     0.103186
(6, 1, iAWE)     0.001082
(7, 1, iAWE)     0.021384
(8, 1, iAWE)     0.000453
(9, 1, iAWE)     0.000403
(10, 1, iAWE)    0.006101
(11, 1, iAWE)    0.001146
(12, 1, iAWE)    0.000536
dtype: float64

In [12]:
print end - start


7.8085038662

In [13]:
elec.select_top_k(k=4)


Out[13]:
1 2 3 4 5 6 7 8 9 10 11 12
active 360.496060 1005.572193 82.958314 203.569523 203.889213 2.152638 24.351495 0.885766 0.722616 11.495919 0.558716 1.077918
apparent 386.911386 1043.941205 99.966983 208.730314 207.341398 2.173996 42.969043 0.911080 0.810098 12.258396 2.302620 NaN
reactive 30.660539 96.815441 53.965398 42.482991 35.209142 0.018759 0.002313 0.000528 0.249570 0.000176 2.087380 NaN

In [14]:
elec.energy_per_meter()


Out[14]:
1 2 3 4 5 6 7 8 9 10 11 12
active 360.496060 1005.572193 82.958314 203.569523 203.889213 2.152638 24.351495 0.885766 0.722616 11.495919 0.558716 1.077918
apparent 386.911386 1043.941205 99.966983 208.730314 207.341398 2.173996 42.969043 0.911080 0.810098 12.258396 2.302620 NaN
reactive 30.660539 96.815441 53.965398 42.482991 35.209142 0.018759 0.002313 0.000528 0.249570 0.000176 2.087380 NaN

In [15]:
elec.total_energy()


Out[15]:
active      1897.730371
reactive     262.570156
apparent    2009.394436
dtype: float64

In [16]:
elec.total_energy?

In [17]:
elec.dropout_rate()


Out[17]:
0.61103563473527689

In [ ]: