Gain advisor script

Discussion in 'Hardware' started by Evgeny, Mar 18, 2021.

  1. Evgeny

    Evgeny New Member

    This script will find out what strong messages percentage is and advise you to tune gain to keep it in range from 0.5% to 5%.

    Script:

    Code:
    #!/usr/bin/env python3
    
    # This script will find out what strong messages percentage is and
    # advise you to tune gain to keep it in range from 0.5% to 5%.
    # Evgeny Varnavskiy 2021
    
    import json
    
    with open('/run/readsb/stats.json') as f:
      data = json.load(f)
    
    strong = data["total"]["local"]["strong_signals"]
    total = data["total"]["local"]["accepted"][0] + data["total"]["local"]["accepted"][1]
    perc = round((strong * 100 / total), 2)
    
    print("Too strong messages percentage:", perc)
    
    if perc > 5:
        print("Decrease gain")
    elif perc < 0.5:
        print("Increase gain")
    else:
        print("Gain optimal")
    
     
  2. James

    James Guest

    thanks! very cool!