Back to the main page.
Bug 2764 - use explicit reshape instead of squeeze
Status | CLOSED FIXED |
Reported | 2014-11-13 17:12:00 +0100 |
Modified | 2016-06-17 16:35:49 +0200 |
Product: | FieldTrip |
Component: | core |
Version: | unspecified |
Hardware: | PC |
Operating System: | Mac OS |
Importance: | P5 normal |
Assigned to: | Jan-Mathijs Schoffelen |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Robert Oostenveld - 2014-11-13 17:12:37 +0100
With bug 2364 we encountered a problem that was due to "squeezing" a 4-D array that had some singleton dimensions. In general it is a bad idea to use squeeze, since it causes the resulting arrays indices to be ordered depending on the data. Using squeeze is a recipe for failure in case there is a single channel, or a single latency, etc. Rather than squeeze, it would be much better to do an explicit reshape, using the nchan/ntime/nfreq/npos or whatever dimensions you expect to be present in the array after squeezing. Here are the possibly affected files in fieldtrip main. mac011> grep -l squeeze *.m ft_clusterplot.m ft_crossfrequencyanalysis.m ft_freqstatistics.m ft_movieplotTFR.m ft_multiplotTFR.m ft_qualitycheck.m ft_regressconfound.m ft_singleplotTFR.m ft_sliceinterp.m ft_sourceanalysis.m ft_sourcemovie.m ft_sourceplot.m ft_statistics_crossvalidate.m ft_timelockanalysis.m ft_timelockgrandaverage.m nutmeg2fieldtrip.m
Robert Oostenveld - 2014-11-13 17:13:18 +0100
(In reply to Robert Oostenveld from comment #0) and here in the first-level subdirectories mac011> grep -l squeeze */*.m | grep -v test fileio/ft_read_event.m forward/ft_headmodel_interpolate.m inverse/ft_eloreta.m plotting/ft_plot_slice.m private/avgref.m private/fourier2crsspctrm.m private/freq2timelock.m private/moviefunction.m private/prepare_freq_matrices.m private/prepare_mesh_manual.m private/spearman_binned.m private/spearman_diff.m private/splint.m private/volplot.m private/volumeedit.m private/volumefillholes.m utilities/ft_checkdata.m utilities/ft_selectdata.m utilities/ft_selectdata_new.m utilities/tokenize.m
Jan-Mathijs Schoffelen - 2016-06-10 09:44:28 +0200
Note to self: -files in fieldtrip/private have been checked, and fixed where needed
Jan-Mathijs Schoffelen - 2016-06-10 09:45:00 +0200
That is: in my local branch: squeeze
Jan-Mathijs Schoffelen - 2016-06-10 09:48:23 +0200
Note to self: I went through all lower-level directories (except test) and changed where necessary.
Jan-Mathijs Schoffelen - 2016-06-10 13:19:56 +0200
Note to self: in the main fieldtrip dir, I leave someone else to worry about crossfrequencyanalysis