Add File

When you create a new application in either Python or R Akumen will take you to the code editor screen. The Code Editor The Code Editor There are Five main areas to the Code editor screen:

  1. Application/Study Actions – Located at the top left-hand side are applications which show property settings.
  2. 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).
  3. Code Editor Actions – above the file view, allows you to upload scripts and models.
  4. 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.
  5. 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.
Info

When Akumen first creates a Py model, it automatically creates an initial main.py file.

To create a new file:

  1. Click on the main.py file.
  2. Delete the sample code in main.py.
  3. A * will appear next to the file indicating that it has been modified.
  4. 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.

  1. Now that we have entered the above code, save the changes to your file.
  2. Now go to the Research Tab at the top right of the screen.
  3. 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.

  4. The periods field is a numeric field, enter the value 12.
Tip

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.

Tip

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