From 9ac40a12adaab964e89451e4a3c594049ca5b7e7 Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Mon, 25 Mar 2019 17:09:33 -0400 Subject: [PATCH] Improve detection of off-diagonal omega names --- NEWS.md | 4 ++++ R/xpdb_access.R | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index e3690e03..6be2801f 100755 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# xpose 0.4.4.9000 +### General +* Off-diagonal ETA names are better-detected (@billdenney #121) + # xpose 0.4.4 ### General * Improved documentation for `xpose_data` (@billdenney #99) diff --git a/R/xpdb_access.R b/R/xpdb_access.R index ab9fadc6..a1f868cf 100755 --- a/R/xpdb_access.R +++ b/R/xpdb_access.R @@ -423,13 +423,23 @@ get_prm <- function(xpdb, } # Assign OMEGA labels - n_omega <- sum(prms$type == 'ome' & prms$diagonal, na.rm = TRUE) + mask_omega <- prms$type == 'ome' & prms$diagonal + mask_omega_all <- + prms$type == 'ome' & + !is.nan(prms$value) & + (prms$diagonal | + !(prms$value == 0 & prms$fixed & !prms$diagonal) + ) + n_omega <- sum(mask_omega, na.rm = TRUE) + n_omega_all <- sum(mask_omega_all, na.rm = TRUE) omega_names <- data$prm_names$omega - if (n_omega != length(omega_names)) { + if (n_omega == length(omega_names)) { + prms$label[mask_omega] <- omega_names + } else if (n_omega_all == length(omega_names)) { + prms$label[mask_omega_all] <- omega_names + } else { warning('[$prob no.', data$problem, ', subprob no.', data$subprob, ', ', data$method, '] $OMEGA labels did not match the number of OMEGAs in the `.ext` file.', call. = FALSE) - } else { - prms$label[prms$type == 'ome' & prms$diagonal] <- omega_names } # Assign SIGMA labels