Crop function is behaving weirdly

External Email - Use Caution

Hi All,

I was trying to crop .EDF data into a ten minute window with this code snippet:

if max(raw.times) < 660:
    raw.crop(tmin=60, tmax=max(raw.times))
else:
    raw.crop(tmin=60, tmax=660)

but what happens it, works for first iteration of loop normally but behaves weirdly for second iteration. (I am reading .EDF file in a loop .)
These are the info about how data loaded
1st Iteration:
before cropping :
<RawEDF | 000007135.EDF, n_channels x n_times : 41 x 241000 (1205.0 sec), ~75.5 MB, data loaded>
After cropping :
<RawEDF | 000007135.EDF, n_channels x n_times : 41 x 120001 (600.0 sec), ~37.6 MB, data loaded>

2nd Iteration:
Before cropping :
<RawEDF | 6969.EDF, n_channels x n_times : 41 x 616000 (1232.0 sec), ~192.8 MB, data loaded>
After cropping :
<RawEDF | 6969.EDF, n_channels x n_times : 41 x 300003 (1500.0 sec), ~93.9 MB, data loaded>

Please guide me through and ask me if any other thing is required to solve this.
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20191120/06fab484/attachment-0001.html

External Email - Use Caution

One other thing , as I am making ML model, so I need sample size should be same dimensions throughout the data so I fixed the frequency of all samples to 200 Hz (its the minimum frequency any data sample can have.) using code:

raw.info['freq'] = 200

Does it actually changes frequency? If it does, then is it a right way to do it?

External Email - Use Caution

raw.info['freq'] = 200

don't do this. It will create bugs.

Use resample method

https://mne.tools/dev/auto_tutorials/preprocessing/plot_30_filtering_resampling.html?highlight=resample

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20191120/2bf08628/attachment.html