This repository has been archived by the owner on Feb 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathplot_sample_histograms.m
71 lines (62 loc) · 2.8 KB
/
plot_sample_histograms.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
% Copyright (C) 2010-2017, Raytheon BBN Technologies and contributors listed
% in the AUTHORS file in TASBE analytics package distribution's top directory.
%
% This file is part of the TASBE analytics package, and is distributed
% under the terms of the GNU General Public License, with a linking
% exception, as described in the file LICENSE in the TASBE analytics
% package distribution's top directory.
function plot_sample_histograms(sampleresults,outputsettings)
% This makes an overlapping plot of the histograms for all of the
% different colors in a set of replicates
cfp_units = '';
AP = sampleresults{1}.AnalysisParameters;
channel_set = getChannelNames(AP);
n_colors = numel(channel_set);
replicates = sampleresults; % rename, for historical reasons
%%% Bin count plots:
% Counts by CFP level:
maxcount = 1e1;
h = figure('PaperPosition',[1 1 5 3.66]);
set(h,'visible','off');
for i=1:n_colors
color = getLineSpec(getChannel(AP,channel_set{i}));
numReplicates = numel(replicates);
for j=1:numReplicates,
counts = replicates{j}.Histograms(:,i);
analysisParam = replicates{j}.AnalysisParameters;
bins = getBins(analysisParam);
bin_centers = get_bin_centers(bins);
bin_widths = get_bin_widths(bins);
rep_units = getChannelUnits(analysisParam,'constitutive');
if strcmp(cfp_units,''), cfp_units = rep_units;
else if ~strcmp(cfp_units,rep_units), cfp_units = 'a.u.';
end
end
start = 1;
bin_size = numel(bin_centers);
while (start <= bin_size)
nanLoc = find(isnan(bin_centers(start:bin_size)), 1);
if isempty(nanLoc)
e = bin_size;
else
e = nanLoc - 1 + start - 1;
end
loglog(bin_centers(start:e),counts(start:e),[color '-']); hold on;
start = max(start+1, e+1);
end
% loglog(get_bin_centers(bins),counts,'-','Color',hsv2rgb([hues(i) 1 0.9])); hold on;
%%% Population mean / std.dev.
pop_mean = replicates{j}.PopMeans(i);
pop_std = replicates{j}.PopStandardDevs(i);
maxval = 10*max(counts);
plot([pop_mean pop_mean],[1e0 maxval],[color '--']);
plot([pop_mean*(pop_std.^2) pop_mean*(pop_std.^2)],[1e0 maxval],[color ':']);
plot([pop_mean/(pop_std.^2) pop_mean/(pop_std.^2)],[1e0 maxval],[color ':']);
maxcount = max(maxcount,max(counts));
end
end;
xlabel(['Constitutive ' cfp_units]); ylabel('Count');
if(outputsettings.FixedXAxis), xlim(outputsettings.FixedXAxis); end;
if(outputsettings.FixedYAxis), ylim(outputsettings.FixedYAxis); else ylim([1e0 10.^(ceil(log10(maxcount)))]); end;
title([outputsettings.StemName,' bin counts, colored by inducer level']);
outputfig(h,[outputsettings.StemName,'-histogram'],outputsettings.Directory);