This repository was archived by the owner on Sep 17, 2021. It is now read-only.
File tree 4 files changed +31
-3
lines changed
4 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 10
10
foo = importlib .util .module_from_spec (spec )
11
11
spec .loader .exec_module (foo )
12
12
13
+ spec1 = importlib .util .spec_from_file_location (
14
+ "PlotGraph.py" , "Randomness/PlotGraph.py"
15
+ )
16
+ foo1 = importlib .util .module_from_spec (spec1 )
17
+ spec1 .loader .exec_module (foo1 )
13
18
14
19
def experiment_func (cycle = None ):
15
20
@@ -116,10 +121,13 @@ def US06_experiment_cycle():
116
121
return cycleC
117
122
118
123
119
- def US06_experiment ():
124
+ def US06_experiment (reply = False ):
120
125
model = pybamm .lithium_ion .DFN ()
121
126
# import drive cycle from file
122
- drive_cycle = pd .read_csv ("US06.csv" , comment = "#" , header = None ).to_numpy ()
127
+ if reply :
128
+ drive_cycle = pd .read_csv ("drive_cycle.csv" , comment = "#" , header = None ).to_numpy ()
129
+ elif not reply :
130
+ drive_cycle = pd .read_csv ("US06.csv" , comment = "#" , header = None ).to_numpy ()
123
131
# create interpolant
124
132
param = model .default_parameter_values
125
133
timescale = param .evaluate (model .timescale )
@@ -134,6 +142,10 @@ def US06_experiment():
134
142
)
135
143
sol_US06_1 = sim_US06_1 .solve ()
136
144
145
+ if reply :
146
+ time = foo1 .plot_graph (sol_US06_1 , sim_US06_1 , reply = reply )
147
+ return time
148
+
137
149
solved = False
138
150
print ("REACHED" )
139
151
while not solved :
Original file line number Diff line number Diff line change @@ -159,6 +159,11 @@ def random_plot_generator(
159
159
return time , feasible
160
160
161
161
elif choice == 2 :
162
+
163
+ if reply :
164
+ time = foo2 .US06_experiment (reply = reply )
165
+ return time
166
+
162
167
repeat = True
163
168
while repeat :
164
169
try :
Original file line number Diff line number Diff line change 3
3
import matplotlib .pyplot as plt
4
4
import importlib .util
5
5
import os
6
+ import gdown
6
7
7
8
spec = importlib .util .spec_from_file_location (
8
9
"RandomPlotGenerator.py.py" , "Randomness/RandomPlotGenerator.py"
@@ -82,6 +83,15 @@ def reply_to_tweet():
82
83
choice = 1 , cycle = experiment
83
84
)
84
85
print ("yes" )
86
+ if "drive cycle" in singleMention .full_text .lower ():
87
+ tweet = singleMention .full_text .split ()
88
+ link = tweet [- 1 ]
89
+ output = 'drive_cycle.csv'
90
+ gdown .download (link , output , quiet = False )
91
+ time = foo .random_plot_generator (
92
+ choice = 2
93
+ )
94
+
85
95
86
96
if feasible :
87
97
media = api .media_upload ("replyFoo.png" )
@@ -109,6 +119,7 @@ def reply_to_tweet():
109
119
)
110
120
111
121
os .remove ("replyFoo.png" )
122
+ os .remove ("drive_cycle.csv" )
112
123
plt .clf ()
113
124
else :
114
125
api .update_status (
Original file line number Diff line number Diff line change 1
- 1375171411245899776
1
+ 1386344261877002240
You can’t perform that action at this time.
0 commit comments