diff --git a/InterSpec_resources/static_text/ShieldSourceFitLog/act_fit.tmplt.html b/InterSpec_resources/static_text/ShieldSourceFitLog/act_fit.tmplt.html
index bed9cc96..1448eece 100644
--- a/InterSpec_resources/static_text/ShieldSourceFitLog/act_fit.tmplt.html
+++ b/InterSpec_resources/static_text/ShieldSourceFitLog/act_fit.tmplt.html
@@ -98,6 +98,7 @@
Warnings
+{% if exists("foreground") %}
-
{% if exists("background") %} Foreground: {% endif %}
@@ -179,7 +180,9 @@ Warnings
{% endif %}
- {% if exists("background") %}
+ {% endif %}
+
+ {% if exists("background") %}
-
Background:
@@ -278,7 +281,6 @@ Warnings
Branching ratios are being corrected for nuclide decay during measurement.
{% endif %}
- {% endif %}
{% if exists("background") %}
-
@@ -288,7 +290,8 @@
Warnings
Background peaks are not being subtracted.
{% endif %}
- {% endif %}
+ {% endif %}
+ {% endif %}
@@ -450,6 +453,7 @@ Warnings
+{% if exists("foreground") %}
+{% endif %}
{% if exists("Shieldings") %}
{% if existsIn(Shieldings,"Shields") %}
diff --git a/InterSpec_resources/static_text/ShieldSourceFitLog/std_fit_log.tmplt.txt b/InterSpec_resources/static_text/ShieldSourceFitLog/std_fit_log.tmplt.txt
index 6fa88df6..b6e72e48 100644
--- a/InterSpec_resources/static_text/ShieldSourceFitLog/std_fit_log.tmplt.txt
+++ b/InterSpec_resources/static_text/ShieldSourceFitLog/std_fit_log.tmplt.txt
@@ -1,4 +1,4 @@
-Foreground LiveTime: {% if foreground.LiveTime_s %}{{ foreground.LiveTime_s }} seconds{% endif %} {% if foreground.LiveTime %}({{ foreground.LiveTime }}){% endif %}
+{% if exists("foreground") %}Foreground LiveTime: {% if foreground.LiveTime_s %}{{ foreground.LiveTime_s }} seconds{% endif %} {% if foreground.LiveTime %}({{ foreground.LiveTime }}){% endif %}{% else %}No foreground spectrum{% endif %}
{% if HasFitResults %}{% if FixedGeometryDetector %}Results given as {{ ActShieldFitSetup.FixedGeometryType }}.{% else %}Distance to source center from detector: {{ ActShieldFitSetup.Distance }}{% endif %}{% endif %}
{% if exists("Detector") %}{% if Detector %}Detector: {{ Detector.Name }} radius {{ printFixed(Detector.Radius_cm,1) }}{% endif %}{% endif %}
{% if HasFitResults %}
diff --git a/src/BatchActivity.cpp b/src/BatchActivity.cpp
index 430e5715..4af43b1b 100644
--- a/src/BatchActivity.cpp
+++ b/src/BatchActivity.cpp
@@ -316,7 +316,8 @@ void fit_activities_in_files( const std::string &exemplar_filename,
= fit_activities_in_file( exemplar_filename, exemplar_sample_nums,
cached_exemplar_n42, filename, options );
- if( fit_results.m_result_code == BatchActivityFitResult::ResultCode::CouldntOpenExemplar )
+ if( (fit_results.m_result_code == BatchActivityFitResult::ResultCode::CouldntOpenExemplar)
+ || (fit_results.m_result_code == BatchActivityFitResult::ResultCode::CouldntOpenBackgroundFile) )
throw runtime_error( fit_results.m_error_msg );
if( !cached_exemplar_n42 )
diff --git a/src/GammaInteractionCalc.cpp b/src/GammaInteractionCalc.cpp
index a19be7cc..7a4baf3d 100644
--- a/src/GammaInteractionCalc.cpp
+++ b/src/GammaInteractionCalc.cpp
@@ -2693,7 +2693,7 @@ std::pair, ROOT::Minuit2::MnUserParamete
}//for(...)
if( peaks.empty() )
- throw runtime_error( "There are not peaks selected for the fit" );
+ throw runtime_error( "There are no peaks selected for the fit" );
double liveTime = foreground ? foreground->live_time() : 1.0f;
double realTime = foreground ? foreground->real_time() : 0.0f;
diff --git a/src/PeakDef.cpp b/src/PeakDef.cpp
index 03ff46dd..1d64da07 100644
--- a/src/PeakDef.cpp
+++ b/src/PeakDef.cpp
@@ -2729,14 +2729,14 @@ std::string PeakDef::gaus_peaks_to_json(const std::vector::digits10 + 1);
answer << "," << q << "continuumEnergies" << q << ":[";
for (size_t i = firstbin; i <= lastbin; ++i)
- answer << (i ? "," : "") << foreground->gamma_channel_lower(i);
+ answer << ((i!=firstbin) ? "," : "") << foreground->gamma_channel_lower(i);
answer << "]," << q << "continuumCounts" << q << ":[";
/*
@@ -2759,14 +2759,14 @@ std::string PeakDef::gaus_peaks_to_json(const std::vectorgamma_channel_lower(i);
+ answer << ((i!=firstbin) ? "," : "") << foreground->gamma_channel_lower(i);
answer << "]," << q << "continuumCounts" << q << ":[";
}
*/
@@ -2778,7 +2778,7 @@ std::string PeakDef::gaus_peaks_to_json(const std::vectorgamma_channel_lower( i );
const float upper_x = foreground->gamma_channel_upper( i );
const float cont_counts = continuum->offset_integral( lower_x, upper_x, foreground );
- answer << (i ? "," : "") << cont_counts;
+ answer << ((i!=firstbin) ? "," : "") << cont_counts;
}
answer << "]";
@@ -2809,10 +2809,10 @@ std::string PeakDef::gaus_peaks_to_json(const std::vectorgamma_channel_lower(i);
+ answer << ((i!=firstbin) ? "," : "") << hist->gamma_channel_lower(i);
answer << "]," << q << "continuumCounts" << q << ":[";
for (size_t i = firstbin; i <= lastbin; ++i)
- answer << (i ? "," : "") << hist->gamma_channel_content(i);
+ answer << ((i!=firstbin) ? "," : "") << hist->gamma_channel_content(i);
answer << "]";
answer << std::setprecision(9);