A Reporter that keeps a list of test results.
More...
#include <deferred_test_reporter.h>
A Reporter that keeps a list of test results.
◆ ReportFailure()
| void ReporterDeferred::ReportFailure |
( |
const Failure & |
failure | ) |
|
|
virtual |
Add a new failure to current test
- Parameters
-
| failure | The failure record |
Reimplemented from UnitTest::Reporter.
◆ SuiteStart()
| void ReporterDeferred::SuiteStart |
( |
const TestSuite & |
suite | ) |
|
|
virtual |
Called at the beginning of a new suite.
- Parameters
-
Creates a new TestResult object with an empty test name as a suite start flag. Adds the TestResult object it to the results container.
Reimplemented from UnitTest::Reporter.
◆ TestFinish()
| void ReporterDeferred::TestFinish |
( |
const Test & |
test | ) |
|
|
virtual |
Store test runtime when the test finishes
- Parameters
-
| test | Test that is about to end |
Reimplemented from UnitTest::Reporter.
◆ TestStart()
| void ReporterDeferred::TestStart |
( |
const Test & |
test | ) |
|
|
virtual |
Called at the beginning of a new test.
- Parameters
-
| test | Test that is about to start |
Creates a new TestResult object and adds it to the results container
Reimplemented from UnitTest::Reporter.
The documentation for this class was generated from the following files:


--- layout: post title: Vector storyboard date: '2016-08-14T22:50:24+02:00' categories: - Storyboards - Graphic Design picture_url: https://film-Storyboards.tumblr.com/post/148964327320 ---


Chapter 4 Basic Concepts
4.1 Score
The score is the gradient (the vector of partial derivatives) of \(log L(\theta)\), with respect to an m-dimensional parameter vector \(\theta\).
\[S(\theta) = \frac{\partial\ell}{\partial \theta}\] Typically, they use \(\nabla\) to note the partical derivative.
\[\nabla \ell\]
Such differentiation will generate a \(m \times 1\) row vector, which indicates the sensitivity of the likelihood.
Quote from Steffen Lauritzen’s slides: “Generally the solution to this equation must be calculated by iterative methods. One of the most common methods is the Newton–Raphson method and this is based on successive approximations to the solution, using Taylor’s theorem to approximate the equation.”
For instance, using logit link, we can get the first derivative of log likelihood logistic regression as follows. We can not really find \(\beta\) easily to make the equation to be 0.
\[\begin{aligned} \frac{\partial \ell} {\partial \beta} &= \sum_{i=1}^{n}x_i^T[y_i-\frac{e^{\beta^Tx_i}}{1+e^{\beta^Tx_i}}] \\ &=\sum_{i=1}^{n} x_i^T[y_i-\hat{y_i}] \end{aligned}\]
4.2 Gradient and Jacobian
Remarks: This part discusses gradient in a more general sense.
When \(f(x)\) is only in a single dimension space:
\(\mathbb{R}^n \rightarrow \mathbb{R}\)
\[\nabla f(x)=[\frac{\partial f}{\partial x_1},\frac{\partial f}{\partial x_2},...,\frac{\partial f}{\partial x_n}]\] When \(f(x)\) is only in a m-dimension space (i.e., Jacobian): \(\mathbb{R}^n \rightarrow \mathbb{R^m}\)
\[Jac(f)=\begin{bmatrix} \frac{\partial f_1}{\partial x_1} & \frac{\partial f_1}{\partial x_2} & \frac{\partial f_1}{\partial x_3} & ... & \frac{\partial f_1}{\partial x_n}\\ \frac{\partial f_2}{\partial x_1} & \frac{\partial f_2}{\partial x_2} & \frac{\partial f_2}{\partial x_3} & ... & \frac{\partial f_2}{\partial x_n} \\ ...\\ \frac{\partial f_m}{\partial x_1} & \frac{\partial f_m}{\partial x_2} & \frac{\partial f_n}{\partial x_3} & ... & \frac{\partial f_m}{\partial x_n} \end{bmatrix}\]
For instance,
\(\mathbb{R}^n \rightarrow \mathbb{R}\):
\[f(x,y)=x^2+2y\] \[\nabla f(x,y)=[\frac{\partial f}{\partial x},\frac{\partial f}{\partial y}]=[2x,2]\] \(\mathbb{R}^n \rightarrow \mathbb{R^m}\)
\[f(x,y)=(x^2+2y,x^3)\] \[Jac(f)=\begin{bmatrix} 2x & 2\\ 2x^2 & 0 \end{bmatrix}\]
4.3 Hessian and Fisher Scoring
Hessian matrix or Hessian is a square matrix of second-order partial derivatives of a scalar-valued function, or scalar field.
\(\mathbb{R}^n \rightarrow \mathbb{R}\)
\[Hessian=\nabla ^2(f) =\begin{bmatrix} \frac{\partial^2 f}{\partial x_1^2} & \frac{\partial^2 f}{\partial x_1 \partial x_2} & \frac{\partial^2 f}{\partial x_1 \partial x_3} & ... & \frac{\partial^2 f}{\partial x_1 \partial x_n}\\ \frac{\partial^2 f}{\partial x_2 \partial x_1} & \frac{\partial^2 f}{\partial x_2^2} & \frac{\partial^2 f}{\partial x_2 \partial x_3} & ... & \frac{\partial^2 f}{\partial x_2 \partial x_n} \\ \frac{\partial^2 f}{\partial x_3 \partial x_1} & \frac{\partial^2 f}{\partial x_3 \partial x_2} & \frac{\partial^2 f}{\partial x_3^2} & ... & \frac{\partial^2 f}{\partial x_3 \partial x_n} \\ ...\\ \frac{\partial^2 f}{\partial x_n \partial x_1} & \frac{\partial^2 f}{\partial x_n \partial x_2} & \frac{\partial^2 f}{\partial x_n \partial x_3} & ... & \frac{\partial^2 f}{\partial x_n^2} \end{bmatrix}\]
As a special case, in the context of logit:
Suppose that the log likelihood function is \(\ell (\theta)\). \(\theta\) is a \(m\) demension vector.
\[ \theta = \begin{bmatrix}\theta_1 \\ \theta_2 \\ \theta_3 \\ \theta_4 \\ ...\\ \theta_m \\ \end{bmatrix}\]
\[Hessian=\nabla ^2(\ell) =\begin{bmatrix} \frac{\partial^2 \ell}{\partial \theta_1^2} & \frac{\partial^2 \ell}{\partial \theta_1 \partial \theta_2} & \frac{\partial^2 \ell}{\partial \theta_1 \partial \theta_3} & ... & \frac{\partial^2 \ell}{\partial \theta_1 \partial \theta_m}\\ \frac{\partial^2 \ell}{\partial \theta_2 \partial \theta_1} & \frac{\partial^2 \ell}{\partial \theta_2^2 } & \frac{\partial^2 \ell}{\partial \theta_1 \partial \theta_3} & ... & \frac{\partial^2 \ell}{\partial \theta_1 \partial \theta_m} \\ \frac{\partial^2 \ell}{\partial \theta_3 \partial \theta_1} & \frac{\partial^2 \ell}{\partial \theta_3 \theta_2 } & \frac{\partial^2 \ell}{\partial \theta_3^2} & ... & \frac{\partial^2 \ell}{\partial \theta_3 \partial \theta_m} \\ ...\\ \frac{\partial^2 \ell}{\partial \theta_m \partial \theta_1} & \frac{\partial^2 \ell}{\partial \theta_m \theta_2 } & \frac{\partial^2 \ell}{\partial \theta_m \partial \theta_3} & ... & \frac{\partial^2 \ell}{\partial \theta_m \partial \theta_m} \end{bmatrix}\]
“In statistics, the observed information, or observed Fisher information, is the negative of the second derivative (the Hessian matrix) of the”log-likelihood" (the logarithm of the likelihood function). It is a sample-based version of the Fisher information." (Direct quote from Wikipedia.)
Thus, the observed information matrix:
\[-Hessian=-\nabla ^2(\ell) \]
Expected (Fisher) information matrix:
\[E[-\nabla ^2(\ell)] \]
4.4 Canonical link function
Inspired by a Stack Exchange post, I created the following figure:
\[ \frac{Paramter}{\theta} \longrightarrow \gamma^{'}(\theta) = \mu \longrightarrow \frac{Mean}{\mu} \longrightarrow g(\mu) = \eta \longrightarrow \frac{ Linear predictor}{\eta} \]
For the case of \(n\) time Bernoulli (i.e., Binomial), its canonical link function is logit. Specifically,
\[ \frac{Paramter}{\theta=\beta^Tx_i} \longrightarrow \gamma^{'}(\theta)= \frac{e^{\beta^Tx_i}}{1+e^{\beta^Tx_i}}\longrightarrow \frac{Mean}{\mu=\frac{e^{\beta^Tx_i}}{1+e^{\beta^Tx_i}}}\longrightarrow g(\mu) = log \frac{\frac{e^{\beta^Tx_i}}{1+e^{\beta^Tx_i}}}{1-\frac{e^{\beta^Tx_i}}{1+e^{\beta^Tx_i}}}\longrightarrow \frac{ Linear predictor}{\eta = \beta^Tx_i}\] Thus, we can see that,
\[\theta \equiv \eta \] The link function \(g(\mu)\) relates the linear predictor \(\eta = \beta^Tx_i\) to the mean \(\mu\).
Remarks:
Parameter is \(\theta = \beta ^T x_i\) (Not \(\mu\)!).
\(\mu=p(y=1)=\frac{e^{\beta^Tx_i}}{1+e^{\beta^Tx_i}}\) (Not logit!).
Link function (i.e., \(g(\mu)\)) = logit = logarithm of odds = log \(\frac{Event - Happened }{Event - Not - Happened}\).
\(g(\mu) = log \frac{\mu}{1-\mu}=\beta^T x_i\). Thus, link function = linear predictor = log odds!
Quote from the Stack Exchange post “Newton Method and Fisher scoring for finding the ML estimator coincide, these links simplify the derivation of the MLE.”
(Recall, we know that \(\mu\) or \(p(y=1)\) is the mean function. Recall that, \(n\) trails of coin flips, and get \(p\) heads. Thus \(\mu = \frac{p}{n}\).)
4.5 Ordinary Least Squares (OLS)
Suppose we have \(n\) observation, and \(m\) variables.
\[\begin{bmatrix} x_{11} & x_{12} & x_{13} & ... & x_{1m}\\ x_{21} & x_{22} & x_{23} & ... & x_{2m} \\ ...\\ x_{n1} & x_{n2} & x_{n3} & ... & x_{nm} \end{bmatrix}\]
Thus, we can write it as the following \(n\) equations.
\[y_1=\beta_0+\beta_1 x_{11}+\beta_2 x_{12}+...+ \beta_m x_{1m}\] \[y_2=\beta_0+\beta_1 x_{21}+\beta_2 x_{22}+...+ \beta_m x_{2m}\] \[y_3=\beta_0+\beta_1 x_{31}+\beta_2 x_{32}+...+ \beta_m x_{3m}\] \[...\]
\[y_n=\beta_0+\beta_1 x_{n1}+\beta_2 x_{n2}+...+ \beta_m x_{nm}\]
We can combine all the \(n\) equations as the following one:
\[y_i=\beta_0+\beta_1 x_{i1}+\beta_2 x_{i2}+...+ \beta_m x_{im} (i \in [1,n])\]
We can further rewrite it as a matrix format as follows.
\[y= X \beta\] Where,
\[y = \begin{bmatrix}y_1 \\ y_2 \\ y_3 \\ y_4 \\ ...\\ y_n \\ \end{bmatrix}\]
\[X=\begin{bmatrix} 1 & x_{11} & x_{12} & x_{13} & ... & x_{1m}\\ 1 & x_{21} & x_{22} & x_{23} & ... & x_{2m} \\ ...\\ 1 & x_{n1} & x_{n2} & x_{n3} & ... & x_{nm} \end{bmatrix}\]
\[\beta = \begin{bmatrix}\beta_0 \\ \beta_1 \\ \beta_2 \\ \beta_3 \\ ...\\ \beta_m \\ \end{bmatrix}\]
Since later we need the inverse of \(X\), we need to make it into a square matrix.
\[X^Ty=X^TX \hat{\beta} \Rightarrow \hat{\beta} = (X^TX)^{-1} X^Ty\]
We can use R to implement this calculation. As we can see, there is no need to do any iterations at all, but rather just pure matrix calculation.
X<-matrix(rnorm(1000),ncol=2) # we define a 2 column matrix, with 500 rows
X<-cbind(1,X) # add a 1 constant
beta_true<-c(2,1,2) # True regression coefficients
beta_true<-as.matrix(beta_true)
y=X%*%beta_true+rnorm(500)
transposed_X<-t(X)
beta_hat<-solve(transposed_X%*%X)%*%transposed_X%*%y
beta_hat
## [,1]
## [1,] 2.017690
## [2,] 1.054682
## [3,] 2.037671
Side Notes The function of as.matrix will automatically make c(2,1,2) become the dimension of \(3 \times 1\), you do not need to transpose the \(\beta\).
4.6 Taylor series
\[\begin{aligned} f(x)|_{a} &=f(a)+\frac{f^{'}(a)}{1!}(x-a)+\frac{f^{'}(a)}{2!}(x-a)^2+\frac{f^{''}(a)}{3!}(x-a)^{3}+...\\&=\sum_{n=0}^{\infty} \frac{f^{n}(a)}{n!}(x-a)^n \end{aligned}\]
For example:
\[\begin{aligned} e^x |_{a=0} &= e^a+ \frac{e^a}{1!}(x-a)+\frac{e^a}{2!}(x-a)^2+...+\frac{e^a}{n!}(x-a)^n \\ &= 1+ \frac{1}{1!}x+\frac{1}{2!}x^2+...+\frac{1}{n!}x^n \end{aligned}\]
if \(x=2\)
\(e^2 = 7.389056\)
\(e^2 \approx 1+\frac{1}{1!}x =1+\frac{1}{1!}2=3\)
\[e^2 \approx 1+\frac{1}{1!}x+\frac{1}{2!}x^2 =1+\frac{1}{1!}2 + \frac{1}{2!}2 =5\] …
\(e^2 \approx 1+\frac{1}{1!}x+\frac{1}{2!}x^2 +\frac{1}{3!}x^2+\frac{1}{4!}x^2+\frac{1}{5!}x^2=7.2666...\)
4.7 References
- Steffen Lauritzen’s slides:
http://www.stats.ox.ac.uk/~steffen/teaching/bs2HT9/scoring.pdf
- The Stack Exchange post:
- Wilipedia for OLS
https://en.wikipedia.org/wiki/Ordinary_least_squares
- Gradient and Jacobian
https://math.stackexchange.com/questions/1519367/difference-between-gradient-and-jacobian
https://www.youtube.com/watch?v=3xVMVT-2_t4
- Newton’s Method and Fisher Scoring
https://en.wikipedia.org/wiki/Hessian_matrix
http://hua-zhou.github.io/teaching/biostatm280-2017spring/slides/18-newton/newton.html
- Observed information


[ Erowid Note: One should not attempt to perform alkaloid extractions without first having an understanding of safe handling procedures for the chemicals and equipment required.]
We had read several reports of free base bufotenin being a pleasant experience. We decided to give it a go and see for ourselves.
We purchased 100 grams of Anadenanthera colubrina seeds and powderized them in a little blender. This was boiled for 1 hour in 1000 ml of water made pH 3 with citric acid found in our local vitamin shop at the mall. We used a pH meter to check that the pH was exactly 3. After boiling, the seeds were filtered through cotton balls and the water was saved. We added 1000 ml of water, boiled the same seeds again, and then filtered out the seeds and saved the water. This was repeated a third time and the seeds were discarded.
The water was boiled down to about 200 ml. We added 50 grams of calcium hydroxide bringing the pH up to about 12.5. Then, we extracted three times with 200 ml of heptane. Because bufotenin is soluble in alkaline water, only the DMT and 5-MeO-DMT could be extracted. The heptane was saved (it contains DMT and 5-MeO-DMT) for later use. Then the extract was evaporated down to a completely dry powder to remove all water. The powder was ground again in a blender. At this point we extracted three times with 200 ml of heptane. Because no water was present, the free base bufotenin had no alkaline water to be soluble in and could now be extracted into the heptane. The heptane was evaporated and free base bufotenin was present as an amber waxy substance. This was scraped up and weighed at 1835 mg.
The three of us each took 100 mg of free base bufotenin mixed with 100 mg of sodium carbonate. We heard that this would help it get absorbed. We all placed it under our tongues. After 15 minutes none of us noticed anything. Our mouths were filled saliva and we couldnít wait to spit it out! Robin swallowed some of it. Me and my girlfriend did our best not to swallow any. We heard it will ruin the effects to swallow. All of our tongues were sore. The mix burned a little. Probably from the sodium carbonate.
After 20 minutes I started feeling really nice. My girlfriend started smiling really big. She said she started feeling a wave of euphoria flowing through her body. Robin said she felt a little bit nauseated.
After about 5 more minutes it hit me really strong. Everything in the room started flashing different colors. The walls were rapidly changing colors, almost like a colored strobe light effect. Robin was getting more nausea and said she was starting to experience some light visual effects.  I didnít bother her.
After about 5 more minutes the effects were really intense. It was like being on a super strong LSD trip, everything was shimmering and swirling, and I heard angels singing all around me but saw no angels. It was incredibly intense, but I felt completely relaxed. My girlfriend sat there motionless, breathing in and out, still smiling really big.
After another 10 minutes I closed my eyes and WOW!!!! I saw a bunch of stars dancing. These turned into angels. They were beautiful, nude, with wings, and were singing. Their faces kept changing, they were multicolored. One of the angels came close to me. I could see through her. I could see she was made of tiny colored stars. Millions of them. Suddenly she blew apart into a million stars. I started to feel dizzy. I opened my eyes. Everything in the room was multi-colored and flashing and waving as if made of water. I began to get a little uncomfortable when I saw my girlfriend was still sitting in the same place motionless. I got up and touched her. She jumped and opened her eyes. She said she was having an out of body experience and couldnít remember the details of it, but it was beautiful. Robin was no longer in the room with us. She was down stairs watching TV. She said she was bored, that the effects were pretty weak.
After another 10 minutes the effects started to fade.
I like the fact that the whole trip was over in about 1 1/2 hours. Itís the perfect duration. I was back to baseline and able to drive Robin home before too late.
The overall effects were very euphoric. It was sort of like a mushroom experience, but more relaxed. I never experienced visuals that were that intense from anything else. It surpassed my experiences with mushrooms, LSD, and DMT. During the peak, I felt completely relaxed and at home with the trip but was hallucinating to the extreme. It was the most beautiful experience I ever had. The sound of the angels singing was clear and loud. I never experienced sound hallucination ever before. Even on hi doses of LSD.
I am surprised at all the negative stuff Iíve read about bufotenin. How could such a beautiful compound have such a negative reputation? Robin did experience negative effects. She experienced lots of nausea and got a headache afterwards. She did swallow some of it, so that may explain her bad experience. Me and my girlfriend both had very beautiful experiences. My girlfriend who normally has bad trips on LSD said the experience was similar to dreaming and was completely unlike LSD. It was her first out of body experience. She said it was sort of like peyote without the rush, and the nausea, but that it was more dreamy.
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.


--- title: "SOC830 Lab 2: Creating Datasets" lastmod: 2018-12-28T00:00:00.000Z draft: false type: docs maths: true output: blogdown::html_page: toc: true linktitle: "Lab 2: Creating Datasets" menu: docs: parent: SOC830(SOCI702) weight: 15 ---
The second lab session covers the following:
R packages are a collection of R functions, sample datasets, and compiled codes developed by the R developer community. Base R (which you installed in Lab 1) provides just essential functions. To conduct more complicated analyses, it would be easier and more efficient to take advantage of predefined R functions that are widely used by researchers. Installing packages is an easy way to access and use such popular R functions. Currently, there are more than 10,000 R packages which are available for free. Out of them, we will use seven packages throughout the course. They are:
Let’s start installing these packages. First, we will install gmodels package (See Figure 1).
Note: It is recommended to update installed R packages. An easy way to update them is to click on Update in the Package tab.
Alternatively, you can also install packages using an R code. In the R Console, type the following code:
install.packages("gmodels", dependencies = TRUE)
Then, hit Enter (for Windows) or Return (for MacOS). It will start installing the gmodels packages. Package names should be enclosed by double quotation marks. Otherwise, R cannot recognise the package name and will show an error message.
Note: Installed packages can be updated by an R code. For example, if you want to update the gmodels package. execute the following code in your R Console:
update.packages("gmodels")
It is not often the case that researchers have to construct datasets manually. They often use constructed datasets, or survey companies often construct datasets instead of them. Nonetheless, we will create a very simple dataset because it helps you understand basic data structures.
Now, we will manually enter a subsample of 30 respondents from Aussa (Australian Survey of Social Attitudes) dataset using Table 1. It includes four variables: gender, age, political orientation and social class.
The questionnaires used for this dataset are:
| Gender | Age | Political Orientation | Social Class |
|---|---|---|---|
| Male | 66 | Right | Middle class |
| Female | 72 | Right | Upper middle class |
| Female | 59 | Left | Middle class |
| Female | 20 | Left | Lower middle class |
| Female | 68 | Right | Upper middle class |
| Male | 76 | Right | Middle class |
| Male | 61 | Left | Upper middle class |
| Male | 90 | Right | Middle class |
| Female | 64 | Left | Lower middle class |
| Female | 39 | Left | Upper middle class |
| Male | 57 | Right | Middle class |
| Male | 47 | Left | Lower class |
| Female | 56 | Left | Middle class |
| Female | 51 | Left | Middle class |
| Male | 34 | Left | Working class |
| Male | 18 | Center | Middle class |
| Female | 18 | Left | Working class |
| Female | 30 | Left | Upper middle class |
| Female | 65 | Right | Middle class |
| Male | 35 | Right | Middle class |
| Female | 44 | Right | Upper class |
| Female | 40 | Right | Middle class |
| Male | 57 | Left | Upper middle class |
| Male | 40 | Left | Lower middle class |
| Female | 59 | Left | Middle class |
| Female | 82 | Right | Middle class |
| Female | 44 | Far right | Working class |
| Female | 30 | Left | Middle class |
| Male | 77 | Left | Working class |
| Female | 60 | Right | Lower middle class |
It is possible to input information directly into R. However, I do not recommend this approach because it is not an efficient way to create datasets. Instead, we will use Excel (or any spreadsheet program) for entering data, and then will import the created datasets into R.
Open Excel and look at Table 1. When you enter gender information, you may start by inputting either “Male” or “Female”. However, typing texts will not be an efficient way to enter data. Instead of typing “Male” or “Female”, I recommend inputting numbers that correspond to each gender category. Look at the questionnaire 1. You will see 1s for males and 2s for females. For the same reason, we will use numbers instead of texts for all other questionnaires. In addition, we will make a new variable of identification numbers for each respondent. The identification number for the first respondent is 1, that for the second is 2, and finally that for the 30th is 30. Also, we need to make variable name in a simple way. Most important is that the variable name should have no space in it. For example, I assign variable names in the following way:
Your final dataframe will look like Table 2.
| id | sex | age | polorient | class |
|---|---|---|---|---|
| 1 | 1 | 66 | 4 | 4 |
| 2 | 2 | 72 | 4 | 5 |
| 3 | 2 | 59 | 2 | 4 |
| 4 | 2 | 20 | 2 | 3 |
| 5 | 2 | 68 | 4 | 5 |
| 6 | 1 | 76 | 4 | 4 |
| 7 | 1 | 61 | 2 | 5 |
| 8 | 1 | 90 | 4 | 4 |
| 9 | 2 | 64 | 2 | 3 |
| 10 | 2 | 39 | 2 | 5 |
| 11 | 1 | 57 | 4 | 4 |
| 12 | 1 | 47 | 2 | 1 |
| 13 | 2 | 56 | 2 | 4 |
| 14 | 2 | 51 | 2 | 4 |
| 15 | 1 | 34 | 2 | 2 |
| 16 | 1 | 18 | 3 | 4 |
| 17 | 2 | 18 | 2 | 2 |
| 18 | 2 | 30 | 2 | 5 |
| 19 | 2 | 65 | 4 | 4 |
| 20 | 1 | 35 | 4 | 4 |
| 21 | 2 | 44 | 4 | 6 |
| 22 | 2 | 40 | 4 | 4 |
| 23 | 1 | 57 | 2 | 5 |
| 24 | 1 | 40 | 2 | 3 |
| 25 | 2 | 59 | 2 | 4 |
| 26 | 2 | 82 | 4 | 4 |
| 27 | 2 | 44 | 5 | 2 |
| 28 | 2 | 30 | 2 | 4 |
| 29 | 1 | 77 | 2 | 2 |
| 30 | 2 | 60 | 4 | 3 |
Enter Table 2 in Excel. Variable names should be entered in the first row (See Figure 2).
After data input is completed, save your data as a format of CSV (Comma delimited) in your WORKING DIRECTORY (See Figure 3).
Note: If you are not sure about what working directory is, see “Setting your default working directory” in Lab 1.
Open RStudio. You will see the tab of “Untitled1” in the “Source” window. In this window, we will write R codes. First, write the following codes (See Figure 4).
# Import CSV files
mydata <- read.csv("table-1-30-respondents.csv")
The first line starts with a hashtag. Any line beginning with a hashtag is a comment for codes in which researchers often put explanations about codes. When you write new codes with which you are not familiar, it would always be good to add comments for them. Otherwise, you may forget the meaning of those codes when you work with them again in the future. The second line is a real R code which imports CSV files into R.
Overall, the meaning of this code is: 1) import CSV files from your working directory. 2) call the imported CSV file mydata.
Next, we need to execute this code. Move the cursor at the line you want to execute. Then, hit Ctrl and Enter key (For MacOS, command and return key) simultaneously. You will see your code transmitted to the “Console” window. After executing the line of code, RStudio automatically advances the cursor to the next line. This enables you to single-step through a sequence of lines.
Note: If you fail to import CSV files, please check the warning message in your R console. It is often the case that you see “No such file or directory” in the warning message. This means that R cannot find your CSV files. Check whether your CSV files are in your working directory and whether the file name is correctly specified (Note that R distinguishes uppercase and lowercase letters).
Let’s check whether the dataset is imported correctly.
mydata
## id sex age polorient class
## 1 1 1 66 4 4
## 2 2 2 72 4 5
## 3 3 2 59 2 4
## 4 4 2 20 2 3
## 5 5 2 68 4 5
## 6 6 1 76 4 4
## 7 7 1 61 2 5
## 8 8 1 90 4 4
## 9 9 2 64 2 3
## 10 10 2 39 2 5
## 11 11 1 57 4 4
## 12 12 1 47 2 1
## 13 13 2 56 2 4
## 14 14 2 51 2 4
## 15 15 1 34 2 2
## 16 16 1 18 3 4
## 17 17 2 18 2 2
## 18 18 2 30 2 5
## 19 19 2 65 4 4
## 20 20 1 35 4 4
## 21 21 2 44 4 6
## 22 22 2 40 4 4
## 23 23 1 57 2 5
## 24 24 1 40 2 3
## 25 25 2 59 2 4
## 26 26 2 82 4 4
## 27 27 2 44 5 2
## 28 28 2 30 2 4
## 29 29 1 77 2 2
## 30 30 2 60 4 3
If you write the data name and execute it, this will show the whole dataset.
Let’s save our R codes so far so that we can import and work on it again next time. Click on the icon of disks in the top menu of the “Source” window (See Figure 5).
In a newly popped-up window, type “myRcode-1.R” in the “File name”. Note that the file name should end with “.R”, which means the file type is an R code file. Then, click on “Save”. This will save your R file in your working directory. Also, you will see the tab of “Untitled” changed into “myRcode-1.R”.
Close RStudio (Do not save workspace image when it is asked) and open it again. If you followed all my instructions in Lab 1, you will see the file of “myRcode-1.R” is automatically loaded. If not, review “Automatically loading your previous R codes” in Lab 1.
In the next lab, we will keep working on the dataset and R file we have made so far. Thus, please keep all the files.


Scheduler 1.62 Reference Manual
by Enrico Barbierato (enrico.barbierato[at]polimi.it), Marco Gribaudo
Dipartimento di Elettronica, Informatica e Bioingeneria, Politecnico di Milano,
Via Ponzio 34/5 - 20133 - Milano
Italy
The Scheduler Library is a collection of data structures and C-language procedures to implement a scheduler.
Three different data structures (List, Heap and Calendar Queue) are also provided in order to grant the maximum flexibility and performance according to the number of the scheduled events.
This document describes:
- The CalendarEvent, List, Heap, Calendar Queue and Auxiliary data structures;
- The procedures creating, populating, displaying and deleting members of the above data structures;
- Two examples of how this library can be used.
The Scheduler library is implemented in C language. It has been tested under Windows, MacOS and Ubuntu Linux environments
using gcc compiler.
The distribution includes a demo program called Scheduler
to show how the library can be used through two examples.
The Scheduler library and the Scheduler demo are free software,
and are provided as usual with no guarantees.
1.1 – A note for the developers
It is possible to enable a trace of the execution by removing the comment:
//#define CE_DEBUG 1
in the file called utilities.h and recompiling again.
This section describes the basic concepts of the library.
The following is a list of definitions for of the data structures used by the library:
| Item | Description |
| sCalendarEvent | This is the main data structure. It can be instantiated as a sList, a sHeap or a sCalendarQueue |
| sHeap | It corresponds to a heap data structure |
| sList | It corresponds to a double linked list data structure |
| sCalendarQueue | It corresponds to a CalendarQueue data structure |
| sParameters | It corresponds to a set of parameters used by the procedures |
| sAuxlists | It includes the pointers (first and last event) to an unsorted sList data structure |
This section explains how the data structures used by the library are defined. For each of the below data structures, a C language variable type is available.
The sList data structure consists of the following:
The sHeap data structure consists of the following:
- A string id representing a Heap identifier;
- Aan array of pointers Index. Each element of this array points to one array of timestamps referring to events. These arrays are allocated dinamically.
- An integer K denoting the dimension of the Index array;
- An integer M denoting the size of the array of doubles to which Index cells point to.
The sCalendarQueue data structure consists of the following:
- A string id representing a Calendar Queue identifier;
- A double pointer of sList type called buckets. Each element of this list is a list itself;
- An integer numberOfBuckets;
- An integer called bucketSize;
- A min and a max double arrays representing the lower and upper boundaries of CALENDAR QUEUE.
The Calendar Event data structure consists of the following:
- A string id representing an a Calendar Event identifier;
- An integer currentChoice representing one of the three data structures used (List, Heap or CalendarQueue);
- A double precision to be used to compare double values;
- A double howmany referring to the current number of events included in the calendar event data structure;
- A union datastructures including a sList, a sHeap and a CalendarQueue. Only one of these data structures can be active at one time.
The variable type for this data structure is called sCalendarEvent.
The sParameters data structure consists of the following:
- An integer choice representing one of List, Heap or Calendar Queue;
- A double epsilon, used when comparing two doubles;
- An integer numberOfBuckets used to represent the number of Buckets in a Calendar Queue;
- An integer bucket_width used to represent the width of a bucketin a Calendar Queue;
- An integer howmany used to denote the maximum number of events (i.e. timestamps);
- An integer K indicating the width of the Heap memory array Index;
- An integer M indicating the number of slots associated to each member of the heap memory array.
This data structure includes an auxiliary list consisting of unsorted events, typically processed starting from the head or the tail of the list.
The AUXLISTS data structure consists of the following:
- A double N1 representing the total number of events in the first auxiliary list;
- A double pointer of sList type called auxF1 and auxL1 pointing repsectively to the first and to the last event of the sList.
This section provides a general introduction to the logic exploited by the algorithms creating, populating and destroying the Calendar Event.
The CalendarEvent data structure is created by the createCE procedure. Since only one of List, Heap or CalendarQueue data structure can be chosen, the following is performed:
- It allocates the memory for the CalendarEvent data structure.
- It sets the pointer to the List to NULL or
- It initializes the Heap data structure by using the initializeHeap procedure or
- It initializes the Calendar Queue data structure by calling the addCalendarQueue procedure.
It is possible to add a new event (i.e. adding a new timestamp) by using the addEvent procedure, which in turn calls one of addEventToList, addEventToHeap
or addEventToCalendarQueue.
An event can be deleted (i.e. it is disconnected by the Calendar Event and made available) or destroyed (the allocated memory for the event is freed).
The same procedure is used for both the operations, by using a boolean value (0/REMOVE for the removal and 1/DESTROY for the destruction)
passed to the destroyEvent procedure. Depending on the specific Calend Event data structure,destroyEvent calls in turn
delEventFromList, delEventFromHeap and delEventFromCalendarQueue.
The Calendar Event memory deallocation corresponds to two operations:
- Deallocation of the specific data structure used;
- Deallocation of the Calendar Event data structure as a whole.
This is achieved by calling the freeCalendarEvent procedure, which in turns involkes one of freeList, freeHeap or freeCalendarQueue.
The pop operation makes available the top (the smallest) event(i.e.timestamp) included in the Calendar Event. According to the specific data structure, the following is performed by the popEvent procedure:
- List: the first element is returned and the pointer to the first Event in the List is updated;
- Heap: the first element of the array is returned. The data structure is balanced if necessary (to preserve the Heap property);
- CalendarQueue: the popEventFromCalendarQueue procedure looks for the first non-empty bucket and it returns its first element. Then, the pointer to the first element of the bucket is updated.
- Auxiliary list (unsorted): in this case, it is possible to perform a pop operation in different ways:
- Extract the first element of the list from the head or from the tail by using delItemAux procedure. The extract policy is denoted by a flag with value HEAD or TAIL;
- Extract an element from the list randomly with RPop procedure by specifying a flag set to:
- UNIFORM, meaning that the element is extracted randomly from the list (all the members of the list are equiprobable);
- WEIGHT, meaning that the element is extracted randomly from the list taking an account a weight associated to it(the probability to extract a specific element of the list grows proportionally to the element's weight)
In the following, the procedures used are described in more detailed according to the data structure that uses them.
It creates a CalendarEvent data structure, which can be one of List, Heap or CalendarQueue. According to the user choice, the corresponding data structure is created (i.e. the memory is allocated).
Input:
- A Parameter structure including the parameters for the CalendarEvent
Output:
- A pointer to the CalendarEvent data structure
sCalendarEvent * createCE(struct Parameters *pars )
It displays the content of the CalendarEvent data structure
Input
- A pointer to the CalendarEvent data structure
void displayCE(sCalendarEvent *pointer)
It adds an event on the CalendarEvent data structure.
Input:
- a pointer to the CalendarEvent;
- A pointer to a sList node including a timestamp
Output:
- An updated pointer to the sList node
sList * addEvent(sCalendarEvent *ce, sList *)
Note: it is possible to add a node that was previously removed (or extracted via a "pop" operation).
It is not possible adding a node that was early destroyed (in this case, a warning message is issued).
It performs a pop operation on the CalendarEvent (List, Heap or CalendarQueue) data structure.
Input
- A pointer to a Calendar Event
- A sList double pointer (passage by reference) representing the extracted event, which includes the smallest timestamp in the CalendarEvent
void popEvent(sCalendarEvent *ce, sList **)
It releases all the data structures used (list, Heap or Calendar Queue)
Input:
- a pointer to the CalendarEvent structure
void freeCalendarEvent(sCalendarEvent *ce)
It creates a sList node given a timestamp and a weight.
Input
Output:
- A pointer to the new sList element.
sList * createEventW(double timestamp, int weight)
It performs a free() operation on a given sList pointer.
Input
- A double pointer (passage by reference) to sList data structure
void freeEvent(sList ** node)
It returns 1 (true) if the Calendar Event data structure is empty, 0 (true) otherwise.
Output
boolean isCEEmpty(sCalendarEvent *ce)
It returns the first event of the Calendar Event.
Input
- A pointer to a Calendar Event data structure
Output
- A pointer to a sList data structure
sList * getCEFirst(sCalendarEvent *ce)
It sets the timestamp for an existing event. For example, you may perform a "pop" operation, set a new timestamp for the resulting event and add the event again to the
CalendarEvent data structure.
Input
- A pointer to a Calendar Event data structure
- A double timestamp
Output:
- A pointer to a sList data structure including the new timestamp.
sList * setEventTimestamp(sList *node, double timestamp)
It returns the timestamp value for a given pointer to sList data structure.
Input
- A pointer to a sList data structure
Output
- The double timestamp value.
double getEventTimestamp(sList * node)
It returns the number of record in the Calendar Event data structure.
Input:
- A pointer to the Calendar Event data structure
Output:
- A double reprenting the number of events in the Calendar Event data structure
double ceCurrentCapacity(sCalendarEvent *ce)
It creates a sList node given a timestamp.
Input
Output:
- A pointer to the new sList element.
sList * createEvent(double timestamp)
It removes or destroys a sList node. A boolean parameter (set to REMOVE or DESTROY) allows to apply or not the free function.
Input
- A pointer to a Calendar Event
- A pointer to a sList
Output:
- A pointer to removed sList node.
sList * destroyEvent(sCalendarEvent *, sList *, boolean);
It applies a time linear factor (αt + β, where α, β ∈ ℜ,α ≥ 0) to a Calendar Event.
Input:
- A pointer to the Calendar Event
- A double alpha representing α
- A double beta representing β
- A double precision representing the precision used to compare double values (note that this is used for Calendar Queue data structure)
void linearTimeTransform(sCalendarEvent *, double, double, double);
It destroys (or simply disconnects) a struct from the List or Bucket (the same procedure is ued for both List and Calendar Queue)
Input:
- a pointer to the List/Bucket structure
- a pointer to the node including the Event to be destroyed or disconnected
- a flag specifying if the node has t be destroyed (with a "free" function) or just disconnected from the List or Bucket
sList * delEventFromList(sList *list , sList *node, boolean destroy)
4.2.2 – readList
It prints the List (Bucket) content
Input
- The pointer to the first record;
void readList(sList *pointer)
4.2.3 – freeList
It deallocates the memory for the list(bucket).
Input:
void freeList(sList *pointer)
4.2.4 – addEventToList
It adds an item to a List or Bucket, with respect to the order relationship (<)
Input:
- The pointer to the first element of the List or Bucket
- The item to be added
Output:
- The updated pointer to the first item of the List or Bucket
sList * addEventToList(sList **first, sEvent event, double precision)
4.2.5 – linearTransformationList
It applies a time linear factor (αt + β, where α, β ∈ ℜ,α ≥ 0) to a List.
Input:
- A pointer to the List
- A double alpha representing α
- A double beta representing β
void linearTransformationList(sList *, double, double);
4.3 – CALENDAR QUEUE
4.3.1 – freeCalendarQueue
It deallocates the memory for the CalendarQueue
Input:
- a pointer to the Calendar Queue
void freeCalendarQueue(sCalendarQueue *cq)
4.3.2 – addCalendarQueue
- It creates the CalendarQueue record;
- It creates numberOfBuckets buckets;
- It initializes the min/max arrays, each one of bucketSize size
Input
- Pointer to the first element of the list;
- The CalendarQueue identifier
- The number of buckets
- The Bucket size
- The precision to compare double values
Output
- The pointer to the first record of the list/Bucket in the CalendarQueue
sCalendarQueue * addCalendarQueue(char *id, int numberOfBuckets, int bucketSize, double precision)
4.3.3 – addEventToCalendarQueue
It adds an Event to the CalendarQueue by choosing the right bucket.
Input:
- The pointer to the CalendarQueue record;
- The item to be added
Output:
sList * addEventToCalendarQueue(sCalendarQueue *calendarqueue, struct Event event, double precision)
4.3.4 – readCalendarQueue
It prints the content of the CalendarQueue.
Input:
- The pointer to the first record of the CalendarQueue.
void readCalendarQueue(sCalendarQueue *pointer)
4.3.5 – DelEventFromCalendarQueue
It deletes the first event (the smallest) from a Calendar Queue.
Input:
- A pointer to the Calendar Queue
- A pointer to a sList node representing the event to be deleted
void DelEventFromCalendarQueue(sCalendarQueue *, sList * );
4.3.6 – linearTransformationCalendarQueue
It applies a time linear factor (αt + β, where α, β ∈ ℜ,α ≥ 0) to a Calendar Queue.
Input:
- A pointer to the Calendar Queue
- A double alpha representing α
- A double beta representing β
- A double precision representing the precision used to compare double values
void linearTransformationCalendarQueue(sCalendarQueue *, double , double , double )
4.4 – Heap
4.4.1 – freeHeap
It deallocates the memory reserved to the heap.
Input:
void freeHeap(sHeap *heap)
4.4.2 – displayHeap
It displays the Heap content.
Input:
void displayHeap(sHeap *heap )
4.4.3 – initializeHeap
It initializes the Heap. Specifically, it allocates the memory for a sHeap struct,
for the K Index components and finally, it allocates the first array of timestamps pointed by Index[0].
Input:
sHeap * initializeHeap(int K, int M)
4.4.4 – addEventToHeap
It adds a timestamp to the Heap.
Input:
- A Pointer to the Heap
- A timestamp;
- The requested precision to compare double values.>/li>
Output:
- A pointer to the sHEap structure.
sHeap *addEventToHeap(sHeap *heap, double T, double precision)
4.4.5 – upHeap
It balances the Heap in case the heapmin property has been violated by a call to addEventToHeap procedure.
Input:
- The sList pointer including the Heap array. The usage of a sList pointer is requested to maintain coherence with
the insertion procedures belonging to the List and CalendarQueue data structures.
- The array size;
- The precision value needed to compare two doubles.
void upHeap(sList *a, int k, double precision)
4.4.6– delEventFromHeap
void delEventFromHeap(sHeap *heap, double precision, boolean destroy)
It deletes the first timestamp (the smallest) from the Heap's array.
No free operation is performed. The deleted element's position is recovered by the next addEventToHeap procedure.
Input:
- A pointer to the Heap
-
- The precision value requested to compare two doubles;
- A boolean flag. Currently, it is ignored for the Heap
4.4.7 – downheap
It balances the Heap in case the heapmin property has been violated by a call to delEventFromHeap procedure.
Input:
- The sList pointer including the Heap array. The usage of a sList pointer is requested to maintain coherence with
the insertion procedures belonging to the List and CalendarQueue data structures.
- The position of the timestamp in the Heap's array to be deleted;
- The precision value needed to compare two doubles.
void downheap(sList *a,int k, int n, double precision)
4.4.8 – readHeap
It reads the content of a specific Heap location.
Input:
- A pointer to the sHeap data structure;
- An integer denoting the element location
Output:
- The event timestamp corresponding to the location in input
double readHeap(sHeap *heap, int i)
4.4.9 – writeHeap
It writes a timestamp event to a specific Heap location. The memory is created dynamically in M chunks (this parameter is specified by the user in the command line when
the Scheduler is invoked).
Input:
- A sHeap pointer;
- An integer representing the location where the timestamp is going to be written in the Heap;
- A double representing the actual event timestamp.
Output:
- An integer representing the success or the failure of the insertion.
int writeHeap(sHeap *heap, int i, double x)
4.4.10 – linearTransformationHeap
It applies a time linear factor (αt + β, where α, β ∈ ℜ,α ≥ 0) to a Heap.
Input:
- A pointer to the Heap
- A double alpha representing α
- A double beta representing β
void linearTransformationHeap(Heap *, double , double )
4.5 – Utilities
4.5.1 – doubleCompare
It compares two double variables.
Input:
- The two doubles a and b to be compared;
- The precision epsilon
Output:
- 0 if a = b
- -1 if a < b
- 1 if a > b
int doubleCompare(double a, double b, double epsilon)
4.6 – AUXLISTS
4.6.1 – addToAux
It adds an sList * event to a sAuxlists, without any ordering. The policy can be either FIFO or LIFO according to a flag (HEAD or TAIL) passed as parameter.
Input :
- The pointers to the first and last element;
- The sList pointer to the event to be added
- A flag set to HEAD or TAIL.
Output:
- The updated pointers to the first and last events in the sAuxlists
- An sList pointer to the added event.
sList * addToAux(sAuxlists *aux, sList * new, boolean mode)
4.6.2 – delItemAux
It deletes the first or the last event to in a sAuxlists. The policy can be either "delete from the head" or "delete from the tail" according to a flag (HEAD or TAIL) passed as parameter.
Input:
- The pointers to the first and last element;
- A flag set to HEAD or TAIL.
Output:
- An sList pointer to the added event.
- The updated pointers to the first and last events in the sAuxlists
sList * delItemAux(sList **, sList ** , boolean );
4.6.3 – createAUXLists
It creates a sAuxlists data structure, initializing also its members.
Output
- An sAuxlists pointer to the created sAuxlists data structure
sAuxlists * createAUXLists()
4.6.4 – getHowmanyAux
It returns the number of records in the unsorted sList member of the sAuxlists data structure.
Input
- An sAuxlists pointer to the sAuxlists data structure
Output
- The current value of N1 member of sAuxlists data structure
4.6.5 – freeAuxiliaryList
It releases the sAuxlists data structure memory allocation.
Input
- An sAuxlists pointer to the sAuxlists data structure
4.6.6 – RPop
It performs a pop operation on a random basis, following two kind of policies: either the events are equiprobable (flag set to UNIFORM) or depend on a weight (flag set to WEIGHT).
It the extraction is performed on the weight, then the threshold value for each node is re-calculated.
Input
- A sAuxlists pointer to data structure memory;
- A flag to denote the extraction policy, set either to UNIFORM or to WEIGHT
- A double pointer (passage by reference) to the extracted node.
void RPop(sAuxlists * aux, boolean flag, sList ** node)
5 – The Scheduler
The Scheduler is a an example of tool using the scheduler library.
5.1 – Usage
The usage is:
scheduler Usage: scheduler data_structure [Index_dimension array_dimension] [number_of_buckets bucket's width]
Where:
- data_structure is 1 for LIST, 2 for HEAP or 3 for CALENDAR_QUEUE
- for HEAP, you must specify Index dimension and array(slot) dimension
-
- for CALENDAR_QUEUE, you must specify numberOfBuckets and bucket_width
For example:
scheduler 1
In this case, the scheduler has been invoked using a List(1).
scheduler 3 10 10
The scheduler has been invoked using a CalendarQueue(3), using 10 buckets of size 10.
scheduler 2 4 10
The scheduler has been invoked using a Heap(2), using an Index of dimension 4, each element of which is pointing to a slot of maximum 10 elements.
Two examples are here presented:
- A scheduler able to create events and store them on a List, a Heap or a Calendar Queue
- An example of the Auxiliary list usage.
5.2 – Using the Calendar Event data structure
5.2.1 – Validation and variables declaration
The Scheduler performs initially different steps:
- It declares a pointer to sCalendarEvent;
- It performs a validation of the input parameters and load some embedded parameters (among which, for example, the precision epsilon). It returns a pointer to the sParameters structure;
- It declares an array of sList elements called nodes used to input some timestamps and a further sList element called out that will be used later for a pop operation.
int main(int argc, char *argv[])
{
sCalendarEvent *ce;
sParameters *pars = validate(argc, argv);
sList *nodes[10], *out;
ce = createCE(pars);
The createCE procedure is invoked passing the pars parameters input. It returns a pointer to the CalendarEvent, allocating the memory for the CalendarEvent and
the corresponding data structure (List, Heap,
or CalendarQueue).
5.2.2 – Adding events to the CalendarEvent
It is necessary to invoke the addEvent procedure, providing in input:
- A pointer to the CalendarEvent
- a pointer to a sList structure including a timestamp (this can be achieved by using the createEvent procedure).
addEvent returns a sList pointer including the timestamp just added and - when using a List or a CalendarList - a valid next and previous pointers.
Next, it is convenient to print the CalendarEvent content to verify that the addEvent operation has completed successfully.
nodes[0] = addEvent(ce, createEvent(40.0)); displayCE(ce);
In the same fashion, it is possible to add more timestamps:
nodes[1] = addEvent(ce, createEvent(30.0)); displayCE(ce);
nodes[2] = addEvent(ce, createEvent(10.0)); displayCE(ce);
which adds other two timestamps (whose values are respectively 30 and 10) to the CalendarEvent.
5.2.3 – Destroy, add and pop events
The following operations performs the following:
- Destroy (a free operation is performed since the DESTROY flag is used) a timestamp from the CalendarEvent;
- Add two new timestamps (with timestamps set respectively to 12 and 5);
- Destroy (performing actually a remove operation, that is without performing a free operation since the REMOVE flag is used) of nodes[3]
- Invoke the popEvent procedure to extract the first (and smallest) timestamp;
- Add another timestamp.
destroyEvent(ce, nodes[0], DESTROY);displayCE(ce);
nodes[3] = addEvent(ce, createEvent(12.0)); displayCE(ce);
nodes[4] = addEvent(ce, createEvent(5.0)); displayCE(ce);
destroyEvent(ce, nodes[3], REMOVE);displayCE(ce);
popEvent(ce, &out);displayCE(ce);
nodes[5] = addEvent(ce, createEvent(1.0));displayCE(ce);
The nodes that were extracted (through a "pop" operation) or removed are re-inserted:
nodes[3] = addEvent(ce, nodes[3]); displayCE(ce);
nodes[0] = addEvent(ce, nodes[0]); displayCE(ce);
out = addEvent(ce, out); displayCE(ce);
5.2.4 – Deallocating the memory
Finally, the CalendarEvent data structure is released. The nodes and out variables must released as well by the user.
freeCalendarEvent(ce);
}
5.3 – Using the Auxiliary list
Sometimes, it is useful to store temporarily events that cannot be placed in the Calendar Event. In this case, it is possible to use the Auxiliary list, which includes two pointers
to a sList data structure, respectively to the first and the last element. Pop operations can be performed in different ways, either from the top or from the end of the list, or randomly - either
uniformly (all the events are equiprobable) or according to a weight associated to the event. The code performs the following:
5.3.1 – Initialization
int demoDLL()
{
sList *out1, *out2, *out3;
out1 = (sList *)malloc(sizeof(sList));
out2 = (sList *)malloc(sizeof(sList));
out3 = (sList *)malloc(sizeof(sList));
sList *node = NULL;
sAuxlists * aux = createAUXLists();
Three sList * variables out1, out2 and out3 are created. The sAuxlists data struture is istantiated.
5.3.2 – Adding the events
Six new events are created. For each one, the timestamp and the weight are passed as arguments to createEventW procedure. Correspondgly, the auxiliary list's content is displayed each time by
using readListW procedure.
node = addToAux(aux, createEventW(12, 2), TAIL);readListW(aux->auxF1);
node = addToAux(aux, createEventW(31, 3), TAIL);readListW(aux->auxF1);
node = addToAux(aux, createEventW(7, 1), TAIL);readListW(aux->auxF1);
node = addToAux(aux, createEventW(19, 4), HEAD);readListW(aux->auxF1);
node = addToAux(aux, createEventW(150, 5), TAIL);readListW(aux->auxF1);
node = addToAux(aux, createEventW(987, 2), HEAD);readListW(aux->auxF1);
5.3.3 – Removing the events by the tail or the head of the list
Two elements are removed from the list, respectively the last (TAIL) and the first (HEAD). If the first element is removed, the delItemAux re-calculates the thresholds for
each component of the list.
readEvent( delItemAux(aux, TAIL));printf("\n");readListW(aux->auxF1);
readEvent( delItemAux(aux, HEAD));printf("\n");readListW(aux->auxF1);
5.3.4 – Random pop operation of the events by uniform or weighted policy
Three elements of the list are extracted by using a pop operation exploiting either the weight attribute (each element can be extracted according to a probability depending on the weight) or simply extracting randomly the event
(being N the events in the list, the probability to extracted the i-th is 1/N).
RPop(aux, WEIGHT, &out1);readListW(aux->auxF1);
RPop(aux, WEIGHT, &out2);readListW(aux->auxF1);
RPop(aux, UNIFORM, &out3);readListW(aux->auxF1);
5.3.5 – Release the memory
All the data structures are released.
free(out1);
free(out2);
free(out3);
freeAuxiliaryList(aux);
return 1;


Mane Backed For Ballon d'Or By Fellow Nominee
by SL InternationalSadio Mane might be competing with the likes of Lionel Messi and Cristiano Ronaldo for the Ballon d'Or award, but the African superstar has now been backed to claim the trophy by one of his fellow nominees.
Read: The 10 Richest Footballers Of All Time
The winner of the 2019 Ballon d'Or award will be named on 2 December, and Real Madrid star Eden Hazard, who is one of the nominees, has made his pick for the award.
Speaking in an interview with Le Parisien, the former Chelsea star backed one of the Liverpool trio of Mane, Mohamed Salah or Virgil van Dijk to walk away with award, but singled the Senegal star out in particular.
Earn Airtime & Data With Soccer Laduma's Social Media App - Download Now
"I would give it to a Liverpool player. Mane, Salah or Van Dijk deserve it," Hazard said.
"If Sadio had won AFCON with Senegal, there would have been no debate. It would be beautiful if he won it.
"Or Momo (Salah), who is one of my friends. It would be a good thing for both African and English football."
Click through the gallery below to see some players who were snubbed for the prestigious award:
Hazard and Mane are among the 30 players who have been nominated for the award, which includes record-sharing five-time winners Messi and Ronaldo.


Machines
Machines automatically and periodically complete some task.
Importers buy resources from the outside world.
Exports sell resources to the outside world.
Chemical reactors transform resources into other resources via chemical reactions.
Nuclear reactors transform elements into other elements via nuclear processes.
Laboratories use resources to produce science.
Resources
Resources are things you can own, use, process, buy, or sell.
Basic resources are the core of your business and affect almost everything you do.
The elements of the Periodic Table form the building blocks of our world.
Compounds are combinations of elements to form a wider variety of substances.
Research
Chemistry research progresses your ability to interact with elements and molecules.
Physics research progresses your ability to interact with the subatomic.
Engineering research focuses on incremental improvements to designs or on power generation.
Social research helps you interact with society, administration, and the economy.


newton's
apple
programming
mathematics
biology
rocket science
ask
sign up
sign in
sign up
sign in
ask
programming
mathematics
biology
rocket science
answer question
ask
suggested questions
How to start up Bootstrap?
How to line divs in CSS?
HTML help?
Can't center divs
More...
Email:
<EMAIL_ADDRESS>Name:
Joaquim João
Surname:
Mendes
Country:
Rwanda
User Badges
2 years club
200 questions
400 answers
10k user score
Most frequented topics
Programming
Cooking
Science
Mathematics
Joaquim João Mendes
12.000
user score
Responsible for Business Development within the Special District as well as Industry Recruitment on the Informatics area and helping existing business grow and expand.I report to a board of 7 Directors and sets the planning for the 8 thousand acre District when it concerns Incentives to large and small industry, tax planning for abatements and tax credits given as incentives.
Joaquim João Mendes
12.000
user score
Email:
<EMAIL_ADDRESS>Name:
Joaquim João
Surname:
Mendes
Country:
Rwanda
Prism letterpress farm-to-table, food truck butcher seitan tilde tacos glossier affogato activated charcoal kombucha dreamcatcher. Copper mug wayfarers tumeric snackwave normcore, freegan kitsch organic humblebrag kickstarter hella quinoa skateboard. Jean shorts ethical pug, fashion axe wayfarers trust fund YOLO man bun live-edge af brunch mumblecore fam actually thundercats. Master cleanse VHS pork belly, flannel live-edge glossier man bun. Aesthetic celiac you probably haven't heard of them.
User Badges
2 years club
200 questions
400 answers
10k user score
Most frequented topics
Programming
Cooking
Science
Mathematics
Submitted Questions
How to start up Bootstrap?
12
How to line divs in CSS?
30
HTML help?
1k
Can't center divs
59
View All questions
Submitted Answers
Yes, you can charge your phone in the microwave.
No that's illegal.
How would i know.
Yes cups are used for that too.
View All Answers


Lead Time is the delay that occurs between the initiation and completion of a process. Lead Time is used in manufacturing, supply chain management, and project management.
What is the unknown value:


Select your burger
This is where you choose your burger
| {{burger.name}} |
|---|
| {{burger.name}} |
Customer infromation
This is where you provide necessary information
Choose Gender


|
Glass Shank |
1 |
3 to 11 |
1.4 |
9.8 |
0 |
0 |
0 |
Critical Strike Chance +%
|
40
|
|
|
Skinning Knife |
5 |
4 to 16 |
1.2 |
12 |
0 |
16 |
0 |
Critical Strike Chance +%
|
40
|
|
|
Carving Knife |
10 |
2 to 20 |
1.4 |
15.4 |
0 |
18 |
26 |
Critical Strike Chance +%
|
40
|
|
|
Stiletto |
15 |
5 to 21 |
1.6 |
20.8 |
0 |
30 |
30 |
Critical Strike Chance +%
|
40
|
|
|
Boot Knife |
20 |
7 to 29 |
1.4 |
25.2 |
0 |
31 |
45 |
Critical Strike Chance +%
|
40
|
|
|
Copper Kris |
24 |
9 to 36 |
1.2 |
27 |
0 |
28 |
60 |
Critical Strike Chance +%
|
80
|
|
|
Skean |
28 |
9 to 35 |
1.5 |
33 |
0 |
42 |
60 |
Critical Strike Chance +%
|
40
|
|
|
Imp Dagger |
32 |
12 to 48 |
1.2 |
36 |
0 |
36 |
78 |
Critical Strike Chance +%
|
60
|
|
|
Flaying Knife |
35 |
14 to 55 |
1.2 |
41.4 |
0 |
73 |
51 |
Critical Strike Chance +%
|
40
|
|
|
Butcher Knife |
38 |
6 to 54 |
1.4 |
42 |
0 |
55 |
79 |
Critical Strike Chance +%
|
40
|
|
|
Poignard |
41 |
11 to 45 |
1.6 |
44.8 |
0 |
72 |
72 |
Critical Strike Chance +%
|
40
|
|
|
Boot Blade |
44 |
14 to 55 |
1.4 |
48.3 |
0 |
63 |
90 |
Critical Strike Chance +%
|
40
|
|
|
Golden Kris |
47 |
16 to 64 |
1.2 |
48 |
0 |
51 |
110 |
Critical Strike Chance +%
|
80
|
|
|
Royal Skean |
50 |
14 to 57 |
1.5 |
53.3 |
0 |
71 |
102 |
Critical Strike Chance +%
|
40
|
|
|
Fiend Dagger |
53 |
19 to 75 |
1.2 |
56.4 |
0 |
58 |
123 |
Critical Strike Chance +%
|
60
|
|
|
Gutting Knife |
56 |
21 to 82 |
1.2 |
61.8 |
0 |
113 |
78 |
Critical Strike Chance +%
|
40
|
|
|
Slaughter Knife |
58 |
9 to 78 |
1.4 |
60.9 |
0 |
81 |
117 |
Critical Strike Chance +%
|
40
|
|
|
Ambusher |
60 |
16 to 63 |
1.6 |
63.2 |
0 |
113 |
113 |
Critical Strike Chance +%
|
40
|
|
|
Ezomyte Dagger |
62 |
18 to 72 |
1.4 |
63 |
0 |
95 |
131 |
Critical Strike Chance +%
|
40
|
|
|
Platinum Kris |
64 |
20 to 79 |
1.2 |
59.4 |
0 |
76 |
149 |
Critical Strike Chance +%
|
80
|
|
|
Imperial Skean |
66 |
17 to 67 |
1.5 |
63 |
0 |
95 |
131 |
Critical Strike Chance +%
|
40
|
|
|
Demon Dagger |
68 |
21 to 83 |
1.2 |
62.4 |
0 |
76 |
149 |
Critical Strike Chance +%
|
60
|
|


How to use the Pixel 4 camera's dual exposure sliders to take better photos
Source: Android Central
The Pixel 4's new camera app introduces several changes to the interface, and for the most part it's still dead simple to use. But there are a couple advanced features and modes, like the dual exposure sliders, that improve its shooting capabilities. Once you know what these sliders do, they can take your photography to the next level.
How to use the Pixel 4's dual exposure sliders
First thing's first: how to show the sliders so you can use them. There's no way to show the exposure sliders on the camera interface all the time, but they're available any time you tap anywhere the viewfinder. The sliders show up for several seconds, and stay longer if you make any slider adjustments.
It takes only a few minutes playing with the sliders to see how they can change a photo.
In order to effectively use the dual exposure sliders, you need to understand some basic photography principles. The left (or top, in portrait) slider is the overall brightness slider, and the right (or bottom) slider is the shadows slider. Most people will understand what changing the brightness means — it adjusts the light sensitivity of the camera, brightening or darkening the entire frame by a set amount. Adjusting the shadows is a bit more nuanced — this adjusts the brightness of only the dark parts of the frame, which has a much more subtle effect because it leaves the remaining whites and colors untouched.
Taking a few minutes to move the sliders around while pointed at a static subject will quickly introduce you to their capabilities. Slide them to the left (or up, in portrait) to increase brightness, and to the right (or down) to decrease brightness.
When the scene you're shooting has a relatively consistent amount of light across the entire frame, sometimes you just need to adjust the overall brightness to get the whole-scene look you desire. However, in cases where you have a scene of mixed lighting, or are trying to emphasize the dark or light parts specifically, the shadows slider can be more useful — and its effect is typically more subtle.
Source: Andrew Martonik / Android Central
AF/AE lock saves you from auto focus frustrations, and opens up possibilities for cool shots.
You'll notice that tapping the viewfinder makes the camera focus on that point as well (which is arguably the main function of tapping), so make sure you keep that in mind when you're tapping to show the sliders. Once you've made slider adjustments, if you tap anywhere else to adjust focus again, the sliders will reset to their default positions.
If you're taking your time to frame and expose a specific shot, the fact that the focus and exposure sliders eventually adjust and disappear will be frustrating. Google's thought about this, and offers an AF/AE "lock" mode — once you set your focal distance, tap the lock icon next to the brightness slider to lock that focal distance. With AF/AE locked, the camera won't auto focus when you move, and subsequently will keep both of your exposure sliders set wherever you left them as well.
Source: Andrew Martonik / Android Central
Understanding one button and two sliders can make a difference in so many different shooting situations.
You can use the auto focus lock to take selectively blurred shots, for example, or just keep the camera from making adjustments when something moves within the frame or your hands move. With auto focus locked, you can still make changes to the exposure sliders and it won't change where you have focus set — the only thing that will remove the lock is tapping somewhere else on the viewfinder or tapping the lock icon.
The exposure sliders are also available when recording video, and in this mode you may be even more likely to use the AF/AE lock as you or your subject are moving. Even if you make no adjustments to the exposure on the fly, keeping the camera from hunting for focus is very helpful.
Whether you use the sliders, lock, or both, your Pixel 4 photos and videos are going to be improved by knowing how they work and when to use them.


Merchant Rex:
I'm not sure if we have what you're looking for. Tell me again...
Buy Wizard equipment.


Toggle navigation
Home
Newsfeed
Newsfeed
Images
My friends
My Profile
My info
My Albums
My Friends
Admin
Logout
Principal Name
Administrator
My Newsfeed
Friends
Images
User Name
Delete
Update


{% extends "base.html" %} {% block title %}Update Member{% endblock %} {% block content %}
Name:
E-mail:
Contact no.:
Present Address:
Permanent Address:
Department:
Designation: Professor Associate Professor Assistant Professor Lecturer Other
Status: Active Inactive
Type: General Privileged


Please feel free to share any of the graphics below regarding VA to your social media accounts!
(This site is currently optimized for Chrome.)


Microsoft Internet Explorer
was detected.
Please use modern browsers :
Chrome,Opera,Firefox,Edge,...
*For hearing Impaired Person*
Successful communication requires the efforts of all people involved in a conversation.
Even when the person with hearing loss utilizes hearing aids and active listening strategies,
it is crucial that others involved in the communication process consistently use good communication strategies,
including the following:
see link.
The site helps people with hearing impairments, you can adjust the volume, audio bandwidth. To continue, you must agree to use the microphone. This is a static website that does not collect any information.
The site helps people with hearing impairments, you can adjust the volume, audio bandwidth. To continue, you must agree to use the microphone. This is a static website that does not collect any information.
*For hearing Impaired Person*
Use headphone (with separate microphone)!
Insert the headphones, press Start,
Adjust Volume, Filters if needed.
Put the phone/microphone on the table and talk.


The alias
rule gives alternative name to
a group of targets. For example, to give the name
core
to a group of three other targets with the
following code:
alias core : im reader writer ;
Using core
on the command line, or in the source list
of any other target is the same as explicitly using
im
, reader
, and
writer
, but it is just more convenient.
Another use of the alias
rule is to change build
properties. For example, if you always want static linking for a
specific C++ Boost library, you can write the following:
alias threads : /boost/thread//boost_thread : <link>static ;
and use only the threads
alias in your Jamfiles.
You can also specify usage requirements for the
alias
target. If you write the following:
alias header_only_library : : : : <include>/usr/include/header_only_library ;
then using header_only_library
in sources will only add an
include path. Also note that when there are some sources, their usage
requirements are propagated, too. For example:
lib lib : lib.cpp : : : <include>. ; alias lib_alias ; exe main : main.cpp lib_alias ;
will compile main.cpp
with the additional include.


--- layout: post title: 'Etsy Ignite: The Importance of Interdisciplinary Thinking' date: 2013-10-22 20:34:44.000000000 -04:00 categories: [] tags: - Etsy - ignite - video status: publish type: post published: true meta: _publicize_pending: '1' author: login: samarthbhaskar email<EMAIL_ADDRESS>display_name: samarthbhaskar first_name: '' last_name: '' ---
http://www.youtube.com/watch?v=Pei6_Bc0hjk
On October 16, 2013 I participated in an Ignite event at Etsy. 12 of my colleagues and I got 5 minutes, 20 auto-advancing slides and the attention of a room-full of our friends and colleagues to tell a story. I talked about why I think it's important to spend time getting outside of your domain of expertise and learning new things, from the arts for example.
I really enjoyed putting words and order to my thoughts on this subject. If you've followed my Twitter feed at any point in time, you can tell me affinity for all different domains of knowledge. Here's to more years of consumption, production, exploration and expansion.


RT @qrush: "It works in RubeGoldberg 2.2 but will not autocompile freeway buttmonkey merge svn commitshare javahunk." http://html9responsiveboilerstrapjs.com/
9/11/2013, 10:26:05 AM
Favs: 0
Retweets: 0
link--- layout: tweet ---
RT @qrush: "It works in RubeGoldberg 2.2 but will not autocompile freeway buttmonkey merge svn commitshare javahunk." http://html9responsiveboilerstrapjs.com/
9/11/2013, 10:26:05 AM
Favs: 0
Retweets: 0
link


Copyright 2012-2017 Hauser Olsson GmbH.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
This is a MongoDB implementation of the CrNiCKL (chronicle) database. CrNiCKL (pronounced "chronicle") is a database for time series written in Java running on top of SQL and NoSQL systems.
Versions 2.0.0 and 2.0.1 bring a non-compatible change in MongoDatabase
. The
constructor now takes a second parameter: a ch.agent.t2.time.TimeDomainCatalog
.
Other changes are a consequence of upgrading to a newer version of the MongoDB
java driver.
The distribution consists of three archives
crnickl-mongodb-x.y.z.jar
crnickl-mongodb-x.y.z-javadoc.jar
crnickl-mongodb-x.y.z-sources.jar
with compiled classes, HTML documentation, and sources. The version number
x.y.z
follows the maven convention. The distribution also includes .asc
files with detached cryptographic signatures.
The software is available from the Maven central
repository. To use version x.y.z
, insert the following dependency into your
pom.xml
file:
<dependency>
<groupId>ch.agent</groupId>
<artifactId>crnickl-mongodb</artifactId>
<version>x.y.z</version>
<scope>compile</scope>
</dependency>
The recommended way is to use git for accessing the source and maven for building. The procedure is easy, as maven takes care of locating and downloading dependencies:
$ git clone https://github.com/jpvetterli/crnickl-mongodb.git
$ cd crnickl-mongodb
$ mvn install
This builds and installs the distribution JARs in your local maven
repository. They can also be found in the target
directory.
When building the software by other means, the following dependencies must be addressed:
crnickl-x.y.z.jar
CrNiCKL databaset2-x.y.z.jar
Time2 Library mongo-java-driver-x.y.z.jar
MongoDB Replace all x.y.z
with the actual version numbers which can be found in the
POM
file included in the binary JAR:
/META-INF/maven/ch.agent/crnickl-mongodb/pom.xml
The following command runs unit tests:
$ mvn -Dmaven.test.skip=false test
The source is available on GitHub.
More information on CrNiCKL is available at the project web site.
Updated: 2017-10-06/jpv.


Use the buttons to call the api. Calling "Test No Auth" should call a non restricted API endpoint.
Clicking "Login" will use the "prefilled" username and password fields to authenticate a user and setup a token
"Get Users" will call a api endpoint which requires a valid JWT token, without the token it will not send a valid resonse, you cna test this before and after authenticating


Second-year Ph.D. Student
Indiana University-Bloomington
Myles Brand Hall #255, 901 E 10th Street, Bloomington, IN 47408, USA
Hello, I am a second-year Ph.D. Student in Health Informatics at Indiana University Bloomington, USA, working with Dr. Christina Chung. My research focuses on Health Informatics, Human-Computer Interaction (HCI), and CSCW.
As a researcher, I am interested in new ways that allow people to extend one’s range of understanding. My goal is to research these ways to foster better human-to-others (such as robots, virtual avatars, and other people) understanding and to enhance the relationship between humans and others. I am also interested in new media that allows one to extend and assist one’s experience. With new interactions and technology, this media enables people to create their own experience easily byusing assistive tools with multi-modal interactions.
Interest: Personal Informatics, HCI, CSCW
In this study, we developed a scalable, effective, and accessible app to address the problems that arise in traditional face-to-face counseling and to treat common psychological problems such as mild depression that people experience in their daily lives.
People often strive to “externalize” memories for long-term saving or sharing with others using different forms of media. We explored and proposed new interactive systems which enhance social presence and enable new experiences with multi-modal interactions.
To see the previous works, press "Past work" on the top


Ta Minh Duc
— Developer
Home
Archives
Work
About
Work
2012
@Wheel-Of-Fortune
Wheel Of Fortune (Windows Game) - DirectX, C++
2013
@Snap
Photo Sharing Social Network - Ruby on Rails, HTML5, jQuery, Ajax
2014
dxta.github.io
My Portfolio Website
BKCloud
Desktop as a Service, Database as a Service in CloudStack


--- layout: post status: publish published: true title: BTS Transactional Adapter Issues 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: 78 wordpress_url: http://winterdom.com/2005/05/btstransactionaladapterissues date: '2005-05-21 07:38:00 +0000' date_gmt: '2005-05-21 07:38:00 +0000' categories: - BizTalk tags: [] comments: [] ---
As part of a project we're working on for one of our clients, we built a transactional receive adapter for BizTalk Server 2004. The adapter itself is working just fine, and truth be told, it was far easier to write than I originally expected, which is good.
However, we have been noticing something a little odd that has me worried a bit. The adapter we built is an isolated receive adapter and what we are seeing is that everytime the isolated host for the adapter is initialized (or rather, just after initializing the adapter into the hosting process), the following error is reported by BizTalk to the application event log:
Event Type: Error
Event Source: BizTalk Server 2004
Event Category: BizTalk Server 2004
Event ID: 6912
Date: 5/20/2005
Time: 11:22:44 AM
User: N/A
Computer: C-TRESTREPO
Description:
The following stored procedure call failed:
" { call admsvr_ReceiveLocation_GetAllInApp( ?)}".
SQL Server returned error string: "Distributed transaction completed. Either
enlist this session in a new transaction or the NULL transaction.".
After doing a lot of digging and a lot of load testing, I've found out the following regarding the error:
Because of this pattern, I'm a little bit stumped as to what the cause of the problem is, and while it doesn't seem to cause any real problems, I'm not very interested in leaving the error popping around in the event log and not knowing what it is we're doing to cause it. Any ideas?


import os.path as op
import numpy as np
import matplotlib.pyplot as plt
import mne
In this tutorial we focus on plotting functions of mne.Evoked
.
Here we read the evoked object from a file. Check out
Epoching and averaging (ERP/ERF) to get to this stage from raw data.
data_path = mne.datasets.sample.data_path()
fname = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif')
evoked = mne.read_evokeds(fname, baseline=(None, 0), proj=True)
print(evoked)
Out:
Reading /home/ubuntu/mne_data/MNE-sample-data/MEG/sample/sample_audvis-ave.fif ...
Read a total of 4 projection items:
PCA-v1 (1 x 102) active
PCA-v2 (1 x 102) active
PCA-v3 (1 x 102) active
Average EEG reference (1 x 60) active
Found the data of interest:
t = -199.80 ... 499.49 ms (Left Auditory)
0 CTF compensation matrices available
nave = 55 - aspect type = 100
Projections have already been applied. Setting proj attribute to True.
Applying baseline correction (mode: mean)
Read a total of 4 projection items:
PCA-v1 (1 x 102) active
PCA-v2 (1 x 102) active
PCA-v3 (1 x 102) active
Average EEG reference (1 x 60) active
Found the data of interest:
t = -199.80 ... 499.49 ms (Right Auditory)
0 CTF compensation matrices available
nave = 61 - aspect type = 100
Projections have already been applied. Setting proj attribute to True.
Applying baseline correction (mode: mean)
Read a total of 4 projection items:
PCA-v1 (1 x 102) active
PCA-v2 (1 x 102) active
PCA-v3 (1 x 102) active
Average EEG reference (1 x 60) active
Found the data of interest:
t = -199.80 ... 499.49 ms (Left visual)
0 CTF compensation matrices available
nave = 67 - aspect type = 100
Projections have already been applied. Setting proj attribute to True.
Applying baseline correction (mode: mean)
Read a total of 4 projection items:
PCA-v1 (1 x 102) active
PCA-v2 (1 x 102) active
PCA-v3 (1 x 102) active
Average EEG reference (1 x 60) active
Found the data of interest:
t = -199.80 ... 499.49 ms (Right visual)
0 CTF compensation matrices available
nave = 58 - aspect type = 100
Projections have already been applied. Setting proj attribute to True.
Applying baseline correction (mode: mean)
[<Evoked | comment : 'Left Auditory', kind : average, time : [-0.199795, 0.499488], n_epochs : 55, n_channels x n_times : 376 x 421>, <Evoked | comment : 'Right Auditory', kind : average, time : [-0.199795, 0.499488], n_epochs : 61, n_channels x n_times : 376 x 421>, <Evoked | comment : 'Left visual', kind : average, time : [-0.199795, 0.499488], n_epochs : 67, n_channels x n_times : 376 x 421>, <Evoked | comment : 'Right visual', kind : average, time : [-0.199795, 0.499488], n_epochs : 58, n_channels x n_times : 376 x 421>]
Notice that evoked
is a list of evoked instances. You can read only one
of the categories by passing the argument condition
to
mne.read_evokeds()
. To make things more simple for this tutorial, we
read each instance to a variable.
evoked_l_aud = evoked[0]
evoked_r_aud = evoked[1]
evoked_l_vis = evoked[2]
evoked_r_vis = evoked[3]
Let’s start with a simple one. We plot event related potentials / fields (ERP/ERF). The bad channels are not plotted by default. Here we explicitly set the exclude parameter to show the bad channels in red. All plotting functions of MNE-python return a handle to the figure instance. When we have the handle, we can customise the plots to our liking.
fig = evoked_l_aud.plot(exclude=())
All plotting functions of MNE-python returns a handle to the figure instance. When we have the handle, we can customise the plots to our liking. We can get rid of the empty space with a simple function call.
fig.tight_layout()
Now let’s make it a bit fancier and only use MEG channels. Many of the
MNE-functions include a picks
parameter to include a selection of
channels. picks
is simply a list of channel indices that you can easily
construct with mne.pick_types()
. See also mne.pick_channels()
and
mne.pick_channels_regexp()
.
Using spatial_colors=True
, the individual channel lines are color coded
to show the sensor positions - specifically, the x, y, and z locations of
the sensors are transformed into R, G and B values.
picks = mne.pick_types(evoked_l_aud.info, meg=True, eeg=False, eog=False)
evoked_l_aud.plot(spatial_colors=True, gfp=True, picks=picks)
Notice the legend on the left. The colors would suggest that there may be two separate sources for the signals. This wasn’t obvious from the first figure. Try painting the slopes with left mouse button. It should open a new window with topomaps (scalp plots) of the average over the painted area. There is also a function for drawing topomaps separately.
evoked_l_aud.plot_topomap()
By default the topomaps are drawn from evenly spread out points of time over the evoked data. We can also define the times ourselves.
times = np.arange(0.05, 0.151, 0.05)
evoked_r_aud.plot_topomap(times=times, ch_type='mag')
Or we can automatically select the peaks.
evoked_r_aud.plot_topomap(times='peaks', ch_type='mag')
You can take a look at the documentation of mne.Evoked.plot_topomap()
or simply write evoked_r_aud.plot_topomap?
in your python console to
see the different parameters you can pass to this function. Most of the
plotting functions also accept axes
parameter. With that, you can
customise your plots even further. First we shall create a set of matplotlib
axes in a single figure and plot all of our evoked categories next to each
other.
fig, ax = plt.subplots(1, 5)
evoked_l_aud.plot_topomap(times=0.1, axes=ax[0], show=False)
evoked_r_aud.plot_topomap(times=0.1, axes=ax[1], show=False)
evoked_l_vis.plot_topomap(times=0.1, axes=ax[2], show=False)
evoked_r_vis.plot_topomap(times=0.1, axes=ax[3], show=True)
Out:
Colorbar is drawn to the rightmost column of the figure. Be sure to provide enough space for it or turn it off with colorbar=False.
Colorbar is drawn to the rightmost column of the figure. Be sure to provide enough space for it or turn it off with colorbar=False.
Colorbar is drawn to the rightmost column of the figure. Be sure to provide enough space for it or turn it off with colorbar=False.
Colorbar is drawn to the rightmost column of the figure. Be sure to provide enough space for it or turn it off with colorbar=False.
Notice that we created five axes, but had only four categories. The fifth
axes was used for drawing the colorbar. You must provide room for it when you
create this kind of custom plots or turn the colorbar off with
colorbar=False
. That’s what the warnings are trying to tell you. Also, we
used show=False
for the three first function calls. This prevents the
showing of the figure prematurely. The behavior depends on the mode you are
using for your python session. See http://matplotlib.org/users/shell.html for
more information.
We can combine the two kinds of plots in one figure using the plot_joint
method of Evoked objects. Called as-is (evoked.plot_joint()
), this
function should give a stylish and informative display of spatio-temporal
dynamics. Also note the topomap_args
and ts_args
parameters of
mne.Evoked.plot_joint()
. You can pass key-value pairs as a python
dictionary that gets passed as parameters to the topomaps
(mne.Evoked.plot_topomap()
) and time series (mne.Evoked.plot()
)
of the joint plot.
For specific styling, use these topomap_args
and ts_args
arguments. Here, topomaps at specific time points (70 and 105 msec) are
shown, sensors are not plotted, and the Global Field Power is shown:
ts_args = dict(gfp=True)
topomap_args = dict(sensors=False)
evoked_r_aud.plot_joint(title='right auditory', times=[.07, .105],
ts_args=ts_args, topomap_args=topomap_args)
We can also plot the activations as images. The time runs along the x-axis
and the channels along the y-axis. The amplitudes are color coded so that
the amplitudes from negative to positive translates to shift from blue to
red. White means zero amplitude. You can use the cmap
parameter to define
the color map yourself. The accepted values include all matplotlib colormaps.
evoked_r_aud.plot_image(picks=picks)
Finally we plot the sensor data as a topographical view. In the simple case we plot only left auditory responses, and then we plot them all in the same figure for comparison. Click on the individual plots to open them bigger.
title = 'MNE sample data (condition : %s)'
evoked_l_aud.plot_topo(title=title % evoked_l_aud.comment)
colors = 'yellow', 'green', 'red', 'blue'
mne.viz.plot_evoked_topo(evoked, color=colors,
title=title % 'Left/Right Auditory/Visual')
We now compute the field maps to project MEG and EEG data to MEG helmet and scalp surface.
To do this we’ll need coregistration information. See Head model and forward computation for more details.
Here we just illustrate usage.
subjects_dir = data_path + '/subjects'
trans_fname = data_path + '/MEG/sample/sample_audvis_raw-trans.fif'
maps = mne.make_field_map(evoked_l_aud, trans=trans_fname, subject='sample',
subjects_dir=subjects_dir, n_jobs=1)
# explore several points in time
field_map = evoked_l_aud.plot_field(maps, time=.1)
Out:
Using surface from /home/ubuntu/mne_data/MNE-sample-data/subjects/sample/bem/sample-5120-5120-5120-bem.fif
Getting helmet for system 306m
Prepare EEG mapping...
Computing dot products for 59 electrodes...
Computing dot products for 2562 surface locations...
Field mapping data ready
Preparing the mapping matrix...
[Truncate at 20 missing 0.001]
The map will have average electrode reference
Prepare MEG mapping...
Computing dot products for 305 coils...
Computing dot products for 304 surface locations...
Field mapping data ready
Preparing the mapping matrix...
[Truncate at 209 missing 0.0001]
Note
If trans_fname is set to None then only MEG estimates can be visualized.
Total running time of the script: (0 minutes 27.726 seconds)
plot_visualize_evoked.py
plot_visualize_evoked.ipynb


A Crowdsourcing Data annoation solution for the ground truth of your data.
 Lean on our automated platform and vetted community. Create a project, Upload your dataset, and track your data being annotated and reviewd by our global workforce.
Get Started!Track the annotation progress of your datasets.
images are being annotated and reviewed by multiple users to ensure a high quality ground truth data.
The online platform and the workforce base ensures fast completion of tasks in hand.
Crowdsourcing Data annotations to the public decreases the cost marginally.


Pathfinding
Components
SourceComponent (Start point)
TargetComponent (End point)
PathfindingComponent (Store the state of the pathfinding process)
PathComponent (Store the result)
System
Pathfinding process is launched in a single thread, returning a future.
When processing is finished, path is stored in a PathComponent.


Interview with Prof. Dermot Barnes-Holmes
Prof. Dermot Barnes-Holmes was a Foundation Professor at the Department of Psychology at National University of Ireland, Maynooth. He is known for his research in human language and cognition through the development of the Relational Frame Theory...
[Read More]


{% comment %}
get_sponsor.html (sponsor_id):
Obtain host sponsor object for the event.
Get the event's foreign key sponsors and use its first object in the array
as host sponsor object.
Parameters:
sponsor_id: id of the sponsor
Yml variable which will be used to access sponsor object.
Returns:
sponsor: sponsor object
Object from collection sponsors.
{% endcomment %}
{% assign sponsor_id = include.sponsor_id %}
{% assign sponsor = site.sponsors | where:"obj_id", sponsor_id | first %}


| set_makevars {withr} | R Documentation |
Makevars
file, by adding new variablesYou probably want with_makevars()
instead of this function.
set_makevars( variables, old_path = makevars_user(), new_path = tempfile(), assignment = c("=", ":=", "?=", "+=") )
variables |
|
old_path |
|
new_path |
|
assignment |
|
Unlike with_makevars()
, it does not activate the new Makevars
file, i.e. it does not set the R_MAKEVARS_USER
environment variable.


Reference # [shows after you enter your address]
{{last5}} | {{string_construct}}
Bitcoin transactions are irreversible. By proceeding, you confirm that the above address is correct and yours. You’ll have no recourse if you can't access bitcoins sent there.


“Ute recession” underlines construction bust
by Houses and HolesVia News:
If you use ute sales as a marker of small business investment in Australia, you get the impression small business is terrified. Sales of light commercial vehicles collapsed in October 2019, down 11 per cent compared with October 2018.
At the start of the 2019, sales were much the same as last year. Some months a bit higher, some a bit lower. Around the middle of this year something changed. Sales of light commercial vehicles – which is mostly utes but includes vans and small buses – began to get worse and worse. In October, the fall was a whopping 11 per cent.
There are 986 words left in this subscriber-only article.