# Error reading cnt file.

**URL:** <https://mne.discourse.group/t/error-reading-cnt-file/10465>\
**Category:** Support & Discussions\
**Tags:** eeg, file-formats, raw\
**Created:** [October 29, 2024, 8:28pm UTC](https://mne.discourse.group/t/error-reading-cnt-file/10465 "2024-10-29T20:28:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![arjbingly](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/arjbingly/32/3956_2.png) [@arjbingly](https://mne.discourse.group/u/arjbingly)\
**Post date:** [October 29, 2024, 8:28pm UTC](https://mne.discourse.group/t/error-reading-cnt-file/10465/1 "2024-10-29T20:28:36Z")

</div>

- MNE version: 1.8.0
- Operating System: macOS 15
- Python version: 3.12

Upon trying to read a cnt file using `mne.io.read_raw_cnt(file_path, data_format='int32', preload=True)`, I get the following error. I have made sure that this is not because of a bad file, as the same error occurs with plenty other files.

> samps = samps.reshape((n\_chunks, f\_channels, channel\_offset), order=“C”)  
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
> ValueError: cannot reshape array of size 2665278 into shape (390625,64,1)

I do understand that to reproduce the error, one will need the file and I will be happy to send it over.

Observations:

- The error occurs during the data load. i.e. with `preload=False` the error only occurs when `raw.load_data()` is called.
- No error when calling `raw.get_data(start=0, stop=100)` (for small `stop` values)

Is this a bug? or am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)\
**Post date:** [October 30, 2024, 7:40am UTC](https://mne.discourse.group/t/error-reading-cnt-file/10465/2 "2024-10-30T07:40:36Z")

</div>

This does sound like a bug, but before submitting a new issue, do you know which software produced the files? You’re saying that the issue is not likely caused by a bad file, but there are cases where a program exports files that do not follow the format specifications. Therefore, it would be helpful if you checked if other tools can load your data, such as [BioSig](https://biosig.sourceforge.net/download.html) (`pip install biosig` should work at least on Windows; if you are on macOS or Linux, see their install instructions).

And just to make sure, there are [two different file formats which use the `.cnt` extension](https://mne.tools/dev/auto_tutorials/io/20_reading_eeg_data.html#ant-neuro-cnt-cnt), namely Neuroscan and ANT Neuro. The function `mne.io.read_raw_cnt()` reads the former, whereas you need `mne.io.read_raw_ant()` for the latter (this will be available in the next release).

---

<div class="post-metadata">

**Author:** ![arjbingly](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/arjbingly/32/3956_2.png) [@arjbingly](https://mne.discourse.group/u/arjbingly)\
**Post date:** [November 1, 2024, 3:22pm UTC](https://mne.discourse.group/t/error-reading-cnt-file/10465/3 "2024-11-01T15:22:29Z")

</div>

I believe the file was produced by Neuroscan. I did not try using other tools.  
But what I did was parse the file using Kaitai by defining the structure with the help of [Various EEG file formats and Conventions](https://paulbourke.net/dataformats/eeg/). I could successfully parse the whole file including all the metadata. So I am sure that the file is good.

---

<div class="post-metadata">

**Author:** ![arjbingly](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/arjbingly/32/3956_2.png) [@arjbingly](https://mne.discourse.group/u/arjbingly)\
**Post date:** [November 1, 2024, 3:23pm UTC](https://mne.discourse.group/t/error-reading-cnt-file/10465/4 "2024-11-01T15:23:58Z")

</div>

I also found out that MNE version 1.3.0 does not produce an error. (I do not know which version caused the break)

---

<div class="post-metadata">

**Author:** ![arjbingly](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/arjbingly/32/3956_2.png) [@arjbingly](https://mne.discourse.group/u/arjbingly)\
**Post date:** [November 1, 2024, 3:24pm UTC](https://mne.discourse.group/t/error-reading-cnt-file/10465/5 "2024-11-01T15:24:53Z")

</div>

Moreover, I could not find mne.io.read\_raw\_ant, was this deprecated?

---

<div class="post-metadata">

**Author:** ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)\
**Post date:** [November 2, 2024, 8:59am UTC](https://mne.discourse.group/t/error-reading-cnt-file/10465/6 "2024-11-02T08:59:38Z")

</div>

Alright, since it did work in MNE 1.3 it is very likely a bug. Could you please open an issue? Also, `read_raw_cnt()` is the correct function to read a Neuroscan file; `read_raw_ant()` (which will be available in MNE 1.9) reads ANT Neuro files (which also happen to have the `.cnt` extension).
