예제 #1
0
@author: kraftmann
"""
import matplotlib.pyplot as plt
import pyComtrade
import scipy
from scipy.fftpack import fft, fftfreq, ifft
import scipy.signal as signal
import numpy as np
from tkinter import *
from tkinter import filedialog

# app
#funcion para cargar

comtradeObj = pyComtrade.ComtradeRecord()


def abrir(comtradeObj):
    ar = filedialog.askopenfilename(
        title="Abrir")  #,filetypes=(("Archivos COMTRADE .cfg y .dat",".")))

    dat = filedialog.askopenfilename(
        title="Abrir")  #,filetypes=(("Archivos COMTRADE.dat ",".dat")))

    comtradeObj.read(ar, dat)
    number_of_samples = comtradeObj['endsamp'][-1]
    sampling_freq = comtradeObj['samp'][-1]
    an = ('Nombre de las señales analogas', comtradeObj.get_analog_ids()
          )  # print the ids of the analog channels.
    b = ('Nombre de las señales digitales', comtradeObj.get_digital_ids()
예제 #2
0
# This is an example of using the pyComtrade module to read a comtrade record.
# The Comtrade data are in the test_data folder.
#
# Developed by Miguel Moreto
# Brazil - 2013
#
__version__ = "$Revision$"  # SVN revision.
__date__ = "$Date$"  # Date of the last SVN revision.

# Matplotlib module is needed for this example.
# pyComtrade needs numpy.
import pyComtrade
import pylab

# Create an instance of the ComtradeRecord class and read the CFG file:
comtradeObj = pyComtrade.ComtradeRecord('./test_data3/test3.cfg')
checkCFG = comtradeObj.ReadCFG()
if checkCFG != 2:
    print comtradeObj.Ach_id  # print the ids of the analog channels.

    N = comtradeObj.getNumberOfSamples()

    print 'Record has %d samples' % (N)
    print 'Sampling rate is %d samples/sec.' % (comtradeObj.getSamplingRate())

    # Reading data file:
    comtradeObj.ReadDataFile()

    # Reading channel 4:
    AnalogChannelData = comtradeObj.getAnalogChannelData(22)