Add File
When you create a new application in either Python or R Akumen will take you to the code editor screen. There are Five main areas to the Code editor screen:
- Application/Study Actions – Located at the top left-hand side are applications which show property settings.
- Workflow Tabs – Build, Research and Report tabs all help generate and use your application.
- In Build you will construct your application.
- In Research you can create and manage all your scenarios.
- In Report you visualize your results from all scenarios.
- In Data we can view/search output values from the model. (Only present in code editor based applications).
- Code Editor Actions – above the file view, allows you to upload scripts and models.
- File View – On the left-hand side of the screen is a tree structure which gives you a way to organize your scripts and models.
- Code Editor Screen – This is the main build area where you can write your models, or where the code is placed when you upload your models.
When Akumen first creates a Py model, it automatically creates an initial main.py file.
To create a new file:
- Click on the main.py file.
- Delete the sample code in main.py.
- A * will appear next to the file indicating that it has been modified.
- Enter the following into the code editor:
def akumen(start_day, periods):
"""
Parameters:
- Input: start_day [datetime]
- Input: periods [float]
"""
return {}
The above will start our model off by allowing us to set a start date and enter the amount of time periods we will be using in the model.
- Now that we have entered the above code, save the changes to your file.
- Now go to the Research Tab at the top right of the screen.
- The start_day field is a date selector cell, in the row labelled Application Level Parameters select a start date.
Info
Assigning a parameter to the Application Level Parameters applies the assigned value to all scenarios across the entire application. Assigning a value to the Study Level Parameters applies the assigned value to all scenarios within a single study. Any value in either of these cells will not be displayed in the scenarios within the studies.
- The periods field is a numeric field, enter the value 12.
In order for Akumen to execute your Python code, we need to define an akumen(…) Python function. This function is the main entry point for your code and must exist in the execution file. The Akumen function must either take keyword arguments (**kwargs) or parameters matching Akumen parameters as input.
The readme file contains handy hints on information on syntax for creating the main.py file. This includes how to define variables that are used in the research grid