<commit_before>'''
Tests for the PyRate's Variance/Covariance matrix functionality.

Created on 14/03/2013
@author: <NAME>
'''


import unittest

from numpy import array

from vcm import cvd
from tests_common import sydney5_mock_ifgs


class VCMTests(unittest.TestCase):

	def test_basic(self):
		ifgs = sydney5_mock_ifgs(5,9)

		#print
		#for i in ifgs:
		#	print i.phase_data
		#	print "/" * 35


		ifgs[0].X_SIZE = 92.0
		ifgs[0].Y_SIZE = 95.0

		ifgs[0].X_CENTRE = (ifgs[0].WIDTH / 2) # spectrally, the grid is not doubled in size
		ifgs[0].Y_CENTRE = (ifgs[0].FILE_LENGTH / 2)

		print cvd(ifgs[0])
<commit_msg>Cleaned and expanded initial vcm test setup.<commit_after>'''
Tests for the PyRate's Variance/Covariance matrix functionality.

Created on 14/03/2013
@author: <NAME>
'''

import unittest
from numpy import array

from shared import Ifg
from vcm import cvd
from tests_common import sydney5_mock_ifgs


class VCMTests(unittest.TestCase):

	def test_basic(self):
		ifgs = sydney5_mock_ifgs(5,9)

		for i in ifgs:
			i.X_SIZE = 92.0
			i.Y_SIZE = 95.0
			i.X_CENTRE = (i.WIDTH / 2) # spectrally, the grid is not doubled in size
			i.Y_CENTRE = (i.FILE_LENGTH / 2)

		maxvar, alpha = cvd(ifgs[0])
		self.assertTrue(maxvar is not None)
		self.assertTrue(alpha is not None)
		print "maxvar, alpha:", maxvar, alpha


	def test_larger(self):
		# test with larger interferogram
		ifg = Ifg("../../tests/sydney_test/obs/geo_060619-061002.unw")
		ifg.open()

		if bool((ifg.phase_data == 0).all()) is True:
			raise Exception("All zero - aaaieeee")

		maxvar, alpha = cvd(ifg)
		self.assertTrue(maxvar is not None)
		self.assertTrue(alpha is not None)
		print "maxvar, alpha:", maxvar, alpha

{'fraction_non_alphanumeric': 0.11740412979351032, 'fraction_numerical': 0.03716814159292035, 'mean_word_length': 3.859598853868195, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6924776', 'n_tokens_mistral': 739, 'n_tokens_neox': 652, 'n_words': 177}