original_docstring: Evaluate the mode shapes for the rotor.
  
          This analysis presents the vibration mode for each critical speed.
          The importance is to locate the critical node, where the displacement
          is the greatest, then apply loads for unbalance response (stability
          level 1)
  
          Parameters
          ----------
          mode : int
              the n'th vibration mode
  
          Returns
          -------
          node_min, node_max : list
              List with nodes where the largest absolute displacements occur
  
          Example
          -------
          >>> import ross as rs
          >>> report = rs.report_example()
          >>> fig = report.mode_shape(mode=0)
          >>> report.node_min
          array([], dtype=float64)
          >>> report.node_max
          array([3.])
          
docstring: Evaluate the mode shapes for the rotor.
  This analysis presents the vibration mode for each critical speed.
  The importance is to locate the critical node, where the displacement
  is the greatest, then apply loads for unbalance response (stability
  level 1)
  
  Parameters
  
  mode : int
  the n'th vibration mode
  
  Returns
  
  node_min, node_max : list
  List with nodes where the largest absolute displacements occur
  
  Example
  
  
docstring_tokens: Evaluate the mode shapes for the rotor . This analysis presents the vibration mode for each critical speed . The importance is to locate the critical node where the displacement is the greatest then apply loads for unbalance response ( stability level 1 ) Parameters mode : int the n ' th vibration mode Returns node_min node_max : list List with nodes where the largest absolute displacements occur Example
code: def mode_shape(self, mode):
          """Evaluate the mode shapes for the rotor.
  
          This analysis presents the vibration mode for each critical speed.
          The importance is to locate the critical node, where the displacement
          is the greatest, then apply loads for unbalance response (stability
          level 1)
  
          Parameters
          ----------
          mode : int
              the n'th vibration mode
  
          Returns
          -------
          node_min, node_max : list
              List with nodes where the largest absolute displacements occur
  
          Example
          -------
          >>> import ross as rs
          >>> report = rs.report_example()
          >>> fig = report.mode_shape(mode=0)
          >>> report.node_min
          array([], dtype=float64)
          >>> report.node_max
          array([3.])
          """
          nodes_pos = self.rotor.nodes_pos
          df_bearings = self.rotor.df_bearings
          df_disks = self.rotor.df_disks
  
          modal = self.rotor.run_modal(speed=self.maxspeed)
          xn, yn, zn, xc, yc, zc_pos, nn = modal.calc_mode_shape(mode=mode)
  
          # reduce 3D view to 2D view
          vn = np.zeros(len(zn))
          for i in range(len(zn)):
              theta = np.arctan(xn[i] / yn[i])
              vn[i] = xn[i] * np.sin(theta) + yn[i] * np.cos(theta)
  
          # remove repetitive values from zn and vn
          idx_remove = []
          for i in range(1, len(zn)):
              if zn[i] == zn[i - 1]:
                  idx_remove.append(i)
          zn = np.delete(zn, idx_remove)
          vn = np.delete(vn, idx_remove)
  
          node_min = np.array([])
          node_max = np.array([])
  
          if self.rotor_type == "between_bearings":
  
              aux_idx_max = argrelextrema(vn, np.greater)[0].tolist()
              aux_idx_min = argrelextrema(vn, np.less)[0].tolist()
  
              # verification of rigid modes
              if len(aux_idx_max) == 0 and len(aux_idx_min) == 0:
                  idx_max = np.argmax(vn)
                  idx_min = np.argmin(vn)
  
                  # corrects the index by the removed points
                  for i in idx_remove:
                      if idx_min > i:
                          idx_min += 1
                      if idx_max > i:
                          idx_max += 1
                  node_max = np.round(np.array([idx_max]) / nn)
                  node_min = np.round(np.array([idx_min]) / nn)
  
              if len(aux_idx_min) != 0:
                  idx_min = np.where(vn == min(vn[aux_idx_min]))[0].tolist()
  
                  # corrects the index by the removed points
                  for i in idx_remove:
                      if idx_min[0] > i:
                          idx_min[0] += 1
                  node_min = np.round(np.array(idx_min) / nn)
  
              if len(aux_idx_max) != 0:
                  idx_max = np.where(vn == max(vn[aux_idx_max]))[0].tolist()
  
                  # corrects the index by the removed points
                  for i in idx_remove:
                      if idx_max[0] > i:
                          idx_max[0] += 1
                  node_max = np.round(np.array(idx_max) / nn)
  
          elif self.rotor_type == "double_overhung":
              node_max = [max(df_disks["n"])]
              node_min = [min(df_disks["n"])]
  
          elif self.rotor_type == "single_overhung_l":
              node_min = [min(df_disks["n"])]
  
          elif self.rotor_type == "single_overhung_r":
              node_max = [max(df_disks["n"])]
  
          plot = figure(
              tools="pan,wheel_zoom,box_zoom,reset,save,box_select",
              width=1400,
              height=700,
              title="Undamped Mode Shape",
              x_axis_label="Rotor lenght",
              y_axis_label="Non dimensional rotor deformation",
          )
          plot.title.text_font_size = "14pt"
          plot.xaxis.axis_label_text_font_size = "14pt"
          plot.yaxis.axis_label_text_font_size = "14pt"
          plot.axis.major_label_text_font_size = "14pt"
  
          nodes_pos = np.array(nodes_pos)
          rpm_speed = (30 / np.pi) * modal.wn[mode]
  
          plot.line(
              x=zn,
              y=vn,
              line_width=4,
              line_color="red",
              legend_label="Mode = %s, Speed = %.1f RPM" % (mode, rpm_speed),
          )
          plot.line(
              x=nodes_pos,
              y=np.zeros(len(nodes_pos)),
              line_dash="dotdash",
              line_width=4.0,
              line_color="black",
          )
          plot.circle(
              x=nodes_pos[df_bearings["n"]],
              y=np.zeros(len(df_bearings)),
              size=12,
              fill_color="black",
          )
  
          pos0 = nodes_pos[min(df_bearings["n"])]
          pos1 = nodes_pos[max(df_bearings["n"])]
          plot.add_layout(
              Label(
                  x=np.mean(nodes_pos[df_bearings["n"]]),
                  y=0,
                  angle=0,
                  text="Bearing Span = %.2f" % (pos1 - pos0),
                  text_font_style="bold",
                  text_font_size="12pt",
                  text_baseline="top",
                  text_align="center",
                  y_offset=20,
              )
          )
          for node in nodes_pos[df_bearings["n"]]:
              plot.add_layout(
                  Span(
                      location=node,
                      dimension="height",
                      line_color="green",
                      line_dash="dashed",
                      line_width=3,
                  )
              )
  
          self.node_min = node_min
          self.node_max = node_max
  
          return plot
code_tokens: def mode_shape ( self , mode ) : nodes_pos = self . rotor . nodes_pos df_bearings = self . rotor . df_bearings df_disks = self . rotor . df_disks modal = self . rotor . run_modal ( speed = self . maxspeed ) xn , yn , zn , xc , yc , zc_pos , nn = modal . calc_mode_shape ( mode = mode ) vn = np . zeros ( len ( zn ) ) for i in range ( len ( zn ) ) : theta = np . arctan ( xn [ i ] / yn [ i ] ) vn [ i ] = xn [ i ] * np . sin ( theta ) + yn [ i ] * np . cos ( theta ) idx_remove = [ ] for i in range ( 1 , len ( zn ) ) : if zn [ i ] == zn [ i - 1 ] : idx_remove . append ( i ) zn = np . delete ( zn , idx_remove ) vn = np . delete ( vn , idx_remove ) node_min = np . array ( [ ] ) node_max = np . array ( [ ] ) if self . rotor_type == "between_bearings" : aux_idx_max = argrelextrema ( vn , np . greater ) [ 0 ] . tolist ( ) aux_idx_min = argrelextrema ( vn , np . less ) [ 0 ] . tolist ( ) if len ( aux_idx_max ) == 0 and len ( aux_idx_min ) == 0 : idx_max = np . argmax ( vn ) idx_min = np . argmin ( vn ) for i in idx_remove : if idx_min > i : idx_min += 1 if idx_max > i : idx_max += 1 node_max = np . round ( np . array ( [ idx_max ] ) / nn ) node_min = np . round ( np . array ( [ idx_min ] ) / nn ) if len ( aux_idx_min ) != 0 : idx_min = np . where ( vn == min ( vn [ aux_idx_min ] ) ) [ 0 ] . tolist ( ) for i in idx_remove : if idx_min [ 0 ] > i : idx_min [ 0 ] += 1 node_min = np . round ( np . array ( idx_min ) / nn ) if len ( aux_idx_max ) != 0 : idx_max = np . where ( vn == max ( vn [ aux_idx_max ] ) ) [ 0 ] . tolist ( ) for i in idx_remove : if idx_max [ 0 ] > i : idx_max [ 0 ] += 1 node_max = np . round ( np . array ( idx_max ) / nn ) elif self . rotor_type == "double_overhung" : node_max = [ max ( df_disks [ "n" ] ) ] node_min = [ min ( df_disks [ "n" ] ) ] elif self . rotor_type == "single_overhung_l" : node_min = [ min ( df_disks [ "n" ] ) ] elif self . rotor_type == "single_overhung_r" : node_max = [ max ( df_disks [ "n" ] ) ] plot = figure ( tools = "pan,wheel_zoom,box_zoom,reset,save,box_select" , width = 1400 , height = 700 , title = "Undamped Mode Shape" , x_axis_label = "Rotor lenght" , y_axis_label = "Non dimensional rotor deformation" , ) plot . title . text_font_size = "14pt" plot . xaxis . axis_label_text_font_size = "14pt" plot . yaxis . axis_label_text_font_size = "14pt" plot . axis . major_label_text_font_size = "14pt" nodes_pos = np . array ( nodes_pos ) rpm_speed = ( 30 / np . pi ) * modal . wn [ mode ] plot . line ( x = zn , y = vn , line_width = 4 , line_color = "red" , legend_label = "Mode = %s, Speed = %.1f RPM" % ( mode , rpm_speed ) , ) plot . line ( x = nodes_pos , y = np . zeros ( len ( nodes_pos ) ) , line_dash = "dotdash" , line_width = 4.0 , line_color = "black" , ) plot . circle ( x = nodes_pos [ df_bearings [ "n" ] ] , y = np . zeros ( len ( df_bearings ) ) , size = 12 , fill_color = "black" , ) pos0 = nodes_pos [ min ( df_bearings [ "n" ] ) ] pos1 = nodes_pos [ max ( df_bearings [ "n" ] ) ] plot . add_layout ( Label ( x = np . mean ( nodes_pos [ df_bearings [ "n" ] ] ) , y = 0 , angle = 0 , text = "Bearing Span = %.2f" % ( pos1 - pos0 ) , text_font_style = "bold" , text_font_size = "12pt" , text_baseline = "top" , text_align = "center" , y_offset = 20 , ) ) for node in nodes_pos [ df_bearings [ "n" ] ] : plot . add_layout ( Span ( location = node , dimension = "height" , line_color = "green" , line_dash = "dashed" , line_width = 3 , ) ) self . node_min = node_min self . node_max = node_max return plot
short_docstring: Evaluate the mode shapes for the rotor.
short_docstring_tokens: Evaluate the mode shapes for the rotor .
comment: """Evaluate the mode shapes for the rotor.
  
          This analysis presents the vibration mode for each critical speed.
          The importance is to locate the critical node, where the displacement
          is the greatest, then apply loads for unbalance response (stability
          level 1)
  
          Parameters
          ----------
          mode : int
              the n'th vibration mode
  
          Returns
          -------
          node_min, node_max : list
              List with nodes where the largest absolute displacements occur
  
          Example
          -------
          >>> import ross as rs
          >>> report = rs.report_example()
          >>> fig = report.mode_shape(mode=0)
          >>> report.node_min
          array([], dtype=float64)
          >>> report.node_max
          array([3.])
          """$SEP$# reduce 3D view to 2D view$SEP$# remove repetitive values from zn and vn$SEP$# verification of rigid modes$SEP$# corrects the index by the removed points$SEP$# corrects the index by the removed points$SEP$# corrects the index by the removed points