Comparing files that differ only in species order


In [2]:
from IPython.display import display
import pandas as pd

from atntools.create_feature_file import getSimulationData

def show_comparison(f1, f2):
    df1 = pd.DataFrame(getSimulationData(f1)[2])
    df2 = pd.DataFrame(getSimulationData(f2)[2])
    df3 = df1 - df2
    print("File 1:")
    display(df1.head())
    print("File 2:")
    display(df2.head())
    print("Difference:")
    display(df3.head())

# Compare shuffled versions of the same nodeconfig
#show_comparison(
#    '../data/set40/biomass-data/ATN.csv',
#    '../data/set40/biomass-data/ATN_1.csv')

# Same nodeconfig, only non-basal species shuffled
#show_comparison(
#    '../data/set41/biomass-data/ATN_1.csv',
#    '../data/set41/biomass-data/ATN_6.csv')

# Convergence ecosystem 0 (checking that default config produces same results in sets 1 and 42)
# OK - they are identical
#show_comparison(
#    '../data/set1/biomass-data/ATN.csv',
#    '../data/set42/biomass-data/ATN.csv')

# Convergence ecosystem 0, non-basal species shuffled
show_comparison(
    '../../data/set42/biomass-data/ATN.csv.gz',
    '../../data/set42/biomass-data/ATN_3.csv.gz')


File 1:
5 14 31 42 70
0 2000 1751 1415 240 2494
1 1587 1476 1698 286 2665
2 1185 1163 1948 342 2852
3 819 842 2114 407 3055
4 513 548 2150 475 3274
File 2:
5 14 31 42 70
0 2000 1751 1415 240 2494
1 1587 1476 1698 286 2665
2 1185 1163 1948 342 2852
3 819 842 2114 407 3055
4 513 548 2150 475 3274
Difference:
5 14 31 42 70
0 0 0 0 0 0
1 0 0 0 0 0
2 0 0 0 0 0
3 0 0 0 0 0
4 0 0 0 0 0

In [ ]: