<commit_before>#Edited 12/3/17 <NAME>
#Unit tests for the set-up functions
import qutip
import numpy
import scipy
import unittest

import QJMCSetUp
import QJMCAA
import QJMCJump
import QJMCEvolve
import QJMCMath


class TestQJMCJump(unittest.TestCase):
	def test_jumpBinary(self):
		tStart = 0
		psi0 = qutip.basis(2, 0)
		psi0 = psi0.full()

		sp = qutip.sigmap()
		sm = qutip.sigmam()
		no = sp*sm
		jumpOps = []
		#Decay
		jumpOps.append(5 * sm)
		jumpOps.append(5 * sp)
		for i in range(len(jumpOps)):
			jumpOps[i] = jumpOps[i].full()
			jumpOps[i]= scipy.sparse.csc_matrix(jumpOps[i])
		jumpOpsPaired = QJMCSetUp.jumpOperatorsPaired(jumpOps)

		sx = qutip.sigmax()
		H = sx
		#All objects must be in a scipy sparse format
		H = H.full()
		H = scipy.sparse.csc_matrix(H)

		settings = QJMCAA.Settings()
		settings.smallestDt = 0.0001

		HEffExponentDtSet, dtSet = QJMCSetUp.HEffExponentSetProductionBinary(H,
			jumpOpsPaired, 0.1, settings)

		#print(dtSet)
		t, psi = QJMCEvolve.evolvePsiByExponent(psi0, tStart, dtSet[0], HEffExponentDtSet[0])

		for _ in range(1000):
			r = 0.5
			t, psi, r = QJMCJump.jumpBinary(tStart, psi0, r, jumpOps, jumpOpsPaired,
		 		dtSet, HEffExponentDtSet)
			self.assertAlmostEqual(t,0.1)


if __name__ == '__main__':
	unittest.main()<commit_msg>Removed unused imports and variables.<commit_after>#Edited 12/3/17 <NAME>
#Unit tests for the set-up functions
import qutip
import scipy
import unittest

import QJMCSetUp
import QJMCAA
import QJMCJump
import QJMCEvolve


class TestQJMCJump(unittest.TestCase):
	def test_jumpBinary(self):
		tStart = 0
		psi0 = qutip.basis(2, 0)
		psi0 = psi0.full()

		sp = qutip.sigmap()
		sm = qutip.sigmam()
		jumpOps = []
		#Decay
		jumpOps.append(5 * sm)
		jumpOps.append(5 * sp)
		for i in range(len(jumpOps)):
			jumpOps[i] = jumpOps[i].full()
			jumpOps[i]= scipy.sparse.csc_matrix(jumpOps[i])
		jumpOpsPaired = QJMCSetUp.jumpOperatorsPaired(jumpOps)

		sx = qutip.sigmax()
		H = sx
		#All objects must be in a scipy sparse format
		H = H.full()
		H = scipy.sparse.csc_matrix(H)

		settings = QJMCAA.Settings()
		settings.smallestDt = 0.0001

		HEffExponentDtSet, dtSet = QJMCSetUp.HEffExponentSetProductionBinary(H,
			jumpOpsPaired, 0.1, settings)

		#print(dtSet)
		t, psi = QJMCEvolve.evolvePsiByExponent(psi0, tStart, dtSet[0], HEffExponentDtSet[0])

		for _ in range(1000):
			r = 0.5
			t, _, r = QJMCJump.jumpBinary(tStart, psi0, r, jumpOps, jumpOpsPaired,
		 		dtSet, HEffExponentDtSet)
			self.assertAlmostEqual(t,0.1)


if __name__ == '__main__':
	unittest.main()
{'fraction_non_alphanumeric': 0.11803921568627451, 'fraction_numerical': 0.025098039215686273, 'mean_word_length': 4.174442190669371, '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': '7088710', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1069, 'n_words': 224}