FlightAware Discussions

Thoughts on optimizing gain

I’ve put in a maximum number of 50 iterations.

That should hopefully suffice.
Also changed the limit to 1e-10.

The formula that is to be fitted can depending on the data be very problematic.
But it’s still the most appropriate formula i managed.

Didn’t work with 1.e-10, changed to 1.e-5, that worked.
Found that 1.e-7 was the lowest I could go before it started oscillating.
There is some differences to the graphs generated by 1.e-5 and 1.e-7.
1.e-5:

1.e-7:

Does it work with the current script that’s online? Shouldn’t need any modification as it’s capped at 50 iterations.

Also could you post the values for a b c and d after the fit?

Final set of parameters            Asymptotic Standard Error
=======================            ==========================
a               = 0.876872         +/- 0.3343       (38.12%)
b               = 1.16871          +/- 0.5515       (47.19%)
c               = 1.02983          +/- 0.1894       (18.39%)
d               = 1.4441           +/- 0.09496      (6.576%)

I will download and try the latest version. The one I used was from earlier today…

These are from 1.e-7:

Final set of parameters            Asymptotic Standard Error
=======================            ==========================
a               = -2.09609         +/- 0.5833       (27.83%)
b               = -8.24441         +/- 17.55        (212.8%)
c               = -3.4256          +/- 14.04        (409.9%)
d               = 3.74596          +/- 11.53        (307.9%)

It works with the current version.
Results are similar to when I ran with 1.e-7.

Final set of parameters            Asymptotic Standard Error
=======================            ==========================
a               = -1.97777         +/- 0.641        (32.41%)
b               = -4.53066         +/- 3.427        (75.63%)
c               = -1.06479         +/- 2.045        (192%)
d               = 1.70993          +/- 2.856        (167%)

Does it run to 50 iterations or does it converge earlier?

Maximum iteration count (50) reached. Fit stopped.

The problem really here is that the fit function is trying to find parameters that make a line that assumes that message rate is dependent on aircraft numbers, and only that. Of course in practice the message rate is going to vary a lot depending on all sorts of factors - range of all the aircraft, overlapping signals number of ground radar interrogations etc.

Since we don’t actually have an accurate theoretical model of the effect of increasing aircraft on message rate, it’s only ever going to be an approximation - the equation it’s trying to fit the data to doesn’t necessarily represent what is (or should be) happening, so the resulting curve is only an approximation. I don’t think it’s worth spending too long trying to make it super accurate, as it’s only intended as a visual indication.

1 Like

I’ve done a new version.
Don’t like c and d becoming negative, so i’m just using abs© and abs(d).

(c or d negative makes for a strange graph)

1 Like

I’ll try it a bit later tonight :slight_smile:

If you are having problems executing the script:

wget -q -O plot.sh https://raw.githubusercontent.com/wiedehopf/adsb-wiki/master/caius_scatter_plot.sh
bash plot.sh

The -O with a filename specified makes sure you overwrite the old version.
Then executing a bash script when it’s not executable, you can just give it to the command bash as an argument.

2 Likes

Here’s an alternative layout I tried:

The scatter plot shows the last week overlaid on the preceding month’s data. The box plots show day, week, month and year summaries.

Preceding month? Week-4 to Week-1 overlaid on Week-0?

Do you create a fit graph for both?
While the dots are pretty they are hard to differentiate.

Yes, It’s the last week, then 30 days prior to that week. I’m only generating a fit for the previous week at the moment. It’s plotting data from the script that pulls from the rrds daily rather than getting them directly.

I’m not happy with the palette at the moment - I wanted to have different palettes for each plot, but you can’t easily do that in gnuplot. I’m not sure the best way to do it - one option is to remove the range colouring from the past week and having the two plots just simple colours, or try and find a palette that gives better contrast between them.

Here’s one alternative that gives a bit better contrast:

Older data is the blue dots, with the recent data using a palette that contains no blue.

I have made a script that you can use to compare two periods of data. Here is an example comparing two different LNAs:

In order to use it, you need to have wiedehopf’s graphs installed and up to date, since data is plotted using data files that are retrieved every day from the collectd database. These are saved in the directory /var/lib/graphs1090/scatter/. If you have updated in the last 10 days or so then you should already be accumulating data.

You can get the script here:

wget https://raw.githubusercontent.com/caiusseverus/adsbcompare/master/compare.sh

To set the periods to compare, the script takes arguments in the following format:

./compare.sh date1 duration1 date2 duration2

where the duration is in days. So for example:

./compare.sh 2019-07-01 10 2019-07-12 3

will compare the period starting 1st July 2019 for 10 days inclusive, with the period starting 12th July 2019 for 3 days inclusive.

The graph is copied to http://ipofraspberrypi/dump1090-fa/data/compare.png
Note that this is volatile, so if you want to keep the graph then save it elsewhere otherwise it will disappear when you next reboot the pi or get overwritten when you next run the script.

If you have any ideas for improvements of changes then let me know.

2 Likes

 ./compare.sh 2019-07-01 10 2019-07-12 3

Maybe add the length of the two data sets in the graph

2019-07-01 - 2019-07-11
2019-07-12 - 2019-07-15

Updated to now show the dates of each period in the title:

1 Like

Thanks…

13 - 14 July - Airspy mini Gain 21 - 12 MHz - Pi4
15 - 18 July - Airspy mini Gain 19 - 20 Mhz - Pi4

Nice - shows a clear increase in the number of messages and aircraft, but not much difference in range.

1 Like

Great!
Now I have some graphs to generate and study :slight_smile:

1 Like