Reading an mff file from Netstation

  • MNE version: 1.7.1
  • operating system: e.g. macOS 15.4

I am a programmer with zero knowledge of EEG helping a PI create a pipeline to analyze his data.I have an EEG file (.mff) that comes from Netstation. I managed to load the data using mne.io.read_raw_egi and then looked at some of the data to do a sanity check. For some reason the number of time points coming from the data import is different than what netsation says there are. My script tells me there are 629588 and netsation says there are 547012. Anyone has experience with this? Am I missing an exclusion criteria of some sort? My end goal is to end up with epoch files that will be used for analysis. Thank you.

# Define the paths to the data files
data_path = "/Users/keeglab/Desktop/EEG_data/raw_data/"
t1_file_list = ["hyperscan_ACM_101_t1_20220531_103952_seg.mff"] 
td_file_list = ["hyperscan_ACM_101_t1_td_20210903_014317_seg.mff"]            
 
 # Read the customized montage            
custom_montage= mne.channels.read_custom_montage(data_path + 'GSN129.sfp')
custom_montage.ch_names[-1] = 'E128'
print(f"Montage channel names are:\n {custom_montage.ch_names}\n")	

# Define the channel exclusion list
drop_channel_list = ["VREF", "DIN2", "DIN1"]
									  
for t1_file,td_file in zip(t1_file_list,td_file_list):
	
	# Get the path to the data file	
	input_fname_t1 = data_path + t1_file
	input_fname_td = data_path + td_file

	# Load the data files 
	raw_data_t1 = mne.io.read_raw_egi(input_fname_t1)    						   
	raw_data_td = mne.io.read_raw_egi(input_fname_td)
    						   
	 # Drop channels and add the montage    						   
	raw_data_t1.drop_channels(drop_channel_list)
	raw_data_t1.set_montage(custom_montage)
    						   	
	raw_data_td.drop_channels(drop_channel_list)
	raw_data_td.set_montage(custom_montage)
	  
	
	print(raw_data_td.info)
	print(f"Reduced channel list:\n {raw_data_td.ch_names}\n")                        	
	print(f"Number of time points:\n {raw_data_td.n_times}\n")

Your code looks correct to me, for what it’s worth. If MNE-Python reads more data than Netstation reports, then Netstation must be cropping it somehow. This could very well be based on some event marker or annotation. Does raw_data.td.annotations contain anyting?

Annotations <Annotations | 3 segments: BAD_ACQ_SKIP (1), DIN1 (1), DIN2 (1)> .

Looks like there was a pause/break in your EEG recording. That is what the "BAD_ACQ_SKIP" annotation indicates. I.e. there was a recording period, a break, and then a second recording period.

I think that MNE’s MFF reader will fill the “missing” times in between your two recording periods with zeros, and then annotate that time with "BAD_ACQ_SKIP".

My guess is that this is why MNE says there is more samples than what Netstation says, for your file.

Is there a way to prevent MNE to not fill in the gap or to ignore such gap. What would be the consequence of that? I imagine pausing a session and restarting later because a kiddo is having an issue is quite common, so there should be a way to address this, I hope.

Talked ot the PI and it turns out you were right on the money, the file she gave me to process had already been segmented. Moving forward we are truly using raw data -and the code just worked. Thank you for the answer.

No, I don’t think so. Why do you want to? Under the hood MNE should always exclude the times within aBAD_ACQ_SKIP annotation (for example, when making epochs, or filtering, etc), so hopefully this acquisition gap should not get in your way.

1 Like