Convert uniform pwm values to raw, driver-specific values.

        :param values: The uniform pwm values (0.0-1.0).
        :return: Converted, driver-specific pwm values.
558500
def _to_raw_pwm(self, values):
        
        return [self._to_single_raw_pwm(values[i])
                for i in range(len(self._pins))]
895731
def normalize_to_range(
    values,
    minimum = 0.0,
    maximum = 1.0
    ):

    

    normalized_values = []
    minimum_value = min(values)
    maximum_value = max(values)
    for value in values:
        numerator = value - minimum_value
        denominator = maximum_value - minimum_value
        value_normalized = (maximum - minimum) * numerator/denominator + minimum
        normalized_values.append(value_normalized)
    return normalized_values
1000205
def build_pwm():
    
    with cd("/tmp/source/c_pwm"):
        test = "import _PWM; print(_PWM.VERSION)"
        run("make py2.7")
        run('sudo python2.7 -c "%s"' % test)
        run("cp _PWM.so ../RPIO/PWM/")
        run("mv _PWM.so ../RPIO/PWM/_PWM27.so")
        run("make py3.2")
        run('python3.2 -c "%s"' % test)
        run("mv _PWM.so ../RPIO/PWM/_PWM32.so")
908926
def _get_values(values, skipna, fill_value=None, fill_value_typ=None,
                isfinite=False, copy=True, mask=None):
    

    if is_datetime64tz_dtype(values):
        # com.values_from_object returns M8[ns] dtype instead of tz-aware,
        #  so this case must be handled separately from the rest
        dtype = values.dtype
        values = getattr(values, "_values", values)
    else:
        values = com.values_from_object(values)
        dtype = values.dtype

    if mask is None:
        if isfinite:
            mask = _isfinite(values)
        else:
            mask = isna(values)

    if is_datetime_or_timedelta_dtype(values) or is_datetime64tz_dtype(values):
        # changing timedelta64/datetime64 to int64 needs to happen after
        #  finding `mask` above
        values = getattr(values, "asi8", values)
        values = values.view(np.int64)

    dtype_ok = _na_ok_dtype(dtype)

    # get our fill value (in case we need to provide an alternative
    # dtype for it)
    fill_value = _get_fill_value(dtype, fill_value=fill_value,
                                 fill_value_typ=fill_value_typ)

    if skipna:
        if copy:
            values = values.copy()
        if dtype_ok:
            np.putmask(values, mask, fill_value)

        # promote if needed
        else:
            values, changed = maybe_upcast_putmask(values, mask, fill_value)

    elif copy:
        values = values.copy()

    # return a platform independent precision dtype
    dtype_max = dtype
    if is_integer_dtype(dtype) or is_bool_dtype(dtype):
        dtype_max = np.int64
    elif is_float_dtype(dtype):
        dtype_max = np.float64

    return values, mask, dtype, dtype_max, fill_value
734246
def value(self):
        
        if self.pwm_device.pin.frequency is None:
            return None
        else:
            try:
                return log2(
                    self.pwm_device.pin.frequency / self.mid_tone.frequency
                ) / self.octaves
            except ZeroDivisionError:
                return 0.0
845936
def to_abivars(self):
        """"""
        abivars = dict(
            gwcalctyp=self.gwcalctyp,
            ecuteps=self.ecuteps,
            ecutsigx=self.ecutsigx,
            symsigma=self.symsigma,
            gw_qprange=self.gw_qprange,
            gwpara=self.gwpara,
            optdriver=self.optdriver,
            nband=self.nband
            #"ecutwfn"  : self.ecutwfn,
            #"kptgw"    : self.kptgw,
            #"nkptgw"   : self.nkptgw,
            #"bdgw"     : self.bdgw,
        )

        # FIXME: problem with the spin
        #assert len(self.bdgw) == self.nkptgw

        # ppmodel variables
        if self.use_ppmodel:
            abivars.update(self.ppmodel.to_abivars())

        return abivars
1042640
def pwm_min_score(self):
        
        if self.min_score is None:
            score = 0
            for row in self.pwm:
                score += log(min(row) / 0.25 + 0.01)
            self.min_score = score
        
        return self.min_score
1343938
def _modify_raw_val(val, is_basepairs):
    
    return float(val) * (config.base_count_multiplier if is_basepairs else config.read_count_multiplier)
1195744
def convert(self, values, nan_rep, encoding, errors):
        

        # values is a recarray
        if values.dtype.fields is not None:
            values = values[self.cname]

        values = _maybe_convert(values, self.kind, encoding, errors)

        kwargs = dict()
        if self.freq is not None:
            kwargs['freq'] = _ensure_decoded(self.freq)
        if self.index_name is not None:
            kwargs['name'] = _ensure_decoded(self.index_name)
        # making an Index instance could throw a number of different errors
        try:
            self.values = Index(values, **kwargs)
        except Exception:  # noqa: E722

            # if the output freq is different that what we recorded,
            # it should be None (see also 'doc example part 2')
            if 'freq' in kwargs:
                kwargs['freq'] = None
            self.values = Index(values, **kwargs)

        self.values = _set_tz(self.values, self.tz)

        return self
257405
def fixed_parameters(self):
        
        libfn = utils.get_lib_fn('getTransformFixedParameters%s'%self._libsuffix)
        return np.asarray(libfn(self.pointer))
678074
def IPT_to_XYZ(cobj, *args, **kwargs):
    
    ipt_values = numpy.array(cobj.get_value_tuple())
    lms_values = numpy.dot(
        numpy.linalg.inv(IPTColor.conversion_matrices['lms_to_ipt']),
        ipt_values)

    lms_prime = numpy.sign(lms_values) * numpy.abs(lms_values) ** (1 / 0.43)

    xyz_values = numpy.dot(
        numpy.linalg.inv(IPTColor.conversion_matrices['xyz_to_lms']),
        lms_prime)
    return XYZColor(*xyz_values, observer='2', illuminant='d65')
1295445
def convert(self, value, units, newunits):
        
        return value * self._units[units] / self._units[newunits]
1071287
def _fx_mapping(raw_rates):
    '''  '''
    return {pair[0].lower(): {
        'timeStamp': pair[1],
        'bid': float(pair[2] + pair[3]),
        'ask': float(pair[4] + pair[5]),
        'high': float(pair[6]),
        'low': float(pair[7])
    } for pair in map(lambda x: x.split(','), raw_rates)}
1117720
def to_valueset(self, state):
        
        return state.solver.VS(state.arch.bits, self.region, self.region_base_addr, self.address)
1305478
def step_amp(self):
        
        difference = self.drift_target - self._raw_value
        if abs(difference) < self.change_rate:
            self.value = self.drift_target
        else:
            delta = self.change_rate * numpy.sign(difference)
            self.value = self._raw_value + delta
111178
def get_rgb_hex(self):
        
        rgb_r, rgb_g, rgb_b = self.get_upscaled_value_tuple()
        return '#%02x%02x%02x' % (rgb_r, rgb_g, rgb_b)
85663
def normalise( range = 0 .. 0xFF )
      if range.exclude_end?
        raise "Normalisation does not support ranges with end value " +
              "excluded (such as #{range})"
      end
      lower, upper = min, max
      if lower.is_a? RGB or upper.is_a? RGB
        current = [ lower.r, lower.g, lower.b ].min ..
                  [ upper.r, upper.g, upper.b ].max
      else
        current = min .. max
      end
      if current.last != current.first
        factor =
          ( range.last - range.first ).to_f / ( current.last - current.first )
        collect { |x| x * factor + ( range.first - current.first * factor ) }
      else
        self + ( range.first - current.first )
      end
    end