Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
There had been a couple of incorrect commits/pushs in the last days...
- Loading branch information
1 parent
157badf
commit bd8aae2
Showing
10 changed files
with
304 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE UserProject SYSTEM "UserProject-4.0.dtd"> | ||
<!-- eric4 user project file for project BioPARKIN --> | ||
<!-- Saved: 2013-02-15, 10:25:54 --> | ||
<!-- Saved: 2013-03-04, 16:49:31 --> | ||
<!-- Copyright (C) 2013 Moritz Wade, Thomas Dierkes, Susanna Röblitz, moritzwade@gmail.com --> | ||
<UserProject version="4.0"> | ||
</UserProject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
% | ||
% [retval] = sample_bioparkin_data( fname, tpoints, [nlevel] ) | ||
% | ||
% input: | ||
% ------ | ||
% fname - a BioPARKIN data file | ||
% tpoints - new time point vector at which the | ||
% given data is resampled | ||
% nlevel - optional: the additive noiselevel | ||
% (default value: 0.01) | ||
% | ||
% output: | ||
% ------- | ||
% retval - the new data matrix WITHOUT the header line | ||
% of the input fileparts | ||
% | ||
% Additionally, a new file with the file name [fname '_pert' ext] | ||
% will be created, storing the reaampled data (but WITHOUT the SD | ||
% columns, up to now ...) | ||
% | ||
|
||
% Copyright (C) 2011 | ||
% Zuse Institute Berlin, Germany | ||
% | ||
% Date 24/11/2011 | ||
% Written by Thomas Dierkes | ||
% | ||
function [retval] = sample_bioparkin_data( fname, tpoints, noise ) | ||
|
||
if nargin < 2 | ||
error('nargin too small: Missing new timepoints?') ; | ||
return ; | ||
end | ||
if nargin < 3 | ||
noise = 0.01 ; | ||
end | ||
|
||
fidin = fopen( fname ) ; | ||
|
||
if fidin < 0 | ||
error('fopen: fidin = %d', fidin) ; | ||
return ; | ||
end | ||
|
||
|
||
header = fgetl(fidin) ; % read WTHOUT trailing newline | ||
|
||
A = [] ; | ||
|
||
while ~ feof(fidin) | ||
line = fgets(fidin) ; | ||
|
||
a = sscanf( line, '%f') ; | ||
A = [ A; a'] ; | ||
end | ||
|
||
fclose( fidin ) ; | ||
|
||
[m,n] = size(A) ; | ||
|
||
t = A(:,1) ; | ||
tpoints = tpoints(:) ; | ||
m = length(tpoints) ; | ||
|
||
retval = [ tpoints, ... | ||
interp1( t, A(:,2:n), tpoints ) + noise*randn(m,n-1) ] ; | ||
|
||
% | ||
|
||
[p,fn,ext] = fileparts( fname ) ; | ||
% fullfile(p, [fn '_pert' ext]) | ||
fidout = fopen( fullfile(p, [fn '_pert' ext]), "w" ) ; | ||
|
||
if fidout < 0, | ||
error('fopen: fidout = %d', fidout) ; | ||
return ; | ||
end | ||
|
||
fprintf( fidout, '%s\n', header ) ; | ||
for j=1:m | ||
fprintf( fidout, '%g \t', retval(j,:) ) ; | ||
fprintf( fidout, '\n' ) ; | ||
end | ||
|
||
fclose( fidout ) ; | ||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.