From cffba452d152e4d374542d79c566bea39d98cebd Mon Sep 17 00:00:00 2001 From: Kristin Date: Mon, 29 Jun 2020 10:32:55 -0700 Subject: [PATCH] Update hist application to accpet nbins when min/max are not set (#3935) * Update hist application to accpet nbins when min/max are not set * Updated history comment on hist test --- isis/src/base/apps/hist/hist.xml | 4 ++++ isis/src/base/apps/hist/main.cpp | 5 +++++ isis/src/base/apps/hist/tsts/default/Makefile | 13 ++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/isis/src/base/apps/hist/hist.xml b/isis/src/base/apps/hist/hist.xml index 39739a369b..17c580d68d 100644 --- a/isis/src/base/apps/hist/hist.xml +++ b/isis/src/base/apps/hist/hist.xml @@ -84,6 +84,10 @@ Updated logic such that min/max values are no longer calculated from .cub if values are provided by the user. Fixes #3881. + + Re-added the ability to set number of bins without setting min/max values after the last update. + Follow-on to #3881. + diff --git a/isis/src/base/apps/hist/main.cpp b/isis/src/base/apps/hist/main.cpp index 7c3246604a..f9a3821ab7 100644 --- a/isis/src/base/apps/hist/main.cpp +++ b/isis/src/base/apps/hist/main.cpp @@ -57,7 +57,12 @@ void IsisMain() { } else { hist = new Histogram(*icube, 1, p.Progress()); + + if (ui.WasEntered("NBINS")){ + hist->SetBins(ui.GetInteger("NBINS")); + } } + // Setup the histogram // Loop and accumulate histogram diff --git a/isis/src/base/apps/hist/tsts/default/Makefile b/isis/src/base/apps/hist/tsts/default/Makefile index 92b0a4cfd2..89268ffcf8 100644 --- a/isis/src/base/apps/hist/tsts/default/Makefile +++ b/isis/src/base/apps/hist/tsts/default/Makefile @@ -1,9 +1,20 @@ +# 2020-06-25 - Kristin Berry - Added a test to check that if nbins is set, it is used. +# To make the truthdata for this test, I set the number of bins to 25, a number much smaller than +# the internal default, and just checked that the output was different from the default test. + APPNAME = hist histTruth.txt.IGNORELINES = Cube +histTruthNbins.txt.IGNORELINES = Cube TEMP = $(OUTPUT)/histTruth.txt +TEMPNBINS = $(OUTPUT)/histTruthNbins.txt include $(ISISROOT)/make/isismake.tsts commands: + # Test without additional arguments $(APPNAME) from=$(INPUT)/isisTruth.cub \ - to= $(TEMP) > /dev/null; + to=$(TEMP) > /dev/null; + + # Test with setting nbins + $(APPNAME) from=$(INPUT)/isisTruth.cub nbins=25\ + to=$(TEMPNBINS) > /dev/null;