DataSet

Class DataSet()

DataSet(parent='MODEL', name='Body_n', label='Body_n', active=True, 
definition_name='def_ds_n', definition_file='', definition_type='')

Creates a data set.

Keyword Arguments

Argument Data Type Description Default
name String The variable name. DataSet_n, for next available integer n.
label String The descriptive label. DataSet_n, for next available integer n.
parent Object The parent. MODEL
active Boolean Used to activate or deactivate this entity. True
definition_name String The definition name of system. def_ds_n for next available integer n.
definition_file String The full path of a file when the definition name is defined in a definition file. ''
definition_type String Definition type of this system. ''

Readonly Properties

datas Dict List of all the datas inside this dataset. []
dd DataSetDict Dictionary of all datas inside the dataset with the keys as variable names of datas and values as the values of these datas. {}
definition_file_modified Bool Specifies if the definition is modified after loading it.
linked_definitions Reference List of system handles which have share the same definition name.
is_linked Bool Indicates whether definition name of this system is used by any other system in the model.
atts Dict Dictionary of all attachment's local variable names and their handles.

Instances

Instance Type Description
value Nonlinear The value or expression describing the input to the transfer function.
u_var SolverVariable The implicit solver variable.
u_array SolverArray The u solver array.
x_array SolverArray The x solver array.
y_array SolverArray The y solver array.

Methods

addAttachment(type='Point', value=None, candidate_tag='', **kwds

Adds an attachment or a list of attachments to the entity.

Parameters:

type (str) - Class name of the attachment to be added. Point if not specified.

value (multiple) - Value the attachment entity handle should be resolved to. None if not specified.

candidate_tag (str) - Candidate tag for this attachment.

att_list (dict) - Dictionary of attachment variable names and attachments values. If you specify this argument you do not need any other argument.

att_listname (str) - Variable name of the attachment that is to be added. If the attachment with that name already exists then the attachment's value will be changed to specified value.

Returns:

Python handle of the added data.

addData(type='RealData', **kwds)

Adds a data to this dataset of type=type.

Parameters:

type (str) - Class name of the data to be added. RealData if not specified.

Keyword Arguments:

name (str) - Variable name of the data.

label (str) - Label of the data.

active (Bool) - Determines if this data is active or not.

value (Any) - Value of the added data.

Returns:

Returns python handle of the added data.

Return type:

Object

Examples

Create a dataset, add datas to it and modify its values.
>>> from hw import mview >>> ds1 = mview.DataSet(name='ds_0')
>>> #Add a RealData member using addData function 
>>> ds1.addData(name = "r_0", type="RealData", value=3.5) 
>>> ds1.r_0.value 3.5 
>>> #Create a StringData 
>>> s1 = mview.StringData(parent=ds1, value='Newton') 
>>> s1.value 'Newton' 
>>> #Use the datas property to get a dictionary of data varnames and its values
>>> ds1.datas['StringData_1'].value 'Newton' 
>>> #Create OptionData in dataset with menu options 'Point', 'Body' and 'Marker' 
>>> ds1.addData(name = "op_0", type="OptionData", types=['Point', 'Body', 'Marker'], value = "Body") 
>>> ds1.op_0.value 'Body' 
>>> #Get the available option menus 
>>> ds1.op_0.types ['Point', 'Body', 'Marker'] 
>>> #Create a filename data 
>>> ds1.addData(name = "f_0", type = "FileNameData", filter="*.txt", ftype="OUTPUT",value="C:/example.txt") 
>>> #Add an attachment to this dataset 
>>> ds1.addAttachment(type="Marker")