![]() |
OpenSeesPyAssistant 1.1
OpenSeesPy for everyone
|
Module with useful functions (discretise curves, ID conventions, etc)
Carmine Schipani, 2021.
More...
Classes | |
class | IDGenerator |
Class that manage the ID generation. More... | |
Functions | |
def | DiscretizeLinearly (np.ndarray LP, int discr, plot=False, block=False, show_original_LP=True) |
This function discretize the curve 'LP' given adding the number of point given by 'discr' between every point (linearly). More... | |
def | DiscretizeLoadProtocol (np.ndarray SDR_LP, np.ndarray nr_cycles_LP, int discr_first_cycle, plot=False, block=False, show_original_peaks=True) |
Discretized a cyclic load protocol keeping a similar discretisation step throughout the different cycles and keeping in the output the extremes (peaks). More... | |
def | GridIDConvention (int pier_axis, int floor_axis, max_pier=-1, max_floor=-1) |
Function used to construct the ID of the nodes in the grid (first nodes that define the geometry of the model). More... | |
def | IDConvention (int prefix, int suffix, n_zeros_between=0) |
Function used to construct IDs for elements and offgrid nodes. More... | |
def | NodesOrientation (int iNode_ID, int jNode_ID) |
Function that finds the orientation of the vector with direction 'jNode_ID''iNode_ID'. More... | |
def | OffsetNodeIDConvention (int node_ID, str orientation, str position_i_or_j) |
Function used to add node on top of existing ones in the extremes of memebers with springs. More... | |
def | plot_member (list element_array, member_name="Member name not defined", show_element_ID=True, show_node_ID=True) |
Function that plots a set of elements. More... | |
def | plot_nodes (list nodes_array, name="Not defined", show_node_ID=True) |
Function that plots a set of nodes. More... | |
def | ProgressingPercentage (max_iter, int i, int next_step, step=10) |
Function that shows the progressing percentage of an iterative process. More... | |
Module with useful functions (discretise curves, ID conventions, etc)
Carmine Schipani, 2021.
def FunctionalFeatures.DiscretizeLinearly | ( | np.ndarray | LP, |
int | discr, | ||
plot = False , |
|||
block = False , |
|||
show_original_LP = True |
|||
) |
This function discretize the curve 'LP' given adding the number of point given by 'discr' between every point (linearly).
LP | (np.ndarray): Array (1 dimension) that stores the curve that needs to be discretized |
discr | (int): The number of points to add between every two points of 'LP' (linearly) |
plot | (bool, optional): Option to show the plot of the discretized (and also the original LP). Defaults to False. |
block | (bool, optional): Option to wait the user command 'plt.show()' (avoiding the stop of the program everytime that a plot should pop up). Defaults to False. |
show_original_LP | (bool, optional): Option to show the original LP to check if the discretized curve is correct. Defaults to True. |
Definition at line 99 of file FunctionalFeatures.py.
def FunctionalFeatures.DiscretizeLoadProtocol | ( | np.ndarray | SDR_LP, |
np.ndarray | nr_cycles_LP, | ||
int | discr_first_cycle, | ||
plot = False , |
|||
block = False , |
|||
show_original_peaks = True |
|||
) |
Discretized a cyclic load protocol keeping a similar discretisation step throughout the different cycles and keeping in the output the extremes (peaks).
SDR_LP | (np.ndarray): Array (1 dimension) that stores the peaks of the cycles. They needs to be only the positive peaks, beacuse this function will use them as the extreme for each cycle. |
nr_cycles_LP | (np.ndarray): Array (1 dimension) that stores the number of cycles for every extreme declared in 'SDR_LP' and its countepart negative. They need to be positive integers. |
discr_first_cycle | (int): The number of points from peak to peak (counting the two peaks) in the first cycle. It should be odd. |
plot | (bool, optional): Option to show the plot of the discretized (and also the original peaks). Defaults to False. |
block | (bool, optional): Option to wait the user command 'plt.show()' (avoiding the stop of the program everytime that a plot should pop up). Defaults to False. |
show_original_peaks | (bool, optional): Option to show the original peaks to check if the discretized curve is correct. The argument plot need to be True. Defaults to True. |
WrongDimension | SDR_LP and nr_cycles_LP need to be of same length. |
NegativeValue | SDR_LP needs to have only positive integers. |
NegativeValue | nr_cycles_LP needs to have only positive integers. |
NegativeValue | discr_first_cycle needs to be a positive integer. |
Definition at line 32 of file FunctionalFeatures.py.
def FunctionalFeatures.GridIDConvention | ( | int | pier_axis, |
int | floor_axis, | ||
max_pier = -1 , |
|||
max_floor = -1 |
|||
) |
Function used to construct the ID of the nodes in the grid (first nodes that define the geometry of the model).
The conventional grid node ID is xy, with x = the pier position 'pier_axis'; y = the floor position 'floor_axis'.
pier_axis | (int): The pier (or x) postion of the node. |
floor_axis | (int): The floor (or y) position of the node. |
max_pier | (int, optional): Maximal pier position of the model (used to identify the number of digits). Defaults to -1, e.g. taken equal of pier_axis. |
max_floor | (int, optional): Maximal floor position of the model (used to identify the number of digits). Defaults to -1, e.g. taken equal of floor_axis. |
NameError | Work In Progress: only 9 floors/bays. |
NegativeValue | The argument pier_axis needs to be a positive integer. |
NegativeValue | The argument floor_axis needs to be a positive integer. |
NegativeValue | The argument max_pier needs to be a positive integer if different from -1. |
NegativeValue | The argument max_floor needs to be a positive integer if different from -1. |
WrongArgument | The argument max_pier need to be equal or bigger to pier_axis |
WrongArgument | The argument max_floor need to be equal or bigger to floor_axis |
Definition at line 159 of file FunctionalFeatures.py.
def FunctionalFeatures.IDConvention | ( | int | prefix, |
int | suffix, | ||
n_zeros_between = 0 |
|||
) |
Function used to construct IDs for elements and offgrid nodes.
It appends to a positive integer number 'prefix' a number of zeros 'n_zeros_between' and at last another positive integer 'suffix'. The conventional element ID is xy(a)x'y'(a') with xya = the node ID in pier x, floor y and offgrid parameter a (optional); x'y'a' = the node ID in pier x', floor y' and offgrid parameter a' (optional). For more information on x and y, see GridIDConvention; for more information on a, see OffsetNodeIDConvention.
prefix | (int): Prefix of the new ID. For a vertical element it should be the left node ID; for an horizontal one it should be the bottom node. |
suffix | (int): Suffix of the new ID. For a vertical element it should be the right node ID; for an horizontal one it should be the top node. |
n_zeros_between | (int, optional): Number of zeros to add between the two nodes. Defaults to 0. |
NegativeValue | The argument prefix needs to be a positive integer. |
NegativeValue | The argument suffix needs to be a positive integer. |
NegativeValue | The argument n_zeros_between needs to be a positive integer. |
Definition at line 201 of file FunctionalFeatures.py.
def FunctionalFeatures.NodesOrientation | ( | int | iNode_ID, |
int | jNode_ID | ||
) |
Function that finds the orientation of the vector with direction 'jNode_ID''iNode_ID'.
If the the nodes are on top of each other, the function returns 'zero_length'.
iNode_ID | (int): Node i. |
jNode_ID | (int): Node j. |
NegativeValue | The argument iNode_ID needs to be a positive integer. |
NegativeValue | The argument jNode_ID needs to be a positive integer. |
Definition at line 270 of file FunctionalFeatures.py.
def FunctionalFeatures.OffsetNodeIDConvention | ( | int | node_ID, |
str | orientation, | ||
str | position_i_or_j | ||
) |
Function used to add node on top of existing ones in the extremes of memebers with springs.
node_ID | (int): Node that we refer to. |
orientation | (str): Orientation of the memeber. Can be 'vertical' or 'horizontal'. |
position_i_or_j | (str): Position at the start 'i' (left or bottom) or at the end 'j' (right or top) of 'node_ID' in the member. |
NegativeValue | The argument node_ID needs to be a positive integer. |
WrongArgument | The argument position_i_or_j needs to be 'i' or 'j' |
WrongArgument | The argument orientation needs to be 'vertical' or 'horizontal' |
Definition at line 232 of file FunctionalFeatures.py.
def FunctionalFeatures.plot_member | ( | list | element_array, |
member_name = "Member name not defined" , |
|||
show_element_ID = True , |
|||
show_node_ID = True |
|||
) |
Function that plots a set of elements.
It can be used to check the correctness of a part of the model or of a member. If the entire model need to be plotted, use instead 'plot_model("nodes", "elements")' from openseespy.postprocessing.Get_Rendering.
Inspired by plot_model written by Anurag Upadhyay and Christian Slotboom.
element_array | (list): An array (list of lists of one dimensions and length = 3) that store the element and nodes IDs. An element is stored in one list with 3 entries: the element ID, node i ID and node j ID. |
member_name | (str, optional): The name of what is plotted. Defaults to "Member name not defined". |
show_element_ID | (bool, optional): Option to show the element IDs. Defaults to True. |
show_node_ID | (bool, optional): Option to show the nodes IDs. Defaults to True. |
WrongDimension | element_array needs to be non-empty. |
WrongDimension | The number of entries in the lists inside the argument element_array need to be 3. |
Definition at line 296 of file FunctionalFeatures.py.
def FunctionalFeatures.plot_nodes | ( | list | nodes_array, |
name = "Not defined" , |
|||
show_node_ID = True |
|||
) |
Function that plots a set of nodes.
It can be used to check the correctness of the model's geometry. If the entire model need to be plotted, use instead 'plot_model("nodes", "elements")' from openseespy.postprocessing.Get_Rendering.
nodes_array | (list): List of 1 dimension with the IDs of the nodes to be displayed. |
name | (str, optional): Name that describe what the plot will show. Defaults to "Not defined". |
show_node_ID | (bool, optional): Option to show the node IDs. Defaults to True. |
WrongArgument | nodes_array needs to be non-empty. |
Definition at line 358 of file FunctionalFeatures.py.
def FunctionalFeatures.ProgressingPercentage | ( | max_iter, | |
int | i, | ||
int | next_step, | ||
step = 10 |
|||
) |
Function that shows the progressing percentage of an iterative process.
max_iter | (int): Maximal number of interations |
i | (int): Current iteration |
next_step | (int): Next step of the percentage (set to 0 for the first iteration and then use the return parameter) |
step | (int, optional): Size of the step (should be a fraction of 100). Defaults to 10. |
Definition at line 14 of file FunctionalFeatures.py.