contest log analysis2

previously Contest log Analysis we got the Skimmer data, and added some columns. We then saved that into a PKL file. We will now use this pickle file... to have a look at the data.

We load the file like this

with open('contest.pkl','rb') as ifp:
    contest=pickle.load(ifp)
contest.head()

Most common country

As the data is in a DataFrame (sort of Excel in Python); This shows you the top 5 countries that were spotted.

contest['Cty2']=contest['Country']
contest.groupby(by=['Country']).agg({'Cty2':'count'},as_index=False).sort_values(['Cty2'],ascending=False)[:5]
Cty2
Country
Japan 3160
Indonesia 2619
Thailand 757
Italy 404
Poland 350

Frankly I am surprised that Poland was so well noticed....

The Least Common

The 10 least spotted countries....

contest.groupby(by=['Country','Band','cqde']).agg({'Cty2':'count'},as_index=False).sort_values(['Cty2'],ascending=True)[:10]
Cty2
Country Band cqde
Afghanistan 15.0 1
Latvia 40.0 DE 1
20.0 1
Kazakhstan 40.0 1
15.0 1
Israel 20.0 DE 1
Ireland 20.0 1
Hungary 20.0 DE 1
Hong Kong 15.0 1
Hawaii 40.0 CQ 1
15.0 DE 1
Guinea-Bissau 40.0 1
Guatemala 20.0 1
Guantanamo Bay 40.0 1
Greece 80.0 1
Lithuania 20.0 1
Greece 20.0 1
Georgia 40.0 1
France 20.0 DE 1
CQ 1

Here I have added which band, and what Mode they were on also.

Who in my country was I competing against ?

pd.DataFrame(contest[contest.Country=='Philippines']['call']).drop_duplicates(subset=['call']).sort_values(['call'])

And I see...

call
827 4D3X
1091 4F3BZ
4808 4F3OM
4781 4G1DIF
1120 DU1/N6HPX
7599 DU1IVT
1823 DU1JM
5458 DU1OC
1382 DU1RB
7347 DU7EYG
6616 DV9IHK
7747 DX7EVM
1914 DX9EVM

Map time

Now this is slightly more tricky.

We start off with a base Map

world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))

And now - plot all the Lat/Lon (This is data we added to the Cluster data at the very beginning).

for b in [80,40,20,10]:
    print(f"Processing {b}")
    map1=contest[contest.Band==b][['Lon','Lat']]
    map1.Lon = map1.Lon * 1

    gdf = geopandas.GeoDataFrame(map1, geometry=geopandas.points_from_xy(map1.Lon, map1.Lat))

    world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
    ax = world.plot(color='white', edgecolor='black',figsize=(18, 18))

    # We can now plot our ``GeoDataFrame``.
    gdf.plot(ax=ax, color='red')
    plt.title(f'Activity observed on {b}m.',loc='center', pad=None)
    plt.savefig(f'activity{b}m.jpg')

What this will do is create a new Map - per band ...

Activity Per Band/Per Hour

It would be nice to see how much activity was per band/per hour.

This is the code to do this

for b in [80,40,20,10]:
    print(f"Processing {b}")
    df_per_cont = contest[contest.Band==b][['ZHour','Cont']]
    df_per_cont['Heard']=1
    df_per_cont.set_index('ZHour',inplace=True)
    df_per_cont.groupby(['ZHour','Cont']).agg({'Heard':'sum'})
    res=pd.pivot_table(df_per_cont,index=["ZHour"],values=["Heard"],aggfunc=np.sum,columns=["Cont"]).fillna(0)


    # Use seaborn style defaults and set the default figure size
    sns.set(rc={'figure.figsize':(20, 11),})
    sns.set(font_scale=1.5)
    plt.title(f'activity on {b}M ')
    output=res.plot(linewidth=1.5)
    plt.savefig(f'timeactivity{b}m.jpg')

Again - it produces an timeactivity{band}m.jpg per band.

I hope this has given you some insight as to how you can use cluster information post contest to try and see where you may have gone wrong.