
import numpy as np
from armor import pattern
dbz = pattern.DBZ
a=pattern.a
a.invar = a.invariantMoments()

results = []
for i in range(200, 500, 100):
    for j in range(0, 60, 10):
        print '\n................\n', i+j
        b = dbz('20120612.0%d'% (i+j))
        b.load()
        b.invar = b.invariantMoments()
        invarcorr    = np.corrcoef(a.invar, b.invar)[0,1]
        abcorr  = a.corr(b)[0,1]
        abdiff  = (a-b).matrix.sum()
        new_entry = {'name':b.name, 'invar':b.invar, 'invarcorr_with_a':invarcorr,
                        'abcorr':abcorr, 'abdiff':abdiff}
        print new_entry
        results.append(new_entry)
                



print '\n'.join( [str((v['name'], v['abcorr'], v['invarcorr_with_a'])) for v in results])
"""
('DBZ20120612.0200', 0.99999999999989797, 1.0)
('DBZ20120612.0210', 0.80389917916062992, 0.99967019705160209)
('DBZ20120612.0220', 0.72398497091838476, 0.83371787277804343)
('DBZ20120612.0230', 0.65648376662075636, 0.99994387499329229)
('DBZ20120612.0240', 0.63367636862973908, 0.99975833529875713)
('DBZ20120612.0250', 0.59796014075479409, 0.99972294518996663)
('DBZ20120612.0300', 0.56460370787850644, 0.99996417400733295)
('DBZ20120612.0310', 0.53369604165341833, 0.99989376210154624)
('DBZ20120612.0320', 0.51005937764539977, 0.99936816179281707)
('DBZ20120612.0330', 0.49535149712761151, 0.99952050966533068)
('DBZ20120612.0340', 0.4816971661909491, 0.99925257734168382)
('DBZ20120612.0350', 0.44908971239812689, 0.99916043219214934)
('DBZ20120612.0400', 0.40735530595503433, 0.99916233200448967)
('DBZ20120612.0410', 0.3878458734557545, 0.99912730110724635)
('DBZ20120612.0420', 0.34195702507285769, 0.99907373305313252)
('DBZ20120612.0430', 0.31495649881586002, 0.99849494262923233)
('DBZ20120612.0440', 0.29707617262952946, 0.99730351941844408)
('DBZ20120612.0450', 0.28590547630842822, 0.99646063448358324)
"""
