Skip to content

Commit

Permalink
Update hist application to accpet nbins when min/max are not set (#3935)
Browse files Browse the repository at this point in the history
* Update hist application to accpet nbins when min/max are not set

* Updated history comment on hist test
  • Loading branch information
krlberry authored Jun 29, 2020
1 parent 92e68f6 commit cffba45
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions isis/src/base/apps/hist/hist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
</change>
<change name="Kristin Berry" date="2020-06-25">
Re-added the ability to set number of bins without setting min/max values after the last update.
Follow-on to #3881.
</change>
</history>

<oldName>
Expand Down
5 changes: 5 additions & 0 deletions isis/src/base/apps/hist/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion isis/src/base/apps/hist/tsts/default/Makefile
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit cffba45

Please sign in to comment.