Skip to content

Commit

Permalink
Let's try this to see if it helps CI8 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaycedowell committed Oct 1, 2024
1 parent bc66dea commit 449b188
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Added better warnings/error messages to lsl.misc.file_cache and lsl.misc.file_lock to help debug stuck locks
* Updated lsl.common.idf to default to using all (full + mini) stations
* Fixed the units on the final report of a DownloadBar run
* Worked on improving the performance of "return_ci8=True" in lsl.reader.ldp

3.0.1
* Fixed a problem with lsl.sim.beam.beam_response/mueller_matrix when scalar azimuth/altitude are provided
Expand Down
20 changes: 14 additions & 6 deletions lsl/reader/ldp.py
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,11 @@ def read(self, duration, time_in_samples=False, return_ci8=False):
count = [0 for i in range(self.description['nantenna'])]
if return_ci8:
data = np.zeros((self.description['nantenna'], frame_count*512), dtype=CI8)
data_view = data.view(np.int8)
else:
data = np.zeros((self.description['nantenna'], frame_count*512), dtype=np.complex64)
data_view = data.view(np.float32)

while True:
if eofFound or nFrameSets == frame_count:
break
Expand Down Expand Up @@ -795,7 +798,7 @@ def read(self, duration, time_in_samples=False, return_ci8=False):
else:
setTime = cFrame.time

data[aStand, count[aStand]*512:(count[aStand]+1)*512] = cFrame.payload.data
data_view[aStand, count[aStand]*1024:(count[aStand]+1)*1024] = cFrame.payload.data.view(data_view.dtype)
count[aStand] += 1
nFrameSets += 1

Expand All @@ -822,7 +825,7 @@ def read(self, duration, time_in_samples=False, return_ci8=False):
else:
setTime = cFrame.time

data[aStand, count[aStand]*512:(count[aStand]+1)*512] = cFrame.payload.data
data_view[aStand, count[aStand]*1024:(count[aStand]+1)*1024] = cFrame.payload.data.view(data_view.dtype)
count[aStand] += 1
nFrameSets += 1

Expand Down Expand Up @@ -1149,8 +1152,10 @@ def read(self, duration, time_in_samples=False, return_ci8=False):
setTime = None
if return_ci8:
data = np.zeros((4,frame_count*4096), dtype=CI8)
data_view = data.view(np.int8)
else:
data = np.zeros((4,frame_count*4096), dtype=np.complex64)
data_view = data.view(np.float32)

# Go!
nFrameSets = 0
Expand Down Expand Up @@ -1218,7 +1223,7 @@ def read(self, duration, time_in_samples=False, return_ci8=False):
else:
setTime = cFrame.time

data[aStand, count[aStand]*4096:(count[aStand]+1)*4096] = cFrame.payload.data
data_view[aStand, count[aStand]*8192:(count[aStand]+1)*8192] = cFrame.payload.data.view(data_view.dtype)
count[aStand] += 1
self._timetag[aStand] = cTimetag
nFrameSets += 1
Expand Down Expand Up @@ -1246,7 +1251,7 @@ def read(self, duration, time_in_samples=False, return_ci8=False):
else:
setTime = cFrame.time

data[aStand, count[aStand]*4096:(count[aStand]+1)*4096] = cFrame.payload.data
data_view[aStand, count[aStand]*8192:(count[aStand]+1)*8192] = cFrame.payload.data.view(data_view.dtype)
count[aStand] += 1
self._timetag[aStand] = cTimetag
nFrameSets += 1
Expand Down Expand Up @@ -1926,8 +1931,11 @@ def read(self, duration=None, time_in_samples=False, return_ci8=False):
count = [0 for i in range(framesPerObs)]
if return_ci8:
data = np.zeros((self.description['nantenna'], self.description['nchan'], frame_count), dtype=CI8)
data_view = data.view(np.int8)
else:
data = np.zeros((self.description['nantenna'], self.description['nchan'], frame_count), dtype=np.complex64)
data_view = data.view(np.float32)

while True:
if eofFound or nFrameSets == frame_count:
break
Expand Down Expand Up @@ -1980,7 +1988,7 @@ def read(self, duration=None, time_in_samples=False, return_ci8=False):
subData = subData.T

aStand = self.mapper.index(first_chan)
data[:,aStand*tbf.FRAME_CHANNEL_COUNT:(aStand+1)*tbf.FRAME_CHANNEL_COUNT,count[aStand]] = subData
data_view[:,aStand*2*tbf.FRAME_CHANNEL_COUNT:(aStand+1)*2*tbf.FRAME_CHANNEL_COUNT,count[aStand]] = subData.view(data_view.dtype)
count[aStand] += 1
nFrameSets += 1

Expand Down Expand Up @@ -2013,7 +2021,7 @@ def read(self, duration=None, time_in_samples=False, return_ci8=False):
subData = subData.T

aStand = self.mapper.index(first_chan)
data[:,aStand*tbf.FRAME_CHANNEL_COUNT:(aStand+1)*tbf.FRAME_CHANNEL_COUNT,count[aStand]] = subData
data_view[:,aStand*2*tbf.FRAME_CHANNEL_COUNT:(aStand+1)*2*tbf.FRAME_CHANNEL_COUNT,count[aStand]] = subData.view(data_view.dtype)
count[aStand] += 1
nFrameSets += 1

Expand Down

0 comments on commit 449b188

Please sign in to comment.