ross.stochastic.ST_DiskElement
Contents
ross.stochastic.ST_DiskElement#
- class ross.stochastic.ST_DiskElement(n, m, Id, Ip, tag=None, color='Firebrick', is_random=None)#
Random disk element.
Creates an object containing a list with random instances of DiskElement.
- Parameters:
- n: int
Node in which the disk will be inserted.
- mfloat, list
Mass of the disk element. Input a list to make it random.
- Idfloat, list
Diametral moment of inertia. Input a list to make it random.
- Ipfloat, list
Polar moment of inertia Input a list to make it random.
- tagstr, optional
A tag to name the element Default is None
- colorstr, optional
A color to be used when the element is represented. Default is “Firebrick”.
- is_randomlist
List of the object attributes to become random. Possibilities:
[“m”, “Id”, “Ip”]
Methods
- __init__(n, m, Id, Ip, tag=None, color='Firebrick', is_random=None)#
- classmethod from_geometry(n, material, width, i_d, o_d, tag=None, is_random=None)#
Random disk element.
Creates an object containing a list with random instances of DiskElement.from_geometry.
- Parameters:
- n: int
Node in which the disk will be inserted.
- material: ross.Material, list of ross.Material
Disk material. Input a list to make it random.
- width: float, list
The disk width. Input a list to make it random.
- i_d: float, list
Inner diameter. Input a list to make it random.
- o_d: float, list
Outer diameter. Input a list to make it random.
- tagstr, optional
A tag to name the element Default is None
- is_randomlist
List of the object attributes to become random. Possibilities:
[“material”, “width”, “i_d”, “o_d”]
- plot_random_var(var_list=None, histogram_kwargs=None, plot_kwargs=None)#
Plot histogram and the PDF.
This function creates a histogram to display the random variable distribution.
- Parameters:
- var_listlist, optional
List of random variables, in string format, to plot. Default is plotting all the random variables.
- histogram_kwargsdict, optional
Additional key word arguments can be passed to change the plotly.go.histogram (e.g. histnorm=”probability density”, nbinsx=20…). *See Plotly API to more information.
- plot_kwargsdict, optional
Additional key word arguments can be passed to change the plotly go.figure (e.g. line=dict(width=4.0, color=”royalblue”), opacity=1.0, …). *See Plotly API to more information.
- Returns:
- figPlotly graph_objects.Figure()
A figure with the histogram plots.
Examples
>>> import ross.stochastic as srs >>> elm = srs.st_disk_example() >>> fig = elm.plot_random_var(["m"]) >>> # fig.show()
- random_var(is_random, *args)#
Generate a list of objects as random attributes.
This function creates a list of objects with random values for selected attributes from ross.DiskElement.
- Parameters:
- is_randomlist
List of the object attributes to become stochastic.
- *argsdict
Dictionary instanciating the ross.DiskElement class. The attributes that are supposed to be stochastic should be set as lists of random variables.
- Returns:
- f_listgenerator
Generator of random objects.