Functions | |
| _get_from_type (items, type) | |
| _type_from_ext (ext) | |
| _is_good_sn (name) | |
| _new_page (type, lname, template, hidden) | |
| _new_page2 (type, lname, template, hidden) | |
| _make_page (page, type_='') | |
| Union[WBook, MBook] | new_book (type=_WBOOK_TYPE, lname='', template='', hidden=False) |
| GPage | new_graph (lname='', template='', hidden=False) |
| IPage | new_image (lname='', hidden=False) |
| Notes | new_notes (name='') |
| Union[WSheet, MSheet] | new_sheet (type=_WBOOK_TYPE, lname='', template='', hidden=False) |
| _get_item (coll, index) | |
| _get_page (type, index) | |
| _get_sheet (index, type) | |
| Union[WBook, MBook, GPage, IPage] | get_page (type, index=0) |
| Union[WSheet, MSheet] | find_sheet (type=_WBOOK_TYPE, ref='') |
| Union[WBook, MBook] | find_book (type=_WBOOK_TYPE, name='') |
| _find_page (name, typestr, type_, pagecls) | |
| GPage | find_graph (name='') |
| IPage | find_image (name='') |
| Notes | find_notes (name='') |
| Union[WBook, MBook] | load_book (fname) |
| List[GPage] | graph_list (select='f', inc_embed=False) |
| Union[WBook, MBook, GPage, IPage] | pages (type_='') |
| open (file, readonly=False, asksave=False) | |
| new (asksave=False) | |
| save (file='') | |
Variables | |
| str | _WBOOK_TYPE = 'w' |
| str | _MBOOK_TYPE = 'm' |
| str | _GPAGE_TYPE = 'g' |
| str | _IPAGE_TYPE = 'i' |
| dict | _PAGE_CLS |
| dict | _LAYER_CLS |
| dict | _PAGE_TYPES |
| dict | _PO_PAGE_TYPES = {v:k for k, v in _PAGE_TYPES.items()} |
originpro A package for interacting with Origin software via Python. Copyright (c) 2020 OriginLab Corporation
|
protected |
WorksheetPages etc has no index, and no slice
Find the work or matrixbook by name (short name) and return a WBook or MBook object.
Parameters:
type (str): Specify 'w' for WBook object or 'm' for MBook object
name (str or int): Name of book. If empty, then active book. If int, then from the collection of books by index
Returns:
(WBook or MBook or None)
Examples:
wb = op.find_book()#if active book is a workbook
mb = op.find_book('m', 'MBook2')
| GPage originpro.project.find_graph | ( | name = '' | ) |
Find the named graph (short name) and return a GPage object.
Parameters:
name (str or int) Name of graph. If empty, then active graph, if int, then index into graph page collection
Returns:
(GPage or None)
Examples:
g = op.find_graph('Graph2')
glayer=op.find_graph()[0]
| IPage originpro.project.find_image | ( | name = '' | ) |
Find the named Image Window and return a IPage object.
Parameters:
name (str or int) Name of Image Window. If empty, then active Image Page, int, then index into Image Page collection
Returns:
(IPage or None)
Examples:
import numpy as np
im = op.find_image('Image1')
data = im.to_np()
dataUpsideDown = np.flip(data, 1)
im.from_np(dataUpsideDown)
| Notes originpro.project.find_notes | ( | name = '' | ) |
Find the named Notes Window and return a Notes object.
Parameters:
name (str) Name of Image window. If empty, then active Notes window.
Returns:
(Notes or None)
Examples:
nt1 = op.find_notes('Notes')
nt2 = op.find_notes()
Find the Sheet referenced by ref (an Origin range string). Default will return active worksheet.
Parameters:
type (str): Specify 'w' for WBook object or 'm' for MBook object
ref (str or int): [book]sheet, an Origin range specification. Can also be just book name to assume active sheet,
so the following are the same if book has only one sheet
'[book1]1', '[book1]1!', 'book1'
You may also pass in an integer for the book index, like 0 for the first book
Returns:
(WSheet or MSheet or None)
Examples:
wks1 = op.find_sheet() #when active book that is a workbook
wks2 = op.find_sheet('w', '[Book1]Sheet2') #when you need a specific sheet
m1 = op.find_sheet('m') #when active is a matrix book
m2 = op.find_sheet('m','MBook1') #when there is only one sheet, use simpler notation
wks3 = op.find_sheet('w',0)# see if there is any workbook at all
get WBook, MBook, GPage, IPage by index
Parameters:
none
Returns:
WBook or MBook or GPage or IPage None
Examples:
w=op.get_page('w', 0)//there should a workbook exist
| List[GPage] originpro.project.graph_list | ( | select = 'f', | |
| inc_embed = False ) |
Returns a list object of GPages representing graphs in the current folder, graphs open in current folder, or graphs in project.
Parameters:
select (str): Specify 'f' for current folder, 'o' for graphs open in current folder, or 'p' for graphs in project
inc_embed (bool): Include embedded graphs in the list, this is supported for 'p' only
Returns:
(list) list of GPage objects
Examples:
graphs1 = op.graph_list('p', True)
graphs2 = op.graph_list('f')
Loads a work or matrixbook from file and returns a WBook or MBook object.
Parameters:
fname (str): File path and name. If file name only, the load from UFF
Returns:
(WBook or MBook or None)
Examples:
wb1 = op.load_book('My Analysis Template.ogwu')#from user file folder
wb2 = op.load_book(op.path('e')+r'Samples\Batch Processing\Peak Analysis.ogw')
| originpro.project.new | ( | asksave = False | ) |
Starts a new project.
Parameters:
asksave (bool)P: If True, prompt user to save current project is it is modified
Returns:
None
Examples:
op.new()
op.new(True)
| Union[WBook, MBook] originpro.project.new_book | ( | type = _WBOOK_TYPE, | |
| lname = '', | |||
| template = '', | |||
| hidden = False ) |
Create a new workbook or matrixbook.
Parameters:
type(str): Specify 'w' for WBook object or 'm' for MBook object
lname (str): Long Name of the book
template (str): Template name. May exclude extension. Does not support OGWU files (e.g. analysis templates). In that case, use load_book.
hidden (bool): True makes newly created book hidden
Returns:
(WBook or MBook or None)
Examples:
wb1 = op.new_book()
wb2 = op.new_book('w', 'My Template')
mb = op.new_book('m', hidden=True)
See Also:
load_book
| GPage originpro.project.new_graph | ( | lname = '', | |
| template = '', | |||
| hidden = False ) |
Create a new empty graph optionally from a template.
Parameters:
lname (str): Long Name of the graph
template (str): Template name. May exclude extension. If not specified, use origin.otp.
hidden (bool): True makes newly created graph hidden
Returns:
(GPage or None)
Examples:
g1 = op.new_graph()
g2 = op.new_graph('My Graph')
g3 = op.new_graph(template=op.path('e') + '3Ys_Y-Y-Y.otp')
| IPage originpro.project.new_image | ( | lname = '', | |
| hidden = False ) |
Create a new image window
Parameters:
lname (str): Long Name of the new window
hidden (bool): True makes newly created window hidden
Returns:
IPage or None
Examples:
im = op.new_image()
| Notes originpro.project.new_notes | ( | name = '' | ) |
Create a new Notes window
Parameters:
lname (str): Name of the new window
Returns:
Notes or None
Examples:
nt = op.new_notes()
| Union[WSheet, MSheet] originpro.project.new_sheet | ( | type = _WBOOK_TYPE, | |
| lname = '', | |||
| template = '', | |||
| hidden = False ) |
Create a new work or matrixbook and return the first sheet as a WSheet or MSheet.
Parameters:
type (str): Specify 'w' for WBook object or 'm' for MBook object
lname (str): Long Name of the book
template (str): Template name. May exclude extension
hidden (bool): True makes newly created book hidden
Returns:
(WSheet or MSheet or None)
Examples:
wks1 = op.new_sheet()
wks2 = op.new_sheet('w', 'My Template.otwu')
mxs = op.new_sheet('m', hidden=True)
| originpro.project.open | ( | file, | |
| readonly = False, | |||
| asksave = False ) |
Opens an Origin project file.
Parameters:
file (str): File path and name
readonly (bool): Opern the file as read-only
asksave (bool): If True, prompt user to save current project is it is modified
Returns:
(bool) True if project is successfully loaded
Examples:
op.open('C:\path\to\My Project.opju')
All pages in project.
Parameters:
type_ (str): Page type, can be 'w', 'm', 'g', 'i'
Returns:
Page Objects
Examples:
wps=op.pages('w')
w1=next(wps)
wshet=w1[0]
| originpro.project.save | ( | file = '' | ) |
Saves the current project. If no file name given, then save to current project file.
Parameters:
file (str): Path and file name to save the project as. Save to current project file if blank.
Returns:
(bool) True if project is successfully saved
Examples
op.save('C:\path\to\My Project.opju')
op.save()
|
protected |
|
protected |
|
protected |