Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/TASBEConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@
doc.histogram.about = 'Settings controlling histogram plotting preferences';
doc.histogram.displayLegend = 'If true, displays legend in bin statistics graphs';
s.histogram.displayLegend = true;
doc.histogram.plotGMM = 'If true, plots gaussian mixture model in bin statistics graphs';
s.histogram.plotGMM = false;

% Excel wrapper preferences
s.template = struct();
Expand Down
31 changes: 30 additions & 1 deletion code/plot_batch_histograms.m
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ function plot_batch_histograms(results,sampleresults,CM,linespecs)
maxcount = max(maxcount,max(max(counts)));
end


for j=1:numReplicates
for k=1:n_colors
ls = linespecs{k};
Expand All @@ -96,6 +95,36 @@ function plot_batch_histograms(results,sampleresults,CM,linespecs)
end
end

% add the plot of the GMM fit if it's available
if TASBEConfig.get('histogram.plotGMM')
for k=1:n_colors
replicates = sampleresults{i};
numReplicates = numel(replicates);
for j=1:numReplicates
fp_dist.mu = replicates{j}.PopComponentMeans;
fp_dist.Sigma(1,1,:) = replicates{j}.PopComponentStandardDevs;
fp_dist.weight = replicates{j}.PopComponentWeights;
bin_widths = get_bin_widths(getBins(replicates{j}.AnalysisParameters));
counts = replicates{j}.BinCounts;
multiplier = sum(counts)*log10(bin_widths);

model = gmm_pdf(fp_dist, log10(bin_centers)')*multiplier;
ls = linespecs{k};
if(ischar(ls) && length(ls)==1 && length(findstr(ls, 'rgbcmykw')) == 1)
plot(bin_centers,model,[ls '--']); hold on;
for l=1:numel(fp_dist.mu)
loglog([10^fp_dist.mu(l) 10^fp_dist.mu(l)],[1 maxcount],[ls ':']);
end
else
plot(bin_centers,model,'Color', ls, 'LineStyle', '--'); hold on;
for l=1:numel(fp_dist.mu)
loglog([10^fp_dist.mu(l) 10^fp_dist.mu(l)],[1 maxcount],'Color', ls, 'LineStyle', ':');
end
end
end
end
end

xlabel(unitlegend); ylabel('Count');
legend(lines, legendentries,'Location','Best');
if(TASBEConfig.isSet('OutputSettings.FixedBinningAxis')), xlim(TASBEConfig.get('OutputSettings.FixedBinningAxis')); end
Expand Down