code: def _calibrate(self, radiance, coefs, channel, calibration):
          
          if self._is_vis(channel):
              if not calibration == 'reflectance':
                  raise ValueError('Cannot calibrate VIS channel to '
                                   '{}'.format(calibration))
              return self._calibrate_vis(radiance=radiance, k=coefs['k'])
          else:
              if not calibration == 'brightness_temperature':
                  raise ValueError('Cannot calibrate IR channel to '
                                   '{}'.format(calibration))
  
              # Since the scanline-detector assignment is unknown, use the average
              # coefficients for all scanlines.
              mean_coefs = {'a': np.array(coefs['a']).mean(),
                            'b': np.array(coefs['b']).mean(),
                            'n': np.array(coefs['n']).mean(),
                            'btmin': coefs['btmin'],
                            'btmax': coefs['btmax']}
              return self._calibrate_ir(radiance=radiance, coefs=mean_coefs)
docs: Convert radiance to reflectance or brightness temperature