Preparation time
less than 30 mins
Cooking time
1 to 2 hours
Serves
Serves 8
Dietary
Preheat the oven to 170C/325F/Gas 3.
Lightly butter a 20cm (8in) loose-bottomed cake tin then dust with a little plain flour and shake off any excess. Line the tin with greaseproof paper.
For the cake, place butter and sugar in a bowl and whisk until light and fluffy. Beat in the eggs one at a time then fold in the flour and the cocoa powder.
Spoon the mixture into the prepared cake tin, smooth the surface with a knife and bake in the pre-heated oven for 1 hour -1 hour 45 minutes until firm and springy. To test if the cake is done, insert a clean skewer into the middle of the cake - if it comes out clean then the cake is ready.
Remove from the oven and leave to cool in the tin for five minutes before turning out onto a wire rack.
Drain the cherries, reserving 200ml (7 fl oz) of the cherry syrup. Add the kirsch to the reserved syrup.
Use a large serrated knife to slice the cake horizontally into three equally sized rounds.
Place each round on a chopping board and spoon the cherry syrup evenly over each disc and leave to soak in.
For the icing, heat 200ml (7 fl oz) of the double cream to scalding point then add the chocolate pieces. Remove from the heat and stir gently until the chocolate is melted and smooth. Pour into a bowl and allow to cool in the refrigerator, to thicken slightly.
Whip the remaining double cream until thick. Spread one of the cake discs with half of the cream then cover with half of the cherries, pressing them in lightly. Top with the second disc of sponge and repeat this process, finishing with the third disc left plain on top. Gently press the whole cake together with the palms of your hands.
Remove the chocolate icing from the fridge and give it a quick stir. Use a palette knife to thickly spread the top and sides of the cake with the icing, starting with the top first. This way, if the chocolate oozes down the sides of the cake, it won't matter. (If preferred you can leave the sides of the cake without icing to show off the layers.)
Leave the cake to set in a cool place then slice into large wedges and serve.


The selection functionality allows implementing UI interaction for selecting elements from the arbitrary set of items. Also, with the help of the selection model it is easy to implement accordions, grouped lists, display of master-details, inline data editing and so on.
To work with selection functionality you should import the RTSelectionModule
module from right-angled
library and add it into your AppModule
imports
array. You can also use RTModule
module which includes the functionality of the entire library.
First of all, we mark an HTML element which represents the selection area by the rtSelectionArea
directive.
Second, we mark the elements placed inside such area by the rtSelectable
directive. This makes these elements
selectable. That is all we need to do to get selection functionality. Now, the following commands are available:
Ctrl
key selects clicked element and keeping the previous selections.Shift
key selects the range of the elements from the last one selected to the
clicked one.
↑
key moves selection to the previous element.↓
key moves selection to the next element.Shift + ↑
combination adds previous element to the collection of the selected elements.Shift + ↓
combination adds next element to the collection of the selected elements.Ctrl + ↑
combination selects the first element in the list.Ctrl + ↓
combination selects the last element in the list.Ctrl + A
combination selects all elements in the list.Tab
and Shift + Tab
moves you up and down the list.
rtSelectionArea
configuration options
rtSelectionArea
directive contains several toggle switches, which can be used to configure selection behavior.
Below you can see the description of this options and the example demonstrating their work.
horizontal (default value is false)
- if you switch on this option, the keyboard handler starts handling
the right
and
left
arrow keys instead of the up
and down
arrow keys.toggleOnly (default value is false)
- if you switch on this option, the element selection can be cleared
only after second click on it. This behavior can be useful for touch devices. Obviously, this option makes sense only
when the multiple
option is switched on.multiple (default value is true)
- it is possible to select multiple elements at a time if this option is
switched on.autoSelectFirst (default value is false)
- specifies that the first element of collection will be selected
automatically on every data loading.
To imply sense into selection, you need a way to execute particular actions depending on whether the element is selected or not. There are the following options to do this:
selected
flag
rtSelectable
directive contains selected
flag, which can be used to respond on the element
selection state changes. The example of such approach is demonstrated in the example above, where we apply the selected
class to the selectable element depending on selected
flag state. Below there is a more interesting example
showing the inline-editing functionality implemented with the selected
flag.
You can also implement the selected
property in your data element. Selection model will update it depending
on the current state of selection.
The second way to process selection is events.
There are three events on which we can subscribe itemSelected
, itemDeselected
, and selectionChanged
.
All of them produce the parameter which implements RTSelectionEvent contract from right-angled
library.
The events are generated by the rtSelectable
directive as well as by the rtSelectionArea
.
Below you can see the example demonstrating the following features:
itemSelected
and itemDeselected
handlers of the rtSelectionArea
event display
notifications that the element has been selected or deselected.rtSelectable
event directive uses restcountries.eu service to fetch and display the detailed information about the country.RtSelectionService
This approach is the most flexible, because it gives the access to full selection functionality.
The RTSelectionService
service is configured as provider for rtSelectionArea
directive. So
the way to access RTSelectionService
from your component depends on where your component is located. If
your component is located inside the rtSelectionArea
component, you can simply specify RTSelectionService
as a parameter of your component constructor.
In the example below we have implemented the custom button component which injects the RTSelectionService
service and calls its getSelectedElements
method on click to display currently selected elements in the
popup.
If you want to implement the component placed as a parent for the element with the rtSelectionArea
directive,
you can reference rtSelectionArea
using the ViewChild decorator and use its selectionService
property to access selection functionality.
The example below implements the same scenario as the previous one, but, instead of the custom button, we implement click
event handler right in our sample component and use rtSelectionArea
requested by the ViewChild decorator. .
rtSelectionArea
from Template
One another way to interact with the selection model is referencing rtSelectionArea
directive right in
your template and using its selectionService
property.
Below you can see the example of buttons which utilizes the selectionService.selectAll
and selectionService.deselectAll
methods.
rtSelectionCheckboxFor
directiveThis directive will be useful in case if you need to implement the selection model that uses checkboxes instead of the click-based elements selection.
trackBy
function
This option was inspired by the trackBy
option of the angular ngFor directive.
The idea is that after data reload selection service performs check of the currently selected elements. For example, in most of the cases when the list is refreshed, the same records will be returned from the server. But as long as new objects will be constructed as elements, regular reference equality check will not be able to restore selection state of elements.
If you have the way to identify your elements (unique id
property, for example), you can specify your own
implementation of the trackBy
function, which will be used for selection state restoring.
In the below example, we are using the trackBy
implementation, which returns the name
property
of element. So, the selection is preserved after data reload.
preventEventsDefaults
and stopEventsPropagation
parametersTwo more options you will not probably need often, but if it happens, they are more than necessary.
The thing is that the selection directives use the stopPropagation and preventDefault methods
in mouse and keyboard handlers for the case when selection was performed successfully. It is required, for example, to
avoid selection of the whole text on the page when Ctrl + A
key combination is pressed, or to prevent the
entire page scrolling when ↑
and ↓
keys pressed and so on.


--- layout: post status: publish published: true title: SqlTrackingQuery Sample author: display_name: Tomas Restrepo login: tomasr email<EMAIL_ADDRESS>url: http://winterdom.com/ author_login: tomasr author_email<EMAIL_ADDRESS>author_url: http://winterdom.com/ wordpress_id: 369 wordpress_url: http://winterdom.com/2006/01/sqltrackingquerysample date: '2006-01-22 16:02:36 +0000' date_gmt: '2006-01-22 16:02:36 +0000' categories: - WinFX - Workflow tags: [] comments: [] ---
Beta 2 of Windows Workflow Foundation includes the new SqlTrackingQuery class (in the System.Workflow.Runtime.Tracking namespace), which allows you to query the tracking records in a SQL Server database inserted by the SqlTrackingService service.
I've written a simple Windows Forms Application that illustrates how to use this basic API and displays the resulting information (well, part of it, as it can be quite a bit) on a simple databinding-based UI. Here's a screenshot:
Something to keep in mind in using this API is that calling SqlTrackingQuery.GetWorkflows() or SqlTrackingQuery.TryGetWorkflow() will attempt to load the original assemblies that defined the workflows for which instances were found in the tracking database. To handle this, the sample simply handles the AppDomain.ResolveAssembly event and provides the user with a simple UI to select the necessary assembly:
You can download the sample here.


Lehigh Celebrates the Big 100 and Launches New Logo
Founded in 1922, Lehigh marks its 100-year anniversary with a brand new look.
Lehigh was born in the Lehigh Valley of Pennsylvania during the heart of the steel mill industry and the rise of workforce safety. We were at the forefront of steel toe development and pioneered the on-site shoe truck. We continuously led the industry in introducing new advanced technologies and innovative product designs.
Our 100-year heritage of safety and innovation is the cornerstone we continue to build on.
As we look forward to our next 100 years, we introduce our new logo to represent both what we have built and how we do business now. Our new mark states that...
We're Foundational.
We're rooted, strong, consistent, dependable, innovative, and successful.
We're Partners.
Working with our customers for the common goal of keeping their employees safe on the job.
We're Progressive.
Embracing digital innovation to always move forward into a bright safety green future.
We're Greater Than.
Offering advanced services and innovative wellness products to the industrial workforce that no one else can or does.
We're CustomFit.
Adjusting to each specific customer for a comprehensive and streamlined program.
In honor of our BIG100, we asked our exceptional Lehigh CustomFit team to share how and why they know us to be the best at what we do. The Lehigh Difference is who we are.
Cheers to the next 100 years!


Trinity School, Shirley Road, Croydon CR9 7AT
0125555555
<EMAIL_ADDRESS>Objectives
School Site
Teaching Staff


Chapter 7 Data Management
Data are valuable, expensive, and crucial for science. Also, as human subjects researchers, it is critical that we project the privacy of our participants and make sure that we are making the best use of our participants time. Therefore, data management is one of the most important things you will do as a researcher. Further, some of the data our lab works on has been shared with us by collaborators. This data may be protected, have a specific data use agreement, and/or not publicly shared. This means that we have agreed to only use the data for a specific purpose, and using the data beyond the agreed-to purpose is not allowed.
Thus, there is no universal access to data in the Aging Well Lab. You will only have access to the data you need to complete the project or projects for which you are working. If, for any reasons, you need access to some of the lab’s unpublished data, please contact Dr. Seaman. She will determine whether access is warranted. Do not use lab data for any purpose other than the project (or projects) we have discussed. If you would like to use lab data for another purpose, please contact Dr. Seaman and she will determine if that use is ok.
As a lab, we will use a variety of storage mechanisms for data, code, data products, and other lab documents. These include UT Dallas Box, Github, the AWL Lab server (garfield), the UT Dallas HPC (Europa), our lab wiki, and storage space on local computers. Please do not store lab data on any non-UT Dallas computer or external storage device.
7.1 Box
The AWL has a Box account that will be used to store most of our work. Because this is a lab account, it is cruical that everyone use the following organizational scheme in this directory.
7.1.1 Grants
This folder contains general grant resources and specific folders for each grant application. If you are starting a new grant application, create a new folder here for your documents.
7.1.2 Institutional Review Board (IRB)
This folder contains documents for all IRB-approved protocols in the lab. In addition to specific folders for each project, there is a folder of sample IRBs and Human Research Certificates).If you are starting a new IRB application, create a new folder here for your documents. Make sure you include a README file specifying the following documents: (1) IRB application and (2) approval letter. If you are using data from another institution, also specify the data use agreement (DUA).
7.1.3 Lab Management
This folder contains documents related to managing the lab. There are separate folders for different aspect of the Lab Manager’s duties, including onboarding new members, recruitment for our studies, supply orders, and files relating to our public facing website.
7.1.4 Measures
This folder contains commonly used measures in the lab. There will be a specific folder for each measure that contains the measure (e.g. Qualtrics files) and scripts to clean and compile the data. Make sure you include a README file describing the contents of your folder.
7.1.5 Presentations
This folder contains abstracts and posters/power points for conferences. There is a folder for each conference we regularly attend (e.g. Cognitive Aging Conference, CAC). The contents of each conference folder are organized by year. If you are submitting an abstract to a conference, find (or create) the appropriate conference folder, find (or create) the appropriate year folder, and then create a folder for your own project. If you’re creating a new folder, include a README file with general info about the conference and when abstracts are typically due.
7.1.6 Projects
This folder contains some data (not neuroimaging) and code for our lab projects. There will be a folder for each project in the lab and it will be organized as described in a section below (Project organization). If you’re creating a new folder, include a README file describing the project and folder contents.
7.1.7 Tasks
This folder contains commonly used tasks in the lab. There will be a specific folder for each task that contains the task (e.g. PsychoPy scripts, data folders). Make sure you include a README file describing the contents of your folder. When a task is going to be deployed for data collection, a copy will be created in the corresponding “Project” folder.
7.2 GitHub
We will use git and GitHub for version control and collaboration. Thus, all projects in the lab will have a repository (aka “repo”) on GitHub. To get started with Git/GitHub, I encourage you to read the Coding Club’s Intro to GitHub.
Using GitHub not only allows us to keep track of and work collaboratively on projects, but it also makes it easy to share projects on OSF when they are complete. Because we will ultimately share our GitHub repos with the world, lab members are expected to submit pull requests instead of pushing their changes directly to GitHub. This will allow me to review code and suggest changes in an easy-to-use format.
In other words, don’t be this cat:
If you don’t know what a pull request is, consult the lab wiki and/or ask a fellow lab member for help.
7.3 AWL Local Computers
We will use the local lab computers to store behavioral data current projects. You should create a ‘github’ directory your computer’s desktop or in your home directory. Inside that directory, you should create a folder for each project you are working on in the lab. The folder should be organized as described in the Data and code organization section below and it should be version controlled using git. This is where you will work on data analysis. As you are working, you will sync this folder with a corresponding repository on GitHub.
7.4 AWL Lab Server (garfield)
The AWL Lab Server is a shared lab resource. It will be used primarily for computationally-demanding processes - this primarilty means computational modeling and neuroimaging projects. Only data, code, and software directly related to lab projects is permitted on the server. If you would like to use the server for another purpose, you must gain Dr. Seaman’s explicit permission first.
Server access will generally be limited to lab staff and graduate students, with some exceptions as necessary. If you need access to the server, contact Dr. Seaman and she will determine whether access is warranted.
All computational processes must be run as either (1) interactive job on a compute node, or (2) a batch job submitted to the compute node. DO NOT RUN ANALYSES ON THE LOGIN NODE because it will limit the ability of others in the lab to run analyses on the server.
Each directory below will contain subdirectories that correspond to projects in the lab. Please make sure you are working in and saving in the appropriate directory.
7.4.1 Raw
This is the data in its native format and is a READ ONLY folder. For questionnaire data, this is straight from Qualtrics or RedCap. For behavioral data, this is the three files generated by PsychoPy for each participant. For neuroimaging data, these are the DICOM files.
7.4.2 Cleaned
This folder contains data in a format that is usable. For questionnaire data, this would be a cleaned data file with corresponding data dictionary. For behavioral and/or neuroimaging data, we will use BIDS format.
7.4.3 Analysis
This folder contains analysis scripts. These may be written in r/python for behavioral analysis or unix/python for neuroimaging analysis. All scripts should start with a number that denotes what order the scripts should be run in. Any auxilary scripts should be kept in a subfolder. Ideally, these scripts will be written in a way that thwy can ultimately be shared on github/OSF.
7.4.4 Jobs
This folder contains the batch job scripts used to submit a script/set of data as a job to the scheduler.
7.4.5 Output
This is where the output of any analysis scripts will be stored.
7.5 UTD HPC (Europa)
To be developed.
7.6 Project organiztion
To facillitate collaborative work and data sharing, all projects will have a similar file structure. This will also make it easier resume work on a project after a break. Generally, we will save all documents in project folders on the Aging Well Lab Box account and code will be saved in separate git/github repositories. Data will be stored in both locations; the psychopy task will generate a data folder inside of the task folder on Box; this is raw data. Data cleaning scripts will clean and save cleaned data into the data folder in the git/github repository.
project
|--- administration
|--- preregistration.docx
|--- project_protocol.docx
|--- project_IC.docx
|--- manuscript
|--- 01_PAG
|--- 02_JGPS
|--- 03_ANC
|--- Original Submission
|--- Revision 1
|--- figures
|--- project.docx
|--- project_preprint.docx
|--- project_supplement.docx
|--- project_revcoverletter2.docx
|--- tables
|--- task
|--- data
|--- stims
project
is the top-level folder and contains all the files for a project. This folder should be renamed for each unique project in a way that indicates what the project is about. It should have the same name as the git/github repository (see below for more information).
administration
is a folder that contains all administrative files for this project, including the preregistration documents, protocols, and consent forms.
manuscript
is a folder that contains all files related to the the manuscript. Inside of this folder will be a number of subfolders, each described below. It will also contain the most up-to-date main manuscript file (project.docx) as well as any preprints, supplements, or cover letters.
Folders that begin with leading numbers (e.g. 01_PAG
, 02_JGPS
, 03_ANC
) represent submission to journals. The version of the manuscript submitted, along with supporting documents (preprints, supplements, cover letters, etc) are moved into these folders when a new journal is selected. In this example, the manuscript was first submitted to Psychology and Aging (PAG), then to Journals of Gerontology: Psychological Sciences (JGPS), and finally to Aging, Neuropsychology and Cognition (ANC). If there are multiple revisions at a journal, the relevant docs are placed inside of folders delineating the original submission
, revision 1
, etc.
figures
is a subfolder under manuscript
that contains all figures for the manuscript. The files should be clearly named, including the figure number. This folder should also include a file with figure captions.
tables
is a subfolder under manuscript
that contains all tables for the manuscript. The files should be clearly named, including the table number. All tables saved here should be in APA format.
task
is a folder that contains the psychopy task for the study (if applicable) and all related folder (stimuli, data, etc.)
data
is a subfolder under task
that contains the raw data generated by psychopy.
stims
is a subfolder under task
that contains any stimuli usind in the psychopy task.
7.7 Data and code organization
To facillitate collaborative work and data sharing, all projects will have a similar file structure for code as well. This will also make it easier resume work on a project after a break and facilitate recycling of code for other projects.
project
|--- 0_get_data.R
|--- 1_preprocess_data.R
|--- 2_analyze_data.R
|--- 3_visualize_data.R
|--- README.txt
|--- data
|--- docs
|--- figs
|--- output
|--- src
This structure is directly stolen from my new favorite blog post, r best practices. We will adapt this format as needed for other programming languages.
Code files are stored in the top level of the project
directory and are named with leading numbers (e.g. 0_get_data.R
) that indicate the order that the scripts should be run in. Also stored in this top-level is a README.txt
file that contains a description of the project and a brief summary for each folder/file in the project.
project
is the top-level folder and contains all the files for a project. This folder should be renamed for each unique project in a way that indicates what the project is about.
data
contains the cleaned data files used in the project. These files should not be altered and are ideally read-only. Each data file should have a corresponding data dictionary that also lives in this folder.
doc
contains any manuscripts or interm summaries producted with the project.
figs
contains any plots, images, tables or figures created and saved by your code. It should be possible to delete and regenerate this folder with the scripts in the project folder.
output
contains non-figure objects created by scripts. For instance, processed data or logs.
scr
contains scripts for small functions you want to source()
in your scripts.
7.7.1 Data and code sharing
We will use the Open Science Framework (OSF) for organizing and sharing materials related to our projects. This will include preregistrations, code (sourced from GitHub), posters, and preprints. We will share all data and code using repositories on the Open Science Framework and will share MRI data on OpenNeuro. I have created an AWL project template that you can use when you create a new page for your own project. When you create a new project, just click “More” and search for our template under “Template (optional)”.
We will publicly share our data/code at the time that we submit projects for publication. While under development, OSF projects should be set to private and shared with your collaborators.
7.7.2 Code Style
We will use the tidyverse style guide for R and PEP-8 style guide for Python. Since we’re all new to coding, this will hopefully help us develop good code hygiene (and mitigate the learning of bad habits).
7.7.3 Archiving data
This area is TBD.


Wisconsin rises to No. 15 in AP sports poll
by Logan RudeMADISON, Wis. - The Badgers got a much-needed boost following their 24-22 win against the Iowa Hawkeyes on Saturday.
Wisconsin has jumped up to No. 15 in the latest AP sports poll.
Following two consecutive losses on the road and a bye week, the Badgers desperately needed a win to keep their dream of a Big Ten West championship alive. A hard fought victory against the Hawkeyes has kept the team in the conversation for now, and that fight will continue next week when the team goes on the road to play Nebraska.
The Minnesota Gophers have moved up to the No. 7 spot, breaking into the top 10 for the first time in decades. In total, there are seven Big Ten teams ranked in this week's poll.


What's with the teeny-tiny blocks, @proffaustus, @CalvinAyre, @nChainGlobal? Scared to go over 32 MB? I thought you guys could mine up to 128 MB!
Or maybe, just maybe, with SV nodes crashing and stalling, you realize that sustained 128 MB blocks are not yet possible ye...


FindOptions
public struct FindOptions : Encodable
Options to use when executing a find
command on a MongoCollection
.
-
Get partial results from a mongos if some shards are down (instead of throwing an error).
Declaration
Swift
public let allowPartialResults: Bool?
-
The number of documents to return per batch.
Declaration
Swift
public let batchSize: Int32?
-
Specifies a collation.
Declaration
Swift
public let collation: Document?
-
Attaches a comment to the query.
Declaration
Swift
public let comment: String?
-
The maximum number of documents to return.
Declaration
Swift
public let limit: Int64?
-
The exclusive upper bound for a specific index.
Declaration
Swift
public let max: Document?
-
The maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies to a TAILABLE_AWAIT cursor. When the cursor is not a TAILABLE_AWAIT cursor, this option is ignored.
Declaration
Swift
public let maxAwaitTimeMS: Int64?
-
Maximum number of documents or index keys to scan when executing the query.
Declaration
Swift
public let maxScan: Int64?
-
The maximum amount of time to allow the query to run.
Declaration
Swift
public let maxTimeMS: Int64?
-
The inclusive lower bound for a specific index.
Declaration
Swift
public let min: Document?
-
The server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use. Set this option to prevent that.
Declaration
Swift
public let noCursorTimeout: Bool?
-
Limits the fields to return for all matching documents.
Declaration
Swift
public let projection: Document?
-
If true, returns only the index keys in the resulting documents.
Declaration
Swift
public let returnKey: Bool?
-
Determines whether to return the record identifier for each document. If true, adds a field $recordId to the returned documents.
Declaration
Swift
public let showRecordId: Bool?
-
The number of documents to skip before returning.
Declaration
Swift
public let skip: Int64?
-
The order in which to return matching documents.
Declaration
Swift
public let sort: Document?
-
init(allowPartialResults:batchSize:collation:comment:limit:max:maxAwaitTimeMS:maxScan:maxTimeMS:min:noCursorTimeout:projection:readConcern:returnKey:showRecordId:skip:sort:)
Convenience initializer allowing any/all parameters to be optional
Declaration
Swift
public init(allowPartialResults: Bool? = nil, batchSize: Int32? = nil, collation: Document? = nil, comment: String? = nil, limit: Int64? = nil, max: Document? = nil, maxAwaitTimeMS: Int64? = nil, maxScan: Int64? = nil, maxTimeMS: Int64? = nil, min: Document? = nil, noCursorTimeout: Bool? = nil, projection: Document? = nil, readConcern: ReadConcern? = nil, returnKey: Bool? = nil, showRecordId: Bool? = nil, skip: Int64? = nil, sort: Document? = nil)


---
layout: post
title: 2/8
date: '2015-02-08T21:01:00.001-07:00'
author: Jacob .
tags:
- progress-reports
modified_time: '2015-02-08T21:01:53.160-07:00'
blogger_id: tag:blogger.com,1999:blog-6400085873105072120.post-7148567774860156371
blogger_orig_url: http://www.svlark.com/2015/02/28.html
---
I got that smelly propane connection fixed and in the process completed my first 12v maintenance task. First of many no doubt.
I was going to try to replace my frayed outhaul, which runs inside the boom. I had this great idea to take the new line, stitch it end-to-end to the old line then pull the old line out, thereby pulling the new line through. Everything went fine until I went to pull the old one out and discovered the line I was pulling was not the line I had just itched the new one to. but a line that is somehow shackled to that line inside the boom. I have no idea how to get at it in there. So for now I'lleave the old outhaul but I've cut off the fraying part so it'll just be kinda short.
April did a beautiful job patching our cockpit canvas. It looks really nice.


Usage: scenario analysis¶
This is a quick tour of CovsirPhy. Details scenario analysis will be explained. “Scenario analysis” means that we calculate the number of cases in the future phases with some sets of ODE parameter values. With this analysis, we can estimate the impact of our activities against the outbreak on the number of cases.
Preparation¶
Prepare the packages.
[1]:
# !pip install covsirphy --upgrade
from pprint import pprint
import covsirphy as cs
cs.__version__
[1]:
'2.20.0'
Dataset preparation¶
[2]:
loader = cs.DataLoader("../input")
# The number of cases and population values
jhu_data = loader.jhu()
# Government Response Tracker (OxCGRT)
oxcgrt_data = loader.oxcgrt()
# The number of tests
pcr_data = loader.pcr()
# The number of vaccinations
vaccine_data = loader.vaccine()
Start scenario analysis¶
As an example, we will analysis the number of cases in Japan. covsirphy.Scenario
is the interface for analysis. Please specify the area (country: required, province: optional) when creating the instance and register the datasets with Scenario.register()
. As the extra datasets, we can select OxCGRTData
, PCRData
, VaccineData
and CountryData
.
[3]:
# Specify country and province (optinal) names
snl = cs.Scenario(country="Japan", province=None)
# Register datasets
snl.register(jhu_data, extras=[oxcgrt_data, pcr_data, vaccine_data])
JHUData
as “the main datasets” because they are required to calculate the number of susceptible/infected/recovered/fatal cases. These variables are used in SIR-F model.PopulationData
is required because JHUData
does not include population values.population_data = data_loader.population()
snl.register(jhu_data, population_data)
Additional information:
Details of the datasets: Usage: datasets
Details of SIR-F model: Usage: SIR-derived models
Display/save figures¶
We have intactive mode and script mode to display/save figures.
When use use interactive shells, including Jupyter Notebook, we can choose either “interactive shell mode” or “script mode” as follows.
[4]:
# Choose interactive mode (default is True when we use interactive shells)
snl.interactive = True
When you want to turn-off interactive mode temporarlly, set False
as Scenario.interactive
or apply show_figure=False
as an argument of methods, including Scenario.records()
. Methods with figures will be shown later in this tutorial.
[5]:
# apply "show_figures=False" to turn-off intaractive mode temporally
# snl.records(show_figure=False)
filename
argument, figures will be saved in your local environment.[6]:
# Stop displaying figures
# snl.interactive = False
# With this mode we can save figures, specifying "filename" argument
# snl.records(filename="records.jpg")
When we run codes as a script (eg. python scenario_analysis.py
), only “script mode” is selectable and Scenario.interactive
is always False
. Figures will be saved when filenames are specified with filename
argument.
Because some methods, including Scenario.summary()
, return dataframes (pandas.DataFrame
), we can save them as CSV files etc. using .to_csv(filename, index=True)
.
We can produce filenames more easily with Filer
class. Please refer to the scripts in example directory of the repository.
[7]:
filer = cs.Filer(directory="output", prefix="jpn", suffix=None, numbering="01")
# filer.png("records")
# -> {"filename": "<absolute path>/output/jpn_01_records.png"}
# filer.jpg("records")
# -> {"filename": "<absolute path>/output/jpn_01_records.jpg"}
# filer.csv("records", index=True)
# -> {"path_or_buf": "<absolute path>/output/jpn_01_records.csv", index: True}
We can save files more easily with Filer
as follows.
[8]:
# record_df = snl.records(**filer.png("records"))
# record_df.to_csv(**filer.csv("records", index=False))
Backup/restore scenario¶
From development version 2.19.1-kappa, we have Scenario.backup(filename)
and Scenario.restore(filename)
to backup/restore timepoints and phase information. This will be helpful when we perform parameter estimation using a server and simulate with the estimated parameter values using local machines.
Note that we need to execute Scenario.register()
in advance to set timepoints with Scenario.restore()
.
Backup information:
[9]:
# backupfile_dict = cs.Filer(directory="output")
# snl.backup(**backupfile_dict)
Restore information:
[10]:
# backupfile_dict = cs.Filer(directory="output")
# snl = cs.Scenario(country="Japan")
# snl.register(jhu_data)
# snl.restore(**backupfile_dict).summary()
After restoring information, we can skip Scenario.trend()
and Scenario.estiate()
(their functionarities will be explaiend later).
Check records¶
Let’s see the records at first. Scenario.records()
method return the records as a pandas dataframe and show a line plot. Some kind of complement will be done for analysis, if necessary.
Scenario.records()
shows the number of infected/recovered/fatal cases as default. Using variables
argument, we can set the variables to show. Here, we chack the number of confirmed/fatal/recovered cases. They are cumurative values.
[11]:
snl.records(variables="CFR").tail()
# This is the same as
# snl.records(variables=["Confirmed", "Fatal", "Recovered"])
[11]:
| Date | Confirmed | Fatal | Recovered | |
|---|---|---|---|---|
| 461 | 2021-05-12 | 651702 | 11064 | 568558 |
| 462 | 2021-05-13 | 658629 | 11165 | 573913 |
| 463 | 2021-05-14 | 665547 | 11255 | 579446 |
| 464 | 2021-05-15 | 671841 | 11365 | 584770 |
| 465 | 2021-05-16 | 677988 | 11463 | 590044 |
The number of infected cases on date:
[12]:
_ = snl.records(variables="I")
# This is the same as
# snl.records(variables=["Infected"])
All available variables can be retrieved with variables="all"
.
[13]:
df = snl.records(variables="all", show_figure=False)
pprint(df.set_index("Date").columns.tolist(), compact=True)
['Confirmed', 'Infected', 'Fatal', 'Recovered', 'Susceptible', 'School_closing',
'Workplace_closing', 'Cancel_events', 'Gatherings_restrictions',
'Transport_closing', 'Stay_home_restrictions',
'Internal_movement_restrictions', 'International_movement_restrictions',
'Information_campaigns', 'Testing_policy', 'Contact_tracing',
'Stringency_index', 'Tests', 'Tests_diff', 'Vaccinations', 'Vaccinated_once',
'Vaccinated_full']
We can specify the variables to show.
[14]:
snl.records(variables=["Vaccinated_once"]).tail()
[14]:
| Date | Vaccinated_once | |
|---|---|---|
| 461 | 2021-05-12 | 3844717 |
| 462 | 2021-05-13 | 4027333 |
| 463 | 2021-05-14 | 4027333 |
| 464 | 2021-05-15 | 4027333 |
| 465 | 2021-05-16 | 4027333 |
We can calculate the number of daily new cases with Scenario.record_diff()
method.
[15]:
# Acceptable variables are the same as Scenario.records()
_ = snl.records_diff(variables="C", window=7)
Scenario.show_complement()
method is useful to show the kinds of complement. The details of complement are explained in Usage: datasets section.
[16]:
# Show the details of complement
snl.show_complement()
[16]:
| Country | Province | Monotonic_confirmed | Monotonic_fatal | Monotonic_recovered | Full_recovered | Partial_recovered | |
|---|---|---|---|---|---|---|---|
| 0 | Japan | - | False | False | True | False | True |
S-R trend analysis¶
S-R trend analysis finds the change points of SIR-derived ODE parameters. Details will be explained in Usage (details: phases). Phases will be separated with dotted lines. i.e. Dot lines indicate the start dates of phases.
[17]:
snl.trend().summary()
[17]:
| Type | Start | End | Population | |
|---|---|---|---|---|
| 0th | Past | 06Feb2020 | 18Feb2020 | 126529100 |
| 1st | Past | 19Feb2020 | 05Mar2020 | 126529100 |
| 2nd | Past | 06Mar2020 | 13Mar2020 | 126529100 |
| 3rd | Past | 14Mar2020 | 24Mar2020 | 126529100 |
| 4th | Past | 25Mar2020 | 02Apr2020 | 126529100 |
| 5th | Past | 03Apr2020 | 16Apr2020 | 126529100 |
| 6th | Past | 17Apr2020 | 01May2020 | 126529100 |
| 7th | Past | 02May2020 | 11May2020 | 126529100 |
| 8th | Past | 12May2020 | 20May2020 | 126529100 |
| 9th | Past | 21May2020 | 28May2020 | 126529100 |
| 10th | Past | 29May2020 | 05Jun2020 | 126529100 |
| 11th | Past | 06Jun2020 | 13Jun2020 | 126529100 |
| 12th | Past | 14Jun2020 | 28Jun2020 | 126529100 |
| 13th | Past | 29Jun2020 | 09Jul2020 | 126529100 |
| 14th | Past | 10Jul2020 | 21Jul2020 | 126529100 |
| 15th | Past | 22Jul2020 | 01Aug2020 | 126529100 |
| 16th | Past | 02Aug2020 | 10Aug2020 | 126529100 |
| 17th | Past | 11Aug2020 | 20Aug2020 | 126529100 |
| 18th | Past | 21Aug2020 | 28Aug2020 | 126529100 |
| 19th | Past | 29Aug2020 | 09Sep2020 | 126529100 |
| 20th | Past | 10Sep2020 | 18Sep2020 | 126529100 |
| 21st | Past | 19Sep2020 | 30Sep2020 | 126529100 |
| 22nd | Past | 01Oct2020 | 13Oct2020 | 126529100 |
| 23rd | Past | 14Oct2020 | 23Oct2020 | 126529100 |
| 24th | Past | 24Oct2020 | 04Nov2020 | 126529100 |
| 25th | Past | 05Nov2020 | 13Nov2020 | 126529100 |
| 26th | Past | 14Nov2020 | 26Nov2020 | 126529100 |
| 27th | Past | 27Nov2020 | 09Dec2020 | 126529100 |
| 28th | Past | 10Dec2020 | 18Dec2020 | 126529100 |
| 29th | Past | 19Dec2020 | 29Dec2020 | 126529100 |
| 30th | Past | 30Dec2020 | 07Jan2021 | 126529100 |
| 31st | Past | 08Jan2021 | 16Jan2021 | 126529100 |
| 32nd | Past | 17Jan2021 | 24Jan2021 | 126529100 |
| 33rd | Past | 25Jan2021 | 01Feb2021 | 126529100 |
| 34th | Past | 02Feb2021 | 09Feb2021 | 126529100 |
| 35th | Past | 10Feb2021 | 17Feb2021 | 126529100 |
| 36th | Past | 18Feb2021 | 02Mar2021 | 126529100 |
| 37th | Past | 03Mar2021 | 12Mar2021 | 126529100 |
| 38th | Past | 13Mar2021 | 25Mar2021 | 126529100 |
| 39th | Past | 26Mar2021 | 06Apr2021 | 126529100 |
| 40th | Past | 07Apr2021 | 15Apr2021 | 126529100 |
| 41st | Past | 16Apr2021 | 24Apr2021 | 126529100 |
| 42nd | Past | 25Apr2021 | 06May2021 | 126529100 |
| 43rd | Past | 07May2021 | 16May2021 | 126529100 |
Parameter estimation of ODE models¶
Here, we will estimate the tau value [min] (using grid search) and parameter values of SIR-derived models using Optuna package (automated hyperparameter optimization framework). As an example, we use SIR-F model. Details of models will be explained in Usage (details: theoritical datasets).
We can select the model from SIR, SIRD and SIR-F model for parameter estimation. SIR-FV model (completely deprecated) and SEWIR-F model cannot be used.
[18]:
# Estimate the tau value and parameter values of SIR-F model
# Default value of timeout in each phase is 180 sec
snl.estimate(cs.SIRF, timeout=180)
<SIR-F model: parameter estimation>
Running optimization with 4 CPUs...
9th phase (21May2020 - 28May2020): finished 296 trials in 0 min 5 sec
10th phase (29May2020 - 05Jun2020): finished 294 trials in 0 min 5 sec
11th phase (06Jun2020 - 13Jun2020): finished 294 trials in 0 min 5 sec
0th phase (06Feb2020 - 18Feb2020): finished 1272 trials in 0 min 25 sec
3rd phase (14Mar2020 - 24Mar2020): finished 1106 trials in 0 min 25 sec
6th phase (17Apr2020 - 01May2020): finished 1668 trials in 0 min 45 sec
12th phase (14Jun2020 - 28Jun2020): finished 1526 trials in 0 min 40 sec
1st phase (19Feb2020 - 05Mar2020): finished 1376 trials in 0 min 35 sec
4th phase (25Mar2020 - 02Apr2020): finished 1781 trials in 0 min 50 sec
2nd phase (06Mar2020 - 13Mar2020): finished 1217 trials in 0 min 30 sec
7th phase (02May2020 - 11May2020): finished 1632 trials in 0 min 45 sec
5th phase (03Apr2020 - 16Apr2020): finished 1217 trials in 0 min 30 sec
13th phase (29Jun2020 - 09Jul2020): finished 1762 trials in 0 min 50 sec
18th phase (21Aug2020 - 28Aug2020): finished 296 trials in 0 min 5 sec
15th phase (22Jul2020 - 01Aug2020): finished 1084 trials in 0 min 25 sec
19th phase (29Aug2020 - 09Sep2020): finished 293 trials in 0 min 5 sec
20th phase (10Sep2020 - 18Sep2020): finished 295 trials in 0 min 5 sec
8th phase (12May2020 - 20May2020): finished 1897 trials in 0 min 55 sec
14th phase (10Jul2020 - 21Jul2020): finished 1651 trials in 0 min 45 sec
24th phase (24Oct2020 - 04Nov2020): finished 291 trials in 0 min 5 sec
21st phase (19Sep2020 - 30Sep2020): finished 1388 trials in 0 min 35 sec
25th phase (05Nov2020 - 13Nov2020): finished 292 trials in 0 min 5 sec
16th phase (02Aug2020 - 10Aug2020): finished 1768 trials in 0 min 50 sec
22nd phase (01Oct2020 - 13Oct2020): finished 1243 trials in 0 min 30 sec
26th phase (14Nov2020 - 26Nov2020): finished 1240 trials in 0 min 30 sec
30th phase (30Dec2020 - 07Jan2021): finished 293 trials in 0 min 5 sec
27th phase (27Nov2020 - 09Dec2020): finished 1767 trials in 0 min 50 sec
17th phase (11Aug2020 - 20Aug2020): finished 1628 trials in 0 min 45 sec
23rd phase (14Oct2020 - 23Oct2020): finished 1068 trials in 0 min 25 sec
33rd phase (25Jan2021 - 01Feb2021): finished 292 trials in 0 min 5 sec
36th phase (18Feb2021 - 02Mar2021): finished 294 trials in 0 min 5 sec
34th phase (02Feb2021 - 09Feb2021): finished 293 trials in 0 min 5 sec
37th phase (03Mar2021 - 12Mar2021): finished 294 trials in 0 min 5 sec
31st phase (08Jan2021 - 16Jan2021): finished 1213 trials in 0 min 30 sec
28th phase (10Dec2020 - 18Dec2020): finished 1079 trials in 0 min 25 sec
35th phase (10Feb2021 - 17Feb2021): finished 293 trials in 0 min 5 sec
38th phase (13Mar2021 - 25Mar2021): finished 1087 trials in 0 min 25 sec
29th phase (19Dec2020 - 29Dec2020): finished 1370 trials in 0 min 35 sec
39th phase (26Mar2021 - 06Apr2021): finished 1645 trials in 0 min 45 sec
42nd phase (25Apr2021 - 06May2021): finished 1083 trials in 0 min 25 sec
32nd phase (17Jan2021 - 24Jan2021): finished 1765 trials in 0 min 50 sec
43rd phase (07May2021 - 16May2021): finished 1389 trials in 0 min 35 sec
40th phase (07Apr2021 - 15Apr2021): finished 1732 trials in 0 min 50 sec
41st phase (16Apr2021 - 24Apr2021): finished 302 trials in 0 min 5 sec
Completed optimization. Total: 5 min 27 sec
[19]:
# Show the summary of parameter estimation
snl.summary()
[19]:
| Type | Start | End | Population | ODE | Rt | theta | kappa | rho | sigma | tau | alpha1 [-] | 1/alpha2 [day] | 1/beta [day] | 1/gamma [day] | RMSLE | Trials | Runtime | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0th | Past | 06Feb2020 | 18Feb2020 | 126529100 | SIR-F | 2.32 | 0.027273 | 0.000000 | 0.066019 | 0.027718 | 1440 | - | - | - | - | 0.142890 | 1272.0 | 0 min 25 sec |
| 1st | Past | 19Feb2020 | 05Mar2020 | 126529100 | SIR-F | 5.61 | 0.008991 | 0.001133 | 0.137344 | 0.023140 | 1440 | 0.009 | 882.0 | 7.0 | 43.0 | 0.166508 | 1376.0 | 0 min 35 sec |
| 2nd | Past | 06Mar2020 | 13Mar2020 | 126529100 | SIR-F | 4.45 | 0.000288 | 0.003503 | 0.126216 | 0.024882 | 1440 | 0.0 | 285.0 | 7.0 | 40.0 | 0.096661 | 1217.0 | 0 min 30 sec |
| 3rd | Past | 14Mar2020 | 24Mar2020 | 126529100 | SIR-F | 2.51 | 0.010285 | 0.002518 | 0.063876 | 0.022654 | 1440 | 0.01 | 397.0 | 15.0 | 44.0 | 0.027972 | 1106.0 | 0 min 25 sec |
| 4th | Past | 25Mar2020 | 02Apr2020 | 126529100 | SIR-F | 4.84 | 0.000285 | 0.001828 | 0.116559 | 0.022244 | 1440 | 0.0 | 547.0 | 8.0 | 44.0 | 0.036672 | 1781.0 | 0 min 50 sec |
| 5th | Past | 03Apr2020 | 16Apr2020 | 126529100 | SIR-F | 12.55 | 0.000363 | 0.001137 | 0.117748 | 0.008241 | 1440 | 0.0 | 879.0 | 8.0 | 121.0 | 0.040911 | 1217.0 | 0 min 30 sec |
| 6th | Past | 17Apr2020 | 01May2020 | 126529100 | SIR-F | 2.02 | 0.033079 | 0.000737 | 0.046327 | 0.021451 | 1440 | 0.033 | 1357.0 | 21.0 | 46.0 | 0.089109 | 1668.0 | 0 min 45 sec |
| 7th | Past | 02May2020 | 11May2020 | 126529100 | SIR-F | 0.26 | 0.095520 | 0.000975 | 0.012374 | 0.042073 | 1440 | 0.096 | 1025.0 | 80.0 | 23.0 | 0.099103 | 1632.0 | 0 min 45 sec |
| 8th | Past | 12May2020 | 20May2020 | 126529100 | SIR-F | 0.16 | 0.054181 | 0.002761 | 0.016654 | 0.094815 | 1440 | 0.054 | 362.0 | 60.0 | 10.0 | 0.026957 | 1897.0 | 0 min 55 sec |
| 9th | Past | 21May2020 | 28May2020 | 126529100 | SIR-F | 0.16 | 0.040250 | 0.005010 | 0.016699 | 0.095047 | 1440 | 0.04 | 199.0 | 59.0 | 10.0 | 0.014298 | 296.0 | 0 min 5 sec |
| 10th | Past | 29May2020 | 05Jun2020 | 126529100 | SIR-F | 0.46 | 0.009146 | 0.003368 | 0.032347 | 0.066856 | 1440 | 0.009 | 296.0 | 30.0 | 14.0 | 0.013204 | 294.0 | 0 min 5 sec |
| 11th | Past | 06Jun2020 | 13Jun2020 | 126529100 | SIR-F | 0.60 | 0.012600 | 0.001126 | 0.040160 | 0.064908 | 1440 | 0.013 | 888.0 | 24.0 | 15.0 | 0.021013 | 294.0 | 0 min 5 sec |
| 12th | Past | 14Jun2020 | 28Jun2020 | 126529100 | SIR-F | 0.96 | 0.034689 | 0.001545 | 0.076432 | 0.075659 | 1440 | 0.035 | 647.0 | 13.0 | 13.0 | 0.035520 | 1526.0 | 0 min 40 sec |
| 13th | Past | 29Jun2020 | 09Jul2020 | 126529100 | SIR-F | 2.14 | 0.000613 | 0.000495 | 0.139629 | 0.064850 | 1440 | 0.001 | 2019.0 | 7.0 | 15.0 | 0.022931 | 1762.0 | 0 min 50 sec |
| 14th | Past | 10Jul2020 | 21Jul2020 | 126529100 | SIR-F | 2.02 | 0.000089 | 0.000085 | 0.146110 | 0.072395 | 1440 | 0.0 | 11784.0 | 6.0 | 13.0 | 0.019499 | 1651.0 | 0 min 45 sec |
| 15th | Past | 22Jul2020 | 01Aug2020 | 126529100 | SIR-F | 2.01 | 0.000167 | 0.000279 | 0.139064 | 0.068870 | 1440 | 0.0 | 3581.0 | 7.0 | 14.0 | 0.024490 | 1084.0 | 0 min 25 sec |
| 16th | Past | 02Aug2020 | 10Aug2020 | 126529100 | SIR-F | 1.65 | 0.000310 | 0.000307 | 0.125580 | 0.075621 | 1440 | 0.0 | 3262.0 | 7.0 | 13.0 | 0.028521 | 1768.0 | 0 min 50 sec |
| 17th | Past | 11Aug2020 | 20Aug2020 | 126529100 | SIR-F | 0.89 | 0.000126 | 0.000659 | 0.081407 | 0.090693 | 1440 | 0.0 | 1517.0 | 12.0 | 11.0 | 0.015641 | 1628.0 | 0 min 45 sec |
| 18th | Past | 21Aug2020 | 28Aug2020 | 126529100 | SIR-F | 0.79 | 0.000433 | 0.000915 | 0.071384 | 0.088933 | 1440 | 0.0 | 1092.0 | 14.0 | 11.0 | 0.014559 | 296.0 | 0 min 5 sec |
| 19th | Past | 29Aug2020 | 09Sep2020 | 126529100 | SIR-F | 0.75 | 0.000319 | 0.001368 | 0.074762 | 0.098323 | 1440 | 0.0 | 730.0 | 13.0 | 10.0 | 0.014191 | 293.0 | 0 min 5 sec |
| 20th | Past | 10Sep2020 | 18Sep2020 | 126529100 | SIR-F | 0.86 | 0.000376 | 0.001487 | 0.080200 | 0.091359 | 1440 | 0.0 | 672.0 | 12.0 | 10.0 | 0.013288 | 295.0 | 0 min 5 sec |
| 21st | Past | 19Sep2020 | 30Sep2020 | 126529100 | SIR-F | 0.88 | 0.000312 | 0.000997 | 0.075151 | 0.084253 | 1440 | 0.0 | 1003.0 | 13.0 | 11.0 | 0.022352 | 1388.0 | 0 min 35 sec |
| 22nd | Past | 01Oct2020 | 13Oct2020 | 126529100 | SIR-F | 1.00 | 0.000138 | 0.001029 | 0.099006 | 0.098218 | 1440 | 0.0 | 971.0 | 10.0 | 10.0 | 0.012246 | 1243.0 | 0 min 30 sec |
| 23rd | Past | 14Oct2020 | 23Oct2020 | 126529100 | SIR-F | 0.98 | 0.000049 | 0.001184 | 0.110228 | 0.111047 | 1440 | 0.0 | 844.0 | 9.0 | 9.0 | 0.012303 | 1068.0 | 0 min 25 sec |
| 24th | Past | 24Oct2020 | 04Nov2020 | 126529100 | SIR-F | 1.26 | 0.000373 | 0.001250 | 0.104096 | 0.081053 | 1440 | 0.0 | 800.0 | 9.0 | 12.0 | 0.011016 | 291.0 | 0 min 5 sec |
| 25th | Past | 05Nov2020 | 13Nov2020 | 126529100 | SIR-F | 1.58 | 0.000123 | 0.000952 | 0.136342 | 0.085139 | 1440 | 0.0 | 1050.0 | 7.0 | 11.0 | 0.005288 | 292.0 | 0 min 5 sec |
| 26th | Past | 14Nov2020 | 26Nov2020 | 126529100 | SIR-F | 1.61 | 0.000364 | 0.000741 | 0.130247 | 0.080262 | 1440 | 0.0 | 1348.0 | 7.0 | 12.0 | 0.016179 | 1240.0 | 0 min 30 sec |
| 27th | Past | 27Nov2020 | 09Dec2020 | 126529100 | SIR-F | 1.18 | 0.000111 | 0.001364 | 0.107502 | 0.089957 | 1440 | 0.0 | 733.0 | 9.0 | 11.0 | 0.012040 | 1767.0 | 0 min 50 sec |
| 28th | Past | 10Dec2020 | 18Dec2020 | 126529100 | SIR-F | 1.23 | 0.000816 | 0.001441 | 0.109664 | 0.087854 | 1440 | 0.001 | 694.0 | 9.0 | 11.0 | 0.013164 | 1079.0 | 0 min 25 sec |
| 29th | Past | 19Dec2020 | 29Dec2020 | 126529100 | SIR-F | 1.22 | 0.000326 | 0.001583 | 0.101449 | 0.081763 | 1440 | 0.0 | 631.0 | 9.0 | 12.0 | 0.012566 | 1370.0 | 0 min 35 sec |
| 30th | Past | 30Dec2020 | 07Jan2021 | 126529100 | SIR-F | 1.51 | 0.001161 | 0.001289 | 0.099652 | 0.064832 | 1440 | 0.001 | 775.0 | 10.0 | 15.0 | 0.009675 | 293.0 | 0 min 5 sec |
| 31st | Past | 08Jan2021 | 16Jan2021 | 126529100 | SIR-F | 1.84 | 0.000919 | 0.001027 | 0.113947 | 0.060728 | 1440 | 0.001 | 973.0 | 8.0 | 16.0 | 0.027863 | 1213.0 | 0 min 30 sec |
| 32nd | Past | 17Jan2021 | 24Jan2021 | 126529100 | SIR-F | 0.93 | 0.000057 | 0.001123 | 0.083040 | 0.088374 | 1440 | 0.0 | 890.0 | 12.0 | 11.0 | 0.015284 | 1765.0 | 0 min 50 sec |
| 33rd | Past | 25Jan2021 | 01Feb2021 | 126529100 | SIR-F | 0.59 | 0.000004 | 0.001607 | 0.059337 | 0.098334 | 1440 | 0.0 | 622.0 | 16.0 | 10.0 | 0.008996 | 292.0 | 0 min 5 sec |
| 34th | Past | 02Feb2021 | 09Feb2021 | 126529100 | SIR-F | 0.51 | 0.000226 | 0.002569 | 0.058978 | 0.113382 | 1440 | 0.0 | 389.0 | 16.0 | 8.0 | 0.006756 | 293.0 | 0 min 5 sec |
| 35th | Past | 10Feb2021 | 17Feb2021 | 126529100 | SIR-F | 0.63 | 0.000201 | 0.003086 | 0.073072 | 0.112896 | 1440 | 0.0 | 324.0 | 13.0 | 8.0 | 0.010449 | 293.0 | 0 min 5 sec |
| 36th | Past | 18Feb2021 | 02Mar2021 | 126529100 | SIR-F | 0.70 | 0.000331 | 0.003702 | 0.073337 | 0.100348 | 1440 | 0.0 | 270.0 | 13.0 | 9.0 | 0.007700 | 294.0 | 0 min 5 sec |
| 37th | Past | 03Mar2021 | 12Mar2021 | 126529100 | SIR-F | 0.89 | 0.000001 | 0.004900 | 0.081967 | 0.087326 | 1440 | 0.0 | 204.0 | 12.0 | 11.0 | 0.008815 | 294.0 | 0 min 5 sec |
| 38th | Past | 13Mar2021 | 25Mar2021 | 126529100 | SIR-F | 1.12 | 0.008487 | 0.002109 | 0.090590 | 0.077924 | 1440 | 0.008 | 474.0 | 11.0 | 12.0 | 0.012063 | 1087.0 | 0 min 25 sec |
| 39th | Past | 26Mar2021 | 06Apr2021 | 126529100 | SIR-F | 1.62 | 0.000439 | 0.001469 | 0.118966 | 0.072133 | 1440 | 0.0 | 680.0 | 8.0 | 13.0 | 0.011568 | 1645.0 | 0 min 45 sec |
| 40th | Past | 07Apr2021 | 15Apr2021 | 126529100 | SIR-F | 1.49 | 0.000339 | 0.000900 | 0.117824 | 0.077977 | 1440 | 0.0 | 1111.0 | 8.0 | 12.0 | 0.018643 | 1732.0 | 0 min 50 sec |
| 41st | Past | 16Apr2021 | 24Apr2021 | 126529100 | SIR-F | 1.63 | 0.000562 | 0.000892 | 0.107090 | 0.064915 | 1440 | 0.001 | 1120.0 | 9.0 | 15.0 | 0.008563 | 302.0 | 0 min 5 sec |
| 42nd | Past | 25Apr2021 | 06May2021 | 126529100 | SIR-F | 1.34 | 0.000907 | 0.000880 | 0.089340 | 0.065660 | 1440 | 0.001 | 1135.0 | 11.0 | 15.0 | 0.006747 | 1083.0 | 0 min 25 sec |
| 43rd | Past | 07May2021 | 16May2021 | 126529100 | SIR-F | 1.31 | 0.000619 | 0.001322 | 0.091114 | 0.068312 | 1440 | 0.001 | 756.0 | 10.0 | 14.0 | 0.006304 | 1389.0 | 0 min 35 sec |
Evaluation of estimation accuracy¶
Accuracy of parameter estimation can be evaluated with RMSLE (Root Mean Squared Log Error) score.
Where \(A\) is the observed (actual) values, \(P\) is estimated (predicted) values. Variables are \(S (i=1), I (i=2), R (i=3)\ \mathrm{and}\ F (i=n=4)\) for SIR-F model. When RMSLE score is low, hyperparameter estimation is highly accurate. Please refer to external sites, including Medium: What’s the Difference Between RMSE and RMSLE?
[20]:
# Show RMSLE scores with the number of optimization trials and runtime for phases
snl.summary(columns=["Start", "End", "RMSLE", "Trials", "Runtime"])
[20]:
| Start | End | RMSLE | Trials | Runtime | |
|---|---|---|---|---|---|
| 0th | 06Feb2020 | 18Feb2020 | 0.142890 | 1272.0 | 0 min 25 sec |
| 1st | 19Feb2020 | 05Mar2020 | 0.166508 | 1376.0 | 0 min 35 sec |
| 2nd | 06Mar2020 | 13Mar2020 | 0.096661 | 1217.0 | 0 min 30 sec |
| 3rd | 14Mar2020 | 24Mar2020 | 0.027972 | 1106.0 | 0 min 25 sec |
| 4th | 25Mar2020 | 02Apr2020 | 0.036672 | 1781.0 | 0 min 50 sec |
| 5th | 03Apr2020 | 16Apr2020 | 0.040911 | 1217.0 | 0 min 30 sec |
| 6th | 17Apr2020 | 01May2020 | 0.089109 | 1668.0 | 0 min 45 sec |
| 7th | 02May2020 | 11May2020 | 0.099103 | 1632.0 | 0 min 45 sec |
| 8th | 12May2020 | 20May2020 | 0.026957 | 1897.0 | 0 min 55 sec |
| 9th | 21May2020 | 28May2020 | 0.014298 | 296.0 | 0 min 5 sec |
| 10th | 29May2020 | 05Jun2020 | 0.013204 | 294.0 | 0 min 5 sec |
| 11th | 06Jun2020 | 13Jun2020 | 0.021013 | 294.0 | 0 min 5 sec |
| 12th | 14Jun2020 | 28Jun2020 | 0.035520 | 1526.0 | 0 min 40 sec |
| 13th | 29Jun2020 | 09Jul2020 | 0.022931 | 1762.0 | 0 min 50 sec |
| 14th | 10Jul2020 | 21Jul2020 | 0.019499 | 1651.0 | 0 min 45 sec |
| 15th | 22Jul2020 | 01Aug2020 | 0.024490 | 1084.0 | 0 min 25 sec |
| 16th | 02Aug2020 | 10Aug2020 | 0.028521 | 1768.0 | 0 min 50 sec |
| 17th | 11Aug2020 | 20Aug2020 | 0.015641 | 1628.0 | 0 min 45 sec |
| 18th | 21Aug2020 | 28Aug2020 | 0.014559 | 296.0 | 0 min 5 sec |
| 19th | 29Aug2020 | 09Sep2020 | 0.014191 | 293.0 | 0 min 5 sec |
| 20th | 10Sep2020 | 18Sep2020 | 0.013288 | 295.0 | 0 min 5 sec |
| 21st | 19Sep2020 | 30Sep2020 | 0.022352 | 1388.0 | 0 min 35 sec |
| 22nd | 01Oct2020 | 13Oct2020 | 0.012246 | 1243.0 | 0 min 30 sec |
| 23rd | 14Oct2020 | 23Oct2020 | 0.012303 | 1068.0 | 0 min 25 sec |
| 24th | 24Oct2020 | 04Nov2020 | 0.011016 | 291.0 | 0 min 5 sec |
| 25th | 05Nov2020 | 13Nov2020 | 0.005288 | 292.0 | 0 min 5 sec |
| 26th | 14Nov2020 | 26Nov2020 | 0.016179 | 1240.0 | 0 min 30 sec |
| 27th | 27Nov2020 | 09Dec2020 | 0.012040 | 1767.0 | 0 min 50 sec |
| 28th | 10Dec2020 | 18Dec2020 | 0.013164 | 1079.0 | 0 min 25 sec |
| 29th | 19Dec2020 | 29Dec2020 | 0.012566 | 1370.0 | 0 min 35 sec |
| 30th | 30Dec2020 | 07Jan2021 | 0.009675 | 293.0 | 0 min 5 sec |
| 31st | 08Jan2021 | 16Jan2021 | 0.027863 | 1213.0 | 0 min 30 sec |
| 32nd | 17Jan2021 | 24Jan2021 | 0.015284 | 1765.0 | 0 min 50 sec |
| 33rd | 25Jan2021 | 01Feb2021 | 0.008996 | 292.0 | 0 min 5 sec |
| 34th | 02Feb2021 | 09Feb2021 | 0.006756 | 293.0 | 0 min 5 sec |
| 35th | 10Feb2021 | 17Feb2021 | 0.010449 | 293.0 | 0 min 5 sec |
| 36th | 18Feb2021 | 02Mar2021 | 0.007700 | 294.0 | 0 min 5 sec |
| 37th | 03Mar2021 | 12Mar2021 | 0.008815 | 294.0 | 0 min 5 sec |
| 38th | 13Mar2021 | 25Mar2021 | 0.012063 | 1087.0 | 0 min 25 sec |
| 39th | 26Mar2021 | 06Apr2021 | 0.011568 | 1645.0 | 0 min 45 sec |
| 40th | 07Apr2021 | 15Apr2021 | 0.018643 | 1732.0 | 0 min 50 sec |
| 41st | 16Apr2021 | 24Apr2021 | 0.008563 | 302.0 | 0 min 5 sec |
| 42nd | 25Apr2021 | 06May2021 | 0.006747 | 1083.0 | 0 min 25 sec |
| 43rd | 07May2021 | 16May2021 | 0.006304 | 1389.0 | 0 min 35 sec |
Additionally, we can visualize the accuracy with Scenario.estimate_accuracy()
, specifing phase name.
[21]:
# Visualize the accuracy for the 2nd phase
snl.estimate_accuracy(phase="2nd")
# phase="last" means the last phases
# snl.estimate_accuracy(phase="last")
We can calculate total score for all phases using Scenario.score()
method. Metrics can be selected from MAE, MSE, MSLE, RMSE and RMSLE.
[22]:
# Get total score: metrics="MAE", "MSE", "MSLE", "RMSE" or "RMSLE"
# snl.score(metrics="RMSLE")
metrics_list = ["MAE", "MSE", "MSLE", "RMSE", "RMSLE"]
for metrics in metrics_list:
metrics_name = metrics.rjust(len(max(metrics_list, key=len)))
print(f"{metrics_name}: {snl.score(metrics=metrics):.3f}")
MAE: 647.423
MSE: 1728064.751
MSLE: 0.003
RMSE: 1025.493
RMSLE: 0.058
Get parameter value¶
We can get the parameter values of a phase using Scenario.get()
method.
[23]:
# Get parameter values
snl.get("Rt", phase="4th")
[23]:
4.84
[24]:
# phase="last" means the last phases
snl.get("Rt", phase="last")
[24]:
1.31
Show parameter history¶
We can get the history of parameter values with a dataframe and a figure.
[25]:
# Get the parameter values as a dataframe
snl.summary(columns=[*cs.SIRF.PARAMETERS, "Rt"])
[25]:
| theta | kappa | rho | sigma | Rt | |
|---|---|---|---|---|---|
| 0th | 0.027273 | 0.000000 | 0.066019 | 0.027718 | 2.32 |
| 1st | 0.008991 | 0.001133 | 0.137344 | 0.023140 | 5.61 |
| 2nd | 0.000288 | 0.003503 | 0.126216 | 0.024882 | 4.45 |
| 3rd | 0.010285 | 0.002518 | 0.063876 | 0.022654 | 2.51 |
| 4th | 0.000285 | 0.001828 | 0.116559 | 0.022244 | 4.84 |
| 5th | 0.000363 | 0.001137 | 0.117748 | 0.008241 | 12.55 |
| 6th | 0.033079 | 0.000737 | 0.046327 | 0.021451 | 2.02 |
| 7th | 0.095520 | 0.000975 | 0.012374 | 0.042073 | 0.26 |
| 8th | 0.054181 | 0.002761 | 0.016654 | 0.094815 | 0.16 |
| 9th | 0.040250 | 0.005010 | 0.016699 | 0.095047 | 0.16 |
| 10th | 0.009146 | 0.003368 | 0.032347 | 0.066856 | 0.46 |
| 11th | 0.012600 | 0.001126 | 0.040160 | 0.064908 | 0.60 |
| 12th | 0.034689 | 0.001545 | 0.076432 | 0.075659 | 0.96 |
| 13th | 0.000613 | 0.000495 | 0.139629 | 0.064850 | 2.14 |
| 14th | 0.000089 | 0.000085 | 0.146110 | 0.072395 | 2.02 |
| 15th | 0.000167 | 0.000279 | 0.139064 | 0.068870 | 2.01 |
| 16th | 0.000310 | 0.000307 | 0.125580 | 0.075621 | 1.65 |
| 17th | 0.000126 | 0.000659 | 0.081407 | 0.090693 | 0.89 |
| 18th | 0.000433 | 0.000915 | 0.071384 | 0.088933 | 0.79 |
| 19th | 0.000319 | 0.001368 | 0.074762 | 0.098323 | 0.75 |
| 20th | 0.000376 | 0.001487 | 0.080200 | 0.091359 | 0.86 |
| 21st | 0.000312 | 0.000997 | 0.075151 | 0.084253 | 0.88 |
| 22nd | 0.000138 | 0.001029 | 0.099006 | 0.098218 | 1.00 |
| 23rd | 0.000049 | 0.001184 | 0.110228 | 0.111047 | 0.98 |
| 24th | 0.000373 | 0.001250 | 0.104096 | 0.081053 | 1.26 |
| 25th | 0.000123 | 0.000952 | 0.136342 | 0.085139 | 1.58 |
| 26th | 0.000364 | 0.000741 | 0.130247 | 0.080262 | 1.61 |
| 27th | 0.000111 | 0.001364 | 0.107502 | 0.089957 | 1.18 |
| 28th | 0.000816 | 0.001441 | 0.109664 | 0.087854 | 1.23 |
| 29th | 0.000326 | 0.001583 | 0.101449 | 0.081763 | 1.22 |
| 30th | 0.001161 | 0.001289 | 0.099652 | 0.064832 | 1.51 |
| 31st | 0.000919 | 0.001027 | 0.113947 | 0.060728 | 1.84 |
| 32nd | 0.000057 | 0.001123 | 0.083040 | 0.088374 | 0.93 |
| 33rd | 0.000004 | 0.001607 | 0.059337 | 0.098334 | 0.59 |
| 34th | 0.000226 | 0.002569 | 0.058978 | 0.113382 | 0.51 |
| 35th | 0.000201 | 0.003086 | 0.073072 | 0.112896 | 0.63 |
| 36th | 0.000331 | 0.003702 | 0.073337 | 0.100348 | 0.70 |
| 37th | 0.000001 | 0.004900 | 0.081967 | 0.087326 | 0.89 |
| 38th | 0.008487 | 0.002109 | 0.090590 | 0.077924 | 1.12 |
| 39th | 0.000439 | 0.001469 | 0.118966 | 0.072133 | 1.62 |
| 40th | 0.000339 | 0.000900 | 0.117824 | 0.077977 | 1.49 |
| 41st | 0.000562 | 0.000892 | 0.107090 | 0.064915 | 1.63 |
| 42nd | 0.000907 | 0.000880 | 0.089340 | 0.065660 | 1.34 |
| 43rd | 0.000619 | 0.001322 | 0.091114 | 0.068312 | 1.31 |
Scenario.history()
method shows the trajectories of parameters (and the number of cases).
[26]:
_ = snl.history(target="theta", show_legend=False)
[27]:
_ = snl.history(target="kappa", show_legend=False)
[28]:
_ = snl.history(target="rho", show_legend=False)
[29]:
_ = snl.history(target="sigma", show_legend=False)
Sigma values: the first wave < the second wave > the third wave
However, in the second wave (Jul - Oct), recovery period appears short because we have some effective medicines (not approved, in clinical study), yonger people (people un-associated to sever diseases) were infected.
In the third wave (Nov - ), older people tend to be infected and we are facing with medical collapse at this time…
Show the history of reproduction number¶
\(R_0\) (“R naught”) means “the average number of secondary infections caused by an infected host” (Infection Modeling — Part 1). When this value is larger than 1, the infection disease is outbreaking.
[30]:
_ = snl.history(target="Rt", show_legend=False)
Simulate the number of cases¶
We can compare the actual and simulated (with estimated parameter values) number of confirmed/infected/recovered/fatal cases using Scenario.history()
method.
[31]:
# Compare the actual values and the main scenario
_ = snl.history("Infected")
When we want to show only one scenario with all variables, we use Scenario.simulate()
method.
[32]:
_ =snl.simulate(name="Main")
Main scenario¶
To investigate the effect of parameter changes, we will perform scenario analysis. In the main scenario, we will assume that the parameter values do not change after the last past phase.
i.e. If the parameter velues will not be changed until 31Jul2021, how many cases will be? We call this scenario as “Main” scenario.
[33]:
# Clear future phases in Main scenario
snl.clear(name="Main")
# Add one future phase 30 days with the parameter set of the last past phase
snl.add(days=30, name="Main")
# Add one future phase until 31Jul2021 with the same parameter set
snl.add(end_date="31Jul2021", name="Main")
# Simulate the number of cases
snl.simulate(name="Main").tail()
[33]:
| Date | Infected | Fatal | Recovered | |
|---|---|---|---|---|
| 524 | 2021-07-27 | 349833 | 29760 | 1496213 |
| 525 | 2021-07-28 | 356922 | 30247 | 1520352 |
| 526 | 2021-07-29 | 364146 | 30744 | 1544980 |
| 527 | 2021-07-30 | 371508 | 31251 | 1570107 |
| 528 | 2021-07-31 | 379009 | 31768 | 1595740 |
Medicine scenario¶
To investigate the effect of new medicines, we will assume that \(\sigma\) will be changed in the future phases.
If \(\sigma\) will be 1.2 times in 30 days, how many cases will be? We will call this scenario as “Medicine” scenario.
[34]:
# Calcuate the current sigma value of the last phase
sigma_current = snl.get("sigma", name="Main", phase="last")
sigma_current
[34]:
0.06831201471146749
[35]:
# Sigma value will be double
sigma_new = sigma_current * 1.2
sigma_new
[35]:
0.08197441765376098
[36]:
# Initialize "Medicine" scenario (with the same past phases as that of Main scenario)
snl.clear(name="Medicine")
# Add 30 days as a new future phases with the same parameter set
snl.add(name="Medicine", days=30, sigma=sigma_current)
# Add a phase with doubled sigma value and the same end date with main date
snl.add(name="Medicine", end_date="31Jul2021", sigma=sigma_new)
[36]:
<covsirphy.analysis.scenario.Scenario at 0x7fcaf41fc100>
Check summary of future phases.
[37]:
df = snl.summary()
df.loc[df["Type"] == "Future"]
[37]:
| Type | Start | End | Population | ODE | Rt | theta | kappa | rho | sigma | tau | alpha1 [-] | 1/alpha2 [day] | 1/beta [day] | 1/gamma [day] | RMSLE | Trials | Runtime | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Scenario | Phase | ||||||||||||||||||
| Main | 44th | Future | 17May2021 | 15Jun2021 | 126529100 | SIR-F | 1.31 | 0.000619 | 0.001322 | 0.091114 | 0.068312 | 1440 | 0.001 | 756.0 | 10.0 | 14.0 | - | - | - |
| 45th | Future | 16Jun2021 | 31Jul2021 | 126529100 | SIR-F | 1.31 | 0.000619 | 0.001322 | 0.091114 | 0.068312 | 1440 | 0.001 | 756.0 | 10.0 | 14.0 | - | - | - | |
| Medicine | 44th | Future | 17May2021 | 15Jun2021 | 126529100 | SIR-F | 1.31 | 0.000619 | 0.001322 | 0.091114 | 0.068312 | 1440 | 0.001 | 756.0 | 10.0 | 14.0 | - | - | - |
| 45th | Future | 16Jun2021 | 31Jul2021 | 126529100 | SIR-F | 1.09 | 0.000619 | 0.001322 | 0.091114 | 0.081974 | 1440 | 0.001 | 756.0 | 10.0 | 12.0 | - | - | - |
Simulate the number of cases.
[38]:
_ = snl.simulate(name="Medicine").tail()
Short-term prediction of parameter values¶
With extra datasets, we can predict the ODE parameter values in the future phases because OxCGRT indicators (policy measures), vaccinations and so on impact on parameter values with delay period (the number of days that indicators take for the ODE parameter values to be changed).
OxCGRT indicators are
school_closing,
workplace_closing,
cancel_events,
gatherings_restrictions,
transport_closing,
stay_home_restrictions,
internal_movement_restrictions,
international_movement_restrictions,
information_campaigns,
testing_policy, and
contact_tracing.
Scenario.fit()
method learns the relationship of indicators (X) and the parameter values (y) with regresion model (Elastic Net regression). X was registered with Scenario.register()
and y was calculated with Scenario.estimate()
in advance respectively.
Scenario.fit()
has delay
argument and we can apply the following values.
delay=20
: Exact value of delay period [days].delay=(7, 31)
: Delay period will be found by grid search in the value range of (7, 31) to minimize test score of learing. This is the default value from version 2.20.0.delay=None
: Delay period will be calculated withScenario.estimate_delay()
method. In this method, change point analysis will be done with one selected indicator (“Stringency_index” as default) and variable (“Confirmed” as default) to estimate delay period. This is the default value to version 2.19.1.
When we use delay=None
, the indicator used to estimate delay period (“Stringency_index” as default) will be automatically removed from X dataset. If you have some indicators to be removed additionally, please use removed_cols
argument (list of indicator names) of Scenario.fit()
.
As an example, we only use OxCGRT indicators (except for “Stringency_index” because this is calculated with the other OxCGRT indicators).
[39]:
# Create Forecast scenario (copy Main scenario and delete future phases)
snl.clear(name="Forecast", template="Main")
# Fitting with linear regression model (Elastic Net regression)
fit_dict = snl.fit(
name="Forecast", metric="R2",
removed_cols=[
"Stringency_index", "Tests", "Tests_diff", "Vaccinations", "Vaccinated_once", "Vaccinated_full"]
)
Show determination coeefients of training/test dataset.
[40]:
print(f"R-squared: {fit_dict['score_train']:.3f} (train)")
print(f"R-squared: {fit_dict['score_test']:.3f} (test)")
R-squared: 0.221 (train)
R-squared: 0.029 (test)
Show the intercept and coefficient values of the regression model.
[41]:
print("Coefficient:")
df = fit_dict["intercept"].copy()
df.drop("Intercept", axis=1).style.background_gradient(axis=None)
Coefficient:
[41]:
| School_closing | Workplace_closing | Cancel_events | Gatherings_restrictions | Transport_closing | Stay_home_restrictions | Internal_movement_restrictions | International_movement_restrictions | Information_campaigns | Testing_policy | Contact_tracing | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| theta | -0.026532 | 0.030063 | -0.009687 | -0.004900 | -0.004542 | 0.038611 | -0.028094 | 0.006513 | 0.000000 | -0.015817 | -0.011910 |
| kappa | -0.002053 | 0.002096 | 0.000700 | 0.000018 | 0.000963 | 0.000702 | -0.001568 | 0.000429 | 0.000000 | 0.000422 | -0.000814 |
| rho | 0.063072 | -0.104886 | 0.055872 | 0.027953 | -0.012592 | -0.074602 | 0.032846 | -0.012563 | 0.000000 | 0.017491 | -0.000369 |
| sigma | 0.005664 | 0.044846 | 0.004644 | -0.007420 | 0.010129 | 0.054431 | -0.059124 | -0.018602 | 0.000000 | 0.009947 | -0.004658 |
Scenario.predict()
predicts the parameter values of future phases.
[42]:
# Short-term prediction
snl.predict(name="Forecast")
# We can select list of days to predict optionally
# snl.predict(days=[1, 4], name="Forecast")
[42]:
<covsirphy.analysis.scenario.Scenario at 0x7fcaf41fc100>
Show summary of future phases.
[43]:
df = snl.summary()
df.loc[df["Type"] == "Future"]
[43]:
| Type | Start | End | Population | ODE | Rt | theta | kappa | rho | sigma | tau | alpha1 [-] | 1/alpha2 [day] | 1/beta [day] | 1/gamma [day] | RMSLE | Trials | Runtime | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Scenario | Phase | ||||||||||||||||||
| Main | 44th | Future | 17May2021 | 15Jun2021 | 126529100 | SIR-F | 1.31 | 0.000619 | 0.001322 | 0.091114 | 0.068312 | 1440 | 0.001 | 756.0 | 10.0 | 14.0 | - | - | - |
| 45th | Future | 16Jun2021 | 31Jul2021 | 126529100 | SIR-F | 1.31 | 0.000619 | 0.001322 | 0.091114 | 0.068312 | 1440 | 0.001 | 756.0 | 10.0 | 14.0 | - | - | - | |
| Medicine | 44th | Future | 17May2021 | 15Jun2021 | 126529100 | SIR-F | 1.31 | 0.000619 | 0.001322 | 0.091114 | 0.068312 | 1440 | 0.001 | 756.0 | 10.0 | 14.0 | - | - | - |
| 45th | Future | 16Jun2021 | 31Jul2021 | 126529100 | SIR-F | 1.09 | 0.000619 | 0.001322 | 0.091114 | 0.081974 | 1440 | 0.001 | 756.0 | 10.0 | 12.0 | - | - | - | |
| Forecast | 44th | Future | 17May2021 | 24May2021 | 126529100 | SIR-F | 1.43 | 0.000048 | 0.000939 | 0.095640 | 0.066120 | 1440 | 0.0 | 1065.0 | 10.0 | 15.0 | - | - | - |
Or, short-cut .fit()
and .predict()
with Scenario.fit_predict()
. We can apply all arguments (of .fit()
and .predict()
) to Scenario.fit_predict()
.
[44]:
# Or, when you do not need 'fit_dict',
# snl.fit_predict(name="Forecast").summary(name="Forecast")
To compare this scenario with the other scenarios, we should adjust the last end date with Scenario.adjust_end()
because the last end date is differenct from the other scenarios at this time.
[45]:
# Adjust the last end dates
snl.adjust_end()
# Show the last phases of all scenarios
all_df = snl.summary().reset_index()
for name in all_df["Scenario"].unique():
df = snl.summary(name=name)
last_end_date = df.loc[df.index[-1], "End"]
print(f"{name} scenario: to {last_end_date}")
Main scenario: to 31Jul2021
Medicine scenario: to 31Jul2021
Forecast scenario: to 31Jul2021
Simulate the number of cases of forecast scenario.
[46]:
_ = snl.simulate(variables="CFR", name="Forecast").tail()
Compare the number of cases of the all scenario with Scenario.history()
and variable name.
[47]:
_ = snl.history("Infected")
We can focus on the values in specified date range with the following arguments.
dates
: tuple of start date and end datepast_days
(integer): how many past days to use in calculation from today (Scenario.today
property)phases
(list of str): phase names to use in calculation
These arguments are effective with Scenario.history()
, Scenario.simulate()
, Scenario.track()
and Scenario.score()
.
[48]:
# Get the minimum value (from today to future) to set lower limit of y-axis
lower_limit = snl.history("Infected", dates=(snl.today, None), show_figure=False).min().min()
# From today to future (no limitation regarding end date)
_ = snl.history("Infected", dates=(snl.today, None), ylim=(lower_limit, None))
In the past 20 days. Reference date is today (Scenario.today
property).
[49]:
_ = snl.history("Infected", past_days=20)
In the selected phases. Here, we will show the 3rd, 4th and 5th phase.
[50]:
_ = snl.history("Infected", phases=["3rd", "4th", "5th"])
Compare the scenarios¶
We will compare the scenarios with representative values, reproduction number and parameter values. Currently, we can compare the scenarios with the following indexes.
max(Infected): max value of Infected
argmax(Infected): the date when Infected shows max value
Infected on …: Infected on the end date of the last phase
Fatal on …: Fatal on the end date of the last phase
[51]:
snl.describe()
[51]:
| max(Infected) | argmax(Infected) | Confirmed on 31Jul2021 | Infected on 31Jul2021 | Fatal on 31Jul2021 | 44th_Rt | 45th_Rt | |
|---|---|---|---|---|---|---|---|
| Main | 379009 | 31Jul2021 | 2006517 | 379009 | 31768 | 1.31 | 1.31 |
| Medicine | 202765 | 31Jul2021 | 1708799 | 202765 | 27198 | 1.31 | 1.09 |
| Forecast | 644592 | 31Jul2021 | 2638571 | 644592 | 31087 | 1.43 | 1.43 |
[52]:
_ = snl.history(target="Infected")
[53]:
_ = snl.history(target="Rt")
[54]:
_ = snl.history(target="rho")
[55]:
_ = snl.history(target="sigma")
[56]:
_ = snl.history(target="theta")
[57]:
_ = snl.history(target="kappa")
Change rate of parameters in main scenario¶
History of each parameter will be shown. Values will be divided by the values in 0th phase.
[58]:
_ = snl.history_rate(name="Main")
Retrospective analysis¶
We can evaluate the impact of measures using past records. How many people were infected if the parameter values have not changed sinse 01Sep2020?
[59]:
# Perform retrospective analysis
snl_retro = cs.Scenario(country="Japan")
snl_retro.register(jhu_data)
snl_retro.retrospective(
"01Jan2021", model=cs.SIRF, control="Main", target="Retrospective", timeout=10)
<SIR-F model: parameter estimation>
Running optimization with 4 CPUs...
9th phase (21May2020 - 28May2020): finished 202 trials in 0 min 5 sec
6th phase (17Apr2020 - 01May2020): finished 404 trials in 0 min 10 sec
10th phase (29May2020 - 05Jun2020): finished 234 trials in 0 min 5 sec
3rd phase (14Mar2020 - 24Mar2020): finished 391 trials in 0 min 10 sec
0th phase (06Feb2020 - 18Feb2020): finished 464 trials in 0 min 10 sec
11th phase (06Jun2020 - 13Jun2020): finished 208 trials in 0 min 5 sec
7th phase (02May2020 - 11May2020): finished 422 trials in 0 min 10 sec
4th phase (25Mar2020 - 02Apr2020): finished 438 trials in 0 min 10 sec
1st phase (19Feb2020 - 05Mar2020): finished 400 trials in 0 min 10 sec
12th phase (14Jun2020 - 28Jun2020): finished 442 trials in 0 min 10 sec
8th phase (12May2020 - 20May2020): finished 481 trials in 0 min 10 sec
5th phase (03Apr2020 - 16Apr2020): finished 487 trials in 0 min 10 sec
2nd phase (06Mar2020 - 13Mar2020): finished 489 trials in 0 min 10 sec
18th phase (21Aug2020 - 28Aug2020): finished 265 trials in 0 min 5 sec
13th phase (29Jun2020 - 09Jul2020): finished 485 trials in 0 min 10 sec
15th phase (22Jul2020 - 01Aug2020): finished 485 trials in 0 min 10 sec
19th phase (29Aug2020 - 09Sep2020): finished 269 trials in 0 min 5 sec 21st phase (19Sep2020 - 30Sep2020): finished 488 trials in 0 min 10 sec
14th phase (10Jul2020 - 21Jul2020): finished 486 trials in 0 min 10 sec 20th phase (10Sep2020 - 18Sep2020): finished 268 trials in 0 min 5 sec
16th phase (02Aug2020 - 10Aug2020): finished 482 trials in 0 min 10 sec
22nd phase (01Oct2020 - 13Oct2020): finished 490 trials in 0 min 10 sec
24th phase (24Oct2020 - 04Nov2020): finished 264 trials in 0 min 5 sec
27th phase (27Nov2020 - 09Dec2020): finished 477 trials in 0 min 10 sec
25th phase (05Nov2020 - 13Nov2020): finished 264 trials in 0 min 5 sec
17th phase (11Aug2020 - 20Aug2020): finished 483 trials in 0 min 10 sec
23rd phase (14Oct2020 - 23Oct2020): finished 482 trials in 0 min 10 sec
30th phase (30Dec2020 - 31Dec2020): finished 414 trials in 0 min 5 sec
28th phase (10Dec2020 - 18Dec2020): finished 436 trials in 0 min 10 sec
26th phase (14Nov2020 - 26Nov2020): finished 443 trials in 0 min 10 sec
36th phase (10Feb2021 - 17Feb2021): finished 253 trials in 0 min 5 sec 33rd phase (17Jan2021 - 24Jan2021): finished 442 trials in 0 min 10 sec
31st phase (01Jan2021 - 07Jan2021): finished 460 trials in 0 min 10 sec
29th phase (19Dec2020 - 29Dec2020): finished 465 trials in 0 min 10 sec
34th phase (25Jan2021 - 01Feb2021): finished 253 trials in 0 min 5 sec
37th phase (18Feb2021 - 02Mar2021): finished 252 trials in 0 min 5 sec
35th phase (02Feb2021 - 09Feb2021): finished 223 trials in 0 min 5 sec
32nd phase (08Jan2021 - 16Jan2021): finished 416 trials in 0 min 10 sec
39th phase (13Mar2021 - 25Mar2021): finished 374 trials in 0 min 10 sec
42nd phase (16Apr2021 - 24Apr2021): finished 241 trials in 0 min 5 sec
38th phase (03Mar2021 - 12Mar2021): finished 405 trials in 0 min 10 sec
40th phase (26Mar2021 - 06Apr2021): finished 506 trials in 0 min 10 sec
43rd phase (25Apr2021 - 06May2021): finished 510 trials in 0 min 10 sec
41st phase (07Apr2021 - 15Apr2021): finished 514 trials in 0 min 10 sec
44th phase (07May2021 - 16May2021): finished 518 trials in 0 min 10 sec
Completed optimization. Total: 1 min 46 sec
<SIR-F model: parameter estimation>
Running optimization with 4 CPUs...
6th phase (17Apr2020 - 01May2020): finished 376 trials in 0 min 10 sec
4th phase (25Mar2020 - 02Apr2020): finished 401 trials in 0 min 10 sec
2nd phase (06Mar2020 - 13Mar2020): finished 397 trials in 0 min 10 sec
0th phase (06Feb2020 - 18Feb2020): finished 505 trials in 0 min 10 sec
5th phase (03Apr2020 - 16Apr2020): finished 392 trials in 0 min 10 sec
3rd phase (14Mar2020 - 24Mar2020): finished 393 trials in 0 min 10 sec
1st phase (19Feb2020 - 05Mar2020): finished 420 trials in 0 min 10 sec
7th phase (02May2020 - 11May2020): finished 374 trials in 0 min 10 sec
10th phase (29May2020 - 05Jun2020): finished 221 trials in 0 min 5 sec
8th phase (12May2020 - 20May2020): finished 395 trials in 0 min 10 sec
14th phase (10Jul2020 - 21Jul2020): finished 394 trials in 0 min 10 sec
12th phase (14Jun2020 - 28Jun2020): finished 391 trials in 0 min 10 sec
11th phase (06Jun2020 - 13Jun2020): finished 204 trials in 0 min 5 sec
9th phase (21May2020 - 28May2020): finished 244 trials in 0 min 5 sec
18th phase (21Aug2020 - 28Aug2020): finished 250 trials in 0 min 5 sec
16th phase (02Aug2020 - 10Aug2020): finished 402 trials in 0 min 10 sec
15th phase (22Jul2020 - 01Aug2020): finished 397 trials in 0 min 10 sec
13th phase (29Jun2020 - 09Jul2020): finished 335 trials in 0 min 10 sec
19th phase (29Aug2020 - 09Sep2020): finished 201 trials in 0 min 5 sec
20th phase (10Sep2020 - 18Sep2020): finished 228 trials in 0 min 5 sec
24th phase (24Oct2020 - 04Nov2020): finished 234 trials in 0 min 5 sec
17th phase (11Aug2020 - 20Aug2020): finished 389 trials in 0 min 10 sec
22nd phase (01Oct2020 - 13Oct2020): finished 396 trials in 0 min 10 sec
25th phase (05Nov2020 - 13Nov2020): finished 209 trials in 0 min 5 sec
21st phase (19Sep2020 - 30Sep2020): finished 415 trials in 0 min 10 sec
30th phase (30Dec2020 - 31Dec2020): finished 385 trials in 0 min 5 sec
26th phase (14Nov2020 - 26Nov2020): finished 391 trials in 0 min 10 sec
23rd phase (14Oct2020 - 23Oct2020): finished 379 trials in 0 min 10 sec
28th phase (10Dec2020 - 18Dec2020): finished 422 trials in 0 min 10 sec
31st phase (01Jan2021 - 16May2021): finished 455 trials in 0 min 10 sec
27th phase (27Nov2020 - 09Dec2020): finished 456 trials in 0 min 10 sec
29th phase (19Dec2020 - 29Dec2020): finished 482 trials in 0 min 10 sec
Completed optimization. Total: 1 min 15 sec
[60]:
# Show the summary of estimation
cols = ["Start", "End", "ODE", "Rt", *cs.SIRF.PARAMETERS] + ["RMSLE", "Trials", "Runtime"]
snl_retro.summary(columns=cols)
[60]:
| Start | End | ODE | Rt | theta | kappa | rho | sigma | RMSLE | Trials | Runtime | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Scenario | Phase | |||||||||||
| Main | 0th | 06Feb2020 | 18Feb2020 | SIR-F | 2.32 | 0.027273 | 0.000000 | 0.066019 | 0.027718 | 0.142890 | 464.0 | 0 min 10 sec |
| 1st | 19Feb2020 | 05Mar2020 | SIR-F | 4.93 | 0.007714 | 0.001322 | 0.136657 | 0.026198 | 0.170717 | 400.0 | 0 min 10 sec | |
| 2nd | 06Mar2020 | 13Mar2020 | SIR-F | 4.47 | 0.001421 | 0.003424 | 0.126398 | 0.024802 | 0.096698 | 489.0 | 0 min 10 sec | |
| 3rd | 14Mar2020 | 24Mar2020 | SIR-F | 2.49 | 0.010093 | 0.002681 | 0.063014 | 0.022401 | 0.029328 | 391.0 | 0 min 10 sec | |
| 4th | 25Mar2020 | 02Apr2020 | SIR-F | 4.81 | 0.000068 | 0.001829 | 0.117450 | 0.022604 | 0.036945 | 438.0 | 0 min 10 sec | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| Retrospective | 27th | 27Nov2020 | 09Dec2020 | SIR-F | 1.18 | 0.000405 | 0.001359 | 0.105707 | 0.088069 | 0.012154 | 456.0 | 0 min 10 sec |
| 28th | 10Dec2020 | 18Dec2020 | SIR-F | 1.23 | 0.000816 | 0.001441 | 0.109664 | 0.087854 | 0.013164 | 422.0 | 0 min 10 sec | |
| 29th | 19Dec2020 | 29Dec2020 | SIR-F | 1.22 | 0.000560 | 0.001466 | 0.100267 | 0.080776 | 0.012890 | 482.0 | 0 min 10 sec | |
| 30th | 30Dec2020 | 31Dec2020 | SIR-F | 1.81 | 0.000399 | 0.001834 | 0.104821 | 0.056012 | 0.000484 | 385.0 | 0 min 5 sec | |
| 31st | 01Jan2021 | 16May2021 | SIR-F | 0.98 | 0.000476 | 0.001837 | 0.086501 | 0.086397 | 0.365129 | 455.0 | 0 min 10 sec |
77 rows × 11 columns
[61]:
# History of reproduction number
_ = snl_retro.history("Rt")
[62]:
# History of Infected
_ = snl_retro.history("Infected")
[63]:
# Show the representative values
snl_retro.describe()
[63]:
| max(Infected) | argmax(Infected) | Confirmed on 16May2021 | Infected on 16May2021 | Fatal on 16May2021 | 5th_Rt | 14th_Rt | 15th_Rt | 17th_Rt | 20th_Rt | ... | 35th_Rt | 36th_Rt | 37th_Rt | 38th_Rt | 39th_Rt | 40th_Rt | 41st_Rt | 42nd_Rt | 43rd_Rt | 44th_Rt | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Main | 79473 | 16May2021 | 685367 | 79473 | 11563 | 12.31 | 2.24 | 2.03 | 0.90 | 0.87 | ... | 0.49 | 0.63 | 0.7 | 0.89 | 1.12 | 1.63 | 1.56 | 1.63 | 1.34 | 1.31 |
| Retrospective | 37149 | 01Jan2021 | 615843 | 28084 | 11769 | 12.20 | 2.30 | 2.02 | 0.89 | 0.86 | ... | - | - | - | - | - | - | - | - | - | - |
2 rows × 27 columns


Iran planning attacks on Israel: Netanyahu
Israeli Prime Minister Benjamin Netanyahu on Sunday accused Iran of planning attacks against the Jewish state and said everything possible would be done to prevent them.
The premier, who was indicted on corruption charges on Thursday and is seen to be battling for his political life, made his remarks on a visit to an army base near the border with conflict-ravaged Syria.
“Iran’s aggression in our region, and against us, continues,” Netanyahu said.
He was speaking on the day US General Mark Milley, chairman of the Joint Chiefs of Staff, was in the country to meet his Israeli counterpart Aviv Kohavi.
Related Articles
Bidding to avoid elections, Israel president asks parliament…
Nov 21, 2019 14,705 0
Saudi Arabia oil attacks: Weapons debris ‘proves Iran…
Sep 19, 2019 15,952 4
Iran seizes British tanker in Strait of Hormuz
Jul 20, 2019 15,594 2
UAE-based tanker disappears in Strait of Hormuz
Jul 17, 2019 6,966 0
The two generals discussed “operational questions and regional developments”, an army statement said.
Speaking on the Israeli-annexed Golan Heights, Netanyahu said “we are taking all necessary actions to prevent Iran from entrenching here in our region.”
“This includes the activity necessary to thwart the transfer of lethal weaponry from Iran to Syria, whether by air or overland.
“We will also take action to thwart Iran’s effort to turn Iraq and Yemen into bases for launching rockets and missiles” at Israel, he added.
On Wednesday, in a rare confirmation of such operations, Israel said its warplanes carried out a “very intense” attack against Iranian forces and Syrian army targets in Syria.
Britain-based monitoring group the Syrian Observatory for Human Rights said 23 people were killed in the strikes — 21 fighters and two civilians.
The previous day, Israel’s “Iron Dome” missile defence system had intercepted four rockets fired from Syria, with the army blaming an “Iranian force”.
Attorney General Avichai Mandelblit announced Thursday he had charged Netanyahu with bribery, fraud and breach of trust, prompting speculation that the end of the premier’s decade-long tenure was nigh. AFP


Hi. I’m Flavio Percoco (a.k.a flaper87), and I’m a Software Engineer at Red Hat, where I spend my days working on OpenStack, speaking at conferences. In my spare time I contribute to Rust, write, read, surf, travel, smoke my coffee and drink my pipe.
{{ article.summary }}


My name is Dmitry. I am web developer. I like Python with Django framework and PHP with Laravel framework.


| DOSE: T+ 0:00 |
0.5 tablets |
oral |
Ketamine |
(pill / tablet) |
| T+ 0:00 |
0.5 tablets |
oral |
MDMA |
(pill / tablet) |
| T+ 0:30 |
0.5 g |
smoked |
Cannabis |
|
[Erowid Note: While it may be that the substances described below are MDMA and Ketamine, Ecstasy tablets are notoriously impure or misrepresented, often containing chemicals other than those they are presumed to contain. This report is marked as an MDMA and Ketamine report, but readers should be aware there are aspects of it that suggest the identification is speculative.]
This was, by far, the worst and simultaneously best experience of my life.
About 2 weeks before this ordeal, a friend and I had bought some blue puma rolls. This was the first time I had rolled with this friend and it proved to be a very enjoyable and heart-opening experience. Because of the amazing time we had the time before, we decided to buy some more.
In between this time, I was introduced to the movie “The Number 23” and had become very interested in the phenomena and had began to see it in my every day life. Nothing major, just a tip of the hat to the number everywhere I went.
When we went to get them, the guy said he didn't have any more blue pumas but would sell us some orange boo-boo's. Not knowing any different, I took them and went on my way. Later that night, my friend and I took the rolls. While waiting for the effects to kick in, and see to how it would affect the roll, we decided to smoke some cannabis.
For this we went in to his closet that we had setup for a hotbox room. About halfway through the bowl I felt the familiar rush of ecstasy coming on. I tell my friend this and within a few minutes he had gotten the same rush. Ten minutes later, I had what we call a 'mind-explosion.' It had started with me just thinking about the number 23. I like to think very philosophically and was pondering the purpose of this number. I quickly came to the conclusion that the number was almost like life’s personal metaphor to make us realize how connected we are. The number can be found in absolutely anything. After this realization the mind-explosion happened. I was quickly and constantly able to make connections between everything and anything. Colors, sounds, animals, words, buildings, races and species all blended in to one concise object and thought. I was literally holding the entire universe in my conscious.
Now, I am proud to say that I am an atheist. I haven’t been capable of believing in a anthropomorphized god in a very long time and, because of this, have lived an immensely blasphemous life. With this mind-explosion, I felt like I had found God. Not the “true” God that I think of, as in the whole universe, but as in the Christian God.
I broke down.
I couldn’t even scream because I was so scared.  But my mind snapped back. 23 became God. The absolution of the complete oneness of the universe. I snapped back again and thought “how can a number be a God?” Then I had a breakthrough that I have not been able to leave behind since. This is the night that I finally realized what Zen thought is truly about. The complete opening of the door that lead me to the paradoxical oneness of it all. Everything pieced together, anything anyone has ever said, written, drawn, done, was a representation of the whole because that’s what we are. We try to separate, categorized, and ostracized things but in truth we are all just one piece and that piece is existence.
Finally we began to come down and reflected on what had just happened. What was strange was that he and I had the EXACT same trip. It was as though we were sharing thoughts so it seemed almost redundant to talk about it. We began to calm down and decided to smoke a little more to finish the calming. All the while the hallucinations began.  However, there was nothing malicious about it. Apparently I began to look like an orange weasel. The hallucinations faded away and we finally managed to pass out.
The next morning will forever be known as “that one time.”
We woke up and felt ungodly dead. It required an immense amount of effort just to get up from bed and walk to the bathroom. It was almost like I was barely connected to my body so I had to try harder to move it. Sadly, this feeling didn’t work for the agony that my body felt, every muscle ached. Our minds kept racing, making constant connections to the point to where it was just annoying and exhausting to think. I honestly wanted to stop thinking but I couldn’t. Everything was horrible.  We tried to go back to sleep but the thoughts wouldn’t end. We tried to smoke some weed to help but it only seemed to make the physical exhaustion worse. We sat around and did nothing but groan for FIVE hours straight. We had no desire to do anything.
Finally after the 5 hours groan-fest, we managed to collect enough energy to get up and walk downstairs. We decided to attempt to go for a walk and see if that would alleviate the rest of the dragged down feeling. The walk did help but at the same time I felt more tired but less exhausted, if that makes sense. That next night, I slept like a baby.
After this whole experience, we found out that our rolls had been cut with Ketamine, which I think is what caused the mass hallucinations and the dragging effect the next day. I would never suggest this combination to any one unless to just truly feel you need to awaken your mind and nothing else has worked.
Simultaneously, I am glad it happened and wish that I had never done it.
And thus continues the paradoxical nature of the world.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


public class TreeModel
extends totalcross.lang.Object
| Modifier and Type | Field and Description |
|---|---|
boolean |
allowsChildren
flag used to determine if a node is a leaf or a folder.
|
| Constructor and Description |
|---|
TreeModel()
Constructor to create an empty tree model with allowsChildren is true.
|
TreeModel(boolean allowsChildren)
Constructor to create an empty tree model that use allowsChildren to determine the leaf node, if and only if
allowsChildren is true.
|
TreeModel(Node root)
Constructor to create a tree model with the specified root node and with allowsChildren is true.
|
TreeModel(Node root,
boolean allowsChildren)
Constructor to create a tree model with the specified root node and with the specified allowsChildren flag.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNode(Node parent,
Node newNode)
Method to add a node to the parent node at the specified position.
|
void |
clear()
Method to clear this model.
|
Node |
getRoot()
Method to return the root node of this tree model.
|
void |
insertNode(Node parent,
Node newNode,
int index)
Method to insert a node to the parent node at the specified position.
|
void |
modifyNode(Node node,
Object userObject)
Method to modify a node userObject and notify the tree of the changes.
|
void |
reload()
Method to notify the tree to reload.
|
void |
removeNode(Node parent,
Node node)
Method to remove a node from the tree.
|
void |
setRoot(Node root)
Method to set the root node of this tree model and notify the tree to reload the tree.
|
void |
setTree(Tree tree)
Method to set the tree (For internal use only) This method register the tree to this model, so when the user add,
delete, or modify a node, the tree view will be notify and updated.
|
public boolean allowsChildren
public TreeModel(Node root, boolean allowsChildren)
public TreeModel(Node root)
public TreeModel()
public TreeModel(boolean allowsChildren)
allowsChildren
- true to use allowwsChildren to determine a leaf node.public void setTree(Tree tree)
tree
- the tree (view) that is associated with this model.public void clear()
public void reload()
public Node getRoot()
public void setRoot(Node root)
root
- the new root node of this tree model.public void insertNode(Node parent, Node newNode, int index)
parent
- the parent node of the node to insert.newNode
- the new node to insert into this tree model.index
- the index to insert the node intopublic void addNode(Node parent, Node newNode)
parent
- the parent node of the node to insert.newNode
- the new node to insert into this tree model.public void removeNode(Node parent, Node node)
parent
- the parent node of the node to remove.node
- the node to remove from this tree model.


Atoms
Physics
Energising the Body
Senses and Waves
Classification and Ecology
Total Points
App
Creators


--- layout: tweet ---
Later Barcelona. It's been great! #baruco
9/13/2014, 9:00:54 PM
Favs: 5
Retweets: 0


The table below illustrates some of the various Zelda titles with information on each. They are labeled by video game title, release platform and year respectively.
The table below illustrates some of the various Zelda titles with information on each. They are labeled by video game title, release platform and year respectively.
| Title | Platform | Year |
|---|---|---|
| The Legend of Zelda | Nintendo Entertaintment System | 1986 |
| The Adventure of Link | Nintendo Entertaintment System | 1987 |
| A Link to the Past | Super Nintendo Entertaintment System | 1991 |
| Link's Awakening | Game Boy | 1993 |
| Ocarina of Time | Nintendo 64 | 1998 |
| Majora's Mask | Nintendo 64 | 2000 |
| Oracle of Seasons and Oracle of Ages | Game Boy Color | 2001 |
| Four Swords | Game Boy Advanced | 2002 |
| The Wind Waker | Nintendo Gamecube | 2002 |
| Four Swords Adventure | Nintendo Gamecube | 2004 |
| The Minish Cap | Game Boy Advanced | 2004 |
| Twilight Princess | Nintendo Gamecube/Nintendo Wii | 2006 |
| Phantom Hourglass | Nintendo DS | 2007 |
| Spirit Tracks | Nintendo DS | 2009 |
| Skyward Sword | Nintendo Wii | 2011 |
| A Link Between Worlds | Nintendo 3DS | 2013 |
| Tri Force Heroes | Nintendo 3DS | 2015 |
| Breath of the Wild | Nintendo Wii U/Nintendo Switch | 2017 |


You need to install the Programmer Dvorak Keyboard Layout first before using this rule.
Once the driver package is installed, this rule will simply toggle the OS-wide layout to it when the command key is pressed and toggle back when it is released.