docs: def _band_calculations(self, rsr, flux, scale, **options):
          """Derive the inband solar flux or inband solar irradiance for a given
          instrument relative spectral response valid for an earth-sun distance
          of one AU.
  
          rsr: Relative Spectral Response (one detector only)
          Dictionary with two members 'wavelength' and 'response'
          options:
          detector: Detector number (between 1 and N - N=number of detectors
          for channel)
          """
          from scipy.interpolate import InterpolatedUnivariateSpline
  
          if 'detector' in options:
              detector = options['detector']
          else:
              detector = 1
  
          # Resample/Interpolate the response curve:
          if self.wavespace == 'wavelength':
              if 'response' in rsr:
                  wvl = rsr['wavelength'] * scale
                  resp = rsr['response']
              else:
                  wvl = rsr['det-{0:d}'.format(detector)]['wavelength'] * scale
                  resp = rsr['det-{0:d}'.format(detector)]['response']
          else:
              if 'response' in rsr:
                  wvl = rsr['wavenumber'] * scale
                  resp = rsr['response']
              else:
                  wvl = rsr['det-{0:d}'.format(detector)]['wavenumber'] * scale
                  resp = rsr['det-{0:d}'.format(detector)]['response']
  
          start = wvl[0]
          end = wvl[-1]
          # print "Start and end: ", start, end
          LOG.debug("Begin and end wavelength/wavenumber: %f %f ", start, end)
          dlambda = self._dlambda
          xspl = np.linspace(start, end, round((end - start) / self._dlambda) + 1)
  
          ius = InterpolatedUnivariateSpline(wvl, resp)
          resp_ipol = ius(xspl)
  
          # Interpolate solar spectrum to specified resolution and over specified
          # Spectral interval:
          self.interpolate(dlambda=dlambda, ival_wavelength=(start, end))
  
          # Mask out outside the response curve:
          maskidx = np.logical_and(np.greater_equal(self.ipol_wavelength, start),
                                   np.less_equal(self.ipol_wavelength, end))
          wvl = np.repeat(self.ipol_wavelength, maskidx)
          irr = np.repeat(self.ipol_irradiance, maskidx)
  
          # Calculate the solar-flux: (w/m2)
          if flux:
              return np.trapz(irr * resp_ipol, wvl)
          else:
              # Divide by the equivalent band width:
              return np.trapz(irr * resp_ipol, wvl) / np.trapz(resp_ipol, wvl)