radar data acquisition analysis and visualization using
play

Radar data acquisition, analysis and visualization using - PowerPoint PPT Presentation

. Radar data acquisition, analysis and visualization using reproducible research with Sweave Keun Myoung Lee 1 1 CEWIT Korea The R User Conference 2013, July 10-12 2013 University of Castilla-La Mancha, Albacete, Spain v.02f7 of 2013-07-11


  1. . Radar data acquisition, analysis and visualization using reproducible research with Sweave Keun Myoung Lee 1 1 CEWIT Korea The R User Conference 2013, July 10-12 2013 University of Castilla-La Mancha, Albacete, Spain v.02f7 of 2013-07-11 Vladimir Skvortsov 1 , 2 2 Department of Computer Science, SUNY Korea

  2. Outline Data acquisition module . 5 Data Acquisition Principles Measurement flow Measurement timings Measurement Setup using C++ Qt software . Hardware . 6 Data Analysis and Visualization Workflow Data Analysis Examples useR!2013: Radar DAQ, A&V using Sweave Outline . Benefits and Goals . . . 1 Outline . . 2 Introduction . 3 Concept Sweave Introduction Features . . 4 Radar project Problem Statement 2 / 63

  3. Outline Data acquisition module . 5 Data Acquisition Principles Measurement flow Measurement timings Measurement Setup using C++ Qt software . Hardware . 6 Data Analysis and Visualization Workflow Data Analysis Examples useR!2013: Radar DAQ, A&V using Sweave Introduction . Benefits and Goals . . . 1 Outline . . 2 Introduction . 3 Concept Sweave Introduction Features . . 4 Radar project Problem Statement 3 / 63

  4. Introduction The idea of RR is popular. The tools for RR implementation are Introduction useR!2013: Radar DAQ, A&V using Sweave EX= Sweave is the most well-known tool. A T R + L important. applied to the data. . Everything includes data, codes and description of how the code is reproduce the results they present. scientific articles with everything required to independently is an approach aiming at complementing classical printed Reproducible Research (RR) or reproducible data analysis . 4 / 63

  5. Outline Data acquisition module . 5 Data Acquisition Principles Measurement flow Measurement timings Measurement Setup using C++ Qt software . Hardware . 6 Data Analysis and Visualization Workflow Data Analysis Examples useR!2013: Radar DAQ, A&V using Sweave Sweave . Benefits and Goals . . . 1 Outline . . 2 Introduction . 3 Concept Sweave Introduction Features . . 4 Radar project Problem Statement 5 / 63

  6. Sweave

  7. R + LaTeX= Sweave . . ”Sweave provides a flexible framework for mixing text and S code for automatic document generation. A single source file contains both documentation text and S code, which are then woven into a final document containing the documentation text together with the S code and/or the output of the code (text, graphs)” – Freidrich Leisch Created in 2002. It is called ‘S-weave’ not ‘R-weave’ because R is an implementation of the S language. useR!2013: Radar DAQ, A&V using Sweave Sweave 7 / 63

  8. R + LaTeX= Sweave EX Sweave useR!2013: Radar DAQ, A&V using Sweave command and code chunks reuse is generated (called chunks ) and documentation segments 8 / 63 A T computational strengths that is similar to the noweb ⋆ Sweave is based on literate programming (LP) approach and has syntax ⋆ A function in R ⋆ Allows mixing a code (R) with text written in (LaTeX) ⋆ Takes advantage of both LaTeX typesetting capabilities and R’s ⋆ Sweave is simple if you know both R and L ⋆ A file is simple text one consisting of a sequence of code segments ⋆ Enables the generation of dynamic documents ⋆ R code is executed first and the output embedded when the document ⋆ Enables a modularity of code using \SweaveInput{module.Rnw} ⋆ Reproducible research tool

  9. Sweave Workflow 4. Display the example.pdf file. EX , XeL A T EX or LuaL A T EX in order to obtain your final document: example.tex pdflatex . 1. A Sweave file has the extension Rnw . This is a plain text file which has both L All the workflow is usually done with one command, e.g. in TeXmaker (Ubuntu/Linux) software: . . R CMD Sweave %.Rnw|pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %|pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %|evince %.pdf Make sure Sweave.sty is in your texmf path (or in your working directory) useR!2013: Radar DAQ, A&V using Sweave Sweave A T 3. Compile the tex file with one of the most popular engines like pdfL 9 / 63 example.Rnw A T EX code and R code all in one (also called a noweb file). For instance we start with example.Rnw 2. Compile the Sweave file with R in order to produce a tex file: R ( using Sweave function ) − − − − − − − − − − − − − − − − − − − → example.tex − − − − − − − → example.pdf

  10. Our Development Workflow 1. Add code to R script for data analysis using RStudio, Rgedit or other IDE 2. Test the code 3. When the code debugging is complete, add the tested code to Sweave document useR!2013: Radar DAQ, A&V using Sweave Sweave 10 / 63

  11. Sweave Tools Comparison yes no R code navigation yes, partial yes Own PDF viewer yes yes Dockable internal PDF viewer no (opens a LaTeX navigation separated window) synctex support yes yes not all view- ers Total score: yes (8), no (1) yes (7), no (2) useR!2013: Radar DAQ, A&V using Sweave Sweave yes color Features yes Software Tools Notes TeXmaker (v3.4.1) RStudio (v0.96.316) Sweave support yes yes LaTeX syntax high- lighting yes LaTeX custom build the same FG yes (full) yes (very limited) R syntax highlighting yes (R chunk has different background) 1 R code chunk has 11 / 63 no, partial [ 1 ]

  12. R + LaTeX= Sweave Sweave document is .Rnw text file which includes both R and L Sweave useR!2013: Radar DAQ, A&V using Sweave \end{document} Sweave embeds all the results! R code chunk x <- rnorm(50); y <- 5*x + rnorm(50) set.seed(123) # reproducibility 12 / 63 Here is a linear regression example: \maketitle \begin{document} \author{Vladimir Skvortsov} \title{Sweave Example 1} \documentclass[a4paper]{article} EX code. A T <<>> = model <- lm(y ~ x); summary(model) @

  13. Sweave Options for R code . Sweave useR!2013: Radar DAQ, A&V using Sweave # empty . example: . \includegraphics statement is incorporated into the typeset document treated as LaTeX code 13 / 63 chunks «...» = ⋆ name : user-specified – Specify name of chunk ⋆ eval : TRUE, FALSE – Evaluate chunk? ⋆ echo : TRUE, FALSE – If it is TRUE, in addition to output, R input ⋆ term : TRUE, FALSE – Emulates R session? ⋆ results : verbatim, tex, hide – Output? Chunks with ’tex’ will be ⋆ fig : TRUE, FALSE – Chunk produces figure/graphics? ⋆ include : TRUE, FALSE – Automatically generate << results, echo=FALSE, term=TRUE, results=tex >> = @

  14. Sweave: Including Figures include=TRUE a includegraphics LaTeX command is generated. the run. figure environment after the chunk to put figures in. and include pdf or png files manually. useR!2013: Radar DAQ, A&V using Sweave Sweave 14 / 63 ⋆ One can generate one figure per chunk of code if fig=TRUE and ⋆ Sweave dump the figures into current document directory during ⋆ To have more control over the figure including, we can create a ⋆ To have a full control over inclusion of graphics, we have to create

  15. Sweave: Including Figures - The Simplest Way library("graphics") x <- rnorm(50) y <- 5*x+rnorm(50) plot(x, y) useR!2013: Radar DAQ, A&V using Sweave Sweave 15 / 63 << fig1plot,echo=TRUE,fig=TRUE,include=TRUE >> = @

  16. Sweave: Including Figures - \includegraphics[height=5cm,width=5cm] Sweave useR!2013: Radar DAQ, A&V using Sweave \end{figure} \end{center} \label{fig:scatter2} \caption{Scatter plot} {filename-fig1plot2} \begin{center} More Control \begin{figure} with some LaTeX include parameters ... plot(x, y) y <- 5*x+rnorm(50) x <- rnorm(50) library("graphics") 16 / 63 << fig1plot2,echo=TRUE,fig=TRUE,include=FALSE >> = @

  17. Sweave: Including Figures - \begin{figure} Sweave useR!2013: Radar DAQ, A&V using Sweave \end{figure} \label{fig:scatter3} \caption{Scatter plot} \includegraphics[width=6in, height=5in]{fig1plot3} % width and height have to be in inches here too! \centering with some LaTeX include parameters ... Full Control dev.off() plot(x, y) y <- 5*x+rnorm(50) x <- rnorm(50) pdf(file="fig1plot3.pdf", width=6, height=5) # pdf size (width and height) in inches! require("grDevices") 17 / 63 << fig1plot3,echo=FALSE,results=hide >> = @

  18. Sweave: Including Figures - Extreme Embedding Sweave useR!2013: Radar DAQ, A&V using Sweave embedding-images-with-an-encoding-algorithm \includegraphics{myfigure.png} \generateimage{myfigure.txt}{myfigure.png} \immediate\write18{convert.cmd #1 > #2}} \newcommand{\generateimage}[2]{% package) which writes it to a file Embedding images with an encoding algorithm 18 / 63 ⋆ Encode your image (e.g. myfigure.png) using Base64 encoding algorithm ⋆ Put the text based Base64 code in an filecontents environment (filecontents ⋆ Add to preamble ( -shell-escape is active and use an external script) ⋆ Add to document source: http://tex.stackexchange.com/questions/21541/

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend