SignalInitTableCheck.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # -*- coding: UTF-8 -*-
  2. """
  3. @Project :Matrix_Check
  4. @File :SignalInitTableCheck.py
  5. @Author :haojiang
  6. @Date :2022/9/28 18:15
  7. """
  8. import csv
  9. from enum import Enum
  10. class TableColumnHeaderType(Enum):
  11. Signal = 0
  12. Type = 1
  13. Bit = 2
  14. App = 3
  15. AppValue = 4
  16. Raw = 5
  17. RawValue = 6
  18. Controller = 7
  19. Frame = 8
  20. PDU = 9
  21. class SignalInitTableCheck:
  22. Column_Need_Check = [TableColumnHeaderType.Signal.value,
  23. TableColumnHeaderType.Type.value,
  24. TableColumnHeaderType.Bit.value,
  25. TableColumnHeaderType.RawValue.value]
  26. def __init__(self):
  27. pass
  28. def get_csv_data(self, file_name: str):
  29. with open(file_name, 'r') as csvfile:
  30. spamreader = csv.reader(csvfile, delimiter=',')
  31. is_header_readed = False
  32. table_data = list()
  33. for row in spamreader:
  34. if not is_header_readed:
  35. is_header_readed = True
  36. continue
  37. table_data.append([row[column] for column in SignalInitTableCheck.Column_Need_Check])
  38. return table_data
  39. if __name__ == '__main__':
  40. matrix_path = r'D:\01_Work\02_WP\EP39_EREV\branch\src\MatrixAssistant_V2.0\EP39_EREV_SIMU+_GW\20220729-qy1-EP39EREV_SIMU+_GW_Rx_初值表.csv'
  41. sc = SignalInitTableCheck()
  42. sc.get_csv_data(matrix_path)