XOP in a loop


Version: 2023b

Type: Bug Fixes

Category: Programming

Subcategory: Python

Jira: ORG-23387


When use Python function to do Linear Fit in a loop, it fails. Create XYY data in active worksheet with random numbers then run below code to see the failure.

import originpro as op
wks_all = op.find_sheet()
for i in range(wks_all.cols):
    if i==0:
        continue
    lr = op.LinearFit()
    print(f'col({i+1}):')
    lr.set_data(wks_all, 0, i)
    rr = lr.result()
    b = rr['Parameters']['Slope']['Value']
    b_err = rr['Parameters']['Slope']['Error']
    print(f'slope={b}+-{b_err}')

Fixed in Origin2023b