-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
221 lines (217 loc) · 12.5 KB
/
ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
library(shiny)
library(shinythemes)
library(SimSpin)
library(shinycssloaders)
library(plot3D)
options(shiny.maxRequestSize = 100*1024^2)
shinyUI(
fluidPage(
titlePanel('', windowTitle = 'SimSpin'),
tags$head(tags$link(rel="shortcut icon", href="favicon.ico"),
tags$link(rel="apple-touch-icon", href="apple_icon.png", sizes="158x158")
),
tags$style(type="text/css", "body { overflow-y: scroll; }"),
div(class = " titleContainer", img(src="simspin.gif",class="headerImage",style="width:100%")),
div(class="row marginRow"),
div (id="navAlign",
navbarPage(" ", theme = shinytheme("simplex"), fluid = TRUE, collapsible = TRUE,
tabPanel("Analyse",
# Sidebar with a file input for simulation to be analysed
sidebarLayout(
sidebarPanel(
checkboxInput("example_file", label = "Use SimSpin example file?", value=TRUE),
fileInput("sim_file", label = "Or upload simulation file:", multiple = FALSE, buttonLabel = "Browse...",
placeholder = "No file selected"),
checkboxGroupInput("ptype", label = "Particle types:",
choiceNames = c("Dark Matter", "Disc", "Bulge"),
choiceValues = c(1, 2, 3), selected = c(2,3)),
selectInput("DM_profile", label = "Dark Matter Profile:", choices = c("Hernquist", "NFW", "None")),
# only show this panel if DM_profile == Hernquist
conditionalPanel(
condition = "input.DM_profile == 'Hernquist'",
numericInput("DM_mass", label = "Mass:", value = 185.966),
numericInput("DM_a", label = "Scale radius:", value = 34.5)
),
# only show this panel if DM_profile == NFW
conditionalPanel(
condition = "input.DM_profile == 'NFW'",
numericInput("DM_vm", label = "Virial mass:", value = 185.966),
numericInput("DM_a", label = "Scale radius:", value = 34.5),
numericInput("DM_rhof", label = "Density at flattening radius:", value = 0.00035)
),
selectInput("bin_type", label = "Segementation:", choices = c("r", "cr", "z"), selected = "r",
multiple = FALSE),
sliderInput("rmax", label = "Maximum radius:", min = 1, max = 500, value = 200, step = 1),
sliderInput("rbin", label = "Number of segments:", min = 1, max = 1000, value = 200, step = 1),
actionButton("submit_1", label = "Go!")
),
mainPanel(
tabsetPanel(
tabPanel("Segments",
h3(htmlOutput("segments_title")),
withSpinner(plotOutput("simulation_segments"), type = 5, color="#581845"),
htmlOutput("user_specs")
),
tabPanel("Kinematics",
h3(htmlOutput("logp_title")),
withSpinner(plotOutput("logp_dist"), type = 5, color="#FF5733"),
h3(htmlOutput("vrot_title")),
withSpinner(plotOutput("vrot_dist"), type = 5, color="#FFC300"),
h5(htmlOutput("vrot_beware"))
),
tabPanel("Summary",
h3(htmlOutput("kin_title")),
withSpinner(tableOutput("kinematics"), type = 5, color="#C70039"),
h5(htmlOutput("kin_beware")))
))
)
),
tabPanel("Cube",
sidebarLayout(
sidebarPanel(
tags$head(tags$script('$(document).on("shiny:connected", function(e) {
Shiny.onInputChange("innerWidth", window.innerWidth);
});
$(window).resize(function(e) {
Shiny.onInputChange("innerWidth", window.innerWidth);
});
')),
checkboxInput("example_file_2", label = "Use SimSpin example file?", value=TRUE),
fileInput("sim_file_2", label = "Or upload simulation file:", multiple = FALSE, buttonLabel = "Browse...",
placeholder = "No file selected"),
checkboxGroupInput("ptype_2", label = "Particle types:",
choiceNames = c("Disc", "Bulge"),
choiceValues = c(2, 3), selected = c(2,3)),
#numericInput("r200", label = "Virial radius:", value = 200),
sliderInput("z", label = "Redshift:", min = 0.01, max = 0.1, value = 0.06),
selectInput("survey", label = "Survey:", choices = c("SAMI", "MaNGA", "CALIFA", "Hector", "Specified")),
# only show this panel if survey == "Specified"
conditionalPanel(
condition = "input.survey == 'Specified'",
numericInput("fov", label = "IFU field of view:", value = 15),
selectInput("ap_shape", label = "Aperture shape:", choices = c("circular", "square", "hexagonal")),
numericInput("central_wvl", label = HTML("Central filter wavelength / Å :"), value = 4800),
numericInput("lsf_fwhm", label = "Line spread function:", value = 2.65),
sliderInput("pixel_sscale", label = "Spaxel scale / '' :", min = 0.25, max = 2, value = 0.5, step = 0.01),
sliderInput("pixel_vscale", label = HTML("Voxel scale / Å :"), min = 0.5, max = 2, value = 1.04, step = 0.01),
numericInput("threshold", label = "Magnitude limit:", value = 25)
),
sliderInput("inc_deg", label = "Inclination:", min = 0, max = 90, value = 90, step = 1),
numericInput("m2l_disc", label = "Disc mass-to-light ratio:", value = 2),
numericInput("m2l_bulge", label = "Bulge mass-to-light ratio:", value = 1),
checkboxInput("blur", label = "Blur?", value = FALSE),
# only show this panel if DM_profile == NFW
conditionalPanel(
condition = "input.blur == true",
selectInput("psf", label = "PSF shape:", choices = c("Moffat", "Gaussian")),
sliderInput("fwhm", label = "FWHM:", min = 0, max = 5, value = 0.5, step = 0.5)
),
actionButton("submit_2", label = "Go!")
),
mainPanel(
h3(htmlOutput("bc_title")),
withSpinner(plotOutput("datacube", height = "100%"), type = 5, color="#581845"),
h3(htmlOutput("build_sum_title")),
withSpinner(tableOutput("build_summary"), type = 5, color="#FF5733")
)
)
),
tabPanel("Observe",
sidebarLayout(
sidebarPanel(
tags$head(tags$script('$(document).on("shiny:connected", function(e) {
Shiny.onInputChange("innerWidth", window.innerWidth);
});
$(window).resize(function(e) {
Shiny.onInputChange("innerWidth", window.innerWidth);
});
')),
checkboxInput("example_file_3", label = "Use SimSpin example file?", value=TRUE),
fileInput("sim_file_3", label = "Or upload simulation file:", multiple = FALSE, buttonLabel = "Browse...",
placeholder = "No file selected"),
checkboxGroupInput("ptype_3", label = "Particle types:",
choiceNames = c("Disc", "Bulge"),
choiceValues = c(2, 3), selected = c(2,3)),
#numericInput("r200_2", label = "Virial radius:", value = 200),
sliderInput("z_2", label = "Redshift:", min = 0.01, max = 0.1, value = 0.06),
selectInput("survey_2", label = "Survey:", choices = c("SAMI", "MaNGA", "CALIFA", "Hector", "Specified")),
# only show this panel if survey == "Specified"
conditionalPanel(
condition = "input.survey_2 == 'Specified'",
numericInput("fov_2", label = "IFU field of view:", value = 15),
selectInput("ap_shape_2", label = "Aperture shape:", choices = c("circular", "square", "hexagonal")),
numericInput("central_wvl_2", label = HTML("Central filter wavelength / Å :"), value = 4800),
numericInput("lsf_fwhm_2", label = "Line spread function:", value = 2.65),
sliderInput("pixel_sscale_2", label = "Spaxel scale / '' :", min = 0.25, max = 2, value = 0.5, step = 0.01),
sliderInput("pixel_vscale_2", label = HTML("Voxel scale / Å :"), min = 0.5, max = 2, value = 1.04, step = 0.01),
numericInput("threshold_2", label = "Magnitude limit:", value = 25)
),
sliderInput("inc_deg_2", label = "Inclination:", min = 0, max = 90, value = 90, step = 1),
numericInput("m2l_disc_2", label = "Disc mass-to-light ratio:", value = 2),
numericInput("m2l_bulge_2", label = "Bulge mass-to-light ratio:", value = 1),
checkboxInput("blur_2", label = "Blur?", value = FALSE),
# only show this panel if DM_profile == NFW
conditionalPanel(
condition = "input.blur_2 == true",
selectInput("psf_2", label = "PSF shape:", choices = c("Moffat", "Gaussian")),
sliderInput("fwhm_2", label = "FWHM:", min = 0, max = 5, value = 0.5, step = 0.5)
),
selectInput("measure_type", label = "Measurment radius details:", choices = c("Fit", "Specified", "Fixed")),
conditionalPanel(
condition = "input.measure_type == 'Fit'",
sliderInput("fac", label = HTML("Factor / R<sub>eff</sub>:"), min = 0, max = 5, value = 1, step = 0.1)
),
conditionalPanel(
condition = "input.measure_type == 'Specified'",
sliderInput("fract", label = HTML("Fraction of mass included:"), min = 0, max = 1, value = 0.5, step = 0.1),
numericInput("ar_a", label = "Semi-major, a / kpc", value = 2),
numericInput("ar_b", label = "Semi-minor, b / kpc", value = 1)
),
conditionalPanel(
condition = "input.measure_type == 'Fixed'",
sliderInput("fac", label = HTML("Factor / R<sub>eff</sub>:"), min = 0, max = 5, value = 1, step = 0.1),
numericInput("ar_a", label = "Semi-major, a / kpc", value = 2),
numericInput("ar_b", label = "Semi-minor, b / kpc", value = 1)
),
actionButton("submit_3", label = "Go!")
),
mainPanel(
tabsetPanel(
tabPanel("Flux",
h3(htmlOutput("fl_flux_title")),
withSpinner(plotOutput("fl_flux_plot", height = "100%"), type = 5, color="#FFC300")
),
tabPanel("Velocity",
h3(htmlOutput("fl_vel_title")),
withSpinner(plotOutput("fl_vel_plot", height = "100%"), type = 5, color="#C70039")
),
tabPanel("Dispersion",
h3(htmlOutput("fl_dis_title")),
withSpinner(plotOutput("fl_dis_plot", height = "100%"), type = 5, color="#581845")
),
tabPanel("Summary",
h3(htmlOutput("find_sum_title")),
withSpinner(tableOutput("find_summary"), type = 5, color="#FF5733")
)
)
)
)
),
tabPanel("Contact",
h3(htmlOutput("contact_info_header")),
htmlOutput("contact_info_1"),
a(actionButton(inputId = "email1", label = "Contact Admin",
icon = icon("envelope", lib = "font-awesome")),
href="mailto:katherine.harborne@icrar.org?subject=SimSpin Web-app Issue"),
htmlOutput("contact_info_2"))
)
))
)