code: def setCalibration(self, dbBoostArray, frequencies, frange):
          if dbBoostArray is not None and frequencies is not None:
              logger = logging.getLogger('main')
              if dbBoostArray.shape != frequencies.shape:
                  logger.error("ERROR: calibration array and frequency array must have same dimensions")
                  return
              if frange is None:
                  frange = (frequencies[0], frequencies[-1])
              logger.debug('setting calibration with samplerate {}'.format(self.samplerate()))
              fs = self.samplerate()
              if fs in StimulusModel.kernelCache:
                  logger.debug('---->using cached filter')
                  self.impulseResponse = StimulusModel.kernelCache[fs]
              else:
                  logger.debug('---->calculating new filter for fs {}'.format(fs))
                  self.impulseResponse = impulse_response(fs, dbBoostArray, frequencies, frange)
                  StimulusModel.kernelCache[fs] = self.impulseResponse
              self._calibration_fs = fs
              if DEFAULT_SAMPLERATE not in StimulusModel.kernelCache:
                  StimulusModel.kernelCache[DEFAULT_SAMPLERATE] = impulse_response(DEFAULT_SAMPLERATE, dbBoostArray, frequencies, frange)
              self._attenuationVector = dbBoostArray
              self._calFrequencies = frequencies
              self._calFrange = frange
          else:
              self.impulseResponse = None