The number of LEDs on the bar graph actually lit up. Note that just
        like :attr:`value`, this can be negative if the LEDs are lit from last
        to first.
484384
def lit_count(self):
        
        lit_value = self.value * len(self)
        if not isinstance(self[0], PWMLED):
            lit_value = int(lit_value)
        return lit_value
1220300
def []=( num, value )
      closed!
      if (num < 0 || num >= @leds.length)
        raise IndexError, "index #{num} is outside of LED range: 0...#{@leds.length-1}"
      end
      @leds[num] = to_color(value)
    end
55312
def brightness_increment(increment = 1)
      params = { brightness: {} }
      params[:brightness][:increment] = increment
      @requester.put(url: "#{@api_url}/state", params: params)
    end
23422
def positive_directional_movement(high_data, low_data):
    
    catch_errors.check_for_input_len_diff(high_data, low_data)
    up_moves = calculate_up_moves(high_data)
    down_moves = calculate_down_moves(low_data)

    pdm = []
    for idx in range(0, len(up_moves)):
        if up_moves[idx] > down_moves[idx] and up_moves[idx] > 0:
            pdm.append(up_moves[idx])
        else:
            pdm.append(0)

    return pdm
679798
def all_off(self):
        

        # If this is a platform without LEDs there is nothing to do
        if not self.leds:
            return

        for led in self.leds.values():
            led.brightness = 0
71682
def show
      closed!
      if @debug
        ary = @leds.map { |value| Rainbow(@debug).color(*to_rgb(value)) }
        $stdout.print "\r#{ary.join}"
      end
      self
    end
1220297
function () {
        if (!this.vertexCount) {
            return;
        }

        if (!this.isUniqueVertex()) {
            this.generateUniqueVertex();
        }

        var attributes = this.attributes;
        var array = attributes.barycentric.value;
        var indices = this.indices;
        // Already existed;
        if (array && array.length === indices.length * 3) {
            return;
        }
        array = attributes.barycentric.value = new Float32Array(indices.length * 3);

        for (var i = 0; i < (indices ? indices.length : this.vertexCount / 3);) {
            for (var j = 0; j < 3; j++) {
                var ii = indices ? indices[i++] : (i * 3 + j);
                array[ii * 3 + j] = 1;
            }
        }
        this.dirty();
    }
683719
function (e, data) {
                if (data.context) {
                    var progress = Math.floor(data.loaded / data.total * 100);
                    data.context.find('.progress')
                        .attr('aria-valuenow', progress)
                        .find('.bar').css(
                            'width',
                            progress + '%'
                        );
                }
            }
1252740
def _get_pwm_values(self, brightness=None, color=None):
        
        if brightness is None:
            brightness = self.brightness
        if color is None:
            color = self.color

        return [(x / 255) * brightness for x in self._rgb_to_rgbw(color)]
859575
def getColorForValue(self, value):
        
        rampIndex = 0

        if value >= self.min and value <= self.max:
            rampIndex = self.getIndexForValue(value)

        elif value > self.max:
            rampIndex = -1

        elif value < self.min:
            rampIndex = 0

        return self.getColorForIndex(rampIndex)
804170
function() {
            var
              barWidth       = $bar.width(),
              totalWidth     = $module.width(),
              minDisplay     = parseInt($bar.css('min-width'), 10),
              displayPercent = (barWidth > minDisplay)
                ? (barWidth / totalWidth * 100)
                : module.percent
            ;
            return (settings.precision > 0)
              ? Math.round(displayPercent * (10 * settings.precision)) / (10 * settings.precision)
              : Math.round(displayPercent)
            ;
          }
715348
def _bar(self, target_name, current, total):
        
        bar_len = 30

        if total is None:
            state = 0
            percent = "?% "
        else:
            total = int(total)
            state = int((100 * current) / total) if current < total else 100
            percent = str(state) + "% "

        if self._n_total > 1:
            num = "({}/{}): ".format(self._n_finished + 1, self._n_total)
        else:
            num = ""

        n_sh = int((state * bar_len) / 100)
        n_sp = bar_len - n_sh
        pbar = "[" + "#" * n_sh + " " * n_sp + "] "

        return num + pbar + percent + target_name
759485
def fade_speed(self, value):
        

        if value is not None:
            assert type(value) is float, "'{0}' attribute: '{1}' type is not 'float'!".format("fade_speed", value)
            assert value >= 0, "'{0}' attribute: '{1}' need to be exactly positive!".format("fade_speed", value)
        self.__fade_speed = value
804200
def bar(self, progress):
        """"""
        if not hasattr(self, "_limit") or not self._limit:
            self._limit = self.terminal_size()
        graph_progress = int(progress * self._limit)
        self.stdout.write('\r', ending='')
        progress_format = "[%-{}s] %d%%".format(self._limit)
        self.stdout.write(
            self.style.SUCCESS(progress_format % (self.progress_symbol * graph_progress, int(progress * 100))),
            ending=''
        )
        self.stdout.flush()
1298652
def run_false_positive_experiment_dim(
                              numActive = 128,
                              dim = 500,
                              numSamples = 1000,
                              numDendrites = 500,
                              synapses = 24,
                              numTrials = 10000,
                              seed = 42,
                              nonlinearity = sigmoid_nonlinearity(11.5, 5)):
  
  numpy.random.seed(seed)
  fps = []
  fns = []
  totalUnclassified = 0

  for trial in range(numTrials):

    # data = generate_evenly_distributed_data_sparse(dim = dim,
    #                                                num_active = numActive,
    #                                                num_samples = numSamples)
    # labels = numpy.asarray([1 for i in range(numSamples / 2)] +
    #                        [-1 for i in range(numSamples / 2)])
    # flipped_labels = labels * -1

    negData = generate_evenly_distributed_data_sparse(dim = dim,
                                                   num_active = numActive,
                                                   num_samples = numSamples/2)
    posData = generate_evenly_distributed_data_sparse(dim = dim,
                                                   num_active = numActive,
                                                   num_samples = numSamples/2)
    halfLabels = numpy.asarray([1 for _ in range(numSamples / 2)])
    flippedHalfLabels = halfLabels * -1

    neuron = Neuron(size =synapses * numDendrites,
                    num_dendrites = numDendrites,
                    dendrite_length = synapses,
                    dim = dim, nonlinearity = nonlinearity)
    neg_neuron = Neuron(size =synapses * numDendrites,
                        num_dendrites = numDendrites,
                        dendrite_length = synapses,
                        dim = dim, nonlinearity = nonlinearity)

    neuron.HTM_style_initialize_on_positive_data(posData)
    neg_neuron.HTM_style_initialize_on_positive_data(negData)

    # Get error for positively labeled data
    fp, fn, uc = get_error(posData, halfLabels, [neuron], [neg_neuron])
    totalUnclassified += uc
    fps.append(fp)
    fns.append(fn)

    # Get error for negatively labeled data
    fp, fn, uc = get_error(negData, flippedHalfLabels, [neuron], [neg_neuron])
    totalUnclassified += uc
    fps.append(fp)
    fns.append(fn)


  print "Error with n = {} : {} FP, {} FN, {} unclassified".format(
    dim, sum(fps), sum(fns), totalUnclassified)

  result = {
    "dim": dim,
    "totalFP": sum(fps),
    "totalFN": sum(fns),
    "total mistakes": sum(fns + fps) + totalUnclassified,
    "error": float(sum(fns + fps) + totalUnclassified) / (numTrials * numSamples),
    "totalSamples": numTrials * numSamples,
    "a": numActive,
    "num_dendrites": numDendrites,
    "totalUnclassified": totalUnclassified,
    "synapses": 24,
    "seed": seed,
  }

  return result
1056247
function (plot, axis, noTicks) {
        var ticks = [],
            minIdx = -1,
            maxIdx = -1,
            surface = plot.getCanvas(),
            logTickValues = PREFERRED_LOG_TICK_VALUES,
            min = clampAxis(axis, plot),
            max = axis.max;

        if (!noTicks) {
            noTicks = 0.3 * Math.sqrt(axis.direction === "x" ? surface.width : surface.height);
        }

        PREFERRED_LOG_TICK_VALUES.some(function (val, i) {
            if (val >= min) {
                minIdx = i;
                return true;
            } else {
                return false;
            }
        });

        PREFERRED_LOG_TICK_VALUES.some(function (val, i) {
            if (val >= max) {
                maxIdx = i;
                return true;
            } else {
                return false;
            }
        });

        if (maxIdx === -1) {
            maxIdx = PREFERRED_LOG_TICK_VALUES.length - 1;
        }

        if (maxIdx - minIdx <= noTicks / 4 && logTickValues.length !== EXTENDED_LOG_TICK_VALUES.length) {
            //try with multiple of 5 for tick values
            logTickValues = EXTENDED_LOG_TICK_VALUES;
            minIdx *= 2;
            maxIdx *= 2;
        }

        var lastDisplayed = null,
            inverseNoTicks = 1 / noTicks,
            tickValue, pixelCoord, tick;

        // Count the number of tick values would appear, if we can get at least
        // nTicks / 4 accept them.
        if (maxIdx - minIdx >= noTicks / 4) {
            for (var idx = maxIdx; idx >= minIdx; idx--) {
                tickValue = logTickValues[idx];
                pixelCoord = (Math.log(tickValue) - Math.log(min)) / (Math.log(max) - Math.log(min));
                tick = tickValue;

                if (lastDisplayed === null) {
                    lastDisplayed = {
                        pixelCoord: pixelCoord,
                        idealPixelCoord: pixelCoord
                    };
                } else {
                    if (Math.abs(pixelCoord - lastDisplayed.pixelCoord) >= inverseNoTicks) {
                        lastDisplayed = {
                            pixelCoord: pixelCoord,
                            idealPixelCoord: lastDisplayed.idealPixelCoord - inverseNoTicks
                        };
                    } else {
                        tick = null;
                    }
                }

                if (tick) {
                    ticks.push(tick);
                }
            }
            // Since we went in backwards order.
            ticks.reverse();
        } else {
            var tickSize = plot.computeTickSize(min, max, noTicks),
                customAxis = {min: min, max: max, tickSize: tickSize};
            ticks = $.plot.linearTickGenerator(customAxis);
        }

        return ticks;
    }
386318
@Override
    public void setValue(double value) {
        super.setValue(value);

        // Set active leds relating to the new value
        calcNoOfActiveLed();

        if (isValueCoupled()) {
            setLcdValue(value);
        }
        repaint(getInnerBounds());
    }