EEGLAB preprocessing for sleep EEG data - eeglab

I have 29-channel EEG data from overnight sleep recordings (~8 hours of EEG data). The EEG data is not continuous as I have paused it if the subject needed a loo break (~5-10 minutes) or to check the impedance (~2 minutes). This inserts a ‘boundary event’ in my EEG data. On some occasions, I have also reapplied a couple of electrodes if the impedance was high. In addition, sometimes I have had to stop the EEG recording and start again due to some technical reasons, because of which I have two EEG files for the same subject during the same night i.e. same session.
In my experiment, I have 15-20 events overnight and plan to use 1-2 minute data before each event for preprocessing and analyses. I would like to use ICA to correct for artifacts but before I do that, I would like to know if I need to split the data at each ‘boundary event’ and process them as separate EEG files? Or can I just consider the EEG recording from each subject as a single EEG recording and perform ICA (I can append the EEG files in cases where I have two EEG files per subject in the same session)? Any suggestions will be highly appreciated as I am very new to EEG and MATLAB.

You can find a detailed comment on your issue here
https://sccn.ucsd.edu/pipermail/eeglablist/2014/007380.html
Changing the impedance of the electrode introduce non-stationarity of the signal, that could affect ICA. However, ICA seems robust to this kind of violation, so you could concatenate all the sessions and run the ICA.
Rather, an issue could be if the electrodes moved during the breaks (ICA is a spatial filter, so spatial releationship are very important. see also here https://sccn.ucsd.edu/pipermail/eeglablist/2016/011878.html).
As a personal comment, I would use an "empirical" approach, to get a better grasp on the data and on the problem. In EEGLAB you could easily write a script and perform two parallel analysis, keeping all equal but the ICA decomposition (one on the concatenated data, one on the data separated for sessions). Then you can compare the difference on the data at the last step. In this way you can appreciate how the different strategy affected your results, and if this is really relevant.

Related

Calculation dynamic delay in AnyLogic

Good day!
Please, help me understand how the Delay block works in AnyLogic. Suppose we deal with a multichannel transmission network.
The model has 2 sources. Suppose these sources generate packets every 1 sec. Packets from different sources have different priorities and need different quantities of resources to be served (it is set up with Priority and Resource_quantity parameters respectively). The Priority_queue in the model is priority-based. The proposed model put the packets into the channels in accordance with Resource availability in the channel. Firstly, it tries to put the packet to the first channel. If there are no available resources it puts the packet into the second channel. If there are no resources in both channels it waits (it is realized with Hold block).
I noticed that if I set delays in blocks delay1 and delay2 with static parameters (for ex. 2 sec) the model works ok. But then I try to calculate it before these blocks the model doesn't take into consideration it at all. And in this case, the model works without any delays.
What did I do wrong here?
I will appreciate any help.
The delay is calculated in Exit block and is written into the variable delay of the agent. I tried to add traceln(agent.delay) as #Jaco-Ben suggested right after calculation of the delay and it showed zero. In this case it doesn't also seize resources :(
Thank #Jaco-Ben for the useful comments.
The delay is zero because
the result of division in Java depends on the types of the operands.
If both operands are integer, the result will be integer as well. To
let Java perform real division (and get a real number as a result) at
least one of the operands must be of real type.
So it was my problem.
To solve it I assigned double to one of the operands :
agent.delay = (double)agent.Resource_quantity/ChannelResources1.idle();
However, it is strange why it shows correct values in the database.

Data Aquisition and plotting simultaneously on Matlab

I have a loop of reading Voltages from Arduino (with a specific sampling rate and clock Frequency).
When I read data without plotting (loop include only the fread/fscanf and i++), the data appears without any problems.
Once I add rolling plot to display the acquired data, the signal will be lost at a sudden and the program stops. Any clarification for that?
If there exist a sample code for multi-threading to plot and perform data acquisition in the same time, I would be very grateful.
Thank you!
I am not sure whether it works for you, but I had the same problem and I used pause(t) before the end of the loop.

How to work with the COUNTER in Nagios or RRD?

I have the following problem:
I want to do the statistics of data that need to be constantly increasing. For example, the number of visits to the link. After some time be restarted these visit and start again from the beginning. To have a continuous increase, want to do the statistics somewhere. For this purpose, use a site that does this. In his condition can be used to COUNTER, GAUGE, AVERAGE, ... a.. I want to use the COUNTER. The system is built on Nagios.
My question is how to use this COUNTER. I guess it is the same as that of the RRD. But I met some strange things in the creation of such a COUNTER.
I submit the values ' 1 ' then ' 2 ' and the chart to come up 3. When I do it doesn't work. After the restart, for example, and submit again 1 to become 4
Anyone dealt with these things tell me briefly how it works with this COUNTER.
I saw that the COUNTER is used for traffic on routers, etc, but I want to apply for a regular graph, which just increases.
The RRD data type COUNTER will convert the input data into a rate, by taking the difference between this sample and the last sample, and dividing by the time interval (note that data normalisation also takes place and this is dependent on the Interval setting of the RRD)
Thus, updating with a constantly increasing count will result in a rate-of-change value to be graphed.
If you want to see your graph actually constantly increasing, IE showing the actual count of packets transferred (for example) rather than the rate of transfer, you would need to use type GAUGE which assumes any rate conversion has already been done.
If you want to submit the rate values (EG, 2 in the last minute), but display the overall constantly increasing total (in other words, the inverse of how the COUNTER data type works), then you would need to store the values as GAUGE, and use a CDEF in your RRDgraph command of the form CDEF:x=y,PREV,+ to obtain the ongoing total. Of course you would only have this relative to the start of the graph time window; maybe a separate call would let you determine what base value to use.
As you use Nagios, you may like to investigate Nagios add-ons such as pnp4nagios which will handle much of the graphing for you.

Digital delay decay

I am developing a digital delay on a microcontroller and I am stuck with the delay decay. The delay is implemented with a comb filter.
Here it is: http://www.tonmeister.ca/main/textbook/intro_to_sound_recording837x.png
The delay line, "emulating the tape", is implemented as a circula buffer. The effect can be killed and such case does not represents an issue; when turning the effect off though, I have the tail of the delay left in the buffer to process, as if the delay had been frozen and the tail slowly decay (depending on the feedback gain).
My question is: how many times I have to recirculate samples through the buffer?
One way I thought to approach this could be by modelling the physical process ... assuming that the input sequence has a loudness of 0dB for its entire duration and that, after going through the delay line, it gets attenuated by a factor of 1/10. In terms of loudness this corresponds to a drop of 20dB, as power = voltage^2, every time the sequence goes through the feedback path. The weakest audible sound has a loudness of −130dB but, taking into consideration the ambient noise as well, −120dB will be sufficient as the least reference power. Hence, after the echoes have been through the feedback path 6 times (120dB/20dB) they will be no longer audible.
Is there a more efficient way?
Thank you!

Processing of sensor data

I am working on a system with laser trip detectors(if something breaks the laser path I get a one on the output of the laser receiver).
I have many of these trip detectors and I want to detect if one is malfunctioning, but I do not know how to go about doing this. The lasers should not trip all that often..maybe a few times a day.
A typical case would be that the laser gets tripped for a .5-2 seconds, or brief intermittent tripping for a short time period, and possibly again after that(within 2-10 seconds)...
Are there any good ways to check the sensor is malfunctioning using a good statistical methodology?
You could just create a "profile" which includes the avg/mean/min/max of how often each sensor is tripped/how long it is tripped/how long is the time between a trip and the next trip etc. for example by using the data of some period of time like the last week/month or similar...
THEN you can compare the current state of a sensor to its profile... when the deviation is "big enough" you can assume an exceptional situation/perhaps a malfunction... the hardest part is to adjust the threshold for the deviation from the profile which in turn if hit triggers for example "malfunction handling"...

Resources