예제 #1
0
def test_window_smooth(tic):
    assert isinstance(tic, IonChromatogram)

    # apply window smoothing: mean and median, in both cases
    # the window is 5 points
    tic1 = window_smooth(tic, window=5)
    assert isinstance(tic1, IonChromatogram)

    tic2 = window_smooth(tic, window=5, use_median=True)
    assert isinstance(tic2, IonChromatogram)

    # an example of how to specify window as a time string
    # (7 seconds in this case)
    tic3 = window_smooth(tic, window="7s")
    assert isinstance(tic3, IonChromatogram)

    for obj in [*test_numbers, test_string, *test_lists, test_dict]:
        with pytest.raises(TypeError):
            window_smooth(obj)  # type: ignore
    for obj in [test_float, *test_lists, test_dict]:
        with pytest.raises(TypeError):
            window_smooth(tic, window=obj)  # type: ignore
    for obj in [test_string, test_float, *test_lists, test_dict]:
        with pytest.raises(TypeError):
            window_smooth(tic, use_median=obj)  # type: ignore
예제 #2
0
파일: proc.py 프로젝트: jontay81/pyms-test
"""proc.py
"""

import sys
sys.path.append("/x/PyMS")

from pyms.GCMS.IO.ANDI.Function import ANDI_reader
from pyms.GCMS.Function import build_intensity_matrix_i
from pyms.Noise.Window import window_smooth

# read the raw data as a GCMS_data object
andi_file = "/x/PyMS/data/gc01_0812_066.cdf"
data = ANDI_reader(andi_file)

# build the intensity matrix
im = build_intensity_matrix_i(data)

# get the size of the intensity matrix
n_scan, n_mz = im.get_size()
print "Size of the intensity matrix is (n_scans, n_mz):", n_scan, n_mz

# loop over all m/z values, fetch the corresponding IC, and perform
# noise smoothing
for ii in im.iter_ic_indices():
    print ii + 1,
    ic = im.get_ic_at_index(ii)
    ic_smooth = window_smooth(ic, window=7)
예제 #3
0
파일: proc.py 프로젝트: ma-bio21/pyms-test
"""proc.py
"""

import sys

sys.path.append("/x/PyMS")

from pyms.GCMS.IO.ANDI.Function import ANDI_reader
from pyms.GCMS.Function import build_intensity_matrix_i
from pyms.Noise.Window import window_smooth

# read the raw data as a GCMS_data object
andi_file = "/x/PyMS/data/gc01_0812_066.cdf"
data = ANDI_reader(andi_file)

# build the intensity matrix
im = build_intensity_matrix_i(data)

# get the size of the intensity matrix
n_scan, n_mz = im.get_size()
print "Size of the intensity matrix is (n_scans, n_mz):", n_scan, n_mz

# loop over all m/z values, fetch the corresponding IC, and perform
# noise smoothing
for ii in im.iter_ic_indices():
    print ii + 1,
    ic = im.get_ic_at_index(ii)
    ic_smooth = window_smooth(ic, window=7)
예제 #4
0
"""proc.py
"""
# This file has been replaced by jupyter/NoiseSmoothing.ipynb

from pyms.GCMS.IO.ANDI import ANDI_reader
from pyms.Noise.Window import window_smooth

# read the raw data
andi_file = "data/gc01_0812_066.cdf"
data = ANDI_reader(andi_file)

# get the TIC
tic = data.tic

# apply window smoothing: mean and median, in both cases
# the window is 5 points
tic1 = window_smooth(tic, window=5)
tic2 = window_smooth(tic, window=5, median=True)

# an example of how to specify window as a time string
# (7 seconds in this case)
tic3 = window_smooth(tic, window='7s')

# write the origina IC and smoothed ICs to a file
tic.write("output/tic.dat", minutes=True)
tic1.write("output/tic1.dat", minutes=True)
tic2.write("output/tic2.dat", minutes=True)
예제 #5
0
파일: proc.py 프로젝트: ma-bio21/pyms-test
"""proc.py
"""

import sys
sys.path.append("/x/PyMS/")

from pyms.GCMS.IO.ANDI.Function import ANDI_reader
from pyms.Noise.Window import window_smooth

# read the raw data
andi_file = "/x/PyMS/data/gc01_0812_066.cdf"
data = ANDI_reader(andi_file)

# get the TIC
tic = data.get_tic()

# apply window smoothing: mean and median, in both cases
# the window is 5 points
tic1 = window_smooth(tic, window=5)
tic2 = window_smooth(tic, window=5, median=True)

# an example of how to specify window as a time string
# (7 seconds in this case)
tic3 = window_smooth(tic, window='7s')

# write the origina IC and smoothed ICs to a file
tic.write("output/tic.dat",minutes=True)
tic1.write("output/tic1.dat",minutes=True)
tic2.write("output/tic2.dat",minutes=True)