Set the base config for sensor

        :param averaging: Sets the numer of samples that are internally averaged
        :param datarate: Datarate in hertz
        :param mode: one of the MODE_* constants
194395
def config(self, averaging=1, datarate=15, mode=MODE_NORMAL):
        
        averaging_conf = {
            1: 0,
            2: 1,
            4: 2,
            8: 3
        }

        if averaging not in averaging_conf.keys():
            raise Exception('Averaging should be one of: 1,2,4,8')
        datarates = {
            0.75: 0,
            1.5: 1,
            3: 2,
            7.5: 4,
            15: 5,
            30: 6,
            75: 7
        }
        if datarate not in datarates.keys():
            raise Exception(
                    'Datarate of {} Hz is not support choose one of: {}'.format(datarate, ', '.join(datarates.keys())))

        config_a = 0
        config_a &= averaging_conf[averaging] << 5
        config_a &= datarates[datarate] << 2
        config_a &= mode

        self.i2c_write_register(0x00, config_a)
1371266
def set_rate(rate):
    
    if not (isinstance(rate, int) or isinstance(rate, float)):
        raise TypeError("argument to set_rate is expected to be int or float")
    global loop_duration
    loop_duration = 1.0/rate
237029
def _set_init_params(self, qrs_amp_recent, noise_amp_recent, rr_recent,
                         last_qrs_ind):
        
        self.qrs_amp_recent = qrs_amp_recent
        self.noise_amp_recent = noise_amp_recent
        # What happens if qrs_thr is calculated to be less than the explicit
        # min threshold? Should print warning?
        self.qrs_thr = max(0.25*self.qrs_amp_recent
                           + 0.75*self.noise_amp_recent,
                           self.qrs_thr_min * self.transform_gain)
        self.rr_recent = rr_recent
        self.last_qrs_ind = last_qrs_ind

        # No qrs detected initially
        self.last_qrs_peak_num = None
593001
def input_to_phase(data, rate, data_type):
    
    if data_type == "phase":
        return data
    elif data_type == "freq":
        return frequency2phase(data, rate)
    else:
        raise Exception("unknown data_type: " + data_type)
377942
def set_rate(self, param):
        
        # TODO: Is not having leading zeroes / 4 digits an error?
        rate = int(param)
        if 1 <= rate <= 15000:
            self.device.temperature_rate = rate / 100.0
        return ""
80161
def _set_config(c):
    
    glfw.glfwWindowHint(glfw.GLFW_RED_BITS, c['red_size'])
    glfw.glfwWindowHint(glfw.GLFW_GREEN_BITS, c['green_size'])
    glfw.glfwWindowHint(glfw.GLFW_BLUE_BITS, c['blue_size'])
    glfw.glfwWindowHint(glfw.GLFW_ALPHA_BITS, c['alpha_size'])

    glfw.glfwWindowHint(glfw.GLFW_ACCUM_RED_BITS, 0)
    glfw.glfwWindowHint(glfw.GLFW_ACCUM_GREEN_BITS, 0)
    glfw.glfwWindowHint(glfw.GLFW_ACCUM_BLUE_BITS, 0)
    glfw.glfwWindowHint(glfw.GLFW_ACCUM_ALPHA_BITS, 0)

    glfw.glfwWindowHint(glfw.GLFW_DEPTH_BITS, c['depth_size'])
    glfw.glfwWindowHint(glfw.GLFW_STENCIL_BITS, c['stencil_size'])
    # glfw.glfwWindowHint(glfw.GLFW_CONTEXT_VERSION_MAJOR, c['major_version'])
    # glfw.glfwWindowHint(glfw.GLFW_CONTEXT_VERSION_MINOR, c['minor_version'])
    # glfw.glfwWindowHint(glfw.GLFW_SRGB_CAPABLE, c['srgb'])
    glfw.glfwWindowHint(glfw.GLFW_SAMPLES, c['samples'])
    glfw.glfwWindowHint(glfw.GLFW_STEREO, c['stereo'])
    if not c['double_buffer']:
        raise RuntimeError('GLFW must double buffer, consider using a '
                           'different backend, or using double buffering')
52758
def set_stream_rates():
    ''''''
    if (not msg_period.trigger() and
        mpstate.status.last_streamrate1 == mpstate.settings.streamrate and
        mpstate.status.last_streamrate2 == mpstate.settings.streamrate2):
        return
    mpstate.status.last_streamrate1 = mpstate.settings.streamrate
    mpstate.status.last_streamrate2 = mpstate.settings.streamrate2
    for master in mpstate.mav_master:
        if master.linknum == 0:
            rate = mpstate.settings.streamrate
        else:
            rate = mpstate.settings.streamrate2
        if rate != -1:
            master.mav.request_data_stream_send(mpstate.settings.target_system, mpstate.settings.target_component,
                                                mavutil.mavlink.MAV_DATA_STREAM_ALL,
                                                rate, 1)
1282148
public void setBaselineEstimatedDuration(int baselineNumber, Duration value)
   {
      set(selectField(TaskFieldLists.BASELINE_ESTIMATED_DURATIONS, baselineNumber), value);
   }
578124
def setModel(self, model):
        """"""
        self.stimModel = model
        self.parameterModel = model.autoParams()
        tone = self.stimModel.data(self.stimModel.index(0,0), QtCore.Qt.UserRole+1)
        info = tone.auto_details()

        # set max/mins
        fmax = info['frequency']['max']
        self.ui.freqStartSpnbx.setMaximum(fmax)
        self.ui.freqStopSpnbx.setMaximum(fmax)
        self.ui.freqStepSpnbx.setMaximum(500000)
        dbmax = info['intensity']['max']
        self.ui.dbStartSpnbx.setMaximum(dbmax)
        self.ui.dbStopSpnbx.setMaximum(dbmax)
        self.ui.dbStepSpnbx.setMaximum(500000)
        self.ui.durSpnbx.setMaximum(info['duration']['max'])
        self.ui.risefallSpnbx.setMaximum(info['risefall']['max'])

        self.fmapper.setModel(self.parameterModel)
        self.dbmapper.setModel(self.parameterModel)
        self.fmapper.addMapping(self.ui.freqStartSpnbx, 1)
        self.fmapper.addMapping(self.ui.freqStopSpnbx, 2)
        self.fmapper.addMapping(self.ui.freqStepSpnbx, 3)
        self.fmapper.addMapping(self.ui.freqNstepsLbl, 4, 'text')
        self.dbmapper.addMapping(self.ui.dbStartSpnbx, 1)
        self.dbmapper.addMapping(self.ui.dbStopSpnbx, 2)
        self.dbmapper.addMapping(self.ui.dbStepSpnbx, 3)
        self.dbmapper.addMapping(self.ui.dbNstepsLbl, 4, 'text')
        self.fmapper.toFirst()
        self.dbmapper.setCurrentIndex(1)

        self.ui.durSpnbx.setValue(tone.duration())
        self.ui.nrepsSpnbx.setValue(self.stimModel.repCount())
        self.ui.risefallSpnbx.setValue(tone.risefall())
        self.tone = tone
840778
def set_regressor_interface_params(spec, features, output_features):
    
    if output_features is None:
        output_features = [("predicted_class", datatypes.Double())]
    else:
        output_features = _fm.process_or_validate_features(output_features, 1)

    if len(output_features) != 1:
        raise ValueError("Provided output features for a regressor must be "
                    "one Double feature.")

    if output_features[0][1] != datatypes.Double():
        raise ValueError("Output type of a regressor must be a Double.")

    prediction_name = output_features[0][0]
    spec.description.predictedFeatureName = prediction_name

    # Normalize the features list.
    features = _fm.process_or_validate_features(features)

    # add input and output features
    for cur_input_name, feature_type in features:
        input_ = spec.description.input.add()
        input_.name = cur_input_name
        datatypes._set_datatype(input_.type, feature_type)

    output_ = spec.description.output.add()
    output_.name = prediction_name
    datatypes._set_datatype(output_.type, 'Double')
    return spec
141020
def _set_oversampling(self, value):
        

        try:
            value = np.atleast_1d(value).astype(float)
            if len(value) == 1:
                value = np.repeat(value, 2)
        except ValueError:
            raise ValueError('Oversampling factors must be float')
        if np.any(value <= 0):
            raise ValueError('Oversampling factors must be greater than 0')

        self._oversampling = value
88421
def set_parameters(self, samples: np.ndarray, window_size, data_min, data_max) -> bool:
        
        redraw_needed = False
        if self.samples_need_update:
            self.spectrogram.samples = samples
            redraw_needed = True
            self.samples_need_update = False

        if window_size != self.spectrogram.window_size:
            self.spectrogram.window_size = window_size
            redraw_needed = True

        if data_min != self.spectrogram.data_min:
            self.spectrogram.data_min = data_min
            redraw_needed = True

        if data_max != self.spectrogram.data_max:
            self.spectrogram.data_max = data_max
            redraw_needed = True

        return redraw_needed
732345
private StreamConfiguration adjustConfigurations(AudioFormat format) {
    int sampleRate = (int) format.getSampleRate();
    int sampleSize = format.getSampleSizeInBits();
    int channels = format.getChannels();

    StreamConfiguration streamConfiguration = new StreamConfiguration();
    streamConfiguration.setSampleRate(sampleRate);
    streamConfiguration.setBitsPerSample(sampleSize);
    streamConfiguration.setChannelCount(channels);

    return streamConfiguration;
  }
622672
def _resample_samplerate(samples, sr, newsr):
    # type: (np.ndarray, int, int, str) -> np.ndarray
    
    try:
        from samplerate import resample
    except ImportError:
        return None

    ratio = newsr/sr
    return _applyMultichan(samples,
                           lambda S: resample(S, ratio, 'sinc_best'))
500445
async def set_sampling_interval(self, command):
        
        sample_interval = int(command[0])
        await self.core.set_sampling_interval(sample_interval)
810165
@Inject
    public void setSamplerConfiguration(@Nullable Configuration.SamplerConfiguration samplerConfiguration) {
        if (samplerConfiguration != null) {
            configuration.withSampler(samplerConfiguration);
        }
    }
691176
def set_config_parameter(self, param, value):
        '''

        '''
        with self._mutex:
            if self._obj.set_configuration(param, value) != RTC.RTC_OK:
                raise exceptions.FailedToSetConfigurationError(param, value)
            # Force a reparse of the configuration
            self._configuration = None