Hi,
I'm new to Neo, and I'm having a hard time applying it to my use case.
In particular, I have Neuralynx EEG data that I'd like to analyze in Python. I was previously analyzing my data in MATLAB, but other packages I want to use are in Python, so I'm making the switch. The data only includes .ncs (EEG) and .nev (event) files. When I would analyze the data in MATLAB, I used a function (provided by Neuralynx) to extract the data from a given channel's .ncs file, including the timestamps, sample frequency, an array of the number of valid samples, an array of the data samples themselves, and the file header. I would reconstruct that channel's signal as a single vector using those pieces, which vector could then be used for other analyses (e.g., FFT, etc.). That is where I am coming from. Is there a way to do that with neo.io.NeuralynxIO?
recording_directory = 'R191014_R191016_200116/'
recording = neo.io.NeuralynxIO(recording_directory)
ephysData = recording.read_block(signal_group_mode='split-all')
segmentsData = []
for seg in ephysData.segments:
segmentsData.append(seg)
There are two problems with this:
1. Each segment's data is separated, and I don't know the best way to concatenate the signals from the different segments. (I know different segments are created by jumps in timestamps--as I did previously in MATLAB, I plan on interpolating missing data so I can have consistent timesteps for the entire recording.) I know "recording._sigs_memmap" gives similar outputs to the MATLAB importing function Neuralynx provided, but it's still segmented, and I don't want to reinvent the wheel if I don't need to. It also does not seem to have all of the elements in the number of valid samples array.
2. Even if the segments were all concatenated, it is not obvious how I access the data for things like plotting with matplotlib.pyplot. I can take the FFT of segmentsData[0].analogsignals[0], so I would expect matplotlib.pyplot.plot(segmentsData[0].analogsignals[0]) to work, but it doesn't.
tl;dr: What's the best way to go from "recording = neo.io.NeuralynxIO(recording_directory)" to plotting and calculating the FFT for the entire (non-segmented) recording session for a given channel?
I appreciate any help you can give!
Best,
Eric Melonakos