Fledex.Effect.BellCurve (fledex v0.8.0)

Copy Markdown View Source

This is an effect that will set the intensity of the LEDs according to a Bell curve distribution.

Options

  • :cache (default: false): We might want to avoid (except during development) to recalculate the bell curve values in every frame of the effect. This option allows to cache the values. CAUTION: if you dynamically change the effect, you will have to first disable the cache for changes to take effect.
  • :multiplier (default: 1): The bell curve is normalized, which will result in very weak brightness values. The multiplier allows to boost that the brightness.
  • :mean (default: count/2): Where the peak of the bell curve is located.
  • :standard_deviation (default: 5.0): This controls the width of the bell curve. A smaller value result in a sharper peak.
  • :min (default: 0): This indicates the minimum value on how far we should calculate the bell curve
  • :max (default: count): This indicates the maximum value on how far we should calculate the bell curve

Summary

Functions

Calculates the bell curve values for the given count and configuration.

Generates {x, y} points for plotting a bell curve.

Returns the probability density at x for a normal distribution.

Functions

calculate_window(count, config)

@spec calculate_window(integer(), keyword()) :: %{required(integer()) => byte()}

Calculates the bell curve values for the given count and configuration.

points(mean, standard_deviation, min, max, step)

@spec points(float(), float(), float(), float(), float()) :: [{float(), float()}]

Generates {x, y} points for plotting a bell curve.

probability_density(x, mean, standard_deviation)

@spec probability_density(float(), float(), float()) :: float()

Returns the probability density at x for a normal distribution.

Examples

Fledex.Effect.BellCurve.probability_density(0, 0, 1)
# 0.3989422804014327