I have been working on a script to quickly output the data values from a piece of testing equipment we use. This is one of my first projects in python outside of the small ones you do to learn various functions.
We currently test motors on a testing stand and record their position using a rotary encoder to see the position of the motor in terms of its rotation and travel.
“0” is the lowest or bottom ‘limit point’ and “7.1~” is the upper ‘limi point’. 7.1 refers to the number of complete turns, a value of 1 represents a 360 Degree Turn.
For this script I am looking for the upper ‘limit point’ values which I have stated are between 7 and 8. Because the system takes a recording at set time intervals there are a lot of repeat values which I didn’t want to display as I only wanted the values which were different from the previous row.
All the data is contained within a .xlsx sheet.
wb = load_workbook('TM_Data.xlsx')
ws = wb.active
high = range(2, ws.max_row)
for i in high:
data_range = ws.cell(row=i, column=1).value
if (data_range >7) and (data_range <8):
if ws.cell(row=i, column=1).value == ws.cell(row=i-1, column=1).value:
I am sure there is a better way to do this, but seeing as I am just starting the code is expected to be a little unprofessional.