Chapter 9 Initialize with genomic data
circlize is quite flexible to initialize the circular plot not only by chromosomes, but also by any type of general genomic categories.
9.1 Initialize with cytoband data
Cytoband data is an ideal data source to initialize genomic plots. It contains length of chromosomes as well as so called “chromosome band” annotation to help to identify positions on chromosomes.
9.1.1 Basic usage
If you work on human genome, the most straightforward way is to directly use
circos.initializeWithIdeogram()
(Figure 9.1).
By default, the function creates a track with chromosome name
and axes, and a track of ideograms.
Although chromosome names added to the plot are pure numeric, actually the internally names have the “chr” index. When you adding more tracks, the chromosome names should also have “chr” index.
## All your sectors:
## [1] "chr1" "chr2" "chr3" "chr4" "chr5" "chr6" "chr7" "chr8" "chr9"
## [10] "chr10" "chr11" "chr12" "chr13" "chr14" "chr15" "chr16" "chr17" "chr18"
## [19] "chr19" "chr20" "chr21" "chr22" "chrX" "chrY"
##
## All your tracks:
## [1] 1 2
##
## Your current sector.index is chrY
## Your current track.index is 2
By default, circos.initializeWithIdeogram()
initializes the plot with
cytoband data of human genome hg19
. Users can also initialize with other
species by specifying species
argument and it will automatically download
cytoband files for corresponding species.
When you are dealing rare species and there is no cytoband data available yet,
circos.initializeWithIdeogram()
will try to continue to download the
“chromInfo” file form UCSC, which also contains lengths of chromosomes, but of
course, there is no ideogram track on the plot.
In some cases, when there is no internet connection for downloading or there is
no corresponding data avaiable on UCSC yet. You can manually construct a data frame
which contains ranges of chromosomes or a file path if it is stored in a file,
and sent to circos.initializeWithIdeogram()
.
cytoband.file = system.file(package = "circlize", "extdata", "cytoBand.txt")
circos.initializeWithIdeogram(cytoband.file)
cytoband.df = read.table(cytoband.file, colClasses = c("character", "numeric",
"numeric", "character", "character"), sep = "\t")
circos.initializeWithIdeogram(cytoband.df)
If you read cytoband data directly from file, please explicitly specify
colClasses
arguments and set the class of position columns as numeric
. The
reason is since positions are represented as integers, read.table
would
treat those numbers as integer
by default. In initialization of circular
plot, circlize needs to calculate the summation of all chromosome lengths.
The summation of such large integers would throw error of integer overflow.
By default, circos.intializeWithIdeogram()
uses all chromosomes which are
available in cytoband data to initialize the circular plot. Users can
choose a subset of chromosomes by specifying chromosome.index
. This
argument is also for ordering chromosomes (Figure 9.2).
circos.initializeWithIdeogram(chromosome.index = paste0("chr", c(3,5,2,8)))
text(0, 0, "subset of chromosomes", cex = 1)
When there is no cytoband data for the specified species, and when chromInfo data
is used instead, there may be many many extra short contigs. chromosome.index
can also be useful to remove unnecessary contigs.
9.1.2 Pre-defined tracks
After the initialization of the circular plot,
circos.initializeWithIdeogram()
additionally creates a track where there are
genomic axes and chromosome names, and create another track where there is an
ideogram (depends on whether cytoband data is available). plotType
argument
is used to control which type of tracks to add. (figure Figure 9.3).
circos.initializeWithIdeogram(plotType = c("axis", "labels"))
text(0, 0, "plotType = c('axis', 'labels')", cex = 1)
circos.clear()
circos.initializeWithIdeogram(plotType = NULL)
text(0, 0, "plotType = NULL", cex = 1)
9.1.3 Other general settings
Similar as general circular plot, the parameters for the layout can be
controlled by circos.par()
(Figure 9.4).
Do remember when you explicitly set circos.par()
, you need to call circos.clear()
to finish the plotting.
circos.par("start.degree" = 90)
circos.initializeWithIdeogram()
circos.clear()
text(0, 0, "'start.degree' = 90", cex = 1)
circos.par("gap.degree" = rep(c(2, 4), 12))
circos.initializeWithIdeogram()
circos.clear()
text(0, 0, "'gap.degree' = rep(c(2, 4), 12)", cex = 1)
9.2 Customize chromosome track
By default circos.initializeWithIdeogram()
initializes the layout and adds
two tracks. When plotType
argument is set to NULL
, the circular layout is
only initialized but nothing is added. This makes it possible for users to
completely design their own style of chromosome track.
In the following example, we use different colors to represent chromosomes and put chromosome names in the center of each cell (Figure 9.5).
set.seed(123)
circos.initializeWithIdeogram(plotType = NULL)
circos.track(ylim = c(0, 1), panel.fun = function(x, y) {
chr = CELL_META$sector.index
xlim = CELL_META$xlim
ylim = CELL_META$ylim
circos.rect(xlim[1], 0, xlim[2], 1, col = rand_color(1))
circos.text(mean(xlim), mean(ylim), chr, cex = 0.7, col = "white",
facing = "inside", niceFacing = TRUE)
}, track.height = 0.15, bg.border = NA)
9.3 Initialize with general genomic category
Chromosome is just a special case of genomic category.
circos.genomicInitialize()
can initialize circular layout with any type of
genomic categories. In fact, circos.initializeWithIdeogram()
is implemented
by circos.genomicInitialize()
. The input data for
circos.genomicInitialize()
is also a data frame with at least three columns.
The first column is genomic category (for cytoband data, it is chromosome
name), and the next two columns are positions in each genomic category. The
range in each category will be inferred as the minimum position and the
maximum position in corresponding category.
In the following example, a circular plot is initialized with three genes.
df = data.frame(
name = c("TP53", "TP63", "TP73"),
start = c(7565097, 189349205, 3569084),
end = c(7590856, 189615068, 3652765))
circos.genomicInitialize(df)
Note it is not necessary that the record for each gene is only one row.
In following example, we plot the transcripts for TP53, TP63 and TP73 in a circular layout (Figure 9.6).
tp_family = readRDS(system.file(package = "circlize", "extdata", "tp_family_df.rds"))
head(tp_family)
## gene start end transcript exon
## 1 TP53 7565097 7565332 ENST00000413465.2 7
## 2 TP53 7577499 7577608 ENST00000413465.2 6
## 3 TP53 7578177 7578289 ENST00000413465.2 5
## 4 TP53 7578371 7578554 ENST00000413465.2 4
## 5 TP53 7579312 7579590 ENST00000413465.2 3
## 6 TP53 7579700 7579721 ENST00000413465.2 2
In the following code, we first create a track which identifies three genes.
circos.genomicInitialize(tp_family)
circos.track(ylim = c(0, 1),
bg.col = c("#FF000040", "#00FF0040", "#0000FF40"),
bg.border = NA, track.height = 0.05)
Next, we put transcripts one after the other for each gene. It is simply to
add lines and rectangles. The usage of circos.genomicTrack()
and
circos.genomicRect()
will be discussed in Chapter 10.
n = max(tapply(tp_family$transcript, tp_family$gene, function(x) length(unique(x))))
circos.genomicTrack(tp_family, ylim = c(0.5, n + 0.5),
panel.fun = function(region, value, ...) {
all_tx = unique(value$transcript)
for(i in seq_along(all_tx)) {
l = value$transcript == all_tx[i]
# for each transcript
current_tx_start = min(region[l, 1])
current_tx_end = max(region[l, 2])
circos.lines(c(current_tx_start, current_tx_end),
c(n - i + 1, n - i + 1), col = "#CCCCCC")
circos.genomicRect(region[l, , drop = FALSE], ytop = n - i + 1 + 0.4,
ybottom = n - i + 1 - 0.4, col = "orange", border = NA)
}
}, bg.border = NA, track.height = 0.4)
circos.clear()
In Figure 9.6, you may notice the start of axes
becomes “0KB” while not the original values. It is just an adjustment of the
axes labels to reflect the relative distance to the start of each gene, while
the coordinate in the cells are still using the original values. Set
tickLabelsStartFromZero
to FALSE
to recover axes labels to the original
values.
9.4 Zooming chromosomes
The strategy is the same as introduced in Section 7.1.
We first define a function extend_chromosomes()
which copy data in subset of
chromosomes into the original data frame.
extend_chromosomes = function(bed, chromosome, prefix = "zoom_") {
zoom_bed = bed[bed[[1]] %in% chromosome, , drop = FALSE]
zoom_bed[[1]] = paste0(prefix, zoom_bed[[1]])
rbind(bed, zoom_bed)
}
We use read.cytoband()
to download and read cytoband data from UCSC. In following,
x ranges for normal chromosomes and zoomed chromosomes are normalized separetely.
cytoband = read.cytoband()
cytoband_df = cytoband$df
chromosome = cytoband$chromosome
xrange = c(cytoband$chr.len, cytoband$chr.len[c("chr1", "chr2")])
normal_chr_index = 1:24
zoomed_chr_index = 25:26
# normalize in normal chromsomes and zoomed chromosomes separately
sector.width = c(xrange[normal_chr_index] / sum(xrange[normal_chr_index]),
xrange[zoomed_chr_index] / sum(xrange[zoomed_chr_index]))
The extended cytoband data which is in form of a data frame is sent to
circos.initializeWithIdeogram()
. You can see the ideograms for chromosome 1
and 2 are zoomed (Figure 9.7).
circos.par(start.degree = 90)
circos.initializeWithIdeogram(extend_chromosomes(cytoband_df, c("chr1", "chr2")),
sector.width = sector.width)
Add a new track.
bed = generateRandomBed(500)
circos.genomicTrack(extend_chromosomes(bed, c("chr1", "chr2")),
panel.fun = function(region, value, ...) {
circos.genomicPoints(region, value, pch = 16, cex = 0.3)
})
Add a link from original chromosome to the zoomed chromosome (Figure 9.7).
circos.link("chr1", get.cell.meta.data("cell.xlim", sector.index = "chr1"),
"zoom_chr1", get.cell.meta.data("cell.xlim", sector.index = "zoom_chr1"),
col = "#00000020", border = NA)
circos.clear()


10.1. SPI Overview
When you implement a new Presto plugin, you implement interfaces and override methods defined by the SPI.
Plugins can provide additional Connectors, Types, Functions and System Access Control. In particular, connectors are the source of all data for queries in Presto: they back each catalog available to Presto.
Code
The SPI source can be found in the presto-spi
directory in the
root of the Presto source tree.
Plugin Metadata
Each plugin identifies an entry point: an implementation of the
Plugin
interface. This class name is provided to Presto via
the standard Java ServiceLoader
interface: the classpath contains
a resource file named com.facebook.presto.spi.Plugin
in the
META-INF/services
directory. The content of this file is a
single line listing the name of the plugin class:
com.facebook.presto.example.ExamplePlugin
For a built-in plugin that is included in the Presto source code,
this resource file is created whenever the pom.xml
file of a plugin
contains the following line:
<packaging>presto-plugin</packaging>
Plugin
The Plugin
interface is a good starting place for developers looking
to understand the Presto SPI. It contains access methods to retrieve
various classes that a Plugin can provide. For example, the getConnectorFactories()
method is a top-level function that Presto calls to retrieve a ConnectorFactory
when Presto
is ready to create an instance of a connector to back a catalog. There are similar
methods for Type
, ParametricType
, Function
, SystemAccessControl
, and
EventListenerFactory
objects.
Building Plugins via Maven
Plugins depend on the SPI from Presto:
<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-spi</artifactId>
<scope>provided</scope>
</dependency>
The plugin uses the Maven provided
scope because Presto provides
the classes from the SPI at runtime and thus the plugin should not
include them in the plugin assembly.
There are a few other dependencies that are provided by Presto, including Slice and Jackson annotations. In particular, Jackson is used for serializing connector handles and thus plugins must use the annotations version provided by Presto.
All other dependencies are based on what the plugin needs for its own implementation. Plugins are loaded in a separate class loader to provide isolation and to allow plugins to use a different version of a library that Presto uses internally.
For an example pom.xml
file, see the example HTTP connector in the
presto-example-http
directory in the root of the Presto source tree.
Deploying a Custom Plugin
In order to add a custom plugin to a Presto installation, create a directory
for that plugin in the Presto plugin directory and add all the necessary jars
for the plugin to that directory. For example, for a plugin called
my-functions
, you would create a directory my-functions
in the Presto
plugin directory and add the relevant jars to that directory.
By default, the plugin directory is the plugin
directory relative to the
directory in which Presto is installed, but it is configurable using the
configuration variable plugin.config-dir
. In order for Presto to pick up
the new plugin, you must restart Presto.
Plugins must be installed on all nodes in the Presto cluster (coordinator and workers).


Collect
Save and tag your online resources for easy access anytime, anywhere
Collect
Save and tag your online resources for easy access anytime, anywhere
Annotate
Annotate web pages and PDF's directly as you browse online
Organize
Organize your links, references and personal input to create a structured research base through Outliner
Share
Share your research with friends, classmates, colleagues or associates
Try it for free Now!


‘That Was Brutal’: Australian Ink Addict Went Blind After Tattooing Eyes Blue — Video
In layman’s terms, the procedure consists of injecting ink into a very thin layer of skin that covers the whites of our eyes – and it can prove to be extremely painful and even dangerous if anything goes wrong.
Amber Luke, a body-modifier from Australia, lost her vision for several weeks after changing the colour of her eyeballs.
“Once the eyeball was penetrated with the ink, it felt like [the tattoo artist] grabbed 10 shards of glass and rubbed it in my eye,” Luke, 25, said. “That happened four times per eye – that was pretty brutal. Unfortunately, my artist went too deep into my eyeball.”
“If your eyeball procedure’s done correctly, you’re not supposed to go blind at all. I was blind for three weeks.”
The procedure, known as scleral tattooing, is performed on the sclera (white part of the eye). The ink is injected under the surface of the conjunctiva, the incredibly thin layer of skin covering the sclera, and then spreads under the surface of the eye. An improper scleral tattoo may cause bad eye swelling and permanent loss of vision, so things appear to have worked out quite well for Luke, all things considered.
According to her Instagram, where she has built a 138,000-strong audience, the woman had her eyeballs tattooed at some point in 2017.
The Brisbane-based ink devotee told Barcroft TV that she got her first tattoo at 16, a year after she was diagnosed with severe clinical depression, as a way to deal with the negative energy inside her.
 She also plans to get herself a Brazilian Butt Lift – an increasingly popular but also dangerous procedure that transfers unwanted body fat from the stomach and/or flanks to the buttocks.
Her mother said she cried when she first saw the eye tattoo, but eventually put up with it.
“She never saw herself as being beautiful. She didn’t see herself through my eyes,” the mum said.
“But I’ve supported her because I could actually see the transition, the growth, and how it’s made her come to who she is today.”
Amber, who calls herself the Blue Eyed White Dragon, has reportedly spent over $37,000 on body modifications and wants to have her body fully covered by tattoos by next March.


This tests loading of a HTML page with a BMP image when the HTTP content-type is set to "text/html" . Expected : This page should have been RENDERED INCORRECTLY .


An example showing how to create services that inherit from a common factory.
I'm having:
You're having:


Jeans
New arrivals
New arrivals
COLLECTION 2016
8 items
Ripped Skinny Jeans
$24.99
New
Mega Ripped Jeans
$19.99
Washed Skinny Jeans
$20.50
Vintage Skinny Jeans
$14.99
Mega Ripped Jeans
$19.99
Washed Skinny Jeans
$20.50
Sale
Vintage Skinny Jeans
$14.99
Ripped Skinny Jeans
$24.99
Subscribe
To get special offers and VIP treatment:
Contact
Questions? Go ahead.
Store
Company Name
0044123123
<EMAIL_ADDRESS>We accept
Amex
Credit Card


What is COVID-19
Coronavirus
Coronavirus disease 2019 (COVID-19) is an infectious disease caused by severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2).[6] The disease was first identified in December 2019 in Wuhan, the capital of China's Hubei province, and has since spread globally, resulting in the ongoing 2019–20 coronavirus pandemic.
Learn More


NEW MODULE
Portal 8.5 system modules can be added by selecting a different category from
the dropdown on the right.
Choose modules to add as prerequisites.
{{module.title || module.name}}
Select Profiles:
|
|
{{profile.name}} |
The module can be added to a new profile by creating a new
profile.
The pre-defined modules can be added to profiles in the profiles
dialog.


Blastzone Studios and Totem V shakes hands on Project PLUR VR.
We're working hard to bring you an unreal music fest experience! Please stay tuned and stay patient folks!
We're seeing the light! We've been werkin' werkin' at Pro Desk Space out in Fullerton, CA. Launch date for early access game will be announced soon.
Members of the PLUR team meets at a hackathon in Los Angeles, CA. We were all strangers.
Together, we ventured off to start our own side project, Drew's List, under Andrew's lead. We eventually became Totem V.
Members decided to take on PLUR VR as a second project under Steven's lead and under his own company, Blastzone Studios. No big deal!
PLUR VR launches after months of hard work! Let's party!
Project Lead
Music Engineer Developer
UI Designer
Game Designer
UI Developer
Music Producer
Video + Media Content


--- layout: post title: "Time to replace REST (HTTP/1.1) with gRPC (HTTP/2)" date: 2019-03-11 23:45:13 -0400 background: '/img/posts/03.jpg' ---
HTTP/2 is a new version of HTTP, that is a major update of HTTP after the introduction of HTTP/1.1 in 1999.
While communicating client with the server, HTTP/1.1 process one request per TCP connection, to process multiple requests simultaneously, the client uses multiple TCP connections in parallel. HTTP/1.1 works on request-response protocol where each connection supports pipelining. This supports single direction streaming but does not support bi-directional streaming. HTTP/1.1 supports SSL, but for that, it establishes an extra connection, that is complete one extra cycle. More connections result in more wait times.
GRPC is a high-performance, open-source universal RPC framework initially developed by Google. It uses Protocol Buffers to define service. It establishes one connection like a tunnel and sends all response in one communication.
In REST, there is a separate request and response for header, body, SSL, etc.. with a separate connection is required. But in gRPC, once a connection is established, the client sends one request and in turns service returns all the response in the same connection.
gRPC is being supported by many languages and platforms. You can generate client and server stubs to communicate between client and server or between services using Protocol Buffers.
Below is officially supported language with supported compilers for gRPC:
The main usage scenarios for gRPC is:
Core Features that make it awesome:
gRPC introduced three new concepts, that is channels, remote procedure calls (RPCs) and messages. The relationship between these three is: each channel can have many RPCs, and each RPC can have many messages. It has a one-to-many relationship between channels and RPCs, and again one-to-many relationship between RPC and Messages.
Channels are virtual connecting between endpoints, RPC is HTTP/2 streams, and messages are associated with RPC and get sent as HTTP/2 data frames. A data frame can have many messages, or if one message is too big it can span to many data frames.
Once connection established between client and server, it creates like a tunnel and keeps that tunnel open for communication. For each set of client and server communication, there is a separate tunnel, in that way it will make several connections and keep all connections open that make communication super fast.
Using Resolver and Load Balancer, gRPC keeps the pool of connections healthy, alive and utilized. When a connection fails, the Load Balancer will begin to reconnect using the last known list of addresses, meanwhile, the resolver will begin to re-resolve the list of hostnames. Once resolution finished, the Load Balancer is informed of the new addresses. To check the health of connection gRPC periodically sending HTTP/2 PING frames on connections to determine whether the connection is still alive.
To write gRPC server or client, first, we can define service in a .proto file and implement client and servers in any gRPC supported languages.
.proto file will look like this:
syntax = “proto3”;
option java_multiple_files = true;
option java_package = “grpc.test.testMe”;
option java_outer_classname = “TestMeProto”;
option objc_class_prefix = “TM”;
package testMe;
service Testing {
rpc SayMessage (TestRequest) returns (TestReply) {}
}
message TestRequest {
string test = 1;
}
message TestReply {
string test = 1;
}
Using .proto file, generate server and client using Protocol Buffer Compiler. And in the final step, use gRPC API of respective language to write client and server. Protocol Buffer is a mechanism for serializing structured data. You can learn more about Protocol Buffer from :
https://developers.google.com/protocol-buffers/docs/proto3You can define four types of service method:
we have already written lots of microservices using REST, to move those microservices to gRPC not too much pain if you will plan it correctly.
You have all business logic written in each microservices, a plan to change from REST to gRPC can have below steps:
This is a relatively new technology that big companies already started implementing, still, HTTP/1.1 (REST) is leading in current developments of microservices. Slowly more tools and support will come and confidence will build up for HTTP/2. For sure REST will become thing of past and industry will move to HTTP/2.
Photographs by Unsplash.


About getting hired - Junior positions
08 Jul 2016If people in software professions talk about getting hired, they tend to get very opinionated.
Any developer can tell you stories of being hounded by more or less competent recruiters, some people will share their stories how recruiting is supposedly completely merciless and yet others seem to ascend to a junior position with minimal experience and training.
I’d like to start a little series on how hiring works at betterplace.org, and in general, so that things get a little less mystifying for everyone involved.
As the topic is broad, we’ll tackle it one step at a time.
Part one: Your first junior position
If you are new to the trade - especially if you’re not originally from a “techie background” - you’re probably wondering what it takes to get that first job in development.
Good news: We want you
Software developers are in high demand.
This is especially good for junior people who come from different walks of life. For you it means that recruiters have more time per resume, and it is less likely that you’re filtered out solely on formal criteria (e.g. “has no degree”).
It also means that there are more companies willing to train you on the job (as experienced people are hard to come by).
Make no mistake, though: I’d still encourage you to get all the education you can get - if you’re fresh out of school by all means do enroll in college and get that degree! (Prefer a practice-oriented program, though, unless you’d like to go into research…)
What is required to get started?
Even though the “formal” requirements are quite relaxed right now, any company hiring you will have “hard” requirements on what they need from new recruits.
At betterplace these go something like:
- You are able to program. And by that we mean that your are able to take a description of a problem and formulate a solution in code. A lot of our interviewing is about finding out just that.
- You understand the basics of the “theory” behind software development. In our daily work we deal with stuff like objects, classes, exceptions, inheritance, network protocols and so on.
- We want you on our team. Don’t get me wrong: This does not mean you have to be “just like us”. We do welcome diversity - both in background and in approach. Once we hire you, we will be around each other for hours every day. We will have to review your code, live with your decisions and you with ours. Thus we need to trust that we’ll have respectful and productive interactions with you in the long run.
Other places have other priorities - but any sane company will put those into their job descriptions.
And if I don’t meet the requirements?
First off, don’t give up just yet. Chances are that as a “junior” person, you fall into one of two groups:
- You just wrote your small app. You are amazed how easy that was, you are really excited about the things you can achieve and you think you’ll be able to do anything and everything within no time.
- Or: You already learned a lot. You have also learned that there are many things you don’t know yet, and that some problems are just hard. You may experience some self-doubt ’cause you’re not so sure if you’ll ever be as good as the folks you learn from.
In case one, just take a deep breath and take a reality check. It’s great that you just took your first step into the world of software, but there’s probably a lot to learn for you. The world will still be there when you are ready.
In the second case you’re probably doing better than you think you are. So don’t throw in the towel.
If you have a mentor, you may just want to get some honest feedback from her or him about where you stand.
And even if you’re not ready yet, remember: Developing software is a skill you can learn, not an innate ability. It just takes dedicated work (and a lot of practice) to succeed.
How do I apply?
The first step is dead simple. You just send us an email explaining why you want to work for us and what you can do, your CV and a link to some code that you wrote (e.g. github).
Formalities include:
- Your email is your “cover” letter. No need for a separate document, really
- Your CV should be attached as a PDF. We don’t really enjoy dealing with weird file formats, or having to visit the “CV web page” you spent so much time on
- The CV should be structured like a standard CV
- We don’t really need your picture, your marital status or your parents’ occupation. We will also skip any motivational blurb you chose to put into your CV
- We do want to know why you chose to apply to betterplace.org
- If you’re not a native speaker, we’d like to know how good your German and/or English language skills are
What happens next?
When we receive your application, you’ll get a friendly email that we received it. Then we will review your application and your github repo (or other code you sent). We may get in touch via email if there are open questions.
If we like your application, you will move on to a first Skype interview and eventually to the technical interviews. But this is stuff for another blog post.
When do I hear back from you?
We are aware that you’re probably holding your breath. Especially if this is your first job. And you’ll immediately get a friendly confirmation that we received your application.
Don’t be overly concerned if, after that, we take a little while to get back to you. We are just a small team, and we have to make time to review your code and CV.
Still, if at any time you feel like we have forgotten you, just ask us for an update.
The same goes if you really need quick feedback (e.g. you have to make a decision by day x). We will try our best to speed things up in that case.
What not to do…
Even though we are happy about every application, there are a few things that’ll quickly get you kicked out of the process:
- Don’t be generic. “To whom it may concern” is not something that gets you off to a good start: Your applications are read by an actual person. Her name is Claudia. And if you had actually read our job posting you would know that. Why should we be interested in you if you’re not even interested in sending us a personalized email? Applications that look like copied and pasted just make you look bad.
- Don’t copy and paste into your github repositories. We very much look into the code that you have on github. After all, your coding is a major part of why we want hire you. We like your repo to be authentic. Which means it should be clear from the git history what your contributions are, and what you got from elsewhere. It is totally fine to fork someones code and improve it, and to collaborate on code. Just never copy stuff from other repos, or from Stackoverflow, or wherever and check it in under your own name.
- Don’t use an inappropriate format or tone. For example: Emails that contain nothing except “Hi I’m Al. Saw your job posting. Just contact me on skype if you’re interested.” are not going to generate much interest, to put it mildly.
What we don’t do
There are some things that people are often annoyed or scared about, that we won’t do to you:
-
Ask brainteaser questions Actually, nobody in their sane mind uses those any more. We will ask simple coding questions during our Skype interviews, but nothing with pirates, goats or foxes.
-
Whiteboard coding Yes, we will have you do coding exercises. We will also expect you to use a whiteboard or paper to explain things. But we will not force you to develop code only with a whiteboard or paper. You may jot down code if you chose to, but you’ll always have the option to use a proper editor and run the code you write.
Find out more
- Google guide to developing technical skills. It’s well worth to check out their site. They offer a lot of insights into their hiring process. And even if it is different from ours (or that of other companies) much of it applies in general.
- Rails Conf video about getting your first Rails job by Molly Black. Great general advice.
- Getting Your Résumé Read, by Joel Spolsky. Very direct, slightly outdated. While you may do better than his candidates at place that gets less résumés than Joel (we do), this is still a worthwhile glimpse into the mind of someone who reads those things.


From 1998 to 2003, I was a daily user of Ultram. At the time, given a choice between hydrocodone or oxycodone and Ultram, I would've taken the Ultram almost every time. I was first given Ultram by my doctor for migraine headaches. After taking the first dose, I was instantly in love with the substance. Despite the typical opioid side-effects like itching, nausea, etc, I found tricks to overcome vomiting. For instance, if I took Ultram in a large dose (i.e. over 400 mg daily), spacing the doses over a couple of hours instead of doing it all at once, vomiting isn't as likely to occur.
Ultram gave me a full body buzz like no other I had felt. It was better than sex, which was a good thing since reaching orgasm with tramadol is almost impossible in high doses. My affair with Ultram continued for several years, fed by a relative who was able to get me free samples of the drug, as she worked at a doctor's office and the pills are not a controlled substance. At the height of my usage, I was taking over 700 milligrams a day. For those who doubt the addictive quality of tramadol, I can attest to severe withdrawal symptoms when I came off the drug for a week or two every month. Body aches, headaches, trembling, nausea and ungodly diarrhea. Depending on my average dose, the withdrawal could be as bad as coming off Lortab. But despite the drawbacks, the feeling I got from Ultram was worth it for the feeling it gave me.
The end of the road, however, came for me in 2003 following three different seizure episodes. One of the side-effects of Ultram is a lowering of a person's seizure threshold. While I had never had a seizure prior to taking tramadol, it didn't matter. I was standing each time I seized, and the fall from each episode broke vertebrae in my back. I ended up with six compression fractures in my back, one of which failed to heal and required a spinal fusion surgery.
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.


{% extends "layout.html" %} {% block content %}
We chose to create this website because Bryan and Sheldon had experience with Data Mining and Kyle had general web development experience.
Currently the website is still in production. We have made a lot of progress on the website since Bryan had to parse the MovieLens dataset and Sheldon had to retrofit Python Code Users are able to register and log in to the website. Anyone is able to search our database for movies, but only registered users can rate and review movies. Registered users are also allowed to get a list of 15 movies to be recommended based off of their ratings of movies.
We currently are in the process of adding admin privileges so Admins can delete hateful reviews with no sustenance. Admins will be able to ban or delete users and add new movies.
We have error messages are already made on the backend, we just need to use Javascript to display the errors.
We are going to clean the site up a bit more to make it more mobile friendly
This information on the sidebar will probably be made into Modals to have cleaner code.


Pan fry a pita, then top it up with toppings of your choice. Suggestion for topping includes fruit, ice cream, chocolate, peanut butter. This is a great easy to make snack.
20-25mins


?REVISION
of
CUBAN
PLANTS
Myriophyllum
pinna
turn
(╚'al't}
S'PiSTton
1
Det.
J.P.
Carabia
194
.
-r
"'
W
?
Plantă?
Cubenses
Wrightianae.
ttjjk
└└j
-
.
?*
%?
Coll.
C.
WRIGHT.
ft
HThEds
NEW
YORK
BOTANICAL
GARDEN
500394
Myriophyllum
pinnatum
(Walt.)
B.S.P*
E.
N.
Nelson
&
R.
W.
Couch
1934
Herbarium
of
Oral
Roberts
University
01500394
Legend -
Level of confidence that token is an accurately-transcribed word
extremely low
very low
low
undetermined
medium
high
very high


Add Text Q.
[Question Header]
[Question Text]
-
+
Add another
Maximum
Not Editable
Use with Logic
(if checked this field shows in the "Insert option" tool)
Save
Add List Q.
[Question Header]
[Question Text]
-
+
Allow Multiple Selections
(if not checked, only one selection allowed; if checked, more than one selection is allowed)
Use with Logic
(if checked this field shows in the "Insert option" tool)
Save
Insert Option
This option shows if:
Choose Condition
Choose option
equals
does not equal
contains
does not contain
is more than
is less than
Add an additional requirement to make the condition true.
Insert
Copy Field
Insert Field


| gamSim {mgcv} | R Documentation |
Function used to simulate data sets to illustrate the use of
gam
and gamm
. Mostly used in help files to keep down
the length of the example code sections.
gamSim(eg=1,n=400,dist="normal",scale=2,verbose=TRUE)
eg |
numeric value specifying the example required. |
n |
number of data to simulate. |
dist |
character string which may be used to spcify the distribution of the response. |
scale |
Used to set noise level. |
verbose |
Should information about simulation type be printed? |
See the source code for exactly what is simulated in each case.
Gu and Wahba 4 univariate term example.
A smooth function of 2 variables.
Example with continuous by variable.
Example with factor by variable.
An additive example plus a factor variable.
Additive + random effect.
As 1 but with correlated covariates.
Depends on eg
, but usually a dataframe, which may also contain some information on
the underlying truth. Sometimes a list with more items, including a data frame for model fitting.
See source code or helpfile examples where the function is used for further information.
Simon N. Wood<EMAIL_ADDRESS>## see ?gam


cognitive diversity, actual diversity, and the benefits of both
pages 204-208 in resilience have two really fascinating cases that make two astounding points:
cognitive diversity on a team can compensate for and even create better outcomes than intelligence on a team, and actual diversity and cognitive diversity together can be mutually reinforcing and beneficial. so what does all that mean? i’ll explain.
cognitive diversity
scott page is a professor of complex systems, political science, and economics and the university of michigan. he defines cognitive diversity as such: the distribution of different kinds of thinkers within a group.
kevin dunbar, a psychologist at the university of toronto, studied cognitive diversity and its impacts on team performance. turns out that having a team with a high (but not too high) level of cognitive diversity can create higher levels of performance.
dunbar took two scientific research labs and studied them in their actual research environments. team x had a high level of overall intelligence but a relatively narrow range of scientists. team y had a much more diverse set of scientists (i’m not sure how the intelligence level compared). the labs have no connection to each other.
at one point, teams x and y ran into a similar problem. team y, the cognitively diverse team, solved the problem in two minutes at a single meeting. team x was still struggling with the problem two months later. i can only imagine how much time and progress team x wasted trying to solve a problem that team y solved in minutes.
dunbar’s theory is that having different ways to think about a problem allows more access to alternative thinking about potential solutions. when people in a group think similarly, for example, they tend to use similar and more complex metaphors to describe situations because they have shared understanding of the knowledge required to make sense of them. teams with different thinking and backgrounds tend to use more basic but wide ranging types of metaphors in order to spam knowledge gaps between members. this allows more diverse ways of thinking about the same problem which seems to lead to solution faster.
now all of this said, there are certainly tradeoffs to having more diverse teams over similar teams. as with everything, there’s a balance.
teams with low cognitive diversity have low startup costs because they share language and knowledge. the means they can probably move faster when things are going well.
teams with high cognitive diversity have high communications cost. they can’t easily explain their thinking to others without shared backgrounds so they spend extra time doing so. however, the benefit that that creates is ability to blast through problems quickly, as opposed to getting bottle-necked by a lack of ability to think outside the box.
actual diversity
in a similar way, “actual” diversity (gender, class, race, etc.) also has benefits. the example used in the book was about gender.
when men find lab surprising lab results, they tend to assume they know why and keep moving forward (in my opinion, this is an effect of socialization, not physiology). either way, this pattern has the effect of sending teams down wrong pathways. incorrect early assumptions lead to wasted time down the road and makes it difficult to backtrack to find mistakes.
women, however, tend to try to stop and explain surprising results by doing more rigorous testing. by looking for ways to recreate the results, they generate more firm data and thus a higher ability to explain results.
now, from the outside, this may look like women are slower or less aggressive researchers. however, in reality, women are just as aggressive about their research; they just go about the work in completely different ways.
holy shit, that took 30 minutes to write. :O


I am a master student of computational science and engineering at Rice University.
Here is my LinkedIn profile.
Here is my GitHub profile.


Voter Power User
Persona
- Name: Steven Lucero
- Age: 25
- Gender: Male
- Occupation: Amateur YouTuber
- Devices:
- mobile- Samsung Galaxy Note 10 Plus
- laptop- Microsoft Surface Laptop 3
- camera- Canon EOS 80D, GoPro Hero 8
- tablet- Microsoft Surface Go 2
- Attitudes: Aspiring YouTuber. Has worked various restaurant jobs since culinary school.
Favorite food to make and eat is mac and cheese. Regularly uploads pictures of his home cooked creations to
his various social media profiles. Looking for new platforms to attract followers.
- Needs:
- Ability to upload multiple photos of his food
- A secure platform protected from the trolls of the internet
- A competitive style showcase to show how his food stands out
User Story
As a power voter user, I want to upload and vote on multiple photos.
Use Case
Steven is trying his hand at something new: being a person on the internet. Not just any person, but the next
YouTube Chef Sensation! Being trained in a commercial kitchen already, he knew this was something he could
dominate. His specialty: Mac and Cheese. His social media profiles are doing okay but he wants that competitive
feeling he had with the staff at the various restaurants he worked before. Steven discovers That's What Cheese
Said, a website dedicated to ranking Mac and Cheese dishes from restaurants in the area and from user submissions.
After submitting a few votes, Steven knows this is exactly what he was looking for!
Interaction Flow
PreCondition: Steven is on the homepage of That's What Cheese Said
PostCondition: Steven has successfully submitted and voted on the first of many mac photos
- Steven clicks on "create account"
- Site loads empty username and password fields for user to complete
- Steven selects username and password
- Site redirects user to homepage logged in
- Steven clicks submit mac photo
- Site loads empty file selection field
- Steven selects most recent Mac and Cheese photo and clicks submit
- Site loads Steven's photo into pool of photos for users to vote
- Steven now begins voting on user's mac and cheese photos, clicking on the most attractive out of 2 randomly
given photos of mac and cheese
- Site tallys vote and presents 2 more random user submitted photos
- Steven makes note to regularly upload/vote on photos and let the votes tally up, hoping to be in the Top 5 ASAP
Frequency of use
Steven plans to vote 5-7 times per week and wants to upload a new photo at least once per week


mainWindow module¶
- platform
Unix, Windows
- synopsis
This is the main module. Run this file to start the GUI.
- moduleauthor
Michael Eller<EMAIL_ADDRESS>-
class
mainWindow.
Ui_MainWindow
[source]¶ Bases:
object
The graphical structure of Ui_MainWindow was generated by QtDesigner. The window contains a settings menu, LCD display, and a button to launch a live plot.
-
setupUi
(MainWindow)[source]¶ This function initializes the window by altering the MainWindow object passed (by reference) to it.
- Parameters
MainWindow – this must be of type PyQt5.QtWidgets.QMainWindow
-
retranslateUi
(MainWindow)[source]¶ This function translates the GUI objects of this class to the passed MainWindow objcect, then sets the text of the various objects in the main window.
- Parameters
MainWindow – this must be of type PyQt5.QtWidgets.QMainWindow
-
check_port
()[source]¶ Checks to see if the user has set a port. If not, the user will not be able to start the live plot or LCD.
-
open_settings_filter
()[source]¶ This function spawns an instance of windowFilterGUI.Ui_Dialog. This is triggered by clicking Menu > Settings > Window Filter.
-
open_settings_sample_rate
()[source]¶ This function spawns an instance of sampRateGUI.Ui_Dialog. This is triggered by clicking Menu > Settings > Sample Rate.
-
open_settings_scale_axes
()[source]¶ This function spawns an instance of scaleAxesGUI.Ui_Dialog. This is triggered by clicking Menu > Settings > Scale Axes.
-
open_settings_port
()[source]¶ This function spawns an instance of portsGUI.Ui_Dialog. This is triggered by clicking Menu > Settings > Port Connection.
-
show_plot
()[source]¶ This function spawns an instance of plotGUI.Ui_Dialog. It is triggered by the user clicking the large ‘Plot’ button.
-
Usage¶
import sys
from PyQt5 import QtWidgets
from mainWindow import Ui_MainWindow
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())


Classy
2/9/2016
A class in Ruby can be thought of as a blueprint. The class is like a controlled environment for a program. You can define a class and then make certain rules to go along with that class. Let's say that we're writing a program that tells us if we have enough ingredients for certain items. The first step is to create a class: my_kitchen. We do this because we're going to define variables and methods based on what I have.
Instance variables are really important when working in classes. An instance variable is a variable that has a set value that remains intact throughout the class. Let's say I want to set up some core ingredients values up in my program. For example, I have 10 eggs. This is a fact. In my kitchen right now, I have 10 eggs. The value of eggs will remain constant throughout my program. Instead of defining the number of eggs I have in each method I create, I can make it an instance variable in the begining of the program and continue to use eggs as I go!


Current Light capabilities.
@since RPC 5.0
Constructs a newly allocated SDLLightCapabilities object with the name of the light or group of lights
- (nonnull instancetype)initWithName:(nonnull SDLLightName)name;
init(name: SDLLightName)
The name of a light or a group of lights
An instance of the SDLLightCapabilities class
Constructs a newly allocated SDLLightCapabilities object with given parameters
- (nonnull instancetype)initWithName:(nonnull SDLLightName)name
densityAvailable:(BOOL)densityAvailable
colorAvailable:(BOOL)colorAvailable
statusAvailable:(BOOL)statusAvailable;
init(name: SDLLightName, densityAvailable: Bool, colorAvailable: Bool, statusAvailable: Bool)
The name of a light or a group of lights
light’s density can be set remotely
Light’s color can be set remotely by using the RGB color space
whether status is available
An instance of the SDLLightCapabilities class
@abstract The name of a light or a group of lights
Required, SDLLightName
@property (nonatomic, strong) SDLLightName _Nonnull name;
var name: SDLLightName { get set }
@abstract Indicates if the light’s density can be set remotely (similar to a dimmer).
Optional, Boolean
@property (nonatomic, strong, nullable) NSNumber<SDLBool> *densityAvailable;
var densityAvailable: (NSNumber & SDLBool)? { get set }
@abstract Indicates if the light’s color can be set remotely by using the RGB color space.
Optional, Boolean
@property (nonatomic, strong, nullable) NSNumber<SDLBool> *colorAvailable;
var colorAvailable: (NSNumber & SDLBool)? { get set }
@abstract Indicates if the status (ON/OFF) can be set remotely. App shall not use read-only values (RAMP_UP/RAMP_DOWN/UNKNOWN/INVALID) in a setInteriorVehicleData request.
Optional, Boolean
@property (nonatomic, strong, nullable) NSNumber<SDLBool> *statusAvailable;
var statusAvailable: (NSNumber & SDLBool)? { get set }


"""Higher order operations initialized with a component or components."""
from functools import reduce
from .core import MultipleOperation, SingleOperation
[docs]class Compose(MultipleOperation):
"""Implement a pipeline to execute a sequence of components.
Propagating attributes."""
[docs] def __init__(self, components, **kwargs):
"""
Initialize a pipeline.
Args:
components (iterable): an iterable containing components.
kwargs (dict): arguments to pass to Encoder as attributes.
"""
super(Compose, self).__init__(
components=components, attributes=kwargs
)
[docs] def __call__(self, an_object):
"""
Execute a composition of components.
Args:
an_object (object): an input for the composition.
Returns:
a xr.DataArray or iterable of xr.DataArray generated from the
composition.
"""
attributes = self.attributes # propagate attributes
for component in self.components:
component.attributes.update(attributes)
an_object = component(an_object)
attributes.update(component.attributes) # after call
return an_object
[docs]class Broadcast(MultipleOperation):
"""Broadcast an input using multiple components."""
[docs] def __init__(self, components, **kwargs):
"""
Initialize the operation.
Args:
components (iterable): an iterable containing components.
kwargs (dict): arguments to pass to Brancher as attributes.
"""
super(Broadcast, self).__init__(
components=components, attributes=kwargs
)
[docs] def __call__(self, an_object):
"""
Broadcast an object into an iterable of xr.DataArrays
using multiple components.
Args:
an_object (object): an object.
Returns:
an iterable of xr.DataArrays.
"""
operation_attributes = self.attributes.copy() # collect attributes
for component in self.components:
self.attributes.update(component.attributes)
component.attributes.update(operation_attributes)
yield component(an_object)
[docs]class BroadcastMap(MultipleOperation):
"""Broadcast input to multiple Map components initialized on the fly."""
[docs] def __init__(self, components, **kwargs):
"""
Initialize the operation.
Args:
components (iterable): an iterable containing components.
kwargs (dict): arguments to pass to Brancher as attributes.
"""
super(BroadcastMap, self).__init__(
components=components, attributes=kwargs
)
[docs] def __call__(self, an_iterable):
"""
Apply each object to all components.
Args:
an_iterable (iterable): an iterable of objects.
Returns:
an iterable of xr.DataArrays.
"""
an_iterable = list(an_iterable)
operation_attributes = self.attributes.copy() # collect attributes
for component in self.components:
self.attributes.update(component.attributes)
component.attributes.update(operation_attributes)
for an_object in Map(component, **operation_attributes)(an_iterable): # noqa
yield an_object
[docs]class ZipMap(MultipleOperation):
"""Map component of an iterable to respective xr.DataArray of an iterable.
"""
[docs] def __init__(self, components, **kwargs):
"""
Initialize the zip.
Args:
components (iterable): an iterable containing components.
kwargs (dict): arguments to pass to components as attributes.
"""
super(ZipMap, self).__init__(
components=components, attributes=kwargs
)
[docs] def __call__(self, an_iterable):
"""
Encoding an iterable to an iterable of xr.DataArrays, the attributes
are added to xr.DataArray.
Args:
an_iterable (iterable): an_iterable.
Returns:
an iterable of xr.DataArrays.
"""
operation_attributes = self.attributes.copy() # collect attributes
for component, an_object in zip(self.components, an_iterable):
self.attributes.update(component.attributes)
component.attributes.update(operation_attributes)
yield component(an_object)
[docs]class Map(SingleOperation):
"""Apply component to all objects in iterable"""
[docs] def __init__(self, component, **kwargs):
"""
Initialize the reduction.
Args:
component (Component): a component accepting iterable.
kwargs (dict): arguments to pass to component as attributes.
"""
super(Map, self).__init__(
component=component, attributes=kwargs
)
[docs] def __call__(self, an_iterable):
"""
Map the component over an iterable using the standard map.
Args:
an_iterable (iterable): an iterable of objects.
Returns:
a map object (iterable).
"""
return map(self.component.__call__, an_iterable)
[docs]class Reduce(SingleOperation):
"""Apply component with iterable input with single returned object."""
[docs] def __init__(self, component, **kwargs):
"""
Initialize the reduction.
Args:
component (Component): a component accepting iterable.
kwargs (dict): arguments to pass to component as attributes.
"""
super(Reduce, self).__init__(
component=component, attributes=kwargs
)
[docs] def __call__(self, an_iterable):
"""
Reduce an iterable to a single object using the standard reduce.
Args:
an_iterable (iterable): an iterable of objects.
Returns:
an object.
"""
return reduce(self.component.__call__, an_iterable)


--- title: Energy Demand Analysis w/ Time Series Forecasting author: Rihad Variawa date: '2019-02-02' slug: energy-demand-analysis-w-time-series-forecasting categories: - Machine Learning - R tags: [] header: image: 'headers/ere.jpg' summary: 'Energy Demand Forecasting' ---
This document focuses on an analysis of the energy demands of a European country.
The dataset of the daily energy needs (in GWh) between 2004 and 2010.
A time series forecast using the arima model as follows:
sourceURL <- 'https://gist.githubusercontent.com/Peque/715e91350f0e68e3342f/raw/d28312ac0e49888a5079fcea188770acaf3aa4a2/mme.csv'
# download and load data into memory
tmp <- tempfile()
download.file(sourceURL, tmp, method = 'curl')
df <- read.csv(tmp)
unlink(tmp)
head(df)
date demand
1 01-01-04 488.07
2 02-01-04 582.02
3 03-01-04 575.58
4 04-01-04 542.39
5 05-01-04 600.26
6 06-01-04 544.76
# convert date strings to POSIX dates
df$date <- strptime(df$date, format = '%d-%m-%y')
# day of week
df$day <- as.factor(strftime(df$date, format = '%A'))
# day of year
df$yearday <- as.factor(strftime(df$date, format = '%m%d'))
# structure for analysis
str(df)
'data.frame': 3288 obs. of 4 variables:
$ date : POSIXlt, format: "2004-01-01" "2004-01-02" ...
$ demand : num 488 582 576 542 600 ...
$ day : Factor w/ 7 levels "Friday","Monday",..: 5 1 3 4 2 6 7 5 1 3 ...
$ yearday: Factor w/ 366 levels "0101","0102",..: 1 2 3 4 5 6 7 8 9 10 ...
# df split to create test set
df_test <- subset(df, date >= strptime('01-01-2011', format = '%d-%m-%Y'))
df <- subset(df, date < strptime('01-01-2011', format = '%d-%m-%Y'))
ts <- ts(df$demand, frequency = 1)
# df and time series objects
demandts <- xts(df$demand, df$date)
plot(demandts, main = 'Energy Demand Preview', xlab = 'Time', ylab = 'Demand (GWh)')
Observations:
# demand by day of the week
ggplot(df, aes(day, demand)) +
geom_boxplot(fill='slateblue', alpha=0.2) + xlab('Time') + ylab('Demand (GWh)') + ggtitle('Demand per day of the week') +
theme_classic()
Observations:
# aggregating demand by day of the year (average)
avg_demand_per_yearday <- aggregate(demand ~ yearday, df, 'mean')
# computing the smooth curve for the time series. Data is replicated before computing the curve in order to achieve continuity
smooth_yearday <- rbind(avg_demand_per_yearday, avg_demand_per_yearday, avg_demand_per_yearday, avg_demand_per_yearday, avg_demand_per_yearday)
smooth_yearday <- lowess(smooth_yearday$demand, f = 1 / 45)
l <- length(avg_demand_per_yearday$demand)
l0 <- 2 * l + 1
l1 <- 3 * l
smooth_yearday <- smooth_yearday$y[l0:l1]
# plotting results
par(mfrow = c(1, 1))
# setting year to 2000 to allow existence of 29th February
dates <- as.Date(paste(levels(df$yearday), '2000'), format = '%m%d%Y')
plot(dates, avg_demand_per_yearday$demand, type = 'l', main = 'Average Daily Demand', xlab = 'Time', ylab = 'Demand (GWh)')
lines(dates, smooth_yearday, col = 'yellow', lwd = 2)
Observations:
par(mfrow = c(1, 2))
diff <- avg_demand_per_yearday$demand - smooth_yearday
abs_diff <- abs(diff)
barplot(diff[order(-abs_diff)], main = 'Smoothing error', ylab = 'Error')
boxplot(diff, main = 'Smoothing error', ylab = 'Error')
Observations:
head(strftime(dates[order(-abs_diff)], format = '%B %d'), 10)
[1] "January 01" "December 25" "May 01" "January 06" "August 15"
[6] "December 08" "December 31" "October 12" "November 01" "December 26"
The exact dates which are generating these errors are indeed, holidays or the day just before holidays (as is the case for the 25th November and 31th Devember).
par(mfrow = c(2, 2))
acf(df$demand, 100, main = 'Autocorrelation')
acf(df$demand, 1500, main = 'Autocorrelation')
pacf(df$demand, 100, main = 'Partial autocorrelation')
pacf(df$demand, 1500, main = 'Partial autocorrelation')
Observations:
I’ll decompose the time series for estimates of trend, seasonal, and random components using moving average method.
The model is:
Y[t]=T[t]∗S[t]∗e[t]
where
Y(t) is the number of weeks at time t, T(t) is the trend component at time t, S(t) is the seasonal component at time t, e(t) is the random error component at time t.
# decomposition of weekly seasonal time series
wts <- ts(ts, frequency = 7)
dec_wts <- decompose(wts)
plot(dec_wts)
# demand minus week seasonal
df$demand_mws <- df$demand - as.numeric(dec_wts$season)
# decomposition of yearly time series
yts <- ts(subset(df, yearday != '0229')$demand_mws, frequency = 365)
dec_yts <- decompose(yts)
plot(dec_yts)
Observations:
days365 <- which(df$yearday != '0229')
february29ths <- which(df$yearday == '0229')
df$demand_mwys[days365] <- df$demand_mws[days365] - as.numeric(dec_yts$season)
# Fill values on February 29th
df$demand_mwys[february29ths] <- df$demand_mws[february29ths]
# form new ts from original observations less the weekly and yearly seasonal data
par(mfrow = c(1, 1))
ts_mwys <- ts(df$demand_mwys, frequency = 1)
demandts_mwys <- xts(df$demand_mwys, df$date)
plot(demandts_mwys, main = 'Energy Demand Less Seasonal Data', xlab = 'Time', ylab = 'Demand (GWh)')
# aggregating demand by day of the year (average)
avg_demand_mwys_per_yearday <- aggregate(demand_mwys ~ yearday, df, 'mean')
# computing the smooth curve for the time series. Data is replicated before computing the curve in order to achieve continuity
smooth_yearday <- rbind(avg_demand_mwys_per_yearday, avg_demand_mwys_per_yearday, avg_demand_mwys_per_yearday, avg_demand_mwys_per_yearday, avg_demand_mwys_per_yearday)
smooth_yearday <- lowess(smooth_yearday$demand_mwys, f = 1 / 45)
l <- length(avg_demand_mwys_per_yearday$demand_mwys)
l0 <- 2 * l + 1
l1 <- 3 * l
smooth_yearday <- smooth_yearday$y[l0:l1]
# plotting the result
par(mfrow = c(1, 1))
# setting year to 2000 to allow existence of 29th February
dates <- as.Date(paste(levels(df$yearday), '2000'), format = '%m%d%Y')
plot(dates, avg_demand_mwys_per_yearday$demand_mwys, type = 'l', main = 'Mean Daily Demand', xlab = 'Time', ylab = 'Demand (GWh)')
lines(dates, smooth_yearday, col = 'yellow', lwd = 2)
par(mfrow = c(1, 2))
diff <- avg_demand_mwys_per_yearday$demand_mwys - smooth_yearday
abs_diff <- abs(diff)
barplot(diff[order(-abs_diff)], main = 'Smoothing error', ylab = 'Error')
boxplot(diff, main = 'Smoothing error', ylab = 'Error')
Observations:
# new acf and pacf created
par(mfrow = c(1, 2))
acf(df$demand_mwys, 100, main = 'Autocorrelation')
pacf(df$demand_mwys, 100, main = 'Partial autocorrelation')
The initial ARIMA parameters have been found using the R \(auto.arima()\) function. The differencing parameter \(d\) is selected using the KPSS test. If the null hypothesis of stationarity is accepted when the KPSS is applied to the original time series, then \(d = 0\). Otherwise, the series is differenced until the KPSS accepts the null hypothesis. After that, \(p\) and \(q\) are selected using either AIC or BIC. The SARIMA model has been created using those ARIMA parameters.
model <- Arima(ts, order = c(2, 1, 2), list(order = c(1, 1, 1), period = 7))
# forecast the error w/ test dataframe
auxts <- ts
auxmodel <- model
errs <- c()
pred <- c()
perc <- c()
for (i in 1:nrow(df_test)) {
p <- as.numeric(predict(auxmodel, newdata = auxts, n.ahead = 1)$pred)
pred <- c(pred, p)
errs <- c(errs, p - df_test$demand[i])
perc <- c(perc, (p - df_test$demand[i]) / df_test$demand[i])
auxts <- ts(c(auxts, df_test$demand[i]), frequency = 7)
auxmodel <- Arima(auxts, model = auxmodel)
}
par(mfrow = c(1, 1))
plot(errs, type = 'l', main = 'Error in the forecast')
plot(pred, type = 'l', main = 'Real vs. Forecast', col = 'green')
lines(df_test$demand)
legend('topright', c('Real', 'Forecast'), lty = 1, col = c('black', 'green'))
abserr <- mean(abs(errs))
percerr <- mean(abs(perc)) * 100
percerr
[1] 2.299037
Mean error across test datadrame (2.3%).
# special days present less demand than others. Those days may be taken into account in order to reduce the error
specialday <- function(day) {
correction = 0
if (format(day, '%m%d') %in% c('0101', '0501', '0106', '0815', '1012', '1101', '1206', '1208', '1224', '1225', '1226', '1231'))
correction = -100
else if (format(day, '%m%d') %in% c('0319'))
correction = -50
# on Sunday, do not apply correction
if (as.factor(strftime(day, format = '%A')) == 'Sunday')
return(0)
return(correction)
}
model <- Arima(ts, order = c(2, 1, 2), list(order = c(1, 1, 1), period = 7))
auxts <- ts
auxmodel <- model
errs <- c()
pred <- c()
perc <- c()
for (i in 1:nrow(df_test)) {
p <- as.numeric(predict(auxmodel, newdata = auxts, n.ahead = 1)$pred)
correction = specialday(df_test$date[i])
pred <- c(pred, p + correction)
errs <- c(errs, p + correction - df_test$demand[i])
perc <- c(perc, (p + correction - df_test$demand[i]) / df_test$demand[i])
if (!correction)
auxts <- ts(c(auxts, df_test$demand[i]), frequency = 7)
else
auxts <- ts(c(auxts, p), frequency = 7)
auxmodel <- Arima(auxts, model = auxmodel)
}
par(mfrow = c(1, 1))
plot(errs, type = 'l', main = 'Error in the forecast')
plot(pred, type = 'l', main = 'Real vs. Forecast', col = 'green')
lines(df_test$demand)
legend('topright', c('Real', 'Forecast'), lty = 1, col = c('black', 'green'))
abserr <- mean(abs(errs))
percerr <- mean(abs(perc)) * 100
percerr
[1] 1.956568
Mean error across test dataframe (1,96%).
autoplot(forecast(Arima(tail(ts, 200), model = model))) +
labs(x="Time", y="Energy Demand (GWh)") +
theme_classic()


Hi, I want to follow this tutorial :
http://openenergymonitor.org/emon/buildingblocks/how-to-build-an-arduino...
so I buy this current transform SCT-013-000
Now I'm testing this sensor with a multimeter , so I set multimeter for measure voltage, and plug two cables of SCT-013-000 with multimeter cables, something like shown in this video :
https://www.youtube.com/watch?v=IHozA4Ds5Ts&feature=youtu.be
but I see always 0 V, nothing change, so I think my sensor doesn't work. I buy it on openenergymonitor shop :(
Re: Problem with current transform SCT-013-000
(Didn't watch the video - blocked to me.) The clue is in the name - CURRENT transformer. You must set your meter to read 50 mA ac, and put your CT on a single core cable, to read anything. The connections on the plug are tip and sleeve, there is no connection to the ring. If you put the CT on a twin-core or three-core cable, it does not work. It should look like this:
Re: Problem with current transform SCT-013-000
https://m.youtube.com/watch?v=IHozA4Ds5Ts&feature=youtu.be
same link for mobile.
I do same thing shown in video, I link a lamp with a twin-core cable, split cable and put CT on phase then connect CT output cables in multimeter. As shown in the video multimeter is set to read Vac and value grows when turn on a lamp . Same not work to me. I can't read 50 mA ac becouse my multimeter can read only digital and analogic Voltage and digital current .
But I plug CT in Arduino following tutorial of CT only measurement with same bad result
Re: Problem with current transform SCT-013-000
The CT is rated at 100 A. If you are using a lamp rated at maybe 60 W ( = 250 mA), you should expect to see only 125 μA. The CT gives you an ALTERNATING CURRENT output.
Can you measure resistance with your meter? If you can, you should measure approximately 100 Ω between Tip and Sleeve of your plug.
[The photo shows a temperature sensor wiring. You will have a white wire to the Tip and a red wire to the Sleeve. There is no connection to the Ring.]
"digital and analogic Voltage and digital current"
I think you mean "direct" and "alternating" there:
Re: Problem with current transform SCT-013-000
thank you, I had already cut the cable just below the 3,5mm plug , so now I work directly with white and red cable.
I try this :
connect black cable of multimeter with white cable of CT and red with red, set multimeter on 200 ohm for measure resistor, turn on the light but nothing happen, I see always a 1 digit on screen.
I do same test without connect CT on lamp cable with same results.
I try all ohm values resolution but nothing change
Re: Problem with current transform SCT-013-000
is important wire thickness ? The cable that I put into the CT is much thinner than that of the image
Re: Problem with current transform SCT-013-000
Not a problem, you just need to be sure you clamp the wire (single core) " to " or " from " but not both (2+ cores).
Paul
Re: Problem with current transform SCT-013-000
What value - how many Ohms - do you read for the resistance?
If you read 1 Ω when the lamp is off, then you have a short-circuit either in the cable or inside the CT.
Re: Problem with current transform SCT-013-000
Robert,
Where tulkas85 says, I see always a 1 digit on screen.
Perhaps he's be talking about seeing something like this, and reading an open, as opposed to 1 ohm. (granted, there's other things he's not doing right, but in this case I'm referring to just the meter he's using)
This is one of my DMMs displaying an open.
Re: Problem with current transform SCT-013-000
That's why I carefully wrote "If you read 1 Ω..."
I've no idea how his meter reacts on the resistance range to an alternating voltage superimposed on its internal current feed - I'm guessing it is objecting.
My meter displays O.L for an open circuit - much less confusing.
He needs to read and understand the operating instructions for his meter. If he is not reading his meter correctly, there is little we can do to help him.
tulkas85:
What does your meter read on the resistance range when the meter leads are not connected to anything?


adoc project
This program generates HTML documentation for Python projects by parsing the source code using Python's AST module. As such the source code is not loaded, it never reaches the interpreter and side-effects are effortlessly avoided.
This projet targets Python 3.5 and above.
Features
- AST-based Python parsing
- Fully
setup.py
-based configuration - MD/RST docstrings support
- Additional files inclusion as separate doc sections
- Built-in HTTP live-server
- Single HTML, PDF or Markdown artifact
Long-term Goals
- Symbol resolution, allowing linking through symbols within the document
- JPEG/PNG media inclusion (only one final artifact)
- In-document Graphviz processing
Installation
This is fairly straighforward:
pip install adoc
If you wish to output PDF documentation you'll need to install a different
flavour of adoc
:
pip install adoc[pdf]
Usage
For iteractive generation:
adoc --http .
For an HTML export:
adoc --html docs/index.html .
Hacking on the project
Prepare a virtual environment:
python -m venv env source env/bin/activate pip install -r requirements.txt pip install -r requirements-pdf.txt pip install -r requirements-test.txt
Run the test suite:
pytest .
To start the web server:
python -m adoc --http .
FAQ
Why aren't my Python packages discovered properly?
adoc relies on either setup.py
or find_packages()
for package
discovery. If you have any issue, you may want to check these places first.
The result of find_packages()
is easy to reproduce:
>>> from setuptools import find_packages >>> find_packages('.') ['adoc', 'adoc.formats']
If a package appears missing even though it's a valid package, you'll probably
want to make sure it contains __init__.py
since find_packages()
relies on
these files to determine what is a package and what is not (even though they
are not required in recent Python versions).
Why is one of my packages not showing up at all?
adoc is probably detecting that your package is empty. Here's the definition of an empty package:
- Your package does not hold any function
- Your package does not hold any class
- Your package does not hold any package
That definition is recursive so that a package holding empty packages is considered empty
My setup.py
is weird, I don't want to rely on it.
adoc allows you to override most relevant directives:
--package-dir
: where packages are located.--packages
: manually list packages.--no-setup
: ignoresetup.py
altogether.--find-packages
: force-discover packages.
I don't have a setup.py
.
adoc will attempt to rely on setup.py
as much as possible, but it will
resort to find_packages()
if it has to (and there are still command line
overrides as well).
On a typical project, there wouldn't be any noticeable difference:
adoc --http .
However, you may need to adjust a couple of things if the documentaion comes out as expected:
adoc --package-dir=src --http .
See examples/django-project
and the corresponding HTML
documentation to get an
idea.
My project is just a bunch of scripts.
adoc supports scripts declared in setup.py
and these can be specified
manually on the command-line as well:
adoc --scripts=main.py --http .
See examples/appengine-project
and the corresponding HTML
documentation to get an
idea.
Examples
- examples/django-project:
Django project, no
setup.py
- examples/appengine-project:
AppEngine project, no
setup.py
, no module
API Reference
Module adoc
Module adoc.cli
Command-line interface.
This module exports the program's entry point: main
.
Functions
def cli_setup(
)
CLI arguments parser setup.
def cli_compat(
ap)
CLI backward compatibility.
def logging_setup(
verbose)
def main(
args=None)
Program entry point.
This is where command line arguments are configured and read. Then the configuration is fine-tuned for execution.
Classes
class SplitAppend
Argument parsing action for repeatable csv strings.
Ancestors
Methods
def __call__(
self, parser, namespace, values, option_string=None)
Module adoc.codegen
Python source code generation.
Functions
def lookup(
mapping, atom)
def make_signature(
node)
def make_python(
node)
Generate Python code from an AST node (a subtree).
Module adoc.errors
Classes
class FatalError
Module adoc.formats
Module adoc.formats.md
Markdown formatter.
Functions
def format_md(
text)
Format Markdown text to HTML.
Module adoc.formats.rst
reStructuredText formatter.
This module aims to bring a decent level of compatibility with Sphinx without
relying on anything except docutils
.
This is obviously still a work in progress.
Docutils resources:
- https://docutils.readthedocs.io/en/sphinx-docs/howto/rst-directives.html
- https://docutils.readthedocs.io/en/sphinx-docs/howto/rst-roles.html
Sphinx resources:
- http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
- http://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html
- http://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html
- http://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html
- http://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html
Functions
def dummy_role(
role, rawtext, text, lineno, inliner, options={}, content=[])
def symbol_lookup(
role, rawtext, text, lineno, inliner, options={}, content=[])
def emphasis(
role, rawtext, text, lineno, inliner, options={}, content=[])
def format_rst(
text)
Format reStructuredText text to HTML.
Classes
class DummyDirective
Generic directive that does nothing.
class VersionAdmonition
Version-based admonitions.
Supports the following construction:
.. deprecated:: 0.1 This method is ...
Module adoc.httpd
Documentaion HTTP server.
This module provides an HTTP server exclusively for the purpose of serving HTML documentation over HTTP.
Classes
class RequestHandler
Documentation HTTP request handler.
It will serve HTML documentation for the project at project_path
. A
documentation server will only accept HEAD
and GET
requests and reply
with 404s for any request that's not made on /
.
Ancestors
Methods
def send_headers(
self)
def do_HEAD(
self)
Respond to HEAD
requests.
def do_GET(
self)
Respond to GET
requests.
Only /
will be served, other paths will result in 404s.
def log_message(
self, format, *args)
class Server
Documentation HTTP server.
It will reponde to HTTP requests using RequestHandler
.
Ancestors
Methods
def __init__(
self, host, port, parser, docstrings_format, strip_docstrings)
Module adoc.models
Project modelisation objects.
These data structures allow the modelisation of a project's documentation and source code.
They are handled mostly while parsing a project's source code and later transmited to the HTML writer.
Functions
def walk(
root, attr, max_depth=-1)
Classes
class Atom
Lowest-level unit representing a source code unit.
Methods
def __init__(
self, name, doc=None)
def __str__(
self)
def type(
self)
def fully_qualified_name(
self)
Recursively generate an Atom
's fully qualified name.
def from_ast(
cls, node)
Build Atom
instances from an AST node.
class ParametersMixin
Mixin for classes that hold parameters.
Methods
def add_parameters(
self, parameters)
Add parameters representation (ie. str
).
class DecoratorsMixin
Mixin for classes that hold decorators.
Methods
def add_decorators(
self, decorators)
Add decorators, (ie. str
).
class FunctionsMixin
Mixin for classes that hold Function
instances.
Methods
def is_empty(
self)
def add_function(
self, function)
Add a Function
instance, setting self
as its parent.
class Function
Representation of a function.
Ancestors
Methods
def from_ast(
cls, node)
Build a Function
instance from an AST node.
class ClassesMixin
Mixin for classes that hold Class
instances.
Methods
def is_empty(
self)
def add_class(
self, klass)
Add a Class
instance, setting self
as its parent.
class Class
Representation of a class.
Ancestors
Methods
def add_base(
self, base)
def from_ast(
cls, node)
Build a Class
instance from an AST node.
class ModulesMixin
Mixin for classes that hold Module
instances.
Methods
def is_empty(
self)
def add_module(
self, module)
Add a Module
instance, setting self
as its parent.
class Module
Representation of a module.
No distinction is made between modules and packages.
Ancestors
Methods
def is_empty(
self)
def merge(
self, module)
def from_ast(
cls, node, name)
Build a Module
instance from an AST node.
class Project
Representation of a project.
Ancestors
Methods
def __init__(
self, name, doc, metadata=None)
def add_document(
self, document)
def has_meta(
self, *keys)
def get_meta(
self, key, default=None)
def iter_modules(
self, max_depth=-1)
def iter_functions(
self, max_depth=-1)
def iter_classes(
self, max_depth=-1)
class Document
Representation of a document.
Supported document formats are html
, md
and rst
.
Methods
def __init__(
self, filename)
def html(
self)
Format a document to HTML.
The value of this property is cached for better performances.
def title(
self)
Extract a document's title.
For this to be possible, it has first to formatted to HTML.
The value of this property is cached for better performances.
Module adoc.parser
High-level parsing functions.
Classes
class ProjectParser
Methods
def __init__(
self, path, overrides, no_setup=False, exclude=None, find_packages=False, documents=None)
def parse(
self)
Parse a project, setting the current working directiory.
def parse_project(
self)
Parse a Python project in the current working directory.
def find_readme(
self)
Parse a README file in the current working directory.
def setup_exists(
self)
def load_setup(
self)
Parse a setup.py
file in the current working directory.
def parse_module(
self, path, name)
Parse a Python module.
def parse_file(
self, path, name, strip_ext=True)
Parse a Python file.
Module adoc.utils
Functions
def memoized(
f)
def compose(
*functions)
Classes
class WorkingDirectory
Methods
def __init__(
self, directory)
def __enter__(
self)
def __exit__(
self, *args)
Module adoc.writers
Module adoc.writers.html
HTML writer.
Functions
def write_html(
filename, project, docstrings_format='md', strip_docstrings=False)
def make_html(
project, docstrings_format, strip_docstrings)
Module adoc.writers.md
Markdown writer.
Functions
def write_md(
filename, project, docstrings_format, strip_docstrings)
def make_md(
project, docstrings_format, strip_docstrings)
Module adoc.writers.pdf
Functions
def write_pdf(
filename, project, docstrings_format, strip_docstring)
def make_pdf(
project, docstrings_format, strip_docstring)
Classes
class WeasyPrintLogFilter


<DuxTable> allows for custom cell rendering. A callback is supplied in the render property of the columns array. The callback is passed the item for the row in question. It can return a string or a React component.
<DuxTable>
render


Your network is ready to play and learn but before letting you go we have some advice:
first, do not consider this tutorial as enough to be efficient, you will find that a lot of players are far better than you and it's because they know a lot more on neural networks than you.
That's why, secondly, we advise you to look at the " learn more " tab to find more information on neural networks
Finally, we encourage you to contribute to the community through our forum, you can find help and other people results on our games !


Le'Spy
HOME
ABOUT
COFFEE
DISPLAY
CONTACT
LOCATION
Contact
Your email
Reason for contacting
Questions
Catering
Suggestions
Message
Send a copy to yourself
Contact
2800 Hennepin Avenue South, Minneapolis, MN 55405
© 2019 Le'Spy Cafe. All Rights Reserved.


Mother and daughter claim they 'accidentally' shoplifted 41 items from Walmart
A mother and daughter caught as they shoplifted 41 things from a grocery store claim they lifted them by accident.
Crystal Jakobetz, 37, and her 18-year-old daughter Dakota were arrested on Friday as they allegedly tried to to steal groceries from a Walmart in Wichita Falls, Texas.
Police responded to a theft call from the store and watched Jakobetz and her daughter at a self-checkout kiosk, scanning some items, while placing numerous un-scanned items in their shopping cart.
Walmart security searched the women’s shopping cart and found 41 items that were not scanned or on the receipt. Customers at Walmart are often asked to show receipts to workers on their way out of the store to prove they paid for them.
Police questioned Crystal Jakobetz, who said that if she had taken anything without paying, it was not intentional.
Dakota told police that she did not take anything and did not want to go to jail
Advertisement Advertisement
Wichita Falls Police Spokesman Sergent Harold McClure said the cost of the allegedly stolen items totaled nearly $200.
Both Crystal and her daughter were charged with theft of property over $100.
A judge set both of their bonds at $500 and they were later released from jail.


You can input qrcode.toCanvas() to draw a canvas on console.
You can input qrcode.toImage() to create a image element on console.
You can input qrcode.downloadImage('qrcode') to download image on console.
You can input qrcode.getCanvas().then(canvas => {}) to deal with the canvas.


{% extends "base.html" %} {% block player %}
You won the latest micro league with a point total of {{ user_points }}!!


Flex
Utilize the power of Flexbox to create a wide range of layouts.
This component uses Flexbox, a concept that is still quite new but extremely powerful for creating layouts.
Usage
To apply this component, just add the .uk-flex
class to a

element. This will create the flex container. By default, all flex items will be aligned to the left and equally matched in height and width.
Example
Markup

...

Flex inline
By default, the flex container is displayed as a block element. To apply the behavior of an inline element while still laying out its content according to the flexbox model, use the .uk-flex-inline
class instead of uk-flex
.
Modifiers
You can add a number of different classes to modify the flex behavior.
Alignment
These classes define the horizontal and vertical alignment of flex items and distribute the space between them.
| Class | Description |
|---|---|
.uk-flex-center |
Add this class to center flex items horizontally. |
.uk-flex-right |
Add this class to align flex items to the right. |
.uk-flex-top |
Add this class to align flex items to the top. |
.uk-flex-middle |
Add this class to vertically center flex items. |
.uk-flex-bottom |
Add this class to align flex items to the bottom. |
.uk-flex-space-between |
Add this class to distribute items evenly, with the first item at the beginning and last item at the end of the main axis. |
.uk-flex-space-around |
Add this class to distribute items evenly with equal space on both sides of each item. |
Example
Markup

...

Direction
These classes define the axis flex items placed on and their direction. By default, items run horizontally from left to right.
| Class | Description |
|---|---|
.uk-flex-row-reverse |
Add this class to lay out flex items from right to left. |
.uk-flex-column |
Add this class to lay out flex items as vertical columns. |
.uk-flex-column-reverse |
Add this class to lay out flex items from bottom to top. |
Example
Markup

...

Wrap
By default, flex items fit themselves into one row. Add the .uk-flex-wrap
class, so that the items wrap into another row when they no longer fit the viewport. To change the items' direction so that they run from right to left, add the .uk-flex-wrap-reverse
class. The following classes modify the alignment of wrapping flex items. To force the flex items into one row, just add the .uk-flex-nowrap
class.
| Class | Description |
|---|---|
.uk-flex-wrap-top |
Add this class to align multirow flex items to the top. |
.uk-flex-wrap-middle |
Add this class to vertically center multirow flex items. |
.uk-flex-wrap-bottom |
Add this class to align multiline flex items to the bottom. |
.uk-flex-wrap-space-between |
Add this class to distribute item rows evenly, with the first row at the top and last row at the bottom of the container. |
.uk-flex-wrap-space-around |
Add this class to distribute rows evenly with equal space at the top and bottom of each row. |
Example
Markup

...

Item order
By default, flex items are laid out according to the source order. To display a certain item as the first or last one, just add one of these classes.
| Class | Description |
|---|---|
.uk-flex-order-first |
Displays the item as the first one. |
.uk-flex-order-last |
Displays the item as the last one. |
.uk-flex-order-first-small .uk-flex-order-last-small |
Affects device widths of 480px and higher. |
.uk-flex-order-first-medium .uk-flex-order-last-medium |
Affects device widths of 768px and higher. |
.uk-flex-order-first-large .uk-flex-order-last-large |
Affects device widths of 960px and higher. |
.uk-flex-order-first-xlarge .uk-flex-order-last-xlarge |
Affects device widths of 1220px and higher. |
Example
Markup

...

Item dimensions
To determine how much space a flex item should take up, add one of the following classes to the item.
| Class | Description |
|---|---|
.uk-flex-item-none |
The box's size is determined by its content. |
.uk-flex-item-auto |
The space is allocated considering the item's content. |
.uk-flex-item-1 |
The space is allocated solely based on flex. |
Flex and grid
The Flex component can be combined with a grid from the Grid component.
Example
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Lorem ipsum dolor sit amet, consectetur adipisicing elit.


Scenario example builder
Add new Actor
Add new Instance
Add new Process
Name
Add Process
Add new Step to the Process


--- layout: post title: Properties of Discrete-time Algebraic Riccati Equation (DARE) comments: true permalink: properties-of-dare ---
This post serves as a test of emacs org-mode and jekyll static site generator.
We will denote \(\mathbb S_n,\,\mathbb S_n^+,\mathbb S_n^{++}\) to be the set of all real symmetric matrices, the set of all positive semi-definite matrices and the set of all positive definite matrices respectively. For any two matrices \(A,\,B\in \mathbb S_n\), we call \(A \geq B\) (\(A > B\)) if \(A - B\) is positive semi-definite (positive definite).
Let \(A\in \mathbb R^{n\times n}\) and \(C \in \mathbb R^{m\times n}\) be two matrices. Further define \(Q \in \mathbb S_n\) and \(R\in\mathbb S_n\) to be two positive definite matrices. The DARE function \(g: \mathbb S_n^+\rightarrow\mathbb S_n^+\) is defined as
\begin{equation} \label{eq:riccati1} g(X) \triangleq \left[\left(A X A' + Q\right)^{-1} + C'R^{-1}C\right]^{-1}. \end{equation}From Equation \eqref{eq:riccati1}, we can see that \(g\) is monotonically increasing with respect to \(X\).
Using the matrix inversion lemma, we can write \(g\) as
\begin{equation} \label{eq:riccati2} g(X) = h(X) - h(X) C' \left(C h(X) C'+R\right)^{-1}Ch(X), \end{equation}where \(h(X) = AXA' + Q\). For simplicity, we will define
\begin{equation} \tilde g(X) = X - X C' \left(C X C'+R\right)^{-1}CX. \end{equation}Hence, \(g = \tilde g \circ h\).
We only need to show that \(\tilde g\) is concave since \(h\) is linear with respect to \(X\). Consider the following function
\begin{align} \label{eq:linear} \phi (K,X) &\triangleq (I-KC) X (I-KC)' + KRK'\\ & = X - KCX - XC'K' + K(CXC'+R)K'. \end{align}By completing the square, \(\phi(K,X)\) can be rewritten as
\begin{equation} \label{eq:linear2} \phi(K,X) = \tilde g(X) + (K-K_*) (CXC'+R)^{-1}(K-K_*)', \end{equation}where \(K_* = XC'(CXC'+R)^{-1}\). Therefore,
\begin{align} \label{eq:riccatilinear} \tilde g(X) = \min_{K} \phi(K,X). \end{align}Since \(\phi(K,X)\) is linear with respect to \(X\) for a fixed \(K\), \(\tilde g(X)\) is concave with respect to \(X\).
It is well known that if the matrix pair \((A,C)\) is detectable, then the equation \(X = g(X)\) has a unique positive definite solution, which we will denote as \(X_*\).
Let \(X_0 = 0\) and denote \(X_{k+1} = g(X_k)\). Clearly \(X_0 \leq X_*\) and \(X_0 \leq X_1\). Now apply \(g\) on both sides of the inequalities, we have \[ g(X_0) \leq g(X_*),\,g(X_0)\leq g(X_1). \] Notice that \(g(X_0) = X_1,\,g(X_1) = X_2\) and \(g(X_*) = X_*\). Therefore, we have the following chain of inequalities \[ X_0 \leq X_1 \leq X_2 \leq \dots \leq X_*. \]
Since \(\{X_k\}\) is an increasing sequence with an upper bound, \(\{X_k\}\) has a limit, which we can denote as \(X_\infty\). Now by the fact that \(g\) is continuous, \(X_\infty = g(X_\infty)\). Finally, be the fact that \(X_*\) is the unique fixed point, we have that \(X_\infty = X_*\).
Similar trick can be applied to the case where we can find an \(X_1 = g(X_0) \leq X_0\). In that case, we know that \(X_*\) must be no greater than \(X_0\).
Therefore, we can establish the equivalency of the following statements:
We already proved that Statement 2 implies 1. On the other hand, if Statement 1 holds, then \(X_* = g(X_*)\leq X_*\).
Now if we define \(S = X_0^{-1}\), then \(X_0 \leq P\) is equivalent to \(S \geq P^{-1}\). Moreover, \(g(X_0)\leq X_0\) is equivalent to
\begin{align} \label{eq:fixpointequivalence} (A X A' + Q)^{-1} + C'R^{-1}C \geq S \end{align}Using matrix inversion lemma on the LFS of \eqref{eq:fixpointequivalence}, we have \[ Q^{-1} - Q^{-1}A(S + A'Q^{-1}A)^{-1}A'Q^{-1} + C'R^{-1}C\geq S, \] which is equivalent to
\begin{align} \label{eq:fixpointequivalence2} Q^{-1} - S + C'R^{-1}C \geq Q^{-1}A(S + A'Q^{-1}A)^{-1}A'Q^{-1}. \end{align}Now using Schur's complement, \eqref{eq:fixpointequivalence2} is equivalent to the following linear matrix inequality:
\begin{align} \label{eq:lmi} \begin{bmatrix} Q^{-1} - S + C'R^{-1}C&Q^{-1}A\\ A'Q^{-1}& S+A'Q^{-1}A \end{bmatrix} \geq 0. \end{align}As a result, the condition that \(X_* \leq P\) is equivalent to \eqref{eq:lmi} and \(S\geq P^{-1}\). Notice that the LFS of \eqref{eq:lmi} is linear with respect to \(C'R^{-1}C\). This fact can leveraged for sensor placement problems.
Consider the following functions:
\begin{align} \label{eq:linearfractional} f_1(x) = \frac{a_1x+b_1}{c_1x+d_1}, f_2(x) = \frac{a_2x+b_2}{c_2x+d_2}. \end{align}Then
\begin{align} \label{eq:linearfractionalcomposition} f_1(f_2(x)) &= \frac{a_1 \frac{a_2x+b_2}{c_2x+d_2} + b_1}{c_1 \frac{a_2x+b_2}{c_2x+d_2} + d_1}\\ &=\frac{(a_1a_2+b_1c_2)x + a_1b_2 + b_1d_2}{(c_1a_2+d_1c_2)x + c_1b_2 + d_1d_2}. \end{align}One important observation is that the coefficients on the numerator and the denominator can be computed via matrix multiplication:
\begin{align} \begin{bmatrix} a_1&b_1\\ c_1&d_1 \end{bmatrix}\times\begin{bmatrix} a_2&b_2\\ c_2&d_2 \end{bmatrix} = \begin{bmatrix} a_1a_2+b_1c_2&a_1b_2+b_1d_2\\ c_1a_2+d_1c_2&c_1b_2+d_1d_2 \end{bmatrix}. \end{align}We will now move to the case where \(X\) is a matrix instead of just a scalar. Let us consider the following matrix: \[ \Phi = \begin{bmatrix} \Phi_{11}&\Phi_{12} \\ \Phi_{21}&\Phi_{22} \end{bmatrix} \in \mathbb R^{2n\times 2n}, \] where each \(\Phi_{ij}\in \mathbb R^{n\times n}\). Define the following operator
\begin{align} \label{eq:homographic} F(\Phi,X) \triangleq (\Phi_{11}X+\Phi_{12})(\Phi_{21}X+\Phi_{22})^{-1}. \end{align}Similarly for any \(\Phi_1,\,\Phi_2 \in \mathbb R^{2n\times 2n}\), we have
\begin{align} \label{eq:homographiccomposition} F(\Phi_1,F(\Phi_2,X)) = F(\Phi_1\Phi_2,X). \end{align}We now establish the link between linear fractional transformations and Riccati equations. We will assume that \(A\) is invertible. We know that
\begin{align} \label{eq:riccatidecompose1} AXA' &= F\left(\begin{bmatrix} A & 0\\ 0 & (A')^{-1} \end{bmatrix}, X\right),\\ \label{eq:riccatidecompose2} (X + Q)^{-1} &= F\left(\begin{bmatrix} 0 & I\\ I & Q \end{bmatrix}, X\right),\\ \label{eq:riccatidecompose3} (X + C'R^{-1}C)^{-1} &= F\left(\begin{bmatrix} 0 & I\\ I & C'R^{-1}C \end{bmatrix}, X\right). \end{align}As a result, using \eqref{eq:homographiccomposition}, we have
\begin{align} \label{eq:riccatihomo} g(X) = F(\Phi_g,X), \end{align}where
\begin{align} \label{eq:Phimatrixg} \Phi_g \triangleq \begin{bmatrix} A&Q(A')^{-1} \\ C^TR^{-1}CA&(I+C^TR^{-1}CQ)(A')^{-1} \end{bmatrix}. \end{align}Hence, \(g^{(n)}(X) = F(\Phi_g^n,X)\).
We will simply state several key theorems in this paper.
Consider the following function \(\delta: \mathbb S_n^{++}\times \mathbb S_n^{++}\rightarrow \mathbb R\) defined as
\begin{align} \label{eq:metric} \delta(X,Y) = \sqrt{\sum_{i=1}^n \left(\log \lambda_i\right)^2}, \end{align}where \(\lambda_1,\dots,\lambda_n\) are the eigenvalues of \(XY^{-1}\). One can prove that it is a metric on the space of \(\mathbb S_n^{++}\). The main property of this metric is that it is invariant under conjugacy and inversion, i.e.,
\begin{align} \label{eq:invariance} \delta(X^{-1},Y^{-1}) =\delta(X,Y) = \delta (AXA',AYA'). \end{align}Moreover, if a positive semi-definite matrix \(P \geq 0\) and the smallest eigenvalue of \(P\) is \(\beta\), then
\begin{align} \label{eq:contraction} \delta(X+P,Y+P)\leq \frac{\alpha}{\alpha+\beta}\delta(X,Y) \leq \delta(X,Y). \end{align}where \(\alpha\) is the largest eigenvalue of \(X\) and \(Y\).
Therefore, from \eqref{eq:riccatidecompose1}, \eqref{eq:riccatidecompose2} and \eqref{eq:riccatidecompose3} we know that
\begin{align} \label{eq:riccaticontraction} \delta(g(X),g(Y))\leq \delta(X,Y). \end{align}It can be further proved that if \((A,C)\) is observable, then there exists a \(k\) and \(0 < \rho < 1\), such that
\begin{align} \label{eq:riccaticontraction2} \delta(g^{(k)}(X),g^{(k)}(Y))\leq\rho \delta(X,Y). \end{align}


elixush v0.0.4 Elixush.PushState
Summary
Functions
Ends the current environment by popping the :environment stack and replacing all stacks with those on the environment stack. Then, everything on the old :return stack is pushed onto the :exec stack
Returns an empty push state
Returns a copy of the state with the specified stack popped. This is a utility, not for use as an instruction in Push programs
Returns a copy of the state with the value pushed on the named stack. This is a utility, not for use in Push programs
Takes a map of stack names and entire stack states, and returns a new push-state with those stacks set
Add the provided name to the global list of registered instructions
Takes a list of stacks and returns all instructions that have all of their stack requirements fulfilled. This won't include random instructions unless :random is in the types list. This won't include parenthesis-altering instructions unless :parentheses is in the types list
Returns a list of all registered instructions with the given type name as a prefix
Returns a list of all registered instructions aside from random instructions
Puts value at position on type stack in state. This is a utility, not for use as an instruction in Push programs. NOT SAFE for invalid positions
Returns the indicated item of the type stack in state. Returns :no-stack-item if called on an empty stack. This is a utility, not for use as an instruction in Push programs. NOT SAFE for invalid positions
Returns the top item of the type stack in state. Returns :no-stack-item if called on an empty stack. This is a utility, not for use as an instruction in Push programs
Functions
Specs
end_environment(map) :: map
Ends the current environment by popping the :environment stack and replacing all stacks with those on the environment stack. Then, everything on the old :return stack is pushed onto the :exec stack.
Specs
pop_item(atom, map) :: map
Returns a copy of the state with the specified stack popped. This is a utility, not for use as an instruction in Push programs.
Returns a copy of the state with the value pushed on the named stack. This is a utility, not for use in Push programs.
Specs
push_state_from_stacks(map) :: map
Takes a map of stack names and entire stack states, and returns a new push-state with those stacks set.
Takes a list of stacks and returns all instructions that have all of their stack requirements fulfilled. This won't include random instructions unless :random is in the types list. This won't include parenthesis-altering instructions unless :parentheses is in the types list.
Specs
registered_for_type(atom, map) :: Enum.t
Returns a list of all registered instructions with the given type name as a prefix.
Specs
registered_nonrandom :: Enum.t
Returns a list of all registered instructions aside from random instructions.
Puts value at position on type stack in state. This is a utility, not for use as an instruction in Push programs. NOT SAFE for invalid positions.
Specs
stack_ref(atom, integer, map) :: any
Returns the indicated item of the type stack in state. Returns :no-stack-item if called on an empty stack. This is a utility, not for use as an instruction in Push programs. NOT SAFE for invalid positions.


--- products: new: limit: {{theme_settings.homepage_new_products_count}} top_sellers: limit: {{theme_settings.homepage_top_products_count}} featured: limit: {{theme_settings.homepage_featured_products_count}} product: videos: limit: {{theme_settings.productpage_videos_count}} reviews: limit: {{theme_settings.productpage_reviews_count}} related_products: limit: {{theme_settings.productpage_related_products_count}} similar_by_views: limit: {{theme_settings.productpage_similar_by_views_count}} --- {{#partial "page"}}


Durt
Durt
Home
About
Manage Garden
Resources
Social
Woah there! Looks like you're trying to access a page and you don't have permission.
Click the button below to sign up or login in.