{"action":"created","issue":{"url":"https://api.github.com/repos/G-Node/nixpy/issues/116","labels_url":"https://api.github.com/repos/G-Node/nixpy/issues/116/labels{/name}","comments_url":"https://api.github.com/repos/G-Node/nixpy/issues/116/comments","events_url":"https://api.github.com/repos/G-Node/nixpy/issues/116/events","html_url":"https://github.com/G-Node/nixpy/issues/116","id":53755551,"number":116,"title":"tag.retrieve_data gives Segmentation Fault","user":{"login":"ajayramak","id":5683202,"avatar_url":"https://avatars.githubusercontent.com/u/5683202?v=3","gravatar_id":"","url":"https://api.github.com/users/ajayramak","html_url":"https://github.com/ajayramak","followers_url":"https://api.github.com/users/ajayramak/followers","following_url":"https://api.github.com/users/ajayramak/following{/other_user}","gists_url":"https://api.github.com/users/ajayramak/gists{/gist_id}","starred_url":"https://api.github.com/users/ajayramak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajayramak/subscriptions","organizations_url":"https://api.github.com/users/ajayramak/orgs","repos_url":"https://api.github.com/users/ajayramak/repos","events_url":"https://api.github.com/users/ajayramak/events{/privacy}","received_events_url":"https://api.github.com/users/ajayramak/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/G-Node/nixpy/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/G-Node/nixpy/labels/in+progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"jgrewe","id":772522,"avatar_url":"https://avatars.githubusercontent.com/u/772522?v=3","gravatar_id":"","url":"https://api.github.com/users/jgrewe","html_url":"https://github.com/jgrewe","followers_url":"https://api.github.com/users/jgrewe/followers","following_url":"https://api.github.com/users/jgrewe/following{/other_user}","gists_url":"https://api.github.com/users/jgrewe/gists{/gist_id}","starred_url":"https://api.github.com/users/jgrewe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgrewe/subscriptions","organizations_url":"https://api.github.com/users/jgrewe/orgs","repos_url":"https://api.github.com/users/jgrewe/repos","events_url":"https://api.github.com/users/jgrewe/events{/privacy}","received_events_url":"https://api.github.com/users/jgrewe/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-01-08T14:25:35Z","updated_at":"2015-01-09T10:02:12Z","closed_at":null,"body":"Dear Nix Developer team\r\n\r\nI tried to use tag.retrieve_data and got a Segmentation Fault . Here is the test code\r\n\r\n    import nix\r\n    import numpy as np\r\n    from math import pi as PI\r\n    import os\r\n    from matplotlib import pyplot as plt\r\n\r\n\r\n\r\n    fs = 1000.0\r\n    t = np.arange(0, 10, 1 / fs)\r\n    sig1 = np.random.rand(t.shape[0])\r\n    sig2 = np.sin(2 * PI * 0.5 * t)\r\n\r\n    fle = 'test.h5'\r\n\r\n    if os.path.isfile(os.path.join(os.getcwd(), fle)):\r\n      os.remove(fle)\r\n      \r\n    nixFile = nix.File.open(fle, nix.FileMode.Overwrite)\r\n    blk = nixFile.create_block('blk1', 'testBlock')\r\n    da1 = blk.create_data_array('sig1', 'test',  data=sig1)\r\n    dim = da1.append_sampled_dimension(1 / fs)\r\n    dim.unit = 's'\r\n    da2 = blk.create_data_array('sig2', 'test', data=sig2)\r\n    dim = da2.append_sampled_dimension(1 / fs)\r\n    dim.unit = 's'\r\n\r\n    tag1 = blk.create_tag('tag1', 'test', [2])\r\n    tag1.extent = [0.5]\r\n\r\n    tag1.references.append(da1)\r\n    tag1.references.append(da2)\r\n\r\n    snip1 = tag1.retrieve_data(0)\r\n    t1 = np.linspace(0, tag1.extent[0], snip1.shape[0]) + tag1.position[0]\r\n\r\n    plt.plot(t1, snip1)\r\n    plt.show()\r\n\r\n\r\n\r\nPlease help me.\r\n\r\nThanks\r\nAjay\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/G-Node/nixpy/issues/comments/69314814","html_url":"https://github.com/G-Node/nixpy/issues/116#issuecomment-69314814","issue_url":"https://api.github.com/repos/G-Node/nixpy/issues/116","id":69314814,"user":{"login":"ajayramak","id":5683202,"avatar_url":"https://avatars.githubusercontent.com/u/5683202?v=3","gravatar_id":"","url":"https://api.github.com/users/ajayramak","html_url":"https://github.com/ajayramak","followers_url":"https://api.github.com/users/ajayramak/followers","following_url":"https://api.github.com/users/ajayramak/following{/other_user}","gists_url":"https://api.github.com/users/ajayramak/gists{/gist_id}","starred_url":"https://api.github.com/users/ajayramak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajayramak/subscriptions","organizations_url":"https://api.github.com/users/ajayramak/orgs","repos_url":"https://api.github.com/users/ajayramak/repos","events_url":"https://api.github.com/users/ajayramak/events{/privacy}","received_events_url":"https://api.github.com/users/ajayramak/received_events","type":"User","site_admin":false},"created_at":"2015-01-09T10:02:12Z","updated_at":"2015-01-09T10:02:12Z","body":"Dear Jan and Adrian\r\n\r\nI added a unit to the tag and the segmentation fault does not occur any more. But the retrieved value is wrong when the reference has an offset. Here is the test code:\r\n\r\n    import nix\r\n    import numpy as np\r\n    from math import pi as PI\r\n    import os\r\n    from matplotlib import pyplot as plt\r\n\r\n\r\n\r\n    sig1 = np.arange(2, 10)\r\n\r\n    fle = 'test.h5'\r\n\r\n    if os.path.isfile(os.path.join(os.getcwd(), fle)):\r\n      os.remove(fle)\r\n      \r\n    nixFile = nix.File.open(fle, nix.FileMode.Overwrite)\r\n    blk = nixFile.create_block('blk1', 'testBlock')\r\n    da1 = blk.create_data_array('sig1', 'test',  data=sig1)\r\n    dim = da1.append_sampled_dimension(0.1)\r\n    dim.unit = 's'\r\n    dim.offset = 0.2\r\n\r\n\r\n    tag1 = blk.create_tag('tag1', 'test', [0.4])\r\n    tag1.extent = [0.2]\r\n    tag1.units = ['s']\r\n    tag1.references.append(da1)\r\n\r\n\r\n    snip1 = tag1.retrieve_data(0)[:]\r\n    print(snip1)\r\n\r\nExpected output is [4 5] whereas the actual output is [6 7].\r\n\r\nPlease have a look.\r\n\r\nThanks and Cheers\r\nAjay\r\n\r\n"}}