code: def time_average_vel(self, depth):
          
          depths = [l.depth for l in self]
          # Final layer is infinite and is treated separately
          travel_times = [0] + [l.travel_time for l in self[:-1]]
          # If needed, add the final layer to the required depth
          if depths[-1] < depth:
              depths.append(depth)
              travel_times.append((depth - self[-1].depth) / self[-1].shear_vel)
  
          total_travel_times = np.cumsum(travel_times)
          # Interpolate the travel time to the depth of interest
          avg_shear_vel = depth / np.interp(depth, depths, total_travel_times)
          return avg_shear_vel
docs: Calculate the time-average velocity.
  
          Parameters
          ----------
          depth: float
              Depth over which the average velocity is computed.
  
          Returns
          -------
          avg_vel: float
              Time averaged velocity.