Skip to content

Commit

Permalink
Update Python Reader (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Teddy-van-Jerry committed Aug 30, 2023
1 parent efd5916 commit 52031f5
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion reader/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
import time
import datetime
import numpy as np

# plot
import matplotlib.pyplot as plt

def read_parquet_file(file_path):
"""
Expand Down Expand Up @@ -39,6 +40,25 @@ def print_table(df):
# print the data table
print_table(df)

# get the CIR of a row
CIR = df.iloc[2, 2:258]

# Get I and Q data, from column CIR0 to CIR255.
# Each data is 32 bits, and I has the higher 16 bits, Q has the lower 16 bits, interpret as 16-bit signed integer.
CIR_I = []
CIR_Q = []
for i in range(0, 256):
CIR_I.append(np.int16(CIR[i] >> 16))
CIR_Q.append(np.int16(CIR[i] & 0xffff))

# plot
plt.figure(figsize=(10, 5))
plt.plot(CIR_I, label='I')
plt.plot(CIR_Q, label='Q')
plt.legend()
plt.show()


# end time
end_time = time.time()
print('Time elapsed: ', end_time - start_time, ' seconds')

0 comments on commit 52031f5

Please sign in to comment.