File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
libs/policyengine-simulation-api/src/policyengine_api/simulation_api Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 6
6
from policyengine .outputs .macro .comparison .calculate_economy_comparison import (
7
7
EconomyComparison ,
8
8
)
9
+ from pathlib import Path
9
10
10
11
11
12
def create_router ():
@@ -16,9 +17,18 @@ def create_router():
16
17
)
17
18
async def simulate (parameters : SimulationOptions ) -> EconomyComparison :
18
19
model = SimulationOptions .model_validate (parameters )
19
-
20
+ print ( "Initialising" )
20
21
simulation = Simulation (** model .model_dump ())
22
+ print ("Calculating" )
23
+ result = simulation .calculate_economy_comparison ()
24
+ # Clear data files
25
+
26
+ for file in Path ("." ).glob ("*.csv" ):
27
+ file .unlink ()
28
+
29
+ for file in Path ("." ).glob ("*.h5" ):
30
+ file .unlink ()
21
31
22
- return simulation . calculate_economy_comparison ()
32
+ return result
23
33
24
34
return router
You can’t perform that action at this time.
0 commit comments