{"action":"created","issue":{"url":"https://api.github.com/repos/mhvk/baseband/issues/272","repository_url":"https://api.github.com/repos/mhvk/baseband","labels_url":"https://api.github.com/repos/mhvk/baseband/issues/272/labels{/name}","comments_url":"https://api.github.com/repos/mhvk/baseband/issues/272/comments","events_url":"https://api.github.com/repos/mhvk/baseband/issues/272/events","html_url":"https://github.com/mhvk/baseband/issues/272","id":363234621,"node_id":"MDU6SXNzdWUzNjMyMzQ2MjE=","number":272,"title":"Parts of file cannot be read","user":{"login":"00rebe","id":13529540,"node_id":"MDQ6VXNlcjEzNTI5NTQw","avatar_url":"https://avatars2.githubusercontent.com/u/13529540?v=4","gravatar_id":"","url":"https://api.github.com/users/00rebe","html_url":"https://github.com/00rebe","followers_url":"https://api.github.com/users/00rebe/followers","following_url":"https://api.github.com/users/00rebe/following{/other_user}","gists_url":"https://api.github.com/users/00rebe/gists{/gist_id}","starred_url":"https://api.github.com/users/00rebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/00rebe/subscriptions","organizations_url":"https://api.github.com/users/00rebe/orgs","repos_url":"https://api.github.com/users/00rebe/repos","events_url":"https://api.github.com/users/00rebe/events{/privacy}","received_events_url":"https://api.github.com/users/00rebe/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-24T16:58:21Z","updated_at":"2018-09-24T19:00:28Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hi,\r\n\r\nI noticed that in the EK036b Crab observation, certain parts of a data file cannot be read.\r\n\r\nHere is some iPython output using the file, `\"ek036b_jb_no00002.m5a\"` which can be found in the folder `\"/mnt/raid-project/gmrt/rlin/ek036b/jb/\"` to illustrate this. The file format is Mark5B.\r\n\r\n```\r\nIn[1]: from astropy.time import Time\r\n\r\nIn[2]: import astropy.units as u\r\n\r\nIn[3]: from baseband import mark5b\r\n\r\nIn[4]: data_folder = '/mnt/raid-project/gmrt/rlin/ek036b/jb/'\r\n\r\nIn[5]: filename = 'ek036b_jb_no0002.m5a' \r\n\r\nIn[6]: in_file = data_folder + filename\r\n\r\nIn[7]: nchan=16\r\n\r\nIn[8]: sample_rate = 32 * u.MHz\r\n\r\nIn[9]: ref_time = Time(57692, format='mjd')\r\n\r\nIn[10]: timestamp = Time('2016-10-31T23:36:59.999999719', format='isot', precision=9)\r\n\r\nIn[11]: fh = mark5b.open(in_file, mode='rs', nchan=nchan, sample_rate=sample_rate,\r\n                         ref_time=ref_time)\r\n\r\nIn[12]: assert fh.start_time <= timestamp <= fh.stop_time\r\n\r\nIn[13]: fh.seek(timestamp)\r\nOut[13]: 255999991\r\n\r\nIn[14]: fh.read(10)\r\n---------------------------------------------------------------------------\r\nAssertionError                            Traceback (most recent call last)\r\n<ipython-input-16-b91fbba0a544> in <module>()\r\n----> 1 fh.read(10)\r\n\r\n/mnt/raid-cita/rlin/packages/baseband/baseband/vlbi_base/base.py in read(self, count, out)\r\n    541                                                 self.samples_per_frame)\r\n    542             if frame_index != self._frame_index:\r\n--> 543                 self._frame = self._read_frame(frame_index)\r\n    544                 self._frame_index = frame_index\r\n    545\r\n\r\n/mnt/raid-cita/rlin/packages/baseband/baseband/mark5b/base.py in _read_frame(self, index)\r\n    326                  86400 * (frame.kday + frame.jday -\r\n    327                           self.header0.kday - self.header0.jday)) +\r\n--> 328                 frame['frame_nr'] - self.header0['frame_nr']) == index\r\n    329         return frame\r\n    330\r\n\r\nAssertionError:\r\n```"},"comment":{"url":"https://api.github.com/repos/mhvk/baseband/issues/comments/424087332","html_url":"https://github.com/mhvk/baseband/issues/272#issuecomment-424087332","issue_url":"https://api.github.com/repos/mhvk/baseband/issues/272","id":424087332,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDA4NzMzMg==","user":{"login":"mhvk","id":2789820,"node_id":"MDQ6VXNlcjI3ODk4MjA=","avatar_url":"https://avatars0.githubusercontent.com/u/2789820?v=4","gravatar_id":"","url":"https://api.github.com/users/mhvk","html_url":"https://github.com/mhvk","followers_url":"https://api.github.com/users/mhvk/followers","following_url":"https://api.github.com/users/mhvk/following{/other_user}","gists_url":"https://api.github.com/users/mhvk/gists{/gist_id}","starred_url":"https://api.github.com/users/mhvk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhvk/subscriptions","organizations_url":"https://api.github.com/users/mhvk/orgs","repos_url":"https://api.github.com/users/mhvk/repos","events_url":"https://api.github.com/users/mhvk/events{/privacy}","received_events_url":"https://api.github.com/users/mhvk/received_events","type":"User","site_admin":false},"created_at":"2018-09-24T19:00:28Z","updated_at":"2018-09-24T19:00:28Z","author_association":"OWNER","body":"I did a quick check and it looks like the file is missing exactly one frame:\r\n```\r\nfilename = 'crab/jb/ek036b_jb_no0002.m5a'\r\nfh = baseband.open(filename, nchan=16, ref_time=Time(57692, format='mjd'))\r\nfh.info\r\nStream information:\r\nstart_time = 2016-10-31T23:36:52.000000000\r\nstop_time = 2016-10-31T23:49:21.006171875\r\nsample_rate = 32.0 MHz\r\nshape = (23968197500, 16)\r\nformat = mark5b\r\nbps = 2\r\ncomplex_data = False\r\n\r\nFile information:\r\nframe_rate = 12800.0 Hz\r\nsamples_per_frame = 2500\r\nsample_shape = (16,)\r\n\r\nfh.fh_raw.seek(0, 2)\r\n# 96026176448\r\nfh.fh_raw.seek(0, 2) / 10016 * 2500\r\n# 23968195000.0, i.e., 2500 less than above in info.\r\n```\r\nThe file is also odd in how it deals with frame numbers but that is a separate issue (and solved by passing in `sample_rate`)...\r\n\r\nIn any case, this is trickier to fix..."}}
{"actor":{"display_login":"mhvk"}}