Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
aboharbf

Member
Registered:
Posts: 68
Reply with quote  #1 
When setting certain variables in the code, and then adding a line to make them editable, seems to result in something ambiguous. During the script, for example, I set the Solenoid time to something like 150 msec, but when I click "edit variables" in the panel during an experiment, the first value to show up is not 150, but something I've used before (200). Which value is being used? Once I open this panel, if i close it, will it set this new value as the value?

Also, on the topic of variables. When I export data as a .mat, how is the structure changed when you readjust the origin or gain in the middle of a paused experiment, then resume? I get the impression this value is set in the beginning and then not updated. 
0
Jaewon

Administrator
Registered:
Posts: 730
Reply with quote  #2 
In the latest package, there is a PDF manual under the doc directory. Please see the "Subject name" section on page 9. Once a variable is registered as editable, NIMH ML never reads its value from the script again. So editing the script to change the value doesn't work. Use the editable variable menu. In your case, NIMH ML is using 200, not 150. Once you close the menu, the new value will be immediately effective from the next trial.

You are right about the second question. The configuration setting is exported to the data file, just before the task starts. So, if you change something during the task, the configuration already written in the data file (*.bhv2) won't be updated. But the changes will be saved in the configuration file (*_cfg2.mat) when the task ends, so that they can be used next time when you run the task.
0
aboharbf

Member
Registered:
Posts: 68
Reply with quote  #3 
Alright, I will modify things accordingly. Thanks a lot.

Is there any means of storing the Origin and Gain on a trial by trial basis? If I make calls to the MLConfig.EyeTransform object during the course of a trial, will the values here change at all during the experiment or will it be only the values saved at the beginning? 
0
Jaewon

Administrator
Registered:
Posts: 730
Reply with quote  #4 
You do not change the origin and gain every trial, do you? What is the purpose of storing them?

I don't understand the second question.
0
aboharbf

Member
Registered:
Posts: 68
Reply with quote  #5 
Not every trial, it seems like we occasionally experience a drift that leads to fixation issues a few hundred trials in. 
0
Jaewon

Administrator
Registered:
Posts: 730
Reply with quote  #6 
The eye drift issue is pretty common. What I am wondering is why you need to track the origin and gain changes.

If you use auto drift correction (set from the main menu) or forced drift correction ('c' key), the trial-by-trial offset change is recorded in the data file automatically.

If you pause and re-do the calibration, the change of the calibration matrix is not stored to the data file, but you can save it by calling the bhv_variable function, if you want.
0
aboharbf

Member
Registered:
Posts: 68
Reply with quote  #7 
I'm attempting to store all of our signals and events on our Blackrock NSP, including eye signal. the ISCAN computer we have is split to the BNC 2090, leading to the ML computer, but also directly to an analog input port on the front of the Blackrock NSP. This is essentially to avoid the need to realign clocks on align signals produced on two computer. Even though some folks in the lab do this, they don't do it with the eye signal. 
0
Jaewon

Administrator
Registered:
Posts: 730
Reply with quote  #8 
I see. So you want to use the origin and gain to convert the voltages stored by Blackrock into degrees. That makes sense.

But, if I care that much, I would get the origin and gain information from the Blackrock data as well. For example, if your task requires the subject to fixate on the center and another peripheral target, you can retrieve the voltage levels during those two fixations and use them to calibrate the entire signals.

Just in case that my previous explanation was not sufficient, I add how to save the origin and gain below.

calmat = MLConfig.EyeTransform{2};  % or calmat = EyeCal.get_transform_matrix();
bhv_variable('eye_origin',calmat.origin);
bhv_variable('eye_gain',calmat.gain);

If you fix the drift with the 'c' key, the calibration changes in the middle of a trial, so you won't be able to calibrate the whole trial with this info.
0
aboharbf

Member
Registered:
Posts: 68
Reply with quote  #9 
Hey Jaewon,

Thanks. I added in some TrialRecord.User variables to store a single update in Gain/Origin, which I add, but I also realized I could recenter the ISCAN machine (by hitting the center button when the fixation cue is available) and this is a route to have a signal for which I can apply a single transformation, and essentially preserve the correctness of the origin and gain set initially. Any thoughts on that method?
0
Jaewon

Administrator
Registered:
Posts: 730
Reply with quote  #10 
Re-centering does not adjust the gain. As I said, I think storing extra calibration info is unnecessary, whether you read eye signals from NIMH ML or Backrock. So it is up to you.
0
aboharbf

Member
Registered:
Posts: 68
Reply with quote  #11 

Right, I understand that, but recentering in the Eye Scan system will make it so the signals being used in MonkeyLogic (after the Origin and gain transformation) are still readable by looking at codes arriving in the blackrock system and applying the numbers stored in the .mat MonkeyLogic produces. 

When you say unnecessary, do you mean that is it excessive in terms of data storage or that there is a simplier means of doing this?

Also, when you note "but you can save it by calling the bhv_variable function, if you want." earlier, what variable could I write in the script that would pull the origin and gain for that particular trial, and then use this function to store it?

0
Jaewon

Administrator
Registered:
Posts: 730
Reply with quote  #12 
I don't understand what you mean in the first sentence.

The eye signals stored by NIMH ML are already calibrated, so you don't need the origin and gain for that. You don't need the origin and gain for the Blackrock data, either, if your task requires subjects to fixate on at least two points, the center and another peripheral target. The Blakrock data is uncalibrated, but you know which target the subject is supposed to look at during a particular period, so, by comparing the voltage levels between two fixation points, you can calculate the origin and the gain just with the Blackrock data. I already explained this two replies ago (see #8).

I explained it in #8 as well. Put the following code in the timing script.

calmat = MLConfig.EyeTransform{2};
bhv_variable('eye_origin',calmat.origin);
bhv_variable('eye_gain',calmat.gain);

If the length of your trial is less than one minute, it is very unlikely to see a mismatch in the sample number between two computers. I wonder how much accuracy you gain by doing this.
0
aboharbf

Member
Registered:
Posts: 68
Reply with quote  #13 
Quote:
Originally Posted by Jaewon
The eye signals stored by NIMH ML are already calibrated, so you don't need the origin and gain for that. You don't need the origin and gain for the Blackrock data, either, if your task requires subjects to fixate on at least two points, the center and another peripheral target. The Blakrock data is uncalibrated, but you know which target the subject is supposed to look at during a particular period, so, by comparing the voltage levels between two fixation points, you can calculate the origin and the gain just with the Blackrock data.


My Task does not require this. It is simply tight fixation for a period followed by free viewing of a video.

Quote:
Originally Posted by Jaewon
 
calmat = MLConfig.EyeTransform{2};
bhv_variable('eye_origin',calmat.origin);
bhv_variable('eye_gain',calmat.gain);


If what you've said before is correct, storing this MLConfig in a new variable won't change anything - the value is created once and never updated. I wanted to confirm this so I did add this to the code and attempted to run it, got the following:

"Dot indexing is not supported for variables of this type.

Error in fixate_reward_v2_runtime (line 834)
bhv_variable('eye_origin',calmat.origin);

Error in run_trial (line 110)
runtime(MLConfig,TrialRecord,TaskObject,TrialData);

Error in monkeylogic/UIcallback (line 1142)
result = run_trial(MLConfig,datafile);

Error while evaluating UIControl Callback."

I am running the June 5th version.

Also as a note - When I'm running my task, my screen doesn't show the photodiode I have running in the lower right on the player which runs during the task, though I do see it on the stimulus monitor.

0
Jaewon

Administrator
Registered:
Posts: 730
Reply with quote  #14 
Did you do it after you saved the calibration matrix? If you didn't save the calibration, the EyeTransform is empty and there is nothing to save.

The photodiode trigger is for the subject screen only. That is intended.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.