Convert sequence of ICC s15Fixed16 to list of float.
7265
def s15f16l(s):
    """"""
    # Note: As long as float has at least 32 bits of mantissa, all
    # values are preserved.
    n = len(s) // 4
    t = struct.unpack('>%dl' % n, s)
    return map((2**-16).__mul__, t)
1296745
def _float_generator(descriptor, bitwidth):
    ''
    return gen.IterValueGenerator(descriptor.name, values.get_floats(bitwidth))
198387
def to_fixed(stype):
    
    output = []  # List of instructions

    if is_int_type(stype):
        output = to_word(stype)
        output.append('ex de, hl')
        output.append('ld hl, 0')  # 'Truncate' the fixed point
    elif stype == 'f':
        output.append('call __FTOF16REG')
        REQUIRES.add('ftof16reg.asm')

    return output
1022992
def incr_float(self, key, incr_by=1.):
        """"""
        return self.database.hincrbyfloat(self.key, key, incr_by)
862595
def normalize(seq):
    
    s = float(sum(seq))
    return [v/s for v in seq]
322028
def unpack_fixed16(src):
    """"""
    dec_part = unpack_ui16(src)
    int_part = unpack_ui16(src)
    return int_part + dec_part / 65536
33681
def _choose_float_dtype(dtype, has_offset):
    """"""
    # Keep float32 as-is.  Upcast half-precision to single-precision,
    # because float16 is "intended for storage but not computation"
    if dtype.itemsize <= 4 and np.issubdtype(dtype, np.floating):
        return np.float32
    # float32 can exactly represent all integers up to 24 bits
    if dtype.itemsize <= 2 and np.issubdtype(dtype, np.integer):
        # A scale factor is entirely safe (vanishing into the mantissa),
        # but a large integer offset could lead to loss of precision.
        # Sensitivity analysis can be tricky, so we just use a float64
        # if there's any offset at all - better unoptimised than wrong!
        if not has_offset:
            return np.float32
    # For all other types and circumstances, we just use float64.
    # (safe because eg. complex numbers are not supported in NetCDF)
    return np.float64
991814
def _to_array(self, itaper, normalization='4pi', csphase=1):
        
        coeffs = _shtools.SHVectorToCilm(self.tapers[:, itaper])

        if normalization == 'schmidt':
            for l in range(self.lwin + 1):
                coeffs[:, l, :l+1] *= _np.sqrt(2.0 * l + 1.0)
        elif normalization == 'ortho':
            coeffs *= _np.sqrt(4.0 * _np.pi)

        if csphase == -1:
            for m in range(self.lwin + 1):
                if m % 2 == 1:
                    coeffs[:, :, m] = - coeffs[:, :, m]

        return coeffs
881109
def _tofloat(obj):
    """"""
    if "inf" in obj.lower().strip():
        return obj
    try:
        return int(obj)
    except ValueError:
        try:
            return float(obj)
        except ValueError:
            return obj
199232
def normalizeSequence(sequence):
  
  seq = np.array(sequence).astype('float64')

  meanSeq = np.mean(seq)
  stdSeq = np.std(seq)
  seq = (seq - np.mean(seq)) / np.std(seq)

  sequence = seq.tolist()
  return sequence, meanSeq, stdSeq
479137
def clip_to_seconds(m: Union[int, pd.Series]) -> Union[int, pd.Series]:
        """"""
        return m // pd.Timedelta(1, unit='s').value
1104212
private ListDouble convertToListDouble(List<String> tokens) {
        double[] values = new double[tokens.size()];
        for (int i = 0; i < values.length; i++) {
            if (tokens.get(i).isEmpty()) {
                values[i] = Double.NaN;
            } else {
                values[i] = Double.parseDouble(tokens.get(i));
            }
        }
        return new ArrayDouble(values);
    }
203124
def toFloatArray(img):
    '''
    
    '''
    _D = {1: np.float32,  # uint8
          2: np.float32,  # uint16
          4: np.float64,  # uint32
          8: np.float64}  # uint64
    return img.astype(_D[img.itemsize])
1249966
def simxUnpackFloats(floatsPackedInString):
    '''
    
    '''
    b=[]
    for i in range(int(len(floatsPackedInString)/4)):
        b.append(struct.unpack('<f',floatsPackedInString[4*i:4*(i+1)])[0])
    return b
142388
def convert_to_strings(self, sequences, sizes=None):
        """"""
        strings = []
        for x in xrange(len(sequences)):
            seq_len = sizes[x] if sizes is not None else len(sequences[x])
            string = self._convert_to_string(sequences[x], seq_len)
            strings.append(string)
        return strings
62584
def u32le_list_to_byte_list(data):
    """"""
    res = []
    for x in data:
        res.append((x >> 0) & 0xff)
        res.append((x >> 8) & 0xff)
        res.append((x >> 16) & 0xff)
        res.append((x >> 24) & 0xff)
    return res
538985
def knx2_to_float(knxdata):
    """"""
    if len(knxdata) != 2:
        raise KNXException("Can only convert a 2 Byte object to float")

    data = knxdata[0] * 256 + knxdata[1]
    sign = data >> 15
    exponent = (data >> 11) & 0x0f
    mantisse = float(data & 0x7ff)
    if sign == 1:
        mantisse = -2048 + mantisse

    return mantisse * pow(2, exponent) / 100