Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

JIRA

SUMMARY

DESCRIPTION

DETAILS

ORG-22537

Support Intellisense in Python Console

Support Intellisense in Python Console.

Autocomplete hint when typing code in Connectivity: Python Console and Set Column Values dialog.

Use system variable @NPYC=0 to turn it off. Default is 1

ORG-23031

Python originpro to support setting column formula

New method set_formula introduced.

Examples,

Code Block
import originpro as op
wks = op.find_sheet()
wks.set_formula('B', 'A+1')

ORG-22837

Support Missing Values for other data types in Python

Improve PyOrigin and OriginExt to handle custom missing value setting by wks.col.missing.

For originpro packeage,

  • Improve to_np2d, to_np3d and from_np to handle non-double type missing value.

  • Added get_missing_value in MSheet.

  • Added mv argument to from_np.

ORG-22869

Support for Python Script in Buttons

Python can be used in button script now.

To use Python, script must begin either with ''', “““, or the import` keyword

ORG-23210

WSheet ,WBook, MBook ,MSheet ,GPage comments property and Worksheet “User” Tree Access

Added comments property to Page and Layerclasses. Added access to WSheet “User” tree. See Details for code examples.

Examples:

Code Block
wks = op.find_sheet()
wks.comments = 'These are sheet comments'
c = wks.comments

wks.set_str('tree.test.group', 'Group #3')
s = wks.get_str('tree.test.group')

wks.set_int('tree.test.run', 123)
n = wks.get_int('tree.test.run')

ORG-23210

Support specifying DC to use for WSheet from_file method

Third argument (dctype) added to WSheet from_file method allows code to specify exactly which DC to use for import by specifying the DC name. If argument not specified, method will either us CSV or Excel DC.

Example uses the ‘Import Filter’ DC to import the CSV file. User has previously created a custom Import Filter for CSV files. Doing it this way ensures the users import filter is used and not the CSV DC.

Code Block
fn = op.file_dialog('*.csv')
wks=op.find_sheet()
wks.from_file(fn, True, dctype='Import Filter')

ORG-23210

Support managing project explorer

Add method such as folder navigate, folder move, etc.

New methods are added:

Code Block
op.pe.cd #pe_cd
op.pe.search #pe_path
op.pe.mkdir #pe_mkdir
op.pe.move #pe_move

ORG-23210

Support Folder object

Added path and pages function to Folder class

Simple example:

Code Block
op.new_sheet('w')
op.new_sheet('m')
op.new_graph()
pe = op.pe
active = pe.active_folder()
print(active.path)
print(list(active.pages()))
print(list(active.pages('w')))

ORG-23210

Support creating plot with error bars

method add_plot() is improved to support error bars

Code Block
def add_plot(self, obj, coly=-1, colx=-1, colz=-1, type = 's', colyerr=-1, colxerr=-1):

ORG-23239

Better support for importing into multiple sheets for Python-based Import Filter

New method in originpro package, get_import_sheet(), has been added.

Blog post coming soon explaining how and why to use this new method. But briefly, something like:

Code Block
def import_to_sheet(fname, index):
    data = read_file(fname, index)
    wks = op.imp.get_sheet(index)
    wks.from_df(data)

ORG-23240

Python Tree Access

  1. support converting Origin user tree to Python dictionary.

  2. support reading data from report sheet.

  1. Added lt_tree_to_dict() method and usertree, userprops properties.

  2. report_table() method to WSheet class.

ORG-23387

Curve Fit with Python

  1. Python function to do linear curve fit and non-linear curve fit

  2. It supports nonlinear surface fit by improve set_data(). For example: set_data(wks, 0, 1, z=2)

  3. It supports nonlinear matrix fit by introduce set_mdata(). For example: set_mdata(ma,1)

  4. It supports nonlinear multiple variables fit by introduce: set_range(). For example: set_range('[Book1]1!(1,2,3)')

  5. It also supports both Implicit fit and explicit fit by adding argument method for NLFit class. For example: op.NLFit('Ellipse', 'odr')

Linear curve fit

Code Block
import originpro as op
lr = op.LinearFit()
lr.set_data(wks, 0, 1)
lr = op.LinearFit()

# No report sheet
rr = lr.result()
# generate report sheet
r, c = lr.report(1)
wReport=op.find_sheet('w', r)
wCurves=op.find_sheet('w', c)

Nonlinear curve fit

Code Block
import originpro as op
model = op.NLFit('Gauss')
model.set_data(wks, 0, 1)
model.fix_param('y0', 0)
model.fit()

# No report sheet
ret=model.result()
xc=ret['xc']
# generate report sheet
r, c = model.report(True)
wReport=op.find_sheet('w', r)
wCurves=op.find_sheet('w', c)

ORG-23788

Release Origin After Python Script Finished

  1. Added op.attach()

and op.release() functions
  1. function to originpro in Origin 2021b Sr2

  2. Fixed the issue that exit python control can not release Origin.

op.attach(): connect to running Origin instance.

op.releaseexit(): exit python control from CMD, and then release Origin from Python, without closing Origin.

...