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
8 changes: 5 additions & 3 deletions code/@PlasmidExpressionModel/PlasmidExpressionModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@

if (numel(PEM.fp_dist.mu) == 1 || max(PEM.fp_dist.weight)>0.999) && n_components>1, % failure to separate -> duplicate
TASBESession.warn('Model:CFPDistributionSeparation','CannotSeparateDistribution','Distribution could not be separated');
PEM.fp_dist.mu(2) = PEM.fp_dist.mu(1);
PEM.fp_dist.Sigma(:,:,2) = PEM.fp_dist.Sigma(:,:,1); % This Sigma is a *variance*, and not a std. dev.
PEM.fp_dist.weight = [0.5 0.5];
for i=2:n_components
PEM.fp_dist.mu(i) = PEM.fp_dist.mu(1);
PEM.fp_dist.Sigma(:,:,i) = PEM.fp_dist.Sigma(:,:,1); % This Sigma is a *variance*, and not a std. dev.
end
PEM.fp_dist.weight = ones(1,n_components)/n_components;
else if numel(PEM.fp_dist.mu) < n_components
TASBESession.warn('Model:CFPDistributionSeparation','NotEnoughComponents','Less components than expected: %i vs. %i',numel(PEM.fp_dist.mu),n_components);
% add zero-weight components
Expand Down
1 change: 1 addition & 0 deletions code/utils/percentile.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@

function value = percentile(data,n)
sorted = sort(data(~isnan(data))); % sort low to high
if isempty(sorted), value = NaN; return; end; % no numbers in --> NaN out
index = ceil((n/100)*numel(sorted));
value = sorted(index);