[Eeglablist] Using variables in pop_selectevent

Cedric Cannard ccannard at protonmail.com
Wed Dec 28 13:33:47 PST 2022


Hi Arkadiy,

I see, you didn't mention your data were already epoched. I'm going to need a little more info from you to help you.
My understanding from your description is that for each trial, there is an image (let's call S1 at time 0) and then a stimulus 2 (let's call it S2) that follows with a latency fluctuating within a range (e.g., 100-300 ms). Is that correct?

If so, you should be able to use create an index that tracks each S1 event from the 'type' variable (i.e., name of the S1 events), and adjust the latency of the S2 event following them with a simple substraction. Then create an index of trials that are below your threshold, and either rename/extract them.

It is probably easier if you send me a file and more detail in a private email and I can give you the code.

Cedric

------- Original Message -------
On Tuesday, December 27th, 2022 at 4:13 PM, Maksimovskiy, Arkadiy <AMAKSIMOVSKIY at MCLEAN.HARVARD.EDU> wrote:

> Dear Cedric,
>
> Thank you for this code and explanation – much appreciated!
>
> This works well, but one thing that I am still unclear about is how to apply it to epoched latencies, rather than cumulative latencies.
>
> For example, currently I epoch my data as such:
>
> EEGp = pop_epoch( EEG, {  'Picture' }, [0 2.5], 'newname',  'EEGallpicsEpoch', 'epochinfo',  'yes');
>
> However, although the result displays latencies in epoched time, the code seems to only work with cumulative latencies. In other words, if I do the following:
>
> % index of events with latency below your threshold
> evToRename = [EEG.event.latency] <= 10000;
>
> It will index events which have a cumulative threshold of 10,000 (so, adding up the samples of all events that came before it). Do you know how I can apply this threshold to latencies that reset with each epoch (i.e. start from zero every time a picture was shown).
>
> Thank you for your help with this,
>
> Arkadiy
>
> From: Cedric Cannard <ccannard at protonmail.com>
> Date: Friday, December 23, 2022 at 9:49 AM
> To: Maksimovskiy, Arkadiy <AMAKSIMOVSKIY at MCLEAN.HARVARD.EDU>
> Cc: eeglablist at sccn.ucsd.edu <eeglablist at sccn.ucsd.edu>
> Subject: Re: [Eeglablist] Using variables in pop_selectevent
>
> External Email - Use Caution
>
> Dear Arkadiy,
>
> Here is the code to do what you need for events with a latency below 10000 samples (to edit with your fastval value). Note: this will convert all your events to character strings (which should not pose a problem later for STUDY).
>
> % index of events with latency below your threshold
> evToRename = [EEG.event.latency] <= 10000;
>
> % Loop through events and rename events of interest using that index
> for iEv = 1:length(EEG.event)
> if evToRename(iEv)
> EEG.event(iEv).type = 'fastRTs';
> end
> end
> EEG = eeg_checkset(EEG);
>
> Cedric Cannard, PhD
>
> ------- Original Message -------
> On Tuesday, December 20th, 2022 at 9:14 AM, Maksimovskiy, Arkadiy <AMAKSIMOVSKIY at MCLEAN.HARVARD.EDU> wrote:
>
>> Dear EEGlab Users,
>>
>> I am attempting to use the following function to rename events, which meet certain criteria (i.e., their latency is between two numbers):
>>
>> EEGfastrts = pop_selectevent( EEG, 'latency',’0 <= fastval’,'type',{'AnyResponse'},'renametype','FastRTs','deleteevents','off','deleteepochs','off','invertepochs','off');
>>
>> However, when I input a variable (i.e., fastval), instead of an int value, this function does not work.
>>
>> I was wondering if anyone might have suggestions/work-arounds for using this function for a range that is represented (at least, partially) by a variable. This is important, since I intend to insert the function into a loop, which will alter the variable value with every iteration.
>>
>> Thank you in advance for your thoughts and input.
>>
>> -Arkadiy
>> _____________________
>> Arkadiy L. Maksimovskiy, Ph.D. (he/him/his)
>> Assistant Neuroscientist, McLean Hospital
>> Instructor in Psychiatry, Harvard Medical School
>>
>> McLean Hospital
>> 115 Mill Street, 225 deMarneffe, Belmont, 02478-1064
>> https://urldefense.com/v3/__https://secure-web.cisco.com/1TErJfjirkCBiKw-MMLj-pDa4juKcLsO12TXkBKtHq8aqMssITXBpoLLLGxswDEdJX0xZOMBdlZf_eafJr9v3U3oopuJUzGWtbaRi9cl9LjtYWXFR1rsKIXtXp5ZY-b4KQh2ZXxbPfTuDjiXkktoY003ATnp4ClpBd0PBTdYU1kBZOzd8yjdlftRmftVta1nykyjykvBtSz_EC0yYB8jH0axTWqUnngZGfwvKya4UpVGcDDGA0G2BGGwDglQLzMG01Nhw5xNyN1KcVJ3JALsB001tW-kGMPspAQZ488OXGc0DCT-7dL7ZtE_RFawl9T2Dq8gjnHzURVdQnsYgHzOLvA/https*3A*2F*2Furldefense.com*2Fv3*2F__http*3A*2F*2Fmclean.harvard.edu*2F__;!!Mih3wA!BmSTZtt_wNd437SilMYcHAiYsF1LQyfhr7Ot3J7l8ju8cbw11vJzhElOtlgTxD-QQbXY625qqf2c26qcfSmzEZK5f076dRPG2wu8WJA$__;JSUlJSUlJSUl!!Mih3wA!G21qAksZjDm9zkibE9hvOxZrrLTkG4zMVnNQjXgjqLYMr67Vn7jM97l3pIrobj5mqiMcVPyiS-ixDqMGnf8HEeh6ow$ 
>> The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at https://urldefense.com/v3/__https://secure-web.cisco.com/1-U6mD0uWShJ8vlaMriI2QQWevPE1xSPu_bHyEwNI7-03dLsrHKEU9UxRtwfXD5u6zBDzpwfSNt80GJqZOuOCAk7xHjl8fzqvWMjkWTLlsZkv8_XUULfCqNNHT8R4Mq6q_OdgoqJ_9wPUoFjVeK70ejuJh9mkqNLDLznBAco2DFOK7FnJTI8NrlsfosWxwQmlVeKhxGng19YinR3e321NO5mCJdYwmH6j-U2HbZu-SYDQgg9sAbM_Nt2ickY9mg0gezDAJxtCuUr28btbx34iIOT3P1rCAd6rz0K67KMdKmxgXaFZ_2a4kO8oRNNpZG9MDXIpKXC-mfCIjPcyt_M-ZA/https*3A*2F*2Furldefense.com*2Fv3*2F__https*3A*2F*2Fwww.massgeneralbrigham.org*2Fcomplianceline__;!!Mih3wA!BmSTZtt_wNd437SilMYcHAiYsF1LQyfhr7Ot3J7l8ju8cbw11vJzhElOtlgTxD-QQbXY625qqf2c26qcfSmzEZK5f076dRPG-NZCAW0$__;JSUlJSUlJSUl!!Mih3wA!G21qAksZjDm9zkibE9hvOxZrrLTkG4zMVnNQjXgjqLYMr67Vn7jM97l3pIrobj5mqiMcVPyiS-ixDqMGnf9s3-SR4Q$  <https://urldefense.com/v3/__https://secure-web.cisco.com/1-U6mD0uWShJ8vlaMriI2QQWevPE1xSPu_bHyEwNI7-03dLsrHKEU9UxRtwfXD5u6zBDzpwfSNt80GJqZOuOCAk7xHjl8fzqvWMjkWTLlsZkv8_XUULfCqNNHT8R4Mq6q_OdgoqJ_9wPUoFjVeK70ejuJh9mkqNLDLznBAco2DFOK7FnJTI8NrlsfosWxwQmlVeKhxGng19YinR3e321NO5mCJdYwmH6j-U2HbZu-SYDQgg9sAbM_Nt2ickY9mg0gezDAJxtCuUr28btbx34iIOT3P1rCAd6rz0K67KMdKmxgXaFZ_2a4kO8oRNNpZG9MDXIpKXC-mfCIjPcyt_M-ZA/https*3A*2F*2Furldefense.com*2Fv3*2F__https*3A*2F*2Fwww.massgeneralbrigham.org*2Fcomplianceline__;!!Mih3wA!BmSTZtt_wNd437SilMYcHAiYsF1LQyfhr7Ot3J7l8ju8cbw11vJzhElOtlgTxD-QQbXY625qqf2c26qcfSmzEZK5f076dRPG-NZCAW0$__;JSUlJSUlJSUl!!Mih3wA!G21qAksZjDm9zkibE9hvOxZrrLTkG4zMVnNQjXgjqLYMr67Vn7jM97l3pIrobj5mqiMcVPyiS-ixDqMGnf9s3-SR4Q$  > .
>>
>> Please note that this e-mail is not secure (encrypted). If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately. Continuing to send or respond to e-mail after receiving this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail.
>> _______________________________________________
>> Eeglablist page: https://urldefense.com/v3/__http://secure-web.cisco.com/1HsEpJCZqEawPIC6ghE6u__wQf_7a991iV3yOPHbtgxNiKrwIljEixLqw3VSNDUyBCPcAyYvQVIigQkrM_Q0M5iyMcDHyz_0De8IUS4GKhUiz4UsOM6gcCxEBDP2aUA3Zx7VRCYNUV2Pm-IT-oS1pmwBvkjjBBbGDmaizatxIAJuDMyhPq040zgR75wfJJnZ1Q4ciAL0B9M4PDEygKtV8BWbNa-ScJ1P8ru9DmYOTStYANhbwiFgLEkE1NfOiSwJc6UEdhXRZ_ZYjkzIdLRHe3xk6QozoHF-7b8G2Mv8f4yM2DiGvE7YGmuDBrV2M4NkE0prIdP2D0O95iJXVqt32lA/http*3A*2F*2Fsccn.ucsd.edu*2Feeglab*2Feeglabmail.html__;JSUlJSU!!Mih3wA!G21qAksZjDm9zkibE9hvOxZrrLTkG4zMVnNQjXgjqLYMr67Vn7jM97l3pIrobj5mqiMcVPyiS-ixDqMGnf9O7GjJGA$ 
>> To unsubscribe, send an empty email to eeglablist-unsubscribe at sccn.ucsd.edu
>> For digest mode, send an email with the subject "set digest mime" to eeglablist-request at sccn.ucsd.edu
>
> The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Mass General Brigham Compliance HelpLine at https://urldefense.com/v3/__https://www.massgeneralbrigham.org/complianceline__;!!Mih3wA!G21qAksZjDm9zkibE9hvOxZrrLTkG4zMVnNQjXgjqLYMr67Vn7jM97l3pIrobj5mqiMcVPyiS-ixDqMGnf9vHO0tCA$  .
>
> Please note that this e-mail is not secure (encrypted). If you do not wish to continue communication over unencrypted e-mail, please notify the sender of this message immediately. Continuing to send or respond to e-mail after receiving this message means you understand and accept this risk and wish to continue to communicate over unencrypted e-mail.


More information about the eeglablist mailing list