# data lost when exporting to .edf

**URL:** <https://mne.discourse.group/t/data-lost-when-exporting-to-edf/7282>\
**Category:** Support & Discussions\
**Tags:** eeg\
**Created:** [July 24, 2023, 8:34pm UTC](https://mne.discourse.group/t/data-lost-when-exporting-to-edf/7282 "2023-07-24T20:34:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jennie.lavine](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@jennie.lavine](https://mne.discourse.group/u/jennie.lavine)\
**Post date:** [July 24, 2023, 8:34pm UTC](https://mne.discourse.group/t/data-lost-when-exporting-to-edf/7282/1 "2023-07-24T20:34:00Z")

</div>

MNE version: 1.4.2  
operating system: macOS 12.5

I am trying to do the following:

1. Read in a .edf file
2. Select a subset of channels and rename them.
3. Export to a new .edf file

The code I use to do this is the following, where `rawFile` is the path to the original .edf and standardFile is the path to the new .edf to be written.

```python
            psgFile = mne.io.read_raw_edf(rawFile)
            psgInfo = psgFile.info
            for channel in psgInfo.ch_names:
                if channel in self.channel_mapping.keys():
                    mne.rename_channels(psgFile.info,{channel:self.channel_mapping[channel]})
                else:
                    psgFile.drop_channels(channel)
            mne.export.export_raw(standardFile,psgFile,overwrite=True)

```

It seems to work fine, but then I read in my new file as follows:  
`psgFile2 = mne.io.read_raw_edf(standardFile)`

When I look at graphs of psgFile2, all channels are flat lines. Each channel contains a time series with only one value in it, 0.00011273

Any guidance would be greatly appreciated!

---

<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:** [August 16, 2023, 2:34pm UTC](https://mne.discourse.group/t/data-lost-when-exporting-to-edf/7282/2 "2023-08-16T14:34:03Z")

</div>

Please modify your example so that it uses this EDF file (which is publicly available):

[https://osf.io/4g3uw](https://osf.io/4g3uw)

That way, I can try to reproduce this issue.
