Example #1
0
    def generate_cos(self, Vmax, frequency, T, length):
        signal = Signal()
        spectrum = Spectrum()

        signal.set_frequency(frequency)

        x_t = np.linspace(0, T, length)
        y_t = np.multiply(Vmax, np.cos(np.multiply(2 * np.pi * frequency,
                                                   x_t)))

        signal.set_time_data(x_t, y_t)
        S = spectrum.Fourier_transform(signal)
        return signal
Example #2
0
    def generate_sinc(self, Vmax, frequency, T, length):
        signal = Signal()
        spectrum = Spectrum()

        signal.set_frequency(frequency)

        x_t = np.linspace(0, T, length)
        y_t = []

        var = 0
        for i in range(len(x_t)):
            if x_t[i] >= (var + 1) / frequency:
                var = var + 1
            y_t.append(Vmax * np.sinc(8 * frequency *
                                      (x_t[i] - var / frequency) - 4))

        signal.set_time_data(x_t, y_t)
        signal = spectrum.Fourier_transform(signal)
        return signal
Example #3
0
    def Low_pass(self, original_signal):
        signal = Signal()
        spectrum = Spectrum()

        length = len(original_signal.get_time_data()[0])

        x_1, y_1 = original_signal.get_original_frequency_data()
        y = y_1

        for i in range(len(x_1)):
            if x_1[i] <= -self.fa or x_1[i] >= self.fa:
                y[i] = 0

        signal.set_originial_frequency_data(x_1, y)

        signal = spectrum.Original_Fourier_transform(signal, length)
        signal = spectrum.Inverse_Fourier_transform(
            signal,
            original_signal.get_time_data()[0][-1],
            len(original_signal.get_time_data()[0]))
        return signal
Example #4
0
    def generate_square(self, Vmax, frequency, DC, T, length):
        signal = Signal()
        spectrum = Spectrum()

        signal.set_frequency(frequency)

        x_t = np.linspace(0, T, length)
        y_t = []

        var = 0
        for i in range(len(x_t)):
            if x_t[i] >= (var + 1) / frequency:
                var += 1
            if (x_t[i] - var / frequency) >= DC / (100 * frequency):
                y_t.append(0)
            else:
                y_t.append(Vmax)

        signal.set_time_data(x_t, y_t)
        signal = spectrum.Fourier_transform(signal)

        return signal
Example #5
0
from Python.Spectrum import Spectrum
from Python.UniversalSpectrumIdentifier import UniversalSpectrumIdentifier

# USI created
# usi = UniversalSpectrumIdentifier("asdf:PXD000561::Adult_Frontalcortex_bRP_Elite_85_f09:scan:17555:VLHPLEGAVVIIFK/2")

usi = UniversalSpectrumIdentifier(
    "mzspec:PXD002437:00261_A06_P001564_B00E_A00_R1:scan:10951:PEPT[Phospho]IDELVISK/2"
)
# usi = UniversalSpectrumIdentifier("mzspec:PXD005712::20152002_RG_150218_Saita_Ctrl_3XXXXX:scan:5748:AVAAVAATGPASAPGPGGGR/2")
usi.parse(verbose=True)
# if the USI is okay then create a spectrum class to fetch from the online database
if usi.valid:
    # spectrum class just takes in a USI
    spectrum = Spectrum(usi)
    # fetches the USI from the PeptideAtlas database or whatever database is specified
    resp = spectrum.fetch('PeptideAtlas')
    print(resp.code)
    print(resp.message)
    if resp.code == 'OK':
        spectrum.show()