ross.stochastic.ST_PointMass
Contents
ross.stochastic.ST_PointMass#
- class ross.stochastic.ST_PointMass(n, m=None, mx=None, my=None, tag=None, color='DarkSalmon', is_random=None)#
Random point mass element.
Creates an object containing a list with random instances of PointMass.
- Parameters:
- n: int
Node in which the disk will be inserted.
- m: float, list, optional
Mass for the element. Input a list to make it random.
- mx: float, list optional
Mass for the element on the x direction. Input a list to make it random.
- my: float, optional
Mass for the element on the y direction. 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 “DarkSalmon”.
- is_randomlist
List of the object attributes to become random. Possibilities:
[“m”, “mx”, “my”]
- Attributes:
- elementslist
display the list with random point mass elements.
Methods
- __init__(n, m=None, mx=None, my=None, tag=None, color='DarkSalmon', is_random=None)#
- 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_pointmass_example() >>> fig = elm.plot_random_var(["mx"]) >>> # 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.PointMass.
- Parameters:
- is_randomlist
List of the object attributes to become stochastic.
- *argsdict
Dictionary instanciating the ross.PointMass class. The attributes that are supposed to be stochastic should be set as lists of random variables.
- Returns:
- f_listgenerator
Generator of random objects.