{"action":"created","issue":{"url":"https://api.github.com/repos/hyperspy/hyperspy/issues/1517","repository_url":"https://api.github.com/repos/hyperspy/hyperspy","labels_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/1517/labels{/name}","comments_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/1517/comments","events_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/1517/events","html_url":"https://github.com/hyperspy/hyperspy/issues/1517","id":212138891,"number":1517,"title":"Map results in degenerate signals","user":{"login":"woozey","id":14218320,"avatar_url":"https://avatars3.githubusercontent.com/u/14218320?v=3","gravatar_id":"","url":"https://api.github.com/users/woozey","html_url":"https://github.com/woozey","followers_url":"https://api.github.com/users/woozey/followers","following_url":"https://api.github.com/users/woozey/following{/other_user}","gists_url":"https://api.github.com/users/woozey/gists{/gist_id}","starred_url":"https://api.github.com/users/woozey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woozey/subscriptions","organizations_url":"https://api.github.com/users/woozey/orgs","repos_url":"https://api.github.com/users/woozey/repos","events_url":"https://api.github.com/users/woozey/events{/privacy}","received_events_url":"https://api.github.com/users/woozey/received_events","type":"User","site_admin":false},"labels":[{"id":410127191,"url":"https://api.github.com/repos/hyperspy/hyperspy/labels/release:%20next%20patch","name":"release: next patch","color":"5319e7","default":false},{"id":325274696,"url":"https://api.github.com/repos/hyperspy/hyperspy/labels/status:%20fix-submitted","name":"status: fix-submitted","color":"009800","default":false},{"id":142014,"url":"https://api.github.com/repos/hyperspy/hyperspy/labels/type:%20bug","name":"type: bug","color":"e10c02","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-03-06T14:31:04Z","updated_at":"2017-05-25T10:33:21Z","closed_at":"2017-05-25T10:33:21Z","body":"I'm not sure if it is a bug or just wrong usage of `map` function, for example starting with `signal2d` and trying to use any function outputting a single value:\r\n\r\n> In [90]:\r\ntt = hs.signals.Signal2D(np.arange(9).reshape((3,3)))\r\nIn [91]:\r\nttt = tt.map(np.sum, inplace=False)\r\nIn [92]:\r\nttt\r\nOut[92]:\r\n<Signal2D, title: , dimensions: (|)>\r\n\r\nresults in a \"degenerate\" (  (|)  ) `signal2d` which is already not the best behaviour... Than converting it to a `base_signal` will be still a degenerate signal which creates troubles with saving/loading:\r\n\r\n> In [93]:\r\nttt.set_signal_type('base_signal')\r\nIn [94]:\r\nttt\r\nOut[94]:\r\n<BaseSignal, title: , dimensions: (|)>\r\nIn [96]:\r\nttt.save('./datasets/test.hdf5')\r\nIn [97]:\r\nttt_l = hs.load('./datasets/test.hdf5')\r\n\r\n> KeyError                                  Traceback (most recent call last)\r\n/Users/vadim/Work_Recent/Prog/_Py/hyperspy/hyperspy/io_plugins/hdf5.py in hdfgroup2signaldict(group, lazy)\r\n    226             axes = [i for k, i in sorted(iter(hdfgroup2dict(\r\n--> 227                 group['_list_' + str(len(exp['data'].shape)) + '_axes'],\r\n    228                 lazy=lazy).items()))]\r\n\r\n> h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/work/h5py/_objects.c:2579)()\r\n\r\n> h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/work/h5py/_objects.c:2538)()\r\n\r\n>/Users/vadim/anaconda/lib/python3.5/site-packages/h5py/_hl/group.py in __getitem__(self, name)\r\n    163         else:\r\n--> 164             oid = h5o.open(self.id, self._e(name), lapl=self._lapl)\r\n    165 \r\n\r\n> h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/work/h5py/_objects.c:2579)()\r\n\r\n> h5py/_objects.pyx in h5py._objects.with_phil.wrapper (/Users/ilan/minonda/conda-bld/work/h5py/_objects.c:2538)()\r\n\r\n> h5py/h5o.pyx in h5py.h5o.open (/Users/ilan/minonda/conda-bld/work/h5py/h5o.c:3551)()\r\n\r\n> KeyError: \"Unable to open object (Object '_list_1_axes' doesn't exist)\"\r\n\r\n> During handling of the above exception, another exception occurred:\r\n\r\n> OSError                                   Traceback (most recent call last)\r\n<ipython-input-97-1041497ad4ee> in <module>()\r\n----> 1 ttt_l = hs.load('./datasets/test.hdf5')\r\n\r\n> /Users/vadim/Work_Recent/Prog/_Py/hyperspy/hyperspy/io.py in load(filenames, signal_type, stack, stack_axis, new_axis_name, lazy, **kwds)\r\n    229             objects = [load_single_file(filename, lazy=lazy,\r\n    230                                         **kwds)\r\n--> 231                        for filename in filenames]\r\n    232 \r\n    233         if preferences.Plot.plot_on_load:\r\n\r\n> /Users/vadim/Work_Recent/Prog/_Py/hyperspy/hyperspy/io.py in <listcomp>(.0)\r\n    229             objects = [load_single_file(filename, lazy=lazy,\r\n    230                                         **kwds)\r\n--> 231                        for filename in filenames]\r\n    232 \r\n    233         if preferences.Plot.plot_on_load:\r\n\r\n> /Users/vadim/Work_Recent/Prog/_Py/hyperspy/hyperspy/io.py in load_single_file(filename, signal_type, **kwds)\r\n    275                                 reader=reader,\r\n    276                                 signal_type=signal_type,\r\n--> 277                                 **kwds)\r\n    278 \r\n    279 \r\n\r\n> /Users/vadim/Work_Recent/Prog/_Py/hyperspy/hyperspy/io.py in load_with_reader(filename, reader, signal_type, **kwds)\r\n    284     lazy = kwds.get('lazy', False)\r\n    285     file_data_list = reader.file_reader(filename,\r\n--> 286                                         **kwds)\r\n    287     objects = []\r\n    288 \r\n\r\n> /Users/vadim/Work_Recent/Prog/_Py/hyperspy/hyperspy/io_plugins/hdf5.py in file_reader(filename, backing_store, lazy, **kwds)\r\n    161         for experiment in experiments:\r\n    162             exg = f['Experiments'][experiment]\r\n--> 163             exp = hdfgroup2signaldict(exg, lazy)\r\n    164             # assign correct models, if found:\r\n    165             _tmp = {}\r\n\r\n> /Users/vadim/Work_Recent/Prog/_Py/hyperspy/hyperspy/io_plugins/hdf5.py in hdfgroup2signaldict(group, lazy)\r\n    228                 lazy=lazy).items()))]\r\n    229         except KeyError:\r\n--> 230             raise IOError(not_valid_format)\r\n    231     exp['axes'] = axes\r\n    232     if 'learning_results' in group.keys():\r\n\r\n> OSError: The file is not a valid HyperSpy hdf5 file\r\n"},"comment":{"url":"https://api.github.com/repos/hyperspy/hyperspy/issues/comments/303978743","html_url":"https://github.com/hyperspy/hyperspy/issues/1517#issuecomment-303978743","issue_url":"https://api.github.com/repos/hyperspy/hyperspy/issues/1517","id":303978743,"user":{"login":"francisco-dlp","id":989719,"avatar_url":"https://avatars3.githubusercontent.com/u/989719?v=3","gravatar_id":"","url":"https://api.github.com/users/francisco-dlp","html_url":"https://github.com/francisco-dlp","followers_url":"https://api.github.com/users/francisco-dlp/followers","following_url":"https://api.github.com/users/francisco-dlp/following{/other_user}","gists_url":"https://api.github.com/users/francisco-dlp/gists{/gist_id}","starred_url":"https://api.github.com/users/francisco-dlp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/francisco-dlp/subscriptions","organizations_url":"https://api.github.com/users/francisco-dlp/orgs","repos_url":"https://api.github.com/users/francisco-dlp/repos","events_url":"https://api.github.com/users/francisco-dlp/events{/privacy}","received_events_url":"https://api.github.com/users/francisco-dlp/received_events","type":"User","site_admin":false},"created_at":"2017-05-25T10:33:21Z","updated_at":"2017-05-25T10:33:21Z","body":"Fixed in #1518"}}
{"actor":{"display_login":"francisco-dlp"}}