{"action":"opened","issue":{"url":"https://api.github.com/repos/nilmtk/nilmtk/issues/355","labels_url":"https://api.github.com/repos/nilmtk/nilmtk/issues/355/labels{/name}","comments_url":"https://api.github.com/repos/nilmtk/nilmtk/issues/355/comments","events_url":"https://api.github.com/repos/nilmtk/nilmtk/issues/355/events","html_url":"https://github.com/nilmtk/nilmtk/issues/355","id":59271504,"number":355,"title":"Disaggregation problem with ECO dataset","user":{"login":"piskopat","id":9382099,"avatar_url":"https://avatars.githubusercontent.com/u/9382099?v=3","gravatar_id":"","url":"https://api.github.com/users/piskopat","html_url":"https://github.com/piskopat","followers_url":"https://api.github.com/users/piskopat/followers","following_url":"https://api.github.com/users/piskopat/following{/other_user}","gists_url":"https://api.github.com/users/piskopat/gists{/gist_id}","starred_url":"https://api.github.com/users/piskopat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piskopat/subscriptions","organizations_url":"https://api.github.com/users/piskopat/orgs","repos_url":"https://api.github.com/users/piskopat/repos","events_url":"https://api.github.com/users/piskopat/events{/privacy}","received_events_url":"https://api.github.com/users/piskopat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-02-27T17:58:45Z","updated_at":"2015-02-27T17:58:45Z","closed_at":null,"body":"When I try to disaggregate with the ECO dataset an error occurs. \r\nHave converted it using ```convert_eco('ECO_Dataset','eco.h5','CET')```. Training also works without any problems. But disaggregation fails. \r\n\r\nCode, which produces the error:\r\n \r\n```python\r\nfrom nilmtk import HDFDataStore\r\n\r\neco1.set_window(start='2012-09-20 00:00:00', end=None)\r\n\r\n\r\nmains1 = elec1.mains()\r\noutput1 = HDFDataStore('test1.h5', 'w')\r\n\r\n\r\nco.disaggregate(mains1, output1)\r\n```\r\nError stack:\r\n\r\n```python\r\nLoading data for meter ElecMeterID(instance=1, building=1, dataset='ECO')     ---------------------------------------------------------------------------\r\nKeyError                                  Traceback (most recent call last)\r\n<ipython-input-9-d01adba6651b> in <module>()\r\n      8 \r\n      9 \r\n---> 10 co.disaggregate(mains1, output1)\r\n     11 \r\n\r\nc:\\users\\t410\\nilmtk\\nilmtk\\disaggregate\\combinatorial_optimisation.py in disaggregate(self, mains, output_datastore, **load_kwargs)\r\n    110 \r\n    111         # Add vampire power to the model\r\n--> 112         vampire_power = mains.vampire_power()\r\n    113         print(\"vampire_power = {} watts\".format(vampire_power))\r\n    114         n_rows = state_combinations.shape[0]\r\n\r\nc:\\users\\t410\\nilmtk\\nilmtk\\electric.py in vampire_power(self, **load_kwargs)\r\n    183     def vampire_power(self, **load_kwargs):\r\n    184         # TODO: this might be a naive approach to calculating vampire power.\r\n--> 185         return self.power_series_all_data(**load_kwargs).min()\r\n    186 \r\n    187     def uptime(self, **load_kwargs):\r\n\r\nc:\\users\\t410\\nilmtk\\nilmtk\\electric.py in power_series_all_data(self, **kwargs)\r\n     81     def power_series_all_data(self, **kwargs):\r\n     82         chunks = []\r\n---> 83         for series in self.power_series(**kwargs):\r\n     84             if len(series) > 0:\r\n     85                 chunks.append(series)\r\n\r\nc:\\users\\t410\\nilmtk\\nilmtk\\electric.py in load_series(self, **kwargs)\r\n    586         physical_quantity = kwargs['physical_quantity']\r\n    587         generator = self.load(**kwargs)\r\n--> 588         for chunk in generator:\r\n    589             if chunk.empty:\r\n    590                 yield chunk\r\n\r\nc:\\users\\t410\\nilmtk\\nilmtk\\metergroup.py in load(self, **kwargs)\r\n    665             start = normalise_timestamp(section.start, freq)\r\n    666             index = pd.date_range(start, section.end, closed='left', freq=freq)\r\n--> 667             chunk = combine_chunks_from_generators(index, columns, self.meters, kwargs)\r\n    668             if chunk.empty:\r\n    669                 break\r\n\r\nc:\\users\\t410\\nilmtk\\nilmtk\\metergroup.py in combine_chunks_from_generators(index, columns, meters, kwargs)\r\n   1761         # Update columns_to_average_counter - this is necessary so we do not\r\n   1762         # add up columns like 'voltage' which should be averaged.\r\n-> 1763         physical_quantities = chunk_from_next_meter.columns.get_level_values('physical_quantity')\r\n   1764         columns_to_average = (set(PHYSICAL_QUANTITIES_TO_AVERAGE)\r\n   1765                               .intersection(physical_quantities))\r\n\r\nC:\\Users\\T410\\Anaconda\\lib\\site-packages\\pandas\\core\\index.pyc in get_level_values(self, level)\r\n   3308         values : ndarray\r\n   3309         \"\"\"\r\n-> 3310         num = self._get_level_number(level)\r\n   3311         unique = self.levels[num]  # .values\r\n   3312         labels = self.labels[num]\r\n\r\nC:\\Users\\T410\\Anaconda\\lib\\site-packages\\pandas\\core\\index.pyc in _get_level_number(self, level)\r\n   3166         except ValueError:\r\n   3167             if not isinstance(level, int):\r\n-> 3168                 raise KeyError('Level %s not found' % str(level))\r\n   3169             elif level < 0:\r\n   3170                 level += self.nlevels\r\n\r\nKeyError: 'Level physical_quantity not found'\r\n\r\n```\r\n\r\n\r\nTraining of the model is done with the folowing code:\r\n```python\r\nfrom nilmtk import DataSet, TimeFrame\r\nfrom nilmtk.disaggregate import CombinatorialOptimisation\r\n\r\neco1 = DataSet('eco.h5')\r\n\r\neco1.set_window(start=None, end='2012-09-20 00:00:00')\r\n\r\nelec1 = eco1.buildings[1].elec\r\n\r\nco = CombinatorialOptimisation()\r\nco.train(elec1)\r\n```\r\n\r\nOutput for code above:\r\n```\r\nTraining model for submeter 'ElecMeter(instance=4, building=1, dataset='ECO', appliances=[Appliance(type='fridge', instance=1)])'\r\nTraining model for submeter 'ElecMeter(instance=5, building=1, dataset='ECO', appliances=[Appliance(type='hair dryer', instance=1)])'\r\nTraining model for submeter 'ElecMeter(instance=6, building=1, dataset='ECO', appliances=[Appliance(type='coffee maker', instance=1)])'\r\nTraining model for submeter 'ElecMeter(instance=7, building=1, dataset='ECO', appliances=[Appliance(type='kettle', instance=1)])'\r\nTraining model for submeter 'ElecMeter(instance=8, building=1, dataset='ECO', appliances=[Appliance(type='washing machine', instance=1)])'\r\nTraining model for submeter 'ElecMeter(instance=9, building=1, dataset='ECO', appliances=[Appliance(type='computer', instance=1)])'\r\nTraining model for submeter 'ElecMeter(instance=10, building=1, dataset='ECO', appliances=[Appliance(type='freezer', instance=1)])'\r\nDone training!\r\nc:\\users\\t410\\nilmtk\\nilmtk\\electric.py:97: UserWarning: If you are using `preprocessing` to resample then please do not!  Instead, please use the `sample_period` parameter and set `resample=True`.\r\n  warn(\"If you are using `preprocessing` to resample then please\"\r\n```\r\n\r\n\r\nOutput of show_versions():\r\n\r\n```\r\nshow_versions()\r\n\r\nINSTALLED VERSIONS\r\n------------------\r\ncommit: None\r\npython: 2.7.8.final.0\r\npython-bits: 64\r\nOS: Windows\r\nOS-release: 7\r\nmachine: AMD64\r\nprocessor: Intel64 Family 6 Model 37 Stepping 2, GenuineIntel\r\nbyteorder: little\r\nLC_ALL: None\r\nLANG: None\r\n\r\npandas: 0.15.2\r\nnose: 1.3.4\r\nCython: 0.21.2\r\nnumpy: 1.9.1\r\nscipy: 0.15.1\r\nstatsmodels: 0.5.0\r\nIPython: 2.2.0\r\nsphinx: 1.2.3\r\npatsy: 0.3.0\r\ndateutil: 1.5\r\npytz: 2014.9\r\nbottleneck: None\r\ntables: 3.1.1\r\nnumexpr: 2.3.1\r\nmatplotlib: 1.4.2\r\nopenpyxl: 1.8.5\r\nxlrd: 0.9.3\r\nxlwt: 0.7.5\r\nxlsxwriter: 0.5.7\r\nlxml: 3.4.0\r\nbs4: 4.3.2\r\nhtml5lib: None\r\nhttplib2: None\r\napiclient: None\r\nrpy2: None\r\nsqlalchemy: 0.9.7\r\npymysql: None\r\npsycopg2: 2.5.4 (dt dec pq3 ext)\r\nNone\r\n\r\nDate: 2015-02-27 18:54:28.887000\r\nPlatform: Windows-7-6.1.7601-SP1\r\nSystem version: 2.7\r\nnilmtk version: 0.2.0.dev-e39d324\r\nnilm_metadata version: 0.2.0.dev-2eeeecb\r\nnumpy version: 1.9.1\r\nmatplotlib version: 1.4.2\r\npandas version: 0.15.2\r\nsklearn version: 0.15.2\r\n```"}}