Skip to content

Commit

Permalink
Fix pep8 errors in generate_plots.py
Browse files Browse the repository at this point in the history
  • Loading branch information
pep8speaks committed May 11, 2018
1 parent da55c57 commit 7a2aa11
Showing 1 changed file with 51 additions and 49 deletions.
100 changes: 51 additions & 49 deletions generate_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,29 @@

dirname = os.path.dirname(__file__)


def generate_plot(test_name, x, y):
plt.plot(x,y)
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Fuel Demand [kg]')
plt.title('Test %s Demand' %test_name)
plt.title('Test %s Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name)
'./docs/do/images/%s' % test_name)
plt.savefig(fn)


test_name = 'A-const-1'
x = np.arange(0, 16, step=1)
y = np.zeros(16)
y = y + 1
plt.plot(x,y)
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Fuel Demand [kg]')
plt.title('Test %s Fuel Demand' %test_name)
plt.title('Test %s Fuel Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()
Expand All @@ -34,13 +36,13 @@ def generate_plot(test_name, x, y):
x = np.arange(0, 16, step=1)
y = np.zeros(16)
y = y + 2
plt.plot(x,y)
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Fuel Demand [kg]')
plt.title('Test %s Fuel Demand' %test_name)
plt.title('Test %s Fuel Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()
Expand All @@ -49,13 +51,13 @@ def generate_plot(test_name, x, y):
test_name = 'A-grow-1'
x = np.arange(0, 16, step=1)
y = 0.1 * x
plt.plot(x,y)
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Fuel Demand [kg]')
plt.title('Test %s Power Demand' %test_name)
plt.title('Test %s Power Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()
Expand All @@ -67,13 +69,13 @@ def generate_plot(test_name, x, y):
y[0] = 1
y[1] = 1
y[2] = 1
plt.step(x,y)
plt.step(x, y)
plt.xlabel('Timestep')
plt.ylabel('Fuel Demand [kg]')
plt.title('Test %s Fuel Demand' %test_name)
plt.title('Test %s Fuel Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()
Expand All @@ -82,13 +84,13 @@ def generate_plot(test_name, x, y):
test_name = 'A-decl-2'
x = np.arange(0, 16, step=1)
y = 2 - 0.1 * x
plt.plot(x,y)
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Fuel Demand [kg]')
plt.title('Test %s Fuel Demand' %test_name)
plt.title('Test %s Fuel Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.grid()
Expand All @@ -99,13 +101,13 @@ def generate_plot(test_name, x, y):
x = np.arange(0, 16, step=1)
y = 0.5 * x
y[7:] = 3 - 0.2 * (x[7:]-6)
plt.plot(x,y)
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Fuel Demand [kg]')
plt.title('Test %s Fuel Demand' %test_name)
plt.title('Test %s Fuel Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()
Expand All @@ -115,13 +117,13 @@ def generate_plot(test_name, x, y):
x = np.arange(0, 16, step=1)
y = np.zeros(16)
y = y + 1
plt.plot(x,y)
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Power demand [GWe]')
plt.title('Test %s Power Demand' %test_name)
plt.title('Test %s Power Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()
Expand All @@ -130,28 +132,28 @@ def generate_plot(test_name, x, y):
test_name = 'B-grow-1'
x = np.arange(0, 16, step=1)
y = 0.1 * x
plt.plot(x,y)
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Power demand [GWe]')
plt.title('Test %s Power Demand' %test_name)
plt.title('Test %s Power Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()


test_name = 'B-decl-1'
x = np.arange(0, 16, step=1)
y = 2- 0.1 * x
plt.plot(x,y)
y = 2 - 0.1 * x
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Power Demand')
plt.title('Test %s Power Demand' %test_name)
plt.title('Test %s Power Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()
Expand All @@ -161,13 +163,13 @@ def generate_plot(test_name, x, y):
x = np.arange(0, 16, step=1)
y = 0.5 * x
y[7:] = 3 - 0.2 * (x[7:]-6)
plt.plot(x,y)
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Power demand [GWe]')
plt.title('Test %s Power Demand' %test_name)
plt.title('Test %s Power Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()
Expand All @@ -177,13 +179,13 @@ def generate_plot(test_name, x, y):
x = np.arange(0, 16, step=1)
y = np.zeros(16)
y = y + 1
plt.plot(x,y)
plt.plot(x, y)
plt.xlabel('Timestep')
plt.ylabel('Power demand [GWe]')
plt.title('Test %s Power Demand' %test_name)
plt.title('Test %s Power Demand' % test_name)
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()
Expand All @@ -192,21 +194,21 @@ def generate_plot(test_name, x, y):
x = np.arange(0, 16, step=1)
y = [1]
for time in x[1:]:
prev_value = y[-1]
# if time is a multiple of 7, which is when they decommission
if time%7 == 0:
add = 3
else:
add = 1
now_value = prev_value + add
y.append(now_value)
plt.step(x,y)
prev_value = y[-1]
# if time is a multiple of 7, which is when they decommission
if time % 7 == 0:
add = 3
else:
add = 1
now_value = prev_value + add
y.append(now_value)
plt.step(x, y)
plt.xlabel('Timestep')
plt.ylabel('Cumulative Waste Disposal Demand [kg]')
plt.title('Test %s Waste Disposal Demand' %test_name.replace('-waste', ''))
plt.title('Test %s Waste Disposal Demand' % test_name.replace('-waste', ''))
plt.axis([0, 15, min(y) - 1, max(y) + 1])
fn = os.path.join(os.path.dirname(__file__),
'./docs/do/images/%s' %test_name )
'./docs/do/images/%s' % test_name)
plt.grid()
plt.savefig(fn)
plt.close()
plt.close()

0 comments on commit 7a2aa11

Please sign in to comment.