dzhu / myo-raw

MIT License
218 stars 115 forks source link

EMG raw data #17

Open blackjacksme opened 8 years ago

blackjacksme commented 8 years ago

Hi, Thank you for your work , this code really helped a lot

I have a question though, how do i access the raw, unfiltered, EMG data from your myo_raw.py code? because i noticed in your proc_emg function :

def proc_emg(emg, moving, times=[]):
        if HAVE_PYGAME:
            ## update pygame display
            plot(scr, [e / 2000. for e in emg])
        else:
            print(emg)
        ## print framerate of received data
        times.append(time.time())
        if len(times) > 20:
            #print((len(times) - 1) / (times[-1] - times[0]))
            times.pop(0)`

you can print out the emg, but the EMG data in that variable is already filtered, as in there is no EMG data with negative value. I need help to access the real raw EMG data because i need the frequency spectrum of the signal. How can i do this?

Another thing is about the sample rate. After i change the m.run(1) into m.run(), the sample rate increased into 50 Hz, but the myo device itself can send the EMG data up to 200 Hz. How can i further increase the sample rate?

Best Regards, Rizki F.Z.

larasamirammal commented 8 years ago

@blackjacksme Did you solve the problem ? If so how do you reach the Raw EMG data ? and how did you solve the sampling rate problem ? there is a line where they set emg_hz to 50 did you try to change it?

Alvipe commented 7 years ago

I don't know if you are still interested, as this issue is from a year ago, but I've managed to get the real raw EMG signals, not the filtered ones that this code provides. You can check the code in my fork: https://github.com/Alvipe/myo-raw

hananabilabd commented 6 years ago

@Alvipe which .py to run to get the Raw EMG dATA ?

Alvipe commented 6 years ago

@hananabilabd, the main code is the _myoraw.py. This code graphs raw data from the 8 channels of the Myo. The variable where raw EMG data is stored is called emg. Hope this helps you.

hananabilabd commented 6 years ago

@Alvipe Thanks Yes ,I handled it from emg ,, But I had a problem , that emg data frame is very slow , I receive 512 frame of emg every 10 sec which is very slow while in windows running the capture data provided by MYO_SDK gives me 3000 frame in 10 seconds

PerlinWarp commented 3 years ago

@Alvipe Thank you for your PR!

It's worth noting that the Myo actually has 3 modes, @Alvipe's PR adds the ability to get raw and filtered data using the Myo. Actually raw data is unrectified and scaled between -128 and 127 and can be requested by sending 0x03. I've been working with the Myo for a year and have added some extra functions, including multithreading and Windows support here.

I've also made a Jupyter notebook showing the difference between these modes and you might preprocess the data here. This was for a project on using the Myo to play Breakout, the repo is here. Playing breakout with sEMG

Myo Modes (0x01, raw=False)
By default myo-raw sends 50Hz data that has been rectified and filtered, using a hidden 0x01 mode.
(0x02, raw=True, filtering=True)
Alvipe added the ability to also get filtered non-rectified sEMG (thanks Alvipe).
(0x03, raw=True, filtering=False)
Then I futher added the ability to get true raw non-filtered data at 200Hz. This data is unrectified but scales from -128 and 127.