Sets calibration for all tests

        See :meth:`StimulusModel<sparkle.stim.stimulus_model.StimulusModel.setCalibration>`
967934
def setCalibration(self, db_boost_array, frequencies, frange):
        """"""
        self.calibrationVector = db_boost_array
        self.calibrationFrequencies = frequencies
        self.calibrationFrange = frange
        for test in self._tests:
            test.setCalibration(db_boost_array, frequencies, frange)
1292299
protected void calibrate ()
    {
        long currentTimer = current();
        long currentMillis = System.currentTimeMillis();
        long elapsedTimer = currentTimer - _driftTimerStamp;
        float elapsedMillis = currentMillis - _driftMilliStamp;
        float drift = elapsedMillis / (elapsedTimer / _milliDivider);
        if (_debugCalibrate.getValue()) {
            log.warning("Calibrating", "timer", elapsedTimer, "millis", elapsedMillis,
                        "drift", drift, "timerstamp", _driftTimerStamp,
                        "millistamp", _driftMilliStamp, "current", currentTimer);
        }

        if (elapsedTimer < 0) {
            log.warning("The timer has decided to live in the past, resetting drift" ,
                        "previousTimer", _driftTimerStamp, "currentTimer", currentTimer,
                        "previousMillis", _driftMilliStamp, "currentMillis", currentMillis);
            _driftRatio = 1.0F;

        } else if (drift > MAX_ALLOWED_DRIFT_RATIO || drift < MIN_ALLOWED_DRIFT_RATIO) {
            log.warning("Calibrating", "drift", drift);
            // Ignore the drift if it's hugely out of range. That indicates general clock insanity,
            // and we just want to stay out of the way.
            if (drift < 100 * MAX_ALLOWED_DRIFT_RATIO && drift > MIN_ALLOWED_DRIFT_RATIO / 100) {
                _driftRatio = drift;
            }  else {
                _driftRatio = 1.0F;
            }
            if (Math.abs(drift - 1.0) > Math.abs(_maxDriftRatio - 1.0)) {
                _maxDriftRatio = drift;
            }

        } else if (_driftRatio != 1.0) {
            log.warning("Calibrating", "drift", drift);
            // If we're within bounds now but we weren't before, reset _driftFactor and log it
            _driftRatio = 1.0F;
        }
        _driftMilliStamp = currentMillis;
        _driftTimerStamp = currentTimer;
    }
1217974
public void setOrtho() {
		matrixMode(MatrixMode.PROJECTION);
		resetMatrix();
		gl.glOrtho(0, this.width, 0, this.height, -1.0e10, 1.0e10);
		matrixMode(MatrixMode.MODELVIEW);
		resetMatrix();
	}
459276
function(/**Boolean*/ normalize) {
      var p = this.period;

      // Adjust period based on the calibration test time
      if (normalize && !this.isCalibration) {
        var cal = Test.CALIBRATIONS[this.loopArg ? 0 : 1];

        // If the period is within 20% of the calibration time, then zero the
        // it out
        p = p < cal.period*1.2 ? 0 : p - cal.period;
      }

      return Math.round(1/p);
    }
281890
def _copy_calibration(self, calibration):
        """"""
        for key, item in calibration.__dict__.items():
            self.__dict__[key] = item
274440
def setEditor(self, name):
        """"""
        editor = get_stimulus_editor(name)
        self.editor = editor
        self._stim.setStimType(name)
175894
def setAccelerometerSensitivity(self, value):
        
        # note that this implicitly disables the self tests on each axis
        # i.e. the full byte is actually 000[accel]000 where the 1st 3 are the accelerometer self tests, the next two
        # values are the actual sensitivity and the last 3 are unused
        # the 2 [accel] bits are translated by the device as follows; 00 = 2g, 01 = 4g, 10 = 8g, 11 = 16g
        # in binary we get 2 = 0, 4 = 1000, 8 = 10000, 16 = 11000
        # so the 1st 3 bits are always 0
        try:
            self.i2c_io.write(self.MPU6050_ADDRESS,
                              self.MPU6050_RA_ACCEL_CONFIG,
                              {2: 0, 4: 8, 8: 16, 16: 24}[value])
            self._accelerationFactor = value / 32768.0
            self.accelerometerSensitivity = value
            logger.debug("Set accelerometer sensitivity = %d", value)
        except KeyError:
            raise ArgumentError(value + " is not a valid sensitivity (2,4,8,18)")
27854
def load_calibration(self):
        """"""
        registers = self.i2c_read_register(0xAA, 22)
        (
            self.cal['AC1'],
            self.cal['AC2'],
            self.cal['AC3'],
            self.cal['AC4'],
            self.cal['AC5'],
            self.cal['AC6'],
            self.cal['B1'],
            self.cal['B2'],
            self.cal['MB'],
            self.cal['MC'],
            self.cal['MD']
        ) = struct.unpack('>hhhHHHhhhhh', registers)
983554
def set_stim_by_index(self, index):
        
        # remove any current components
        self.stimulus.clearComponents()
        # add one to index because of tone curve
        self.stimulus.insertComponent(self.stim_components[index])
562590
protected void setExpectation() {
		expectation = 0.0;
		for(Double d: insertStat.keySet()) {
			expectation += d*(insertStat.get(d)/observationCount);
		}
	}
606989
def run(self):
        """"""
        self._initialize_run()

        stimuli = self.protocol_model.allTests()

        self.acq_thread = threading.Thread(target=self._worker, 
                                           args=(stimuli,), )
        # save the current calibration to data file doc        
        if self.save_data:
            info = {'calibration_used': self.calname, 'calibration_range': self.cal_frange}
            self.datafile.set_metadata(self.current_dataset_name, info)

        # save the start time and set last tick to expired, so first
        # acquisition loop iteration executes immediately
        self.start_time = time.time()
        self.last_tick = self.start_time - (self.interval/1000)

        self.acq_thread.start()
        return self.acq_thread
1337202
async def SetSLALevel(self, creds, level):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='ModelConfig',
                   request='SetSLALevel',
                   version=1,
                   params=_params)
        _params['creds'] = creds
        _params['level'] = level
        reply = await self.rpc(msg)
        return reply
575934
def _set_value(self, parameter, new_value):
        """"""
        try:
            self.block_matcher.__setattr__(parameter, new_value)
        except BadBlockMatcherArgumentError:
            return
        self.update_disparity_map()
1124971
def updateCalibration(self):
        """"""
        if self.samplerate() != self._calibration_fs:
            self.setCalibration(self._attenuationVector, self._calFrequencies, self._calFrange)
454065
private static void adjustUncalibrated(DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
										   RectangleLength2D_F64 bound, double scale) {
		// translation
		double deltaX = -bound.x0*scale;
		double deltaY = -bound.y0*scale;

		// adjustment matrix
		SimpleMatrix A = new SimpleMatrix(3,3,true,new double[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
		SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
		SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);

		rectifyLeft.set(A.mult(rL).getDDRM());
		rectifyRight.set(A.mult(rR).getDDRM());
	}
711666
def set_accuracy(self, acc):
        
        self.acc = acc
        if self.child:
            self.child.set_accuracy(acc)
1343615
def calibration_stimulus(self, mode):
        
        if mode == 'tone':
            return self.tone_calibrator.stimulus
        elif mode =='noise':
            return self.bs_calibrator.stimulus