-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7f83026
commit 1b1a7f9
Showing
4 changed files
with
52 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from .funcs import * |
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 |
---|---|---|
|
@@ -10,6 +10,8 @@ | |
import glob | ||
import numpy as np | ||
|
||
__all__ = [] | ||
|
||
|
||
class CustomParser(argparse.ArgumentParser): | ||
|
||
|
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,48 @@ | ||
__all__ = ['smoothen', 'getShape', 'writeShapedFile', 'writeFile'] | ||
|
||
|
||
|
||
import numpy as np | ||
from scipy.interpolate import RectBivariateSpline | ||
import os,shutil,subprocess,sys | ||
from csaps import csaps | ||
|
||
|
||
|
||
|
||
|
||
def smoothen(data, shape, tc, pc, cols, sm=0.95): | ||
data.shape = shape | ||
|
||
grid = [data[:,0,tc], data[0,:, pc]] | ||
|
||
res = np.copy(data) | ||
|
||
for c in cols: | ||
res[...,c] = csaps(grid, data[...,c], grid, smooth=sm) | ||
return res | ||
|
||
|
||
|
||
|
||
def getShape(data): | ||
for i in range(data.shape[1]): | ||
print(np.unique(data[:,i]).shape) | ||
|
||
|
||
|
||
def writeShapedFile(file,data,fmt='%.8f'): | ||
assert len(data.shape)==3, "A 3D data is required for this function" | ||
with open(file, 'w') as f: | ||
for i in data: | ||
np.savetxt(f,i,delimiter='\t', fmt=fmt) | ||
f.write('\n') | ||
|
||
|
||
|
||
def writeFile(file,dat,tc=0,fmt='%.8f'): | ||
with open(file,'w') as f: | ||
for i in np.unique(dat[:,tc]): | ||
np.savetxt(f,dat[dat[:,tc]==i],delimiter='\t', fmt=fmt) | ||
f.write('\n') | ||
|
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