OriginPro
 
Loading...
Searching...
No Matches
originpro.matrix.MSheet Class Reference
Inheritance diagram for originpro.matrix.MSheet:
originpro.base.DSheet originpro.base.BaseLayer originpro.base.BaseObject

Public Member Functions

def get_book (self)
 
def depth (self)
 
def depth (self, z)
 
def from_np (self, arr, dstack=False, mv=None)
 
def to_np2d (self, index=0, order='C')
 
def from_np2d (self, arr, index=0)
 
def to_np3d (self, dstack=False, order='C')
 
def show_image (self, show=True)
 
def show_thumbnails (self, show=True)
 
def show_slider (self, show=True)
 
def get_missing_value (self, index=0)
 
def xymap (self)
 
def xymap (self, xy)
 
def get_label (self, index, type_='L')
 
def get_labels (self, type_='L')
 
def set_label (self, index, val, type_='L')
 
def set_labels (self, labels, type_='L', offset=0)
 
def from_img (self, img)
 
- Public Member Functions inherited from originpro.base.DSheet
def __str__ (self)
 
def __repr__ (self)
 
def shape (self)
 
def shape (self, val)
 
def remove_DC (self)
 
def has_DC (self)
 
def from_file (self, fname, keep_DC=True, dctype='', sel='', sparks=False)
 
def lt_range (self, use_name=True)
 
def get_book (self)
 
def get_labels (self, type_='L')
 
def set_labels (self, labels, type_='L', offset=0)
 
def tabcolor (self)
 
def tabcolor (self, rgb)
 
- Public Member Functions inherited from originpro.base.BaseLayer
def __str__ (self)
 
def activate (self)
 
def destroy (self)
 
def label (self, name)
 
def remove_label (self, label)
 
def add_label (self, text, x=None, y=None)
 
def add_line (self, x1, y1, x2, y2)
 
- Public Member Functions inherited from originpro.base.BaseObject
def __init__ (self, obj)
 
def __del__ (self)
 
def __str__ (self)
 
def __bool__ (self)
 
def index (self)
 
def get_str (self, prop)
 
def get_int (self, prop)
 
def get_float (self, prop)
 
def set_str (self, prop, value)
 
def set_int (self, prop, value)
 
def set_float (self, prop, value)
 
def method_int (self, name, arg='')
 
def method_float (self, name, arg='')
 
def method_str (self, name, arg='')
 
def lt_exec (self, labtalk)
 
def name (self)
 
def name (self, value)
 
def lname (self)
 
def lname (self, value)
 
def comments (self)
 
def comments (self, value)
 
def show (self)
 
def show (self, value)
 
def usertree (self)
 
def usertree (self, tr)
 
def userprops (self)
 

Public Attributes

 depth
 
 shape
 
- Public Attributes inherited from originpro.base.BaseObject
 obj
 

Detailed Description

This class represents an Origin Matrix Sheet, it holds an instance of a PyOrigin MatrixSheet.

Member Function Documentation

◆ depth() [1/2]

def originpro.matrix.MSheet.depth (   self)
Parameters:
    none
Returns:
    return the number of matrix objects in the matrix sheet
Examples:
    >>>ms = op.find_sheet('m')
    >>>ms.depth

◆ depth() [2/2]

def originpro.matrix.MSheet.depth (   self,
  z 
)
set the number of matrix objects in the matrix sheet
Parameters:
    z(int):number of matrix objects in the matrix sheet
Returns:
    number of matrix objects in the matrix sheet
Examples:
    ms=op.new_sheet('m', hidden=True)
    ms.depth = 100
    print(ms.depth)

◆ from_img()

def originpro.matrix.MSheet.from_img (   self,
  img 
)
Convert image to Matrix

Parameters:
    img(IPage): input image page
Returns:
    None
Examples:
    ms = op.find_sheet('m')
    img = op.find_image('Image1')
    ms.from_img(img)

◆ from_np()

def originpro.matrix.MSheet.from_np (   self,
  arr,
  dstack = False,
  mv = None 
)
Set a matrix sheet data from a multi-dimensional numpy array. Existing data and MatrixObjects will be deleted.

Parameters:
    arr (numpy array): 2D for a single MatrixObject, and 3D for multiple MatrixObjects (rows, cols, N)
    dstack (bool):   True if arr as row,col,depth, False if depth,row,col
    mv(float, int): if specified, to set the internal missing value for each MatrixObject. This is needed when arr contains nan and not double type
Returns:
    None

Examples:
    ms = op.new_sheet('m')
    arr = np.array([[[1, 2, 3], [4, 5, 6]], [[11, 12, 13], [14, 15, 16]]])
    ms.from_np(arr)

◆ from_np2d()

def originpro.matrix.MSheet.from_np2d (   self,
  arr,
  index = 0 
)
Transfers data from a numpy 2D array into a single MatrixObject.

Parameters:
    arr (numpy array) 2D
    index (int): MatrixObject index in the MatrixLayer

Returns:
    None

Examples:
    index = 0
    ms = op.find_sheet('m')         # a matrix must be active
    npdata = ms.to_np2d(index)      # get as numpy array the data from one matrix object
    npdata *= 10                    # multiply every element by 10
    ms.from_np2d(npdata, index)     # set the modified array into the matrix object

◆ get_book()

def originpro.matrix.MSheet.get_book (   self)
Returns parent book of sheet.

Parameters:

Returns:
    (MBook)

Examples:
    mb = ma.get_book().add_sheet()

Reimplemented from originpro.base.DSheet.

◆ get_label()

def originpro.matrix.MSheet.get_label (   self,
  index,
  type_ = 'L' 
)
Return a Matrix object label text.

Parameters:
    index (int ): Matrix object index or 'x', 'y' for sheet XY labels
    type_ (str): A column label row character (see https://www.originlab.com/doc/LabTalk/ref/Column-Label-Row-Characters) or a user defined parameter name

Returns:
    (str)

Examples:
    ms=op.find_sheet('m')
    comment = ms.get_label('y','C')

◆ get_labels()

def originpro.matrix.MSheet.get_labels (   self,
  type_ = 'L' 
)
Return Matrix Objects label text.

Parameters:
    type_ (str): A column label row character (see https://www.originlab.com/doc/LabTalk/ref/Column-Label-Row-Characters) or a user defined parameter name

Returns:
    (list)

Examples:
    ms=op.find_sheet('M')
    comments = ms.get_labels('C')

Reimplemented from originpro.base.DSheet.

◆ get_missing_value()

def originpro.matrix.MSheet.get_missing_value (   self,
  index = 0 
)
get the internal missing value, which is needed when data type is not double.
Parameters:
    index(int): matrix object index
Returns:
    (float) missing value
Examples:
    ms=op.find_sheet('m')
    print(ms.get_missing_value())

◆ set_label()

def originpro.matrix.MSheet.set_label (   self,
  index,
  val,
  type_ = 'L' 
)
Set Matrix object label text.

Parameters:
    index (int): Matrix object index or 'x', 'y' for sheet XY labels
    val   (list): the text to set
    type_  (str): A column label row character (see https://www.originlab.com/doc/LabTalk/ref/Column-Label-Row-Characters) or a user defined parameter name
Returns:
    none
Examples:
    ms=op.find_sheet('m')
    ms.set_label('y', 'Lattitude')

◆ set_labels()

def originpro.matrix.MSheet.set_labels (   self,
  labels,
  type_ = 'L',
  offset = 0 
)
Set Matrix objects label text.

Parameters:
    labels (list): the text to set
    type_ (str): A column label row character (see https://www.originlab.com/doc/LabTalk/ref/Column-Label-Row-Characters) or a user defined parameter name
Returns:
    none
Examples:
    ms=op.find_sheet('m')
    ms.set_labels(['long name for col A', 'long name for col B'], 'L')

Reimplemented from originpro.base.DSheet.

◆ show_image()

def originpro.matrix.MSheet.show_image (   self,
  show = True 
)
Show MatrixObjects as images or as numeric values.

Parameters:
    show (bool): If True, show as images

Returns:
    None

Examples:
    ms.show_image()
    ms.show_image(False)

◆ show_slider()

def originpro.matrix.MSheet.show_slider (   self,
  show = True 
)
Show image slider for MatrixObjects.

Parameters:
    show (bool): If True, show slider

Returns:
    None

Examples:
    mat.show_slider()
    mat.show_slider(False)

◆ show_thumbnails()

def originpro.matrix.MSheet.show_thumbnails (   self,
  show = True 
)
Show thumbnail images for a MatrixObjects.

Parameters:
    show (bool): If True, show thumbnails

Returns:
    None

Examples:
    ms.show_thumbnails()
    ms.show_thumbnails(False)

◆ to_np2d()

def originpro.matrix.MSheet.to_np2d (   self,
  index = 0,
  order = 'C' 
)
Transfers data from a single MatrixObject to a numpy 2D array.

Parameters:
    index (int): MatrixObject index in the MatrixLayer
    order (str): Order of numpy array. 'C' for C-style row major order, 'F' for Fortran-style column major order

Returns:
    (numpy array) 2D

Examples:
    arr = ms.to_np2d(0)
    print(arr)
    arr = ms.to_np2d(0, 'R')
    print(arr)

◆ to_np3d()

def originpro.matrix.MSheet.to_np3d (   self,
  dstack = False,
  order = 'C' 
)
Transfers data from a MatrixSheet to a numpy 3D array.

Parameters:
    dstack (bool): True output arrays as row,col,depth, False if depth,row,col
    order (str): Order of numpy array. 'C' for C-style row major order, 'F' for Fortran-style column major order

Returns:
    (numpy array) 3D

Examples:
    arr=[]
    for i in range(10):
        tmp = np.arange(1,13).reshape(3,4)
        arr.append(tmp*(i+1))
    aa = np.dstack(arr)
    print(aa.shape)
    ma = op.new_sheet('m')
    ma.from_np(aa, True)

    bb = ma.to_np3d()
    print(bb.shape)
    mb = op.new_sheet('m')
    mb.from_np(bb)

    cc = ma.to_np3d(True)
    print(cc.shape)
    mc = op.new_sheet('m')
    mc.from_np(cc)
    mc.show_thumbnails()

◆ xymap() [1/2]

def originpro.matrix.MSheet.xymap (   self)
Get Matrix xy values.
Parameters:
    none
Returns:
    (list): x1, x2, y1, y2

Examples:
    ms=op.find_sheet('M')
    x1, x2, y1, y2 = ms.xymap

◆ xymap() [2/2]

def originpro.matrix.MSheet.xymap (   self,
  xy 
)
Set Matrix xy values.

Parameters:
    xy(list): x1, x2, y1, y2
Returns:
    (list): x1, x2, y1, y2
Examples:
    ms=op.find_sheet('M')
    ms.xymap = x1, x2, y1, y2

The documentation for this class was generated from the following file: