Data Blast

Data, Telecom, Maths, Astronomy, Origami, and so on

Basic Web App for Exoplanets by using RShiny

Leave a comment

Before vacation I took an extraordinary course in Coursera platform given by Université of Genève called “The Diversity of Exoplanets“. In general terms, this course presented an overview of the knowledge acquired during the last 20 years in the scope of exoplanets, highlighting the different detection methods and their limitations, and also relevant information provided on the orbital system and the planet itself, and how this information is useful to understand the planets formation. Probably, next year it’s will be available again. For astronomy enthusiasts and everything related to exoplanets and “new worlds”, I recommend highly to take this course.

During the course, I thought of making a simple web app by using R-Shiny solution to display the information gathered by Kepler mission. I finally did it, but I didn’t get a chance to upload it to my blog, until now. It’s true, however, that this app is very simple, but I was excited to do it. On the other hand, by using for example, data in csv format also it’s possible to plot directly by means of Excel or R commands, but I think the use of some javascript libraries could give a better result from the visualization point of view. This app needs to be improved (e.g. adding more variables, using log scale, etc.) or extended to apply ML techniques as I described in my last post for light curve analysis. Here, I basically just tried to plot data without to apply any algorithms. Well, github link is here. I used two datasets: koi.csv (Kepler Object of Interest) and planet_confirmed.csv updated July 2014 from NASA Exoplanet Archive.



#Load Data (Fri Jun  6 10:22:10 2014)
dfk <- read.table("data/koi.csv", sep=",",header=TRUE,stringsAsFactors=FALSE)
dfp <- read.table("data/planets_confirmed.csv", sep=",",header=TRUE,stringsAsFactors=FALSE)

# Confirmed Planets by Kepler Spacecraft
dfp1<-subset(dfp, pl_kepflag == 1)

# Kepler Object of Interest
dfk1<-subset(dfk,koi_disposition == 'CANDIDATE' | koi_disposition == 'CONFIRMED')

#Number Exoplanets by Methods and Years
dfp2<-aggregate(dfp$value,list(Method = dfp$pl_discmethod, Year = dfp$pl_disc),sum)


options(RCHART_LIB = 'polycharts')
options(RCHART_LIB = 'NVD3')

# Define UI for application that draws a histogram
  # Application title
  titlePanel("Exploring NASA Exoplanet Archive"),

  # Sidebar with a slider input for the number of bins
      helpText("Kepler Object of Interest"),
      selectInput(inputId = "var1", label = "X-axis Variable",list("Orbital_Period"= "pl_orbper","Temperature" = "pl_eqt")),
      selectInput(inputId = "var2", label = "Y-axis Variable",list("Distance"= "pl_orbsmax", "Planet_Mass" = "pl_masse","Planet_Radius" = "pl_rade")),
      helpText("Confirmed Planet"),
      selectInput(inputId = "var3", label = "X-axis Variable",list("Temperature"= "koi_teq","Period"= "koi_period")),
      selectInput(inputId = "var4", label = "Y-axis Variable",list("Distance"= "koi_dor", "Eccentricity"= "koi_eccen"))

    # Show a plot of the generated distribution
    tabPanel("KOI", showOutput("plot1", "polycharts")),
    tabPanel("Confirmed Planet", showOutput("plot2", "polycharts")),
    tabPanel("Summary", showOutput("plot3", "NVD3"))


options(RCHART_WIDTH = 800)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
  output$plot1 <- renderChart({
    mytooltip = "#! function(item){return item.pl_name} !#"
    p1 <- rPlot(x = input$var1, y = input$var2, data = dfp1, type = "point",tooltip = mytooltip)
    p1$addParams(height = 400, dom = 'plot1')
  output$plot2 <- renderChart({
    p2 <- rPlot(x = input$var3, y = input$var4, data = dfk1, type = "point", color = "koi_disposition")
    p2$addParams(height = 400, dom = 'plot2')
    output$plot3 <- renderChart({
      p3 <- nPlot(x= "Year", y= "Freq", group = "Method", data = dfp2, type = "multiBarChart")
      p3$addParams(height = 400, dom = 'plot3')

Extra Data:

1) September 8th, 2014 begins a course called “Imagining Other Earths” by Coursera and Princeton University.

2) Exoplanets Explained (PhD Comics TV)

3) The Extrasolar
Planets Encyclopedia (link)


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s