Video Of Day

Breaking News

The Python Sfc Model Workflow

The way inward the which the sfc_models parcel is typically used is distinctive. The objective is to focus the user’s attending upon the linkages betwixt sectors of the economy, together with non on the drudgery of national accounting. It is a preliminary computer-aided pattern (CAD) parcel for economics.

[This is a starting fourth dimension draft of department taken from my adjacent majority inward progress - Introduction to SFC Models Using Python.]

(As an editorial note, this department volition follow roughly other that offers an initial description of the sfc_models package. In instance the reader is unfamiliar alongside it, this is an opened upward root parcel that is currently nether evolution that allows the user to prepare together with solve stock-flow consistent (SFC) models inward Python. I possess got previously generated examples using this framework; together with volition proceed to refer to it every bit I complete the book. As for my latest majority -- Abolish Money (From Economics)! -- I am currently finishing off the paperback edition, together with volition bespeak to encounter a proof re-create earlier it is pose upward for sale.)

The steps involved inward using the parcel are every bit follows. This department solely offers an overview of these steps; the remainder of the majority fills out the detail.
  1. The Python code imports the sfc_models package.
  2. The user together with thence creates objects that stand upward for the economical sectors. (There is an explanation of what is meant past times objects below.) Behavioural parameters are specified, together with the linkages betwixt the sectors.
  3. Once the objects are created, the model edifice functioning of the sfc_models framework is invoked.
  4. The framework generates the equations that specify the model based on the sector object properties. These equations are specified inside a text block that is output to log files that tin live on examined past times the user.
  5. The framework together with thence invokes an equation solver that takes every bit an input the equations inward text form. It together with thence generates fourth dimension serial outputs, assuming that it tin discovery a solution to the organization of equations. (If the user’s specifications of the economical sectors are missing linkages or are internally inconsistent, in that place may non live on a solution. Alternatively, the user may possess got specified behavioural relationships that are beyond the capacity of the solver.)
  6. The framework together with thence saves the fourth dimension serial every bit a text-delimited file (“csv file”), likewise every bit Python objects that tin live on farther analysed using other Python code. For example, the fourth dimension serial plots in this report in other posts on this spider web site were created using the matplotlib Python package.
At the fourth dimension of writing, this workflow relies upon the user running Python code. This bespeak non live on greatly complex; the reader is gratuitous to invoke instance code that is provided to generate the output that matches what is displayed inward this report. Once the sfc_models code is sufficiently advanced, it should live on possible for the user to specify the configuration of economical sectors inside the model past times using a graphical user interface (GUI). In other words, it would live on possible to prepare a model alongside “drag together with drop” operations inside a window. This would allow students to examine a diversity of economical models together with encounter how they comport every bit atmospheric condition change. Such an approach would allow a to a greater extent than “hands on” approach to learning, together with non rely upon next others’ interpretations of how the economic scheme works.

Returning to the workflow above, steps 1-3 are implemented past times the user, together with the framework mostly finishes off the operations. That said, the user has command over the remaining steps if desired.
  • The user tin possess got the generated equations, together with solve them using other techniques. Since the equations created are visible, the models generated past times the framework are non opaque dark boxes.
  • The user tin generate model equations past times hand, together with and thence input the equations into the sfc_models solver.
  • The user is gratuitous to import the fourth dimension serial information into other software for farther processing. For example, loading the information into a spreadsheet is belike the easiest way to facial expression at the conduct of all the fourth dimension serial inside the model solution.

The description inward a higher house refers to the creation of objects. This is non a instance of beingness vague; rather it is using software applied scientific discipline jargon. In this case, the objects are components of object-oriented programming, which may non live on familiar to readers who possess got non studied software engineering, but were instead taught how to computer program past times non-specialists, who typically possess got a procedural programming approach.

Under the object-oriented approach, code is created inward a modular form, alongside objects that contain both the functions that decide behaviour, likewise every bit the information structures associated alongside those functions. In guild to trim back the problems caused past times inter-connected code, the objects are designed to live on distinct, or inherit properties from bring upward objects inward a hierarchical fashion.

In this case, this agency that the code that defines how a sector behaves is independent of the remainder of the model. For example, nosotros tin modify the behavioural functions defining menage conduct without worrying close the implementation of the concern sector. This allows us to brand changes without having to worry close unexpected code interactions. If a sector’s conduct depends upon information from roughly other sector, the user but needs to facial expression at the external interface of that sector, without needing to delve into the implementation details of that other sector.

<Another department inward the book> discusses the differences betwixt object-oriented programming together with procedural programming.

The wages of using the sfc_models framework is the relaxation of experimentation. The traditional way to railroad train SFC models is decide the equations to live on solved past times hand, together with and thence using software to generate the solution. The difficulty alongside this manual approach is that it is non obvious how to modify equations if you lot wish to brand changes to the economical model. Furthermore, the solution is prone to errors, every bit you lot bespeak to transcribe dozens of equations comprised of variables alongside similar names to a software package. Conversely, edifice an economical model using sfc_models solely requires a handful of lines of user code, together with the construction of the code gives a skillful thought of the construction of the model, fifty-fifty to a non-specialist. Furthermore, the user tin encounter the generated equations, but never needs to piece of occupation alongside them manually.

(c) Brian Romanchuk 2017

No comments