parameters: (wavelength_intervals, binning_wavelength_ini, wav_delta)
return_statement: return binning_wavelength, n
docstring: This function defined number of wavelenth slices and creates array of the binning parameters for each slice
docstring_summary: This function defined number of wavelenth slices and creates array of the binning parameters for each slice
docstring_tokens: This function defined number of wavelenth slices and creates array of the binning parameters for each slice
function: def wavelengh_slices(wavelength_intervals, binning_wavelength_ini, wav_delta):
      """ This function defined number of wavelenth slices and creates array of the binning parameters for each slice """
  
      binning_wavelength = []
      if not wavelength_intervals:
          binning_wavelength.append(binning_wavelength_ini)
          n = 1        # in this case, number of wavelength range intervals always will be 1
      else:            # reducing data on a several intervals of wavelengths
          wav1 = float(binning_wavelength_ini[0])
          wv_ini_step = float(binning_wavelength_ini[1])
          wav2 = float(binning_wavelength_ini[2])
  
          # check if chosen wavelenth interval is feasible
          if (wav1 + wav_delta) > wav2:
              raise ValueError("wav_delta is too large for the upper range of wavelength")
          if math.fmod((wav2 - wav1), wav_delta) == 0.0:  # if reminder is 0
              n = (wav2 - wav1)/wav_delta
          else:        # if reminder is greater than 0, to trancate the maximum wavelength in the range
              n = math.floor((wav2 - wav1)/wav_delta)
              max_wave_length = wav1 + n*wav_delta
              print ('\n WARNING: because of your set-up, maximum wavelength to consider \
                  for partial reduction is only %4.2f \n' % max_wave_length)
  
          # number of wavelength range intervals
          n = int(n)
          binning_wavelength_interm = []
          binning_wavelength_interm_1 = wv_ini_step  # binning step is always the same
          for i in range(n):
              binning_wavelength_interm_0 = wav1 + wav_delta * i  # left range
              binning_wavelength_interm_2 = binning_wavelength_interm_0 + wav_delta  # right range
              binning_wavelength_interm = [binning_wavelength_interm_0, binning_wavelength_interm_1, binning_wavelength_interm_2]
              binning_wavelength.append(binning_wavelength_interm)
          binning_wavelength.append(binning_wavelength_ini)       # reduce data on the full range
          n = n + 1  # to include full range
  
      return binning_wavelength, n
function_tokens: def wavelengh_slices ( wavelength_intervals , binning_wavelength_ini , wav_delta ) : binning_wavelength = [ ] if not wavelength_intervals : binning_wavelength . append ( binning_wavelength_ini ) n = 1 # in this case, number of wavelength range intervals always will be 1 else : # reducing data on a several intervals of wavelengths wav1 = float ( binning_wavelength_ini [ 0 ] ) wv_ini_step = float ( binning_wavelength_ini [ 1 ] ) wav2 = float ( binning_wavelength_ini [ 2 ] ) # check if chosen wavelenth interval is feasible if ( wav1 + wav_delta ) > wav2 : raise ValueError ( "wav_delta is too large for the upper range of wavelength" ) if math . fmod ( ( wav2 - wav1 ) , wav_delta ) == 0.0 : # if reminder is 0 n = ( wav2 - wav1 ) / wav_delta else : # if reminder is greater than 0, to trancate the maximum wavelength in the range n = math . floor ( ( wav2 - wav1 ) / wav_delta ) max_wave_length = wav1 + n * wav_delta print ( '\n WARNING: because of your set-up, maximum wavelength to consider \
                  for partial reduction is only %4.2f \n' % max_wave_length ) # number of wavelength range intervals n = int ( n ) binning_wavelength_interm = [ ] binning_wavelength_interm_1 = wv_ini_step # binning step is always the same for i in range ( n ) : binning_wavelength_interm_0 = wav1 + wav_delta * i # left range binning_wavelength_interm_2 = binning_wavelength_interm_0 + wav_delta # right range binning_wavelength_interm = [ binning_wavelength_interm_0 , binning_wavelength_interm_1 , binning_wavelength_interm_2 ] binning_wavelength . append ( binning_wavelength_interm ) binning_wavelength . append ( binning_wavelength_ini ) # reduce data on the full range n = n + 1 # to include full range return binning_wavelength , n