nodes: 0, module; 1, function_definition; 2, function_name:slope_percentile; 3, parameters; 4, block; 5, identifier:self; 6, identifier:date; 7, identifier:mag; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# Remove zero mag_diff.; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, comment:# Derive slope.; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, return_statement; 20, comment:"""
          Return 10% and 90% percentile of slope.
  
          Parameters
          ----------
          date : array_like
              An array of phase-folded date. Sorted.
          mag : array_like
              An array of phase-folded magnitudes. Sorted by date.
  
          Returns
          -------
          per_10 : float
              10% percentile values of slope.
          per_90 : float
              90% percentile values of slope.
          """; 21, assignment; 22, assignment; 23, assignment; 24, assignment; 25, assignment; 26, assignment; 27, assignment; 28, assignment; 29, expression_list; 30, identifier:date_diff; 31, binary_operator:date[1:] - date[:len(date) - 1]; 32, identifier:mag_diff; 33, binary_operator:mag[1:] - mag[:len(mag) - 1]; 34, identifier:index; 35, call; 36, identifier:date_diff; 37, subscript; 38, identifier:mag_diff; 39, subscript; 40, identifier:slope; 41, binary_operator:date_diff / mag_diff; 42, identifier:percentile_10; 43, call; 44, identifier:percentile_90; 45, call; 46, identifier:percentile_10; 47, identifier:percentile_90; 48, subscript; 49, subscript; 50, subscript; 51, subscript; 52, attribute; 53, argument_list; 54, identifier:date_diff; 55, identifier:index; 56, identifier:mag_diff; 57, identifier:index; 58, identifier:date_diff; 59, identifier:mag_diff; 60, attribute; 61, argument_list; 62, attribute; 63, argument_list; 64, identifier:date; 65, slice; 66, identifier:date; 67, slice; 68, identifier:mag; 69, slice; 70, identifier:mag; 71, slice; 72, identifier:np; 73, identifier:where; 74, comparison_operator:mag_diff != 0.; 75, identifier:np; 76, identifier:percentile; 77, identifier:slope; 78, float:10.; 79, identifier:np; 80, identifier:percentile; 81, identifier:slope; 82, float:90.; 83, integer:1; 84, binary_operator:len(date) - 1; 85, integer:1; 86, binary_operator:len(mag) - 1; 87, identifier:mag_diff; 88, float:0.; 89, call; 90, integer:1; 91, call; 92, integer:1; 93, identifier:len; 94, argument_list; 95, identifier:len; 96, argument_list; 97, identifier:date; 98, identifier:mag
code: def slope_percentile(self, date, mag):
          """
          Return 10% and 90% percentile of slope.
  
          Parameters
          ----------
          date : array_like
              An array of phase-folded date. Sorted.
          mag : array_like
              An array of phase-folded magnitudes. Sorted by date.
  
          Returns
          -------
          per_10 : float
              10% percentile values of slope.
          per_90 : float
              90% percentile values of slope.
          """
  
          date_diff = date[1:] - date[:len(date) - 1]
          mag_diff = mag[1:] - mag[:len(mag) - 1]
  
          # Remove zero mag_diff.
          index = np.where(mag_diff != 0.)
          date_diff = date_diff[index]
          mag_diff = mag_diff[index]
  
          # Derive slope.
          slope = date_diff / mag_diff
  
          percentile_10 = np.percentile(slope, 10.)
          percentile_90 = np.percentile(slope, 90.)
  
          return percentile_10, percentile_90