---
# System prepended metadata

title: Python code for variable lignthing

---

# Python code for variable lignthing

This is the proposed code snippet to feature in Driftcam:

```python=3
def strobe width(
        relative_speed_of_motion, 
        altitude, 
        minimum_strobe_width, 
        focal_length):
    """ Computes a variable strobe width given speed, altitude and focal length
    
    This function takes into account:
      - Motion blur: HOW?
      - Sensor sensitivity: HOW?
      - Sensor saturation: HOW?
      
    Args:
      relative_speed_of_motion (float): Relative speed in m/s
      altitude (float): Drifter altitude in meters
      minimum_strobe_width (float): Minimum strobe duration in seconds
      focal_length (float): Camera focal length in meters
      
    Returns:
      float. The desired strobe width
    """
    # The maximum width that the camera strobe can be
    maximum_strobe_width = altitude / (relative_speed_of_motion * focal_length)

    # The width of the strobe light
    strobe_width_output = (2 x Altitude x tan(ΘH)) / (Vc * resh)      

    # This stops the strobe from exceeding safe limits,
    # if the width is tool high then the width is limited to the maximum value
    if width > maximum:
        strobe_width_output = maximum_strobe_width
    elif width < min:
        strobe_width_output = minimum_strobe_width
    return strobe_width_output
```

    