Computes the calibration for each view..
7858
private void computeSolutions(DMatrix4x4 Q) {
		DMatrixRMaj w_i = new DMatrixRMaj(3,3);

		for (int i = 0; i < cameras.size; i++) {
			computeW(cameras.get(i),Q,w_i);
			Intrinsic calib = solveForCalibration(w_i);
			if( sanityCheck(calib)) {
				solutions.add(calib);
			}
		}
	}
501359
def convert_to_radiance(self, data):
        """"""

        bnum = self._header["block5"]['band_number'][0]
        # Check calibration mode and select corresponding coefficients
        if self.calib_mode == "UPDATE" and bnum < 7:
            gain = self._header['calibration']["cali_gain_count2rad_conversion"][0]
            offset = self._header['calibration']["cali_offset_count2rad_conversion"][0]
            if gain == 0 and offset == 0:
                logger.info(
                    "No valid updated coefficients, fall back to default values.")
                gain = self._header["block5"]["gain_count2rad_conversion"][0]
                offset = self._header["block5"]["offset_count2rad_conversion"][0]
        else:
            gain = self._header["block5"]["gain_count2rad_conversion"][0]
            offset = self._header["block5"]["offset_count2rad_conversion"][0]

        return (data * gain + offset).clip(0)
1085086
def calibrate_radiance(array, attributes, index):
    """"""
    offset = np.float32(attributes["radiance_offsets"][index])
    scale = np.float32(attributes["radiance_scales"][index])
    array = (array - offset) * scale
    return array
966493
def getAllViewsAsDict(self):
        """"""
        return {p: self._plugins[p].get_views() for p in self._plugins}
664039
public void checkOneObservationPerView() {
		for (int viewIdx = 0; viewIdx < views.length; viewIdx++) {
			SceneObservations.View v = views[viewIdx];

			for (int obsIdx = 0; obsIdx < v.size(); obsIdx++) {
				int a = v.point.get(obsIdx);
				for (int i = obsIdx+1; i < v.size(); i++) {
					if( a == v.point.get(i)) {
						new RuntimeException("Same point is viewed more than once in the same view");
					}
				}
			}
		}
	}
1124971
def updateCalibration(self):
        """"""
        if self.samplerate() != self._calibration_fs:
            self.setCalibration(self._attenuationVector, self._calFrequencies, self._calFrange)
16506
private void rectifyInputImages() {
		// get intrinsic camera calibration matrices
		DMatrixRMaj K1 = PerspectiveOps.pinholeToMatrix(calib.left, (DMatrixRMaj)null);
		DMatrixRMaj K2 = PerspectiveOps.pinholeToMatrix(calib.right, (DMatrixRMaj)null);

		// compute rectification matrices
		rectifyAlg.process(K1,new Se3_F64(),K2,calib.getRightToLeft().invert(null));

		DMatrixRMaj rect1 = rectifyAlg.getRect1();
		DMatrixRMaj rect2 = rectifyAlg.getRect2();
		rectK = rectifyAlg.getCalibrationMatrix();
		rectR = rectifyAlg.getRectifiedRotation();

		// adjust view to maximize viewing area while not including black regions
		RectifyImageOps.allInsideLeft(calib.left, rect1, rect2, rectK);

		// compute transforms to apply rectify the images
		leftRectToPixel = transformRectToPixel(calib.left, rect1);

		ImageType<T> imageType = ImageType.single(activeAlg.getInputType());

		FMatrixRMaj rect1_F32 = new FMatrixRMaj(3,3); // TODO simplify code some how
		FMatrixRMaj rect2_F32 = new FMatrixRMaj(3,3);
		ConvertMatrixData.convert(rect1, rect1_F32);
		ConvertMatrixData.convert(rect2, rect2_F32);

		ImageDistort<T,T> distortRect1 = RectifyImageOps.rectifyImage(
				calib.left, rect1_F32, BorderType.SKIP,imageType);
		ImageDistort<T,T> distortRect2 = RectifyImageOps.rectifyImage(
				calib.right, rect2_F32, BorderType.SKIP, imageType);

		// rectify and undo distortion
		distortRect1.apply(inputLeft, rectLeft);
		distortRect2.apply(inputRight,rectRight);

		rectifiedImages = true;
	}
1065365
def _calibrate(self, data, labels):
        
        # network calibration
        classifier = defaultdict(Counter)
        for (i,j), label in zip(self._bmus, labels):
            classifier[i,j][label] += 1
        self.classifier = {}
        for ij, cnt in classifier.items():
            maxi = max(cnt.items(), key=itemgetter(1))
            nb = sum(cnt.values())
            self.classifier[ij] = maxi[0], maxi[1] / nb
1109210
private void init( List<CalibrationObservation> observations )
	{
		int totalPoints = 0;
		for (int i = 0; i < observations.size(); i++) {
			totalPoints += observations.get(i).size();
		}

		A.reshape(2*totalPoints,X.numRows,false);
		B.reshape(A.numRows,1,false);
	}
793142
def mag_calibration(self):
        """"""
        self.calibration_state = self.CAL_MAG
        self.mag_dialog = SK8MagDialog(self.sk8.get_imu(self.spinIMU.value()), self)
        if self.mag_dialog.exec_() == QDialog.Rejected:
            return

        self.calculate_mag_calibration(self.mag_dialog.samples)
470368
def process_calibration(self, save=False):
        """"""
        
        if not self.save_data:
            raise Exception("Runner must be set to save when run, to be able to process")

        vfunc = np.vectorize(calc_db, self.mphonesens, self.mphonedb)

        if USE_FFT:
            peaks = np.mean(abs(self.datafile.get_data(self.current_dataset_name + '/fft_peaks')), axis=1)
        else:
            peaks = np.mean(abs(self.datafile.get_data(self.current_dataset_name + '/vamp')), axis=1)

        # print 'calibration frequencies', self.calibration_frequencies
        # cal_index = self.calibration_indexes[self.calibration_frequencies.index(self.calf)]
        # cal_peak = peaks[cal_index]
        # cal_vmax = vmaxes[cal_index]

        # print 'vfunc inputs', vmaxes, self.caldb, cal_vmax

        resultant_dB = vfunc(peaks, self.calpeak) * -1 #db attenuation

        print 'calibration frequences', self.calibration_frequencies, 'indexes', self.calibration_indexes
        print 'attenuations', resultant_dB

        calibration_vector = resultant_dB[self.calibration_indexes].squeeze()
        # Not currenly saving resultant intensity

        return resultant_dB, '', self.calf
821596
def check_views(view_set, max_views=3):
    """"""

    if not isinstance(view_set, Iterable):
        view_set = tuple([view_set, ])

    if len(view_set) > max_views:
        raise ValueError('Can only have {} views'.format(max_views))

    return [check_int(view, 'view', min_value=0, max_value=max_views - 1) for view in view_set]
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)
538053
def accel_calibration(self):
        """"""
        self.calibration_state = self.CAL_ACC
        self.acc_dialog = SK8AccDialog(self.sk8.get_imu(self.spinIMU.value()), self)
        if self.acc_dialog.exec_() == QDialog.Rejected:
            return
        
        self.calculate_acc_calibration(self.acc_dialog.samples)
1080399
def get_frames(self):
        """"""
        frames = super(CalibratedPair, self).get_frames()
        return self.calibration.rectify(frames)
872580
def _post_compute(self):
        """"""
        self._x_labels, self._y_labels = self._y_labels, self._x_labels
        self._x_labels_major, self._y_labels_major = (
            self._y_labels_major, self._x_labels_major
        )
        self._x_2nd_labels, self._y_2nd_labels = (
            self._y_2nd_labels, self._x_2nd_labels
        )
        self.show_y_guides, self.show_x_guides = (
            self.show_x_guides, self.show_y_guides
        )
1319423
def _ir_calibrate(self, data):
        """"""
        fk1 = float(self["planck_fk1"])
        fk2 = float(self["planck_fk2"])
        bc1 = float(self["planck_bc1"])
        bc2 = float(self["planck_bc2"])

        res = (fk2 / xu.log(fk1 / data + 1) - bc1) / bc2
        res.attrs = data.attrs
        res.attrs['units'] = 'K'
        res.attrs['standard_name'] = 'toa_brightness_temperature'
        return res