Reads weights from each of the load cells.
766403
def _read_weights(self):
        
        weights = []

        grams_per_pound = 453.592

        # Read from each of the sensors
        for ser in self._serials:
            ser.write('W\r')
            ser.flush()
        time.sleep(0.02)
        for ser in self._serials:
            try:
                output_str = ser.readline()
                weight = float(output_str) * grams_per_pound
                weights.append(weight)
            except:
                weights.append(0.0)

        # Log the output
        log_output = ''
        for w in weights:
            log_output +='{:.2f} '.format(w)
        rospy.loginfo(log_output)

        return weights
505874
def _load(self, scale=0.001):
        

        with open_workbook(self.path) as wb_:
            for sheet in wb_.sheets():
                if sheet.name in ['Plot of AllBands', ]:
                    continue
                ch_name = OLI_BAND_NAMES.get(sheet.name.strip())

                if ch_name != self.bandname:
                    continue

                wvl = sheet.col_values(0, 2)
                resp = sheet.col_values(1, 2)

                self.rsr = {'wavelength': np.array(wvl) / 1000.,
                            'response': np.array(resp)}
                break
590796
public void load()
    {
        transitives.clear();
        for (final String groupIn : mapGroup.getGroups())
        {
            for (final String groupOut : mapGroup.getGroups())
            {
                if (!groupIn.equals(groupOut))
                {
                    findTransitives(groupIn, groupOut);
                }
            }
        }
    }
566310
def initialize_weights_nn(data, means, lognorm=True):
    
    # TODO
    genes, cells = data.shape
    k = means.shape[1]
    if lognorm:
        data = log1p(cell_normalize(data))
    for i in range(cells):
        for j in range(k):
            pass
1316670
def load_data(limit=0, split=0.8):
    """"""
    # Partition off part of the train data for evaluation
    train_data, _ = thinc.extra.datasets.imdb()
    random.shuffle(train_data)
    train_data = train_data[-limit:]
    texts, labels = zip(*train_data)
    cats = [{"POSITIVE": bool(y), "NEGATIVE": not bool(y)} for y in labels]
    split = int(len(train_data) * split)
    return (texts[:split], cats[:split]), (texts[split:], cats[split:])
1367347
def values(self):
        
        for val in self._client.hvals(self.key_prefix):
            yield self._loads(val)
1370211
def _raw_weights(self):
        
        if self._debug:
            return np.array([[],[],[],[]])

        if not self._running:
            raise ValueError('Weight sensor is not running!')
        if len(self._weight_buffers) == 0:
            time.sleep(0.3)
            if len(self._weight_buffers) == 0:
                raise ValueError('Weight sensor is not retrieving data!')
        weights = np.array(self._weight_buffers)
        return weights
358971
def _load(self, data_path, ignore_missing=False):
        '''
        '''
        if data_path.endswith(".npz"):
            data_dict = np.load(data_path)
            keys = sorted(data_dict.keys())
            for i, k in enumerate(keys):
                data = data_dict[k]
                op_name = "_".join(k.split("_")[:-1])
                param_name = "weights" if k.split("_")[-1] == "W" else "biases"
                if self.verbose:
                    print("Loaded: {} {}".format(op_name, param_name))
                if op_name not in self.weights:
                    self.weights[op_name] = {}
                self.weights[op_name][param_name] = data
        elif data_path.endswith(".npy"):
            data_dict = np.load(data_path).item()
            for op_name in data_dict:
                with tf.variable_scope(op_name, reuse=True):
                    for param_name, data in data_dict[op_name].iteritems():
                        if self.verbose:
                            print("Loaded: {} {}".format(op_name, param_name))
                        if op_name not in self.weights:
                            self.weights[op_name] = {}
                        self.weights[op_name][param_name] = data
        else:
            raise RuntimeError("Invalid file type.")
1134815
def load(self):
        
        for i in range(1, self.bands + 1):
            self.__data[i - 1] = self.matrix(i)
1133016
def _calculate_weights(self, this_samples, N):
        """"""

        this_weights = self.weights.append(N)[:,0]

        if self.target_values is None:
            for i in range(N):
                tmp = self.target(this_samples[i]) - self.proposal.evaluate(this_samples[i])
                this_weights[i] = _exp(tmp)
        else:
            this_target_values = self.target_values.append(N)
            for i in range(N):
                this_target_values[i] = self.target(this_samples[i])
                tmp = this_target_values[i] - self.proposal.evaluate(this_samples[i])
                this_weights[i] = _exp(tmp)
985566
def read_in_weight_table(self, in_weight_table):
        
        print("Reading the weight table...")
        with open_csv(in_weight_table, "r") as csvfile:
            reader = csv.reader(csvfile)
            header_row = next(reader)
            # check number of columns in the weight table
            if len(header_row) < len(self.header_wt):
                raise Exception(self.error_messages[4])
            # check header
            if header_row[1:len(self.header_wt)] != self.header_wt[1:]:
                raise Exception(self.error_messages[5])

        self.dict_list = \
            np.loadtxt(
                in_weight_table,
                delimiter=",",
                usecols=(0, 1, 2, 3, 4),
                skiprows=1,
                dtype={
                    'names': (self.header_wt[0],
                              self.header_wt[1],
                              self.header_wt[2],
                              self.header_wt[3],
                              self.header_wt[4]),
                    'formats': ('i8', 'f8', 'i8', 'i8', 'i8')
                },
            )

        self.count = self.dict_list.shape[0]
        self.size_stream_id = \
            len(np.unique(np.array(self.dict_list[self.header_wt[0]],
                                   dtype=np.int32)))
525465
def load_weights(self, weight_file: str) -> None:
        
        requires_grad = self.requires_grad

        with h5py.File(cached_path(weight_file), 'r') as fin:
            for i_layer, lstms in enumerate(
                    zip(self.forward_layers, self.backward_layers)
            ):
                for j_direction, lstm in enumerate(lstms):
                    # lstm is an instance of LSTMCellWithProjection
                    cell_size = lstm.cell_size

                    dataset = fin['RNN_%s' % j_direction]['RNN']['MultiRNNCell']['Cell%s' % i_layer
                                                                                ]['LSTMCell']

                    # tensorflow packs together both W and U matrices into one matrix,
                    # but pytorch maintains individual matrices.  In addition, tensorflow
                    # packs the gates as input, memory, forget, output but pytorch
                    # uses input, forget, memory, output.  So we need to modify the weights.
                    tf_weights = numpy.transpose(dataset['W_0'][...])
                    torch_weights = tf_weights.copy()

                    # split the W from U matrices
                    input_size = lstm.input_size
                    input_weights = torch_weights[:, :input_size]
                    recurrent_weights = torch_weights[:, input_size:]
                    tf_input_weights = tf_weights[:, :input_size]
                    tf_recurrent_weights = tf_weights[:, input_size:]

                    # handle the different gate order convention
                    for torch_w, tf_w in [[input_weights, tf_input_weights],
                                          [recurrent_weights, tf_recurrent_weights]]:
                        torch_w[(1 * cell_size):(2 * cell_size), :] = tf_w[(2 * cell_size):(3 * cell_size), :]
                        torch_w[(2 * cell_size):(3 * cell_size), :] = tf_w[(1 * cell_size):(2 * cell_size), :]

                    lstm.input_linearity.weight.data.copy_(torch.FloatTensor(input_weights))
                    lstm.state_linearity.weight.data.copy_(torch.FloatTensor(recurrent_weights))
                    lstm.input_linearity.weight.requires_grad = requires_grad
                    lstm.state_linearity.weight.requires_grad = requires_grad

                    # the bias weights
                    tf_bias = dataset['B'][...]
                    # tensorflow adds 1.0 to forget gate bias instead of modifying the
                    # parameters...
                    tf_bias[(2 * cell_size):(3 * cell_size)] += 1
                    torch_bias = tf_bias.copy()
                    torch_bias[(1 * cell_size):(2 * cell_size)
                              ] = tf_bias[(2 * cell_size):(3 * cell_size)]
                    torch_bias[(2 * cell_size):(3 * cell_size)
                              ] = tf_bias[(1 * cell_size):(2 * cell_size)]
                    lstm.state_linearity.bias.data.copy_(torch.FloatTensor(torch_bias))
                    lstm.state_linearity.bias.requires_grad = requires_grad

                    # the projection weights
                    proj_weights = numpy.transpose(dataset['W_P_0'][...])
                    lstm.state_projection.weight.data.copy_(torch.FloatTensor(proj_weights))
                    lstm.state_projection.weight.requires_grad = requires_grad
1156853
def load(self, f, skip):
        """"""
        array = self.get()
        counter = 0
        counter_limit = array.size
        convert = array.dtype.type
        while counter < counter_limit:
            line = f.readline()
            words = line.split()
            for word in words:
                if counter >= counter_limit:
                    raise FileFormatError("Wrong array data: too many values.")
                if not skip:
                    array.flat[counter] = convert(word)
                counter += 1
1316679
def load(self):
        """"""

        for drpins in self.iload(self.entry):
            self.drps[drpins.name] = drpins

        return self
98254
def _read(self):
        """"""
        _, data_img_name, label_img_name = self.f.readline().strip('\n').split("\t")
        data = {}
        label = {}
        data[self.data_name], label[self.label_name] = self._read_img(data_img_name, label_img_name)
        return list(data.items()), list(label.items())
1094112
def read(self, handle):
        '''
        '''
        self.bytes_per_element, = struct.unpack('b', handle.read(1))
        dims, = struct.unpack('B', handle.read(1))
        self.dimensions = [struct.unpack('B', handle.read(1))[0] for _ in range(dims)]
        self.bytes = b''
        if self.total_bytes:
            self.bytes = handle.read(self.total_bytes)
        size, = struct.unpack('B', handle.read(1))
        self.desc = size and handle.read(size).decode('utf-8') or ''
1186843
def weights(self):
        ''
        self._check_estimated()
        u_input = self.u
        return _KoopmanWeights(u_input[0:-1], u_input[-1])