Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amplifier resolution in brainampsocket #109

Open
felixilgatto opened this issue Mar 5, 2020 · 1 comment
Open

Amplifier resolution in brainampsocket #109

felixilgatto opened this issue Mar 5, 2020 · 1 comment

Comments

@felixilgatto
Copy link

felixilgatto commented Mar 5, 2020

Hey
I notice that the BrainAmpSocket node, doesn't take into account the resolution of the amplifier.
So I suggest this small fix in the thread of this node.

# brainampsocket.py

# Extract numerical data
block, points, nb_marker = struct.unpack('<LLL', rawdata[:hs])
sigsize = dt.itemsize * points * self.nb_channel
sigs = np.frombuffer(rawdata[hs:hs+sigsize], dtype=dt)
sigs = sigs.reshape(points, self.nb_channel)
head += points
sigs = sigs * self.resolutions[np.newaxis,:] # here
self.outputs['signals'].send(sigs, index=head)

I also pass in thread argument the resolution array.

# brainampsocket.py

class BrainAmpThread(QtCore.QThread):
    def __init__(self, outputs, brainamp_host, brainamp_port, nb_channel, resolutions, parent=None):
        QtCore.QThread.__init__(self)
        self.outputs = outputs
        self.brainamp_host= brainamp_host
        self.brainamp_port= brainamp_port
        self.nb_channel = nb_channel
        self.resolutions = resolutions # here

        self.lock = Mutex()
        self.running = False
@felixilgatto felixilgatto changed the title Resolution Resolution in brainampsocket Mar 5, 2020
@felixilgatto felixilgatto changed the title Resolution in brainampsocket Amplifier resolution in brainampsocket Mar 5, 2020
@samuelgarcia
Copy link
Contributor

Hi.
thanks for this.
Would you be OK to make a PR ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants