Hi everytone.
I am trying to build a GUI to call a bunch of my functions. It is based on Makie as it was suggested in this forum because the idea is to read a data file and them cut, filter, etc the data while displaying the changes. It is basically a couple of plots in GLmakie and a bunch of menus.
Here is an example of what I need with some simple matrix and data:
using GLMakie
fig = Figure(resolution = (1800, 1200))
xs = range(0, 2π, length=100)
ys = range(0, 2π, length=100)
zs = [sin(x*y) for x in xs, y in ys]
ax, hm = heatmap(fig[2:5,1:5],xs, ys, zs)
cb = Colorbar(fig[2:5, 6], hm)
x = range(0, 10, length=100)
y = sin.(x)
lines(fig[6,1:5], x, y)
## Menus
menu_File = Menu(fig, options = ["Read H5 file", "Read jld2 file", "Save to jld2", "Save to SAC", "Save to SEGY"])
menu_DAS_Processing = Menu(fig, options = ["Low Pass Filter","High Pass Filter","Bandpass Filter","Integrate","Derivate","Detrend","Remove Mean","Taper ends"])
menu_Channel_Processing = Menu(fig, options = ["Low Pass Filter","High Pass Filter","Bandpass Filter","Integrate","Derivate","Detrend","Remove Mean","Taper ends"])
menu_colormap = Menu(fig, options = ["bone_1","curl","inferno","grayC50","jet","magma","plasma","PRGn","PiYG","RdBu_11","RdGy_11","RdYlBu_11","Spectral_11","turbo","viridis"])
## Menus
#menu_File = Menu(fig, options = ["Read H5 file", "Read jld2 file", "Save to jld2", "Save to SAC", "Save to SEGY"],cell_color_hover=RGBf(0.90, 0.90, 0.90),cell_color_active=RGBf(0.80, 0.80, 0.80))
#menu_DAS_Processing = Menu(fig, options = ["Low Pass Filter","High Pass Filter","Bandpass Filter","Integrate","Derivate","Detrend","Remove Mean","Taper ends"], default = "Bandpass Filter",cell_color_hover=RGBf(0.90, 0.90, 0.90),cell_color_active=RGBf(0.80, 0.80, 0.80))
#menu_Channel_Processing = Menu(fig, options = ["Low Pass Filter","High Pass Filter","Bandpass Filter","Integrate","Derivate","Detrend","Remove Mean","Taper ends"], default = "Bandpass Filter",cell_color_hover=RGBf(0.90, 0.90, 0.90),cell_color_active=RGBf(0.80, 0.80, 0.80))
#menu_colormap = Menu(fig, options = ["bone_1","curl","inferno","grayC50","jet","magma","plasma","PRGn","PiYG","RdBu_11","RdGy_11","RdYlBu_11","Spectral_11","turbo","viridis"], default = "RdBu_11",cell_color_hover=RGBf(0.90, 0.90, 0.90),cell_color_active=RGBf(0.80, 0.80, 0.80))
## Plotting Menus
fig[1, 1] = vgrid!(
Label(fig, "File", width = nothing),
menu_File;
tellheight = false, width = 200)
fig[1, 2] = vgrid!(
Label(fig, "DAS Processing", width = nothing),
menu_DAS_Processing;
tellheight = false, width = 200)
fig[1, 3] = vgrid!(
Label(fig, "Channel Processing", width = nothing),
menu_Channel_Processing;
tellheight = false, width = 200)
fig[1, 4] = vgrid!(
Label(fig, "Others", width = nothing),
menu_colormap;
tellheight = false, width = 200)
notify(menu_colormap.selection)
on(menu_colormap.selection) do s
hm.colormap = s
end
fig
Now, in the first menu I need to call my own function which would look in a script like this:
strainrate, rtime, htime, offset, atrib = rdas("Data.h5");
This data file should be read and then update the plot to this data.
Then if the user needs to filter it with a butterworth filter 200 Hz to 1000 Hz and 4 poles (for example) he/she can calls:
filtstrainrate = bpdas(strainrate, rtime, offset, 200, 1000; poles=4);
Now, my question is how can I call this functions to the Makie window and request the user for the inputs required by each function.
Tips and recommendations are welcomed.
Thanks in advance!!!
M.