Forum
Register Calendar Latest Topics
 
 
 


Reply
  Author   Comment   Page 4 of 5      Prev   1   2   3   4   5   Next
stremblay

Member
Registered:
Posts: 65
Reply with quote  #76 
Hi Jaewon,

Thanks for your help.

I encountered another bug in your most recent version.

I'm trying to send a stimulation lasting 12 msec using the toggleobject function, assigning one analog output port of my DAQ to Stimulation 1 of the Input\output menu of ML.

I get the following error, which I would not get with the old ML running on Matlab 32-bit.

Do you have any idea what is going on?

Thanks!

Hitrate = NaN% in 0 trials (up to sliding window = 150) within block.
<<<*** MonkeyLogic ***>>> Error using monkeylogic (line 1081)
Timing File Execution Error
Error using analogoutput/trigger (line 224)
OBJ must be running before TRIGGER is called. Call START.

Error in TTLeyelink_runtime/toggleobject (line 368)

Error in TTLeyelink_runtime (line 1168)

Error in monkeylogic (line 1075)
TrialData = feval(timingfile, TaskObject, Screen, DAQ, MLConfig.EyeTransform, MLConfig.JoyTransform, BehavioralCodes, TrialRecord, 0);

Error in mlmenu (line 2206)
monkeylogic(condfile, datafile, testflag);


Error in mlmenu (line 2206)
monkeylogic(condfile, datafile, testflag);Warning: Figure is saved in ml_error_workspace.mat. Saving graphics handle variables can cause the creation of very large files. To save
graphics figures, use savefig.
> In monkeylogic (line 1318)
In mlmenu (line 2206)
Error using monkeylogic (line 1081)
Timing File Execution Error
Error using analogoutput/trigger (line 224)
OBJ must be running before TRIGGER is called. Call START.

Error in TTLeyelink_runtime/toggleobject (line 368)

Error in TTLeyelink_runtime (line 1168)

Error in monkeylogic (line 1075)
TrialData = feval(timingfile, TaskObject, Screen, DAQ, MLConfig.EyeTransform, MLConfig.JoyTransform, BehavioralCodes,
TrialRecord, 0);

Error in mlmenu (line 2206)
monkeylogic(condfile, datafile, testflag);


Error in mlmenu (line 2206)
monkeylogic(condfile, datafile, testflag);

Error while evaluating UIControl Callback

Closed MonkeyLogic.

0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #77 
Hi stremblay,

I know the meaning of the error, but I don't get it in my testing and I don't see the route that can possibly lead to the error. Can you send me the task files so that I can reproduce it for a test?
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #78 
Hey Jaewon,

I just sent you my task folder in a private message. Please run block 1. The crash should happen at the end of the first trial, when the stimulation (TTL) is suppose to be sent.

The error seems to be related to the fact that the variable "Running" is set to 0 in the object DAQ.analogoutput. That's all I know.

Thanks again and let me know whether you can reproduce the bug.

best
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #79 
Hi stremblay,

You are using AnalogOutput both for Reward and Stimulation. Although different channels are assigned, it is not possible to use one AnalogOutput for two independent tasks. (That is also the reason why you cannot use two STM objects in one trial.) So getting that error is just a matter of which function you call first. You will get an error in the old version as well, if you call goodmonkey() before toggleobject(). But, to keep the compatibility, I will think about making toggleobject() before goodmonkey() work.

0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #80 
Thanks Jaewon,

That would be great if you can integrate this compatibility.

We found another issue with the latest version of NIMH, this time regarding eventmarkers. We send many eventmarkers in our task, and get all of them received on the other side (Blackrock Cereplex Direct) when using the old ML on 32-bit. However, on NIMH 64-bit, we are missing many of those eventmarkers. This is odd since, when testing the digital outputs in ML menu on NIMH, we get everything fine.

Any idea what might be happening? Can you reproduce this with our task on your system?

Thanks again,
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #81 
I am not familiar with Blackrock's products. Do you know what is the minimum pulse length that the device can detect?
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #82 
Not sure, but the sampling rate is 30KHz, so it should be able to detect something pretty fast. 
Importantly, the Blackrock system has no issues detecting eventmarkers sent from the old ML.
Did you change anything to the pulse length in NIMH?
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #83 
There is nothing in the ML code that regulates the pulse length. That is what I was concerned about. Can you do me a favor? Would you run the same test after replacing trialholder.m in your ML with the attached file? As a quick fix, I added a short pause in the eventmarker() so that the pulse length gets longer. If this solves the problem, I will implement it in a proper way later.
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #84 
Hi Jaewon,

I tried your new trial holder and it seems to have fixed the issue. I see you added a 1 msec pause after putvalue. I will try to diminish this value to the minimum required so not to slow down the workflow of ML, while awaiting a more permanent fix from you.

Thanks again for your precious help.
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #85 
Thanks for the prompt feedback. I didn't change the old ML code in eventmarker(), because the putvalue call in MATLAB used to take much longer than 250 us, which is the pulse duration that I used for Plexon and TDT in C++. However, my toolbox is 2-3 times faster in the recent 64-bit MATLAB and obviously the pulse length is not long enough without some pause now.

FYI, I will not use pause() in my fix. For measuring the elapsed time, you should use tic and toc.

I also checked the manual of Blackrock Cereplex Direct. They said the sampling rate is 30 kS/s (samples per sec) in the main text. S/s is the notation usually used when there is only one converter and it is multiplexed. So it is possible that the overall sampling rate can be lower when you use more than one channel. (Maybe what they mean is that each channel is sampled at 30 kHz, but they are not very clear about it.) They also distinguished 96 digital data channels from 16 digital input, so the speed of 30 kHz is probably applied to the 96 channels only.
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #86 
Hi jaewon,

The words are correctly read by our Blackrock receiving system simply by adding a pause() function, even if the length of the pause is 0 (i.e. pause(0)).

However, another issue regarding the timing of words arises in the NIMH ML that didn't use to be a problem in the old ML. To check if the timestamping of words in blackrock is done correctly relative to timestamps in ML, we do a simple test: Does the length of a trial in clock1 (say ML) equal the length of a trial in clock2 (Blackrock). This test is relatively robust to drifting of clocks since the comparison is done within a trial. In the old ML, we would get differences in trial length < 2msec, which could be explained by rounding timestamps to the msec. However, in the NIMH ML, with a 1msec pause implemented in trialholder eventmarker(), we get up to 9msec differences in trial length. 

Interestingly, if I decrease the length of this pause the trial length differences between the two clocks increase. Conversely, If I increase the length of this pause (up to 10msec) the trial length differences decrease. Indeed, with a 10msec pause in eventmarker() trial length differences drop down to <1ms. 

Do you have any idea of why this would be the case? I have sent you by email the necessary mat. files and the script I used to run these tests.

Best, 
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #87 
# Changes in NIMH MonkeyLogic, Dec 21, 2016

  ~ A problem that crashes MATLAB R2014b-R2015aSP1 in a certain monitor
   configuration under the 100% DPI mode is fixed. It was because my code that
   worked around a bug in those MATLAB versions was not perfect and detected
   the screen coordinates incorrectly. (Thanks to Xiaomin Yue)
 
  ~ Now the output pulse of eventmarker() is enforced to be at lease 125 us.
   Otherwise, event codes may not be registered in a fast system due to the too
   short pulse length. (Thanks to Sebastien Tremblay)
   
  ~ Now Reward can be triggered with the STM object via AnalogOutput, if
   toggleobject() is called before goodmonkey(). This is the same behavior as
   the old ML does. (Thanks to Sebastien Tremblay)

0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #88 
Hi stremblay,

I linked a new version in which the things we discussed above are applied. 125 us was long enough for TDT that I used to have, but please test if it works for your device as well. Regarding to using AnalogOutput for both Reward and Stimulation, keep in mind that you must trigger the STM object before calling goodmonkey(). Otherwise, you will get the same error, although the message will be different. This is a limitation of NI devices, not of the DAQ toolbox or ML.

You should not trust the accuracy of pause(). pause(0) never takes 0 sec and that is just the time the pulse needed additionally. As I wrote in my email, it is not the trial length that differs between the two clocks. All the timestamps except the first one in each trial were shifted by roughly the same amount in your device. So please send me the timing file so that I can examine this.

-----

I just remembered why I didn't try to enable Stimulation when Reward was also AnalogOutput. With NIMh daqtoolbox, the STM object can be triggered multiple times in a trial and I made it as a default behavior. So the STM object is automatically armed again once triggered and does not give Reward a chance to be triggered. Although I made a necessary code change, triggering Reward via AnalogOutput won't work until I change this default behavior. Let me think about how to implement user selection interface for this.
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #89 
# Changes in NIMH MonkeyLogic, Dec 23, 2016

  + Now the STM object takes the third argument in the condition file that
   indicates whether it needs to be triggered multiple time in one trial. If
   the argument is 0 or not given, the STM object is disabled after one firing
   as in the old ML with MATLAB's DAQ toolbox. This change is for making it
   possible to trigger Reward via AnalogOutput after Stimulation is done.
   
  + embedtimingfile.m is rewritten to add the customizable reward function to
   the runtime. And it now removes trailing single line comments as well.
 
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #90 
Hi stremblay,

I tested the timing accuracy of eventcodes with a Plexon MAP box and it looked okay. The max difference of timestamps between ML and Plexon was 0.75 msec in my test. Maybe it was because of the pause() function, which was put for temporary testing. As I mentioned above, pause() should not be used for this kind of purpose. Please test with the new version.

Regarding to the MaxLatency issue in your task, I also noticed that you don't suppress the output of toggleobject() so that the flip time is displayed on the MATLAB command window. The time that ML becomes weak in keeping a good cycle rate is between a toggleobject() and the following eyejoytrack(), where the first frame of the scene and the second frame are drawn, respectively. As far as I learned, printing something on the MATLAB command window takes time longer than you think, so sometimes MaxLatency can be shorter significantly by simply putting a semi-colon at the end of toggleobject(). There are other things I planed to test, but I didn't have time to do yet. I will keep you posted on what I find.
0
Wing

Junior Member
Registered:
Posts: 16
Reply with quote  #91 
   #91  
Hi Jaewon,

    Except for calibration and parameter settings on the control panel, are there any other procedures supposed to do before we enable the Eye Drift Correlation function?

    I got error report when I run a customized fixation task with Eye Drift Correlation function turned on.

/***

error monkeylogic (line 1205)
newTform = adjust_eye_calibration(TrialData.AnalogData.EyeSignal, config_fixtargets, DAQ, MLConfig.EyeTransform, MLConfig.EyeAdjustFraction,           MLConfig.FixDegrees, MLConfig.FixTime, MLConfig.EyeSmoothingSigma, MLConfig.EyeCalibrationTargets);

error mlmenu (line 2208)
monkeylogic(condfile, datafile, testflag);
Reference to non-existent field 'EyeCalibrationTargets'。

***/
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #92 
Hi Jaewon,

Thanks for the new version.

I can confirm that the words are now correctly read by a Blackrock neural recording system with the new pulse length.

Regarding the TTL stimulation, I am now able to send the TTL before goodmonkey without getting an error. However, the length of the goodmonkey reward is now out of my control. It would trigger for a time length that is independent from the one set in my timing file.

Regarding the max latency, I tried silencing every toggleobject calls with a semicolon. It's true that now I don't get anything written in the command window, thanks for that! However, I still get Max latencies between 2 and 10 msec. Let's recall that it was the presence of 2 call to eyejoytrack that seemed to be the source of the problem, although I never understood why...

Thanks again!
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #93 
Hi Wing,

I am working on it. Sorry for the inconvenience.
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #94 
Hi stremblay,

For the goodmonkey duration, there was a missing clean-up codeline that I thought I had put in. But it affected the time records only, not the actual duration. Can you tell me how you measured the time length?

For the max latency, I have a question about your setup. Are the refresh rates between your screens different?
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #95 
Hi Jaewon, 

I have run a few more tests and the function goodmonkey in your latest version (Dec23rd) seems to have a couple issues.

1. If I run a task (the same than the one that I have sent you previously) where a TTL is sent using toggleobject, the "stimulation1" in the main menu is attributed AO1, and goodmonkey is used; the goodmonkey duration is out of my control. I have tried setting the reward duration to 50msec, 100 msec or 500msec in the timing script, but the voltage output lasts for at least 2seconds irrespectively (i've measured this using a voltometer).

2. Now if I run the exact same task, but I commented out the toggleobject(stimulation) and cleared the stimulation setting in the main menu; the voltage output from the AO0 port attributed to "reward" in the main menu goes up to 5v when launching monkeylogic (even before goodmonkey is read, as it always does) and then remains at 5v until I reboot the computer. Further, if I don't stop the task and goodmonkey is read, the following error message is outputted:

Error using monkeylogic (line 1081)
Timing File Execution Error

Error using analogoutput/putsample (line 249)
PUTSAMPLE cannot be called while OBJ is running.

Error in visual_star_runtime>reward_function/reward_on (line 1670)

Error in visual_star_runtime>reward_function (line 1735)

Error in visual_star_runtime/goodmonkey (line 951)

Error in visual_star_runtime (line 1623)

Error in monkeylogic (line 1075)

                TrialData = feval(timingfile, TaskObject, Screen, DAQ, MLConfig.EyeTransform, MLConfig.JoyTransform, BehavioralCodes,

                TrialRecord, 0);

Error in mlmenu (line 2208)

                    monkeylogic(condfile, datafile, testflag);

Error in mlmenu (line 2208)

                    monkeylogic(condfile, datafile, testflag);

Error while evaluating UIControl Callback


3. If I now do the same test as above, commenting toggleobject(stimulation), but leaving the stimulation configuration intact, the same problem arises: 5v are outputted from the reward AO0 and remains at 5v until I reboot the computer (i.e. even closing monkeylogic and matlab does not stop the voltage output)

I have run each one of these tests several times and these anomalies arise in a consistent manner. Furthur, note that these issues do not arise in previous versions of monkeylogic, meaning they probably aren't due to our hardware. 
Do you have any idea why the latest monkeylogic would behave this way?

Finally, to respond to your question: both our screens have a 60Hz refresh rate.

Thanks again for all your work,
0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #96 
Hi stremblay,

Thank you for your careful testing. The problems you mentioned sound very strange. I just tested things as you described but couldn't replicate them. I checked the signal lengths with an oscilloscope. On my compuer, the TTL (AO1) was triggered fine and the reward signal (AO0) varied as 50, 100 and 150 ms as I set. I need to think about how such problems can happen in your system. The following is some details from my testing with your three conditions.

1. As I said, I didn't get a problem in running this. Can you check if the goodmonkey call actually takes more than 2 sec or if the goodmonkey ends in 100 ms but the signal is just long? I think you can do this by putting tic and toc before and after goodmonkey();

2. First of all, I didn't see the 5-volt output, when I did this. Second, I got an error, but it was not "PUTSAMPLE cannot be called while OBJ is running." It was because the STM object was still defined in the conditions file, but not configured in the ML menu.

3. There was still no 5-volt output, but I finally got "PUTSAMPLE cannot be called while OBJ is running." However, this is expected, as I explained earlier. If you don't trigger the STM object first, you can't trigger Reward. You will get the same result in the old ML as well.

It seems that there is something that makes analogoutput as 5v during initialization in your system. It is not a problem that the voltage remains at 5v. It doesn't come down to 0v of itself, unless you issue a command to do so.

0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #97 
A second thought. You may just have the reward polarity issue. That explains why AO becomes high on start up and why you don't have control on the pulse length. Do you get high on both AO0 and AO1 or AO0 only?

http://forums.monkeylogic.org/post/reward-function-8352424?pid=1294310089
0
stremblay

Member
Registered:
Posts: 65
Reply with quote  #98 
It was indeed the reward polarity issue! 
Now everything seems to work perfectly. Thanks again so much for your hard work!

0
Jaewon

Senior Member
Registered:
Posts: 344
Reply with quote  #99 
# Changes in NIMH MonkeyLogic, Jan 5, 2017

  + Now both manual and automatic eye drift corrections work, whether the eye
   calibration is used or not. For manual correction, press the 'c' key during
   the trial and then the eye position at that moment becomes the new origin,
   (0,0). If 'c' is pressed mistakenly, the change can be reverted by 'u'. (You
   can undo multiple times.) The automatic correction takes into account all
   fixation points where eyejoytrack() with 'holdfix' was finished succesfully
   and now uses a much simpler algorithm that requires the adjustment magnitude
   parameter only.

  + MATLAB UI controls in the control screen now display the information of
   the current trial, not the previous trial. (Thanks to Joshua Aman)
 
  ~ Frame skipping during the joystick cursor update is not warned anymore.
   (Thanks to kms from the ML forum)
   
  ~ The reward time records kept during initialization are now being deleted
   correctly before the first trial begins.

0
EXP.2086

Junior Member
Registered:
Posts: 4
Reply with quote  #100 
Hi Jaewon,
 
I don't know whether it's common, but the Jan-5-2017 version on my Win7 with MatLab R2016b doesn't show real time wave when test I/O. And when I change back to version Dec-1-2016, MonkeyLogic just don't work 
at all.


0
Previous Topic | Next Topic
Print
Reply

Quick Navigation: