-
Notifications
You must be signed in to change notification settings - Fork 121
feat : revise plot function of 'hgf_ibrb' and 'hgf_ibrb single' #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/ehgf
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -520,74 +520,94 @@ plot_hgf_ibrb <- function(obj, fontSize = 10, ncols = 2, binSize = 30) { | |||||||||||||||||
| k <- 1 | ||||||||||||||||||
| if (!is.null(mu_kappa) && ncol(mu_kappa) > 0) { | ||||||||||||||||||
| for (i in seq_len(ncol(mu_kappa))) { | ||||||||||||||||||
| plots[[k]] <- plotDist( | ||||||||||||||||||
| sample = mu_kappa[, i], | ||||||||||||||||||
| fontSize = fontSize, | ||||||||||||||||||
| binSize = binSize, | ||||||||||||||||||
| xLab = bquote(kappa[.(i+1)] ~ "(phasic volatility)") | ||||||||||||||||||
| ) | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
| sample_all <- mu_kappa[,i] | ||||||||||||||||||
| if (length(unique(sample_all)) >1) { | ||||||||||||||||||
| plots[[k]] <- plotDist( | ||||||||||||||||||
| sample = mu_kappa[, i], | ||||||||||||||||||
| fontSize = fontSize, | ||||||||||||||||||
| binSize = binSize, | ||||||||||||||||||
| xLab = bquote(kappa[.(i+1)] ~ "(level" ~ .(i+1) ~"-" ~.(i+2)~"coupling)") | ||||||||||||||||||
| ) | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| if (!is.null(mu_omega) && ncol(mu_omega) > 0) { | ||||||||||||||||||
| for (i in seq_len(ncol(mu_omega))) { | ||||||||||||||||||
| sample_all <-mu_omega[,i] | ||||||||||||||||||
| if (length(unique(sample_all))>1) { | ||||||||||||||||||
| plots[[k]] <- plotDist( | ||||||||||||||||||
| sample = mu_omega[, i], | ||||||||||||||||||
| fontSize = fontSize, | ||||||||||||||||||
| binSize = binSize, | ||||||||||||||||||
| xLab = bquote(omega[.(i+1)] ~ "(tonic volatility)") | ||||||||||||||||||
| ) | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| if (!is.null(mu_zeta) && length(mu_zeta) > 0) { | ||||||||||||||||||
| sample_all = mu_zeta | ||||||||||||||||||
| if (length(unique(mu_zeta))>1) { | ||||||||||||||||||
| plots[[k]] <- plotDist( | ||||||||||||||||||
| sample = mu_omega[, i], | ||||||||||||||||||
| sample = mu_zeta, | ||||||||||||||||||
| fontSize = fontSize, | ||||||||||||||||||
| binSize = binSize, | ||||||||||||||||||
| xLab = bquote(omega[.(i+1)] ~ "(tonic volatility)") | ||||||||||||||||||
| xLab = expression(zeta ~ "(inv. decision noise)") | ||||||||||||||||||
| ) | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| if (!is.null(mu_zeta) && length(mu_zeta) > 0) { | ||||||||||||||||||
| plots[[k]] <- plotDist( | ||||||||||||||||||
| sample = mu_zeta, | ||||||||||||||||||
| fontSize = fontSize, | ||||||||||||||||||
| binSize = binSize, | ||||||||||||||||||
| xLab = expression(zeta ~ "(inv. decision noise)") | ||||||||||||||||||
| ) | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
| } | ||||||||||||||||||
| h_all <- do.call(multiplot, c(plots, list(cols = ncols))) | ||||||||||||||||||
| return(h_all) | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| plot_hgf_ibrb_single <- function(obj, fontSize = 10, ncols = 2, binSize = 30) { | ||||||||||||||||||
| pars <- obj$parVals | ||||||||||||||||||
| kappa = pars$kappa | ||||||||||||||||||
| omega = pars$omega | ||||||||||||||||||
| zeta = pars$zeta | ||||||||||||||||||
| plots <- list() | ||||||||||||||||||
| k <- 1 | ||||||||||||||||||
| if (!is.null(pars$kappa) && ncol(pars$kappa) > 0) { | ||||||||||||||||||
| for (i in seq_len(ncol(pars$kappa))) { | ||||||||||||||||||
| plots[[k]] <- plotDist( | ||||||||||||||||||
| sample = pars$kappa[, i], | ||||||||||||||||||
| fontSize = fontSize, | ||||||||||||||||||
| binSize = binSize, | ||||||||||||||||||
| xLab = bquote(kappa[.(i+1)] ~ "(phasic volatility)") | ||||||||||||||||||
| ) | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
| if (!is.null(kappa) && ncol(kappa) > 0) { | ||||||||||||||||||
| for (i in seq_len(ncol(kappa))) { | ||||||||||||||||||
| sample_all <- kappa[,i] | ||||||||||||||||||
| if (length(unique(sample_all)) >1) { | ||||||||||||||||||
| plots[[k]] <- plotDist( | ||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding whitespace
Suggested change
|
||||||||||||||||||
| sample = kappa[, i], | ||||||||||||||||||
| fontSize = fontSize, | ||||||||||||||||||
| binSize = binSize, | ||||||||||||||||||
| xLab = bquote(kappa[.(i+1)] ~ "(level" ~ .(i+1) ~"-" ~.(i+2)~"coupling)") | ||||||||||||||||||
| ) | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| if (!is.null(omega) && ncol(omega) > 0) { | ||||||||||||||||||
| for (i in seq_len(ncol(omega))) { | ||||||||||||||||||
| sample_all <- omega[,i] | ||||||||||||||||||
| if (length(unique(sample_all)) >1) { | ||||||||||||||||||
| plots[[k]] <- plotDist( | ||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding whitespace
Suggested change
|
||||||||||||||||||
| sample = omega[, i], | ||||||||||||||||||
| fontSize = fontSize, | ||||||||||||||||||
| binSize = binSize, | ||||||||||||||||||
| xLab = bquote(omega[.(i+1)] ~ "(tonic volatility)") | ||||||||||||||||||
| ) | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| if (!is.null(pars$omega) && ncol(pars$omega) > 0) { | ||||||||||||||||||
| for (i in seq_len(ncol(pars$omega))) { | ||||||||||||||||||
| if (!is.null(zeta) && length(zeta) > 0) { | ||||||||||||||||||
| sample_all <- zeta | ||||||||||||||||||
| if (length(unique(sample_all)) >1) { | ||||||||||||||||||
| plots[[k]] <- plotDist( | ||||||||||||||||||
| sample = pars$omega[, i], | ||||||||||||||||||
| sample = zeta, | ||||||||||||||||||
|
Comment on lines
+600
to
+603
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the Suggestion: removing
Suggested change
|
||||||||||||||||||
| fontSize = fontSize, | ||||||||||||||||||
| binSize = binSize, | ||||||||||||||||||
| xLab = bquote(omega[.(i+1)] ~ "(tonic volatility)") | ||||||||||||||||||
| xLab = expression(zeta ~ "(inv. decision noise)") | ||||||||||||||||||
| ) | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
|
bugoverdose marked this conversation as resolved.
Outdated
|
||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
| if (!is.null(pars$zeta) && length(pars$zeta) > 0) { | ||||||||||||||||||
| plots[[k]] <- plotDist( | ||||||||||||||||||
| sample = pars$zeta, | ||||||||||||||||||
| fontSize = fontSize, | ||||||||||||||||||
| binSize = binSize, | ||||||||||||||||||
| xLab = expression(zeta ~ "(inv. decision noise)") | ||||||||||||||||||
| ) | ||||||||||||||||||
| k <- k + 1 | ||||||||||||||||||
| } | ||||||||||||||||||
| h_all <- do.call(multiplot, c(plots, list(cols = ncols))) | ||||||||||||||||||
| return(h_all) | ||||||||||||||||||
| } | ||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
sample_alldoesn't seem to be used + adding whitespace