Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
FDonati committed Jan 17, 2019
1 parent 3bd4baa commit 84119bf
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pySUTtoIO/transformation_model_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, sut, make_secondary):
sut2 = ms(sut)
self.V = sut2.supply
self.U = sut2.use
np.savetxt("use.csv", self.U)
self.q = np.sum(self.V, axis=1)
self.Y = sut2.final_use

Expand All @@ -35,8 +36,13 @@ def __init__(self, sut, make_secondary):

def transformation_matrix(self):
make = np.transpose(self.V)
g = self._sut.total_industry_output
return np.dot(tl.invdiag(g), make)
g_orig = self._sut.total_industry_output
g1 = np.sum(self.V, axis=0)
g2 = np.sum(self.U, axis=0) + np.sum(self._sut.value_added, axis=0)
np.savetxt("g1.txt", g1)
np.savetxt("g2.txt", g2)
np.savetxt("g_orig.txt", g_orig)
return np.dot(tl.invdiag(g_orig), make)

def io_transaction_matrix(self):
use = self.U
Expand Down Expand Up @@ -73,6 +79,8 @@ def io_total_requirement_matrix(self):

def check_io_transaction_matrix(self, rel_tol=default_rel_tol):
is_correct = True
q_orig = np.sum(self.V, axis=1)
np.savetxt("q_orig.txt", q_orig)
q1 = np.sum(self.io_transaction_matrix(), axis=1) + \
np.sum(self.Y, axis=1)
np.savetxt("q1.txt", q1)
Expand Down

0 comments on commit 84119bf

Please sign in to comment.