From 2afc8d6234bceab5433503f9a578459afedb3aa0 Mon Sep 17 00:00:00 2001 From: erhan-k Date: Tue, 2 Feb 2021 18:37:00 -0600 Subject: [PATCH 1/3] Update JROfileread.py added lines that extracts from the JRO header the pulsing code information. JROfileread.py is a shorter version jroread.py ... is it faster? that needs to be examined. --- isrpy/readpack/JROfileread.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/isrpy/readpack/JROfileread.py b/isrpy/readpack/JROfileread.py index d12fc82..e477dd2 100644 --- a/isrpy/readpack/JROfileread.py +++ b/isrpy/readpack/JROfileread.py @@ -44,6 +44,21 @@ def nextdatablock(self): # method to read headaer and data block by block self.dh=dh self.hts=h0+dh*arange(nsa) + tauH=fid.read(nTaus) # tau's header + + if CodeType != 0: # dynamic header info about codes + + codeH=fid.read(8) + numCodes,numBauds=unpack(' Date: Tue, 2 Feb 2021 18:51:27 -0600 Subject: [PATCH 2/3] Update JROfileread.py a minor modification in JROfileread.py about nTaus!!! --- isrpy/readpack/JROfileread.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/isrpy/readpack/JROfileread.py b/isrpy/readpack/JROfileread.py index e477dd2..8041822 100644 --- a/isrpy/readpack/JROfileread.py +++ b/isrpy/readpack/JROfileread.py @@ -44,7 +44,10 @@ def nextdatablock(self): # method to read headaer and data block by block self.dh=dh self.hts=h0+dh*arange(nsa) - tauH=fid.read(nTaus) # tau's header + + if nTaus !=0: + tauH=fid.read(nTaus) # tau's header + self.tauH=tauH if CodeType != 0: # dynamic header info about codes @@ -58,7 +61,7 @@ def nextdatablock(self): # method to read headaer and data block by block tmpc=fromfile(fid,'u1',4*int(ceil(numBauds/32.))) Codes+=[unpackbits(tmpc[::-1])[-1*numBauds:]] self.Codes=Codes - + fid.seek(hlength,0) # now go to data block self.datablock=datablock # read data block after here From 25b06c242880d5d9f8847778abc41a498fdb35bb Mon Sep 17 00:00:00 2001 From: erhan-k Date: Tue, 2 Feb 2021 20:13:07 -0600 Subject: [PATCH 3/3] Update JROfileread.py use ndarray to unpack --- isrpy/readpack/JROfileread.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/isrpy/readpack/JROfileread.py b/isrpy/readpack/JROfileread.py index 8041822..67c83ba 100644 --- a/isrpy/readpack/JROfileread.py +++ b/isrpy/readpack/JROfileread.py @@ -44,7 +44,6 @@ def nextdatablock(self): # method to read headaer and data block by block self.dh=dh self.hts=h0+dh*arange(nsa) - if nTaus !=0: tauH=fid.read(nTaus) # tau's header self.tauH=tauH @@ -71,9 +70,8 @@ def nextdatablock(self): # method to read headaer and data block by block allsamples=self.nSamples*self.nChannels*2 data2read=self.nCycles*allsamples data=fid.read(data2read*2) # read and unpack data block - data=array(unpack('h'*data2read,data)) - data=reshape(data,(self.nCycles,self.nSamples,self.nChannels,2)) + data=ndarray(buffer=data,dtype='