Forums

Welcome, Guest
You have to register before you can post on our site.

Search Forums

(Advanced Search)

Latest Threads
anti-bias algorithm with ...
Forum: Software
Last Post: Josh
Yesterday, 04:33 PM
» Replies: 1
» Views: 34
Error in ArCOMObject_Bpod...
Forum: Hardware
Last Post: Josh
05-25-2022, 01:55 AM
» Replies: 1
» Views: 77
Waveforms from two analog...
Forum: Software
Last Post: HK
05-19-2022, 07:33 PM
» Replies: 4
» Views: 289
Recommended instrument fo...
Forum: Hardware
Last Post: Josh
05-03-2022, 01:31 AM
» Replies: 1
» Views: 464
Best way to stop all soun...
Forum: Software
Last Post: Josh
04-08-2022, 04:24 PM
» Replies: 1
» Views: 465
HiFi module looping sound
Forum: Software
Last Post: Josh
04-01-2022, 04:53 AM
» Replies: 3
» Views: 655
Error: The Serial Port re...
Forum: Software
Last Post: mjdubs25
03-16-2022, 05:44 PM
» Replies: 2
» Views: 689
Which camera is better to...
Forum: Hardware
Last Post: yurier
03-16-2022, 02:16 PM
» Replies: 2
» Views: 1,584
Custom pulse not saved in...
Forum: Software
Last Post: Cristian
03-15-2022, 08:20 AM
» Replies: 2
» Views: 955
State change synchronizat...
Forum: Software
Last Post: water
03-01-2022, 08:48 PM
» Replies: 2
» Views: 808

 
  anti-bias algorithm with TrialManager
Posted by: themachine - Yesterday, 03:49 PM - Forum: Software - Replies (1)

Hi Josh,

when using TrialManager, how can I integrate an anti-bias algorithm into my protocol?


When using RunStateMachine it's possible to use something similar to the TotalRewardDisplay:

   if ~isnan(BpodSystem.Data.RawEvents.Trial{currentTrial}.States.LeftReward(1))
       TotalLeftRewards = TotalLeftRewards +1;

But with TrialManager I can't use this, because the RawEvents only get transmitted at the end of the trial so it doesn't already load the changed "TotalLeftRewards" for the next trial (but only for the one after that).


How can I use currentTrialEvents = getCurrentEvents(TriggerStates) to update a variable to make an anti-bias algorithm with TrialManager in which the amount of times a state happened are counted and change the following trial?


  Error in ArCOMObject_Bpod/read
Posted by: og100 - 05-23-2022, 08:01 PM - Forum: Hardware - Replies (1)

Hi Josh,

I'm running into this error fairly often in Bpod sessions > ~150 trials... Any idea what might be the issue? 

I am using the Hifi module to delivery sound stimuli, and am using the BNC input channel(s) to detect licking events (5V TTL) in a head-fixed mouse set-up with:

Bpod r2
Matlab R2021b with Psychtoolbox 3.0.18 installed
Ubuntu 20.04.4 LTS

Index exceeds the number of array elements. Index must not exceed 1.

Error in ArCOMObject_Bpod/read (line 395)
                        varargout{i} = uint8(obj.InBuffer(PosTongueos+nBytesRead-1));

Error in RunStateMachine (line 101)
            opCodeBytes = BpodSystem.SerialPort.read(2, 'uint8');

Error in RunStateMatrix (line 2)
RawEvents = RunStateMachine;

Error in Stage3_FixedLocation (line 300)
    RawEvents = RunStateMatrix; % Run the trial and return events

Error in run (line 91)
evalin('caller', strcat(script, ';'));

Error in NewLaunchManager>LaunchProtocol (line 717)
run(ProtocolPath);
 
Error while evaluating DestroyedObject Callback.


  Waveforms from two analog output module channels
Posted by: HK - 05-10-2022, 06:52 PM - Forum: Software - Replies (4)

Hi,

I have a 4-channel Analog Output Module. 
I would like to send one waveform to Ch1 and another to Ch2 simultaneously. 

I did the following to load two waveforms:

W.loadWaveform(1, waveform1);
W.loadWaveform(2, waveform2);
LoadSerialMessages('WavePlayer1', {['P',1,0], ['P',2,1]});

However, I am not sure how to trigger both waveforms simultaneously in the AddState command.

If I do 'OutputActions', {'WavePlayer1',1}  or 'OutputActions', {'WavePlayer1',2}, they individually work as expected.
So, the loading of the waveforms seem to be working.  Would you mind letting me know how to trigger both waveforms?
I tried 'OutputActions', {'WavePlayer1',3}, similar to what I would do for BNCState or WireState, but it did not work for WavePlayer1.

Thanks,
Hiroyuki


  Recommended instrument for manual sound calibration
Posted by: Cal - 04-27-2022, 08:46 AM - Forum: Hardware - Replies (1)

Hi,

Do you have any recommended instrument/microphone for measuring the absolute amplitude to calibrate the sound?

Thanks,
Cal


  Best way to stop all sound when terminating a protocol
Posted by: Cal - 04-08-2022, 10:37 AM - Forum: Software - Replies (1)

When you terminate a protocol mid trial the HiFi module will continue to play the cued sound.

I have been tentatively looking through the Bpodgen2 files, I feel we could add:


Code:
H = BpodHiFi(BpodSystem.ModuleUSB.HiFi1);
H.stop
clear H 

Thought it better to ask in case a change like this could cause a knock on effect of errors.
Thanks,
Cal


  HiFi module looping sound
Posted by: Cal - 03-29-2022, 05:01 PM - Forum: Software - Replies (3)

Using the HiFiSound2AFC.m example, how can I loop a sound?

Say I add the 'PunishSound' to the initial 'Waitforpoke' state:

Code:
sma = AddState(sma, 'Name', 'WaitForCenterPoke', ...
       'Timer', 0,...
       'StateChangeConditions', {'Port2In', 'Delay'},...
       'OutputActions', {'HiFi1','*', 'HiFi1', ['P' 2]});

The sound only plays briefly and I can't seem to find the syntax to implement:

Quote:'O' (ASCII 79): Set loop mode for a waveform


Thanks.


  Which camera is better to combine with Bpod?
Posted by: yurier - 03-15-2022, 11:37 AM - Forum: Hardware - Replies (2)

Hello, I am just starting with behavioral neuroscience. I would like to know if it is easy to plug a Ethernet (Power over Ethernetcamera into the Bpod or would be better to time stamp the video acquisitions using an usb camera with Matlab. The application is to combine whisker stimulation with pupilometry. 

Best,
Yuri


  Error: The Serial Port returned 0 bytes (Analog Input Module)
Posted by: mjdubs25 - 03-14-2022, 08:10 PM - Forum: Software - Replies (2)

Hi Josh,

I'm having an issue with the Bpod Analog Input module where I get:
Error: The serial port returned 0 bytes.

This seems to happen randomly, sometimes on the first couple trials of my protocol and sometimes only after 20+ minutes.
I found this thread (https://sanworks.io/forum/showthread.php...ght=serial) and have made sure that I am running the most updated 'master' branch of the firmware on both the State Machine and the AI Module, but the problem persists. The light on the AI Module stays on the whole time. In order to fix the problem, I have to disconnect the AI module from the computer and restart the protocol. Do you have any solution to this?

I am also getting an error about my timer:
Error while evaluating TimerFcn for timer 'timer-159' 
Index exceeds the number of array elements (159).
Error: Invalid op code received
Perhaps this is due to the fact that I am switching between a 'hit' and 'miss' state very quickly? However, I have been running (a version of) this protocol for a while now and have not encountered this error. I did recently switch to using 'TrialManagerObject'. Do you have any idea what might be causing this and how to fix it?

Finally, I get a warning that 'TrialManager reported an inter-trial dead time of >200 microseconds.'
This happens starting on the second trial of my protocol. It also happens if I run an extremely simple protocol that just waits a random amount of time (I've tried both very long and very short times, with no observable effect) and then exits. This makes me think it could be a computer/memory issue as opposed to a code/Matlab issue. What are your thought?

Sorry for the long post, any help would be much appreciated!

Thanks,
Matt W.


Sad Custom pulse not saved in PulsePal
Posted by: Cristian - 03-01-2022, 08:25 AM - Forum: Software - Replies (2)

Hello,

I am working with a custom pulse made via Matlab PulsePal GUI. It works perfectly while the PulsePal is connected to the laptop (configuration already uploaded and saved in PulsePal), even commanding the custom pulse via PulsePal. The problem is that after disconnecting it from the computer it does not work. All the features of the configuration are listed properly (no clue about the custom pulse since no preview there) but the custom pulse does not work. Maybe I am missing somethingConfused.

Thank you very much in advance!
Cristian


  State change synchronization signal
Posted by: water - 02-25-2022, 07:59 AM - Forum: Software - Replies (2)

Hi.

I just want to verify that a behavior that I am seeing with the synchronization signal is the expected behavior. I could not find this documented, but it seems like the built-in state synchronization signal, as accessed from the GUI, flips from high to low or vice versa not only during state changes, but additionally at the end of a trial. In other words, in the transition from the last state of trial 1 to the first state of trial 2, I see 2 bit flips. Is this what is expected?

To give some background on my setup, I have synchronization configured via the GUI to flip BNC1 with every state change. I am recording this channel on a NI data acquisition system at around 10khz. In the transition between trials, I effectively see 2 bit flips-- one I presume is when a new trial is started, and the second I presume is when the first state of a new trial starts. The interval between these two bit flips (ie the duration of the 'new trial being summoned' state) is variable between 10 and 30 milliseconds, and doesnt seem to be obviously related to size of state matrix to load/send.

Thanks!

- Jalal