Repository: mne-tools/mne-python

Issue:
BUG: "mne.read_annotations"

#### Describe the bug
When I used the command '**mne.read_annotations'** to read .csv file. The **onset** always is 0.  However, the **duration** and **description** work well. If I change the file into .txt, it works correctly. 




Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/mne-tools/mne-python/pull/6184?src=pr&el=h1) Report
> Merging [#6184](https://codecov.io/gh/mne-tools/mne-python/pull/6184?src=pr&el=desc) into [master](https://codecov.io/gh/mne-tools/mne-python/commit/8ac51be3e8eeaeb25adaafd8d580fee4dff0f558?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.


```diff
@@            Coverage Diff             @@
##           master    #6184      +/-   ##
==========================================
+ Coverage   89.01%   89.01%   +<.01%     
==========================================
  Files         410      410              
  Lines       73883    73892       +9     
  Branches    12255    12256       +1     
==========================================
+ Hits        65765    65776      +11     
+ Misses       5223     5221       -2     
  Partials     2895     2895
```



cbrnr: LGTM!

Patch:
diff --git a/doc/contributing.rst b/doc/contributing.rst
index e4f0c9e7d..15faa7e05 100644
--- a/doc/contributing.rst
+++ b/doc/contributing.rst
@@ -33,10 +33,12 @@ you can follow those steps:
 
      $ git clone git@github.com:mne-tools/mne-python.git
      $ cd mne-python
-     $ conda env create -f environment.yml
-     $ conda activate mne
-     $ pip install -e .
+     $ conda env create -f environment.yml -n mne-dev
+     $ conda activate mne-dev
+     $ pip install -e .  # or python setup.py develop
 
+Note: -n flag provides the name for the new (development) environment, and
+overrides any name specified in the .yml file.
 To check the installation, you can enter the following commands:
 
   .. code-block:: console
diff --git a/mne/annotations.py b/mne/annotations.py
index a7a97fc1c..311e56dbd 100644
--- a/mne/annotations.py
+++ b/mne/annotations.py
@@ -575,6 +575,12 @@ def read_annotations(fname, sfreq='auto', uint16_codec=None):
     -------
     annot : instance of Annotations | None
         The annotations.
+
+    Notes
+    -----
+    The annotations stored in a .csv require the onset columns to be
+    timestamps. If you have onsets as floats (in seconds), you should use the
+    .txt extension.
     """
     from .io.brainvision.brainvision import _read_annotations_brainvision
     from .io.eeglab.eeglab import _read_annotations_eeglab
@@ -648,6 +654,14 @@ def _read_annotations_csv(fname):
     description = df['description'].values
     if orig_time == 0:
         orig_time = None
+
+    if onset_dt.unique().size != onset.unique().size:
+        warn("The number of onsets in the '.csv' file (%d) does not match "
+             "the number of onsets in the Annotations created (%d). If "
+             "this happens because you did not encode your onsets as "
+             "timestamps you should save your files as '.txt'." %
+             (onset_dt.unique().size, onset.unique().size))
+
     return Annotations(onset, duration, description, orig_time)
 
 
diff --git a/mne/viz/evoked.py b/mne/viz/evoked.py
index 75719125f..3d96540ca 100644
--- a/mne/viz/evoked.py
+++ b/mne/viz/evoked.py
@@ -579,7 +579,7 @@ def _plot_image(data, ax, this_type, picks, cmap, unit, units, scalings, times,
     _check_if_nan(data)
 
     im, t_end = _plot_masked_image(
-        ax, data, times, mask, picks=None, yvals=None, cmap=cmap[0],
+        ax, data, times, mask, yvals=None, cmap=cmap[0],
         vmin=vmin, vmax=vmax, mask_style=mask_style, mask_alpha=mask_alpha,
         mask_cmap=mask_cmap)
 
@@ -1875,6 +1875,8 @@ def plot_compare_evokeds(evokeds, picks=None, gfp=False, colors=None,
     _validate_type(vlines, (list, tuple), "vlines", "list or tuple")
 
     picks = [] if picks is None else picks
+    if title is None and picks in _DATA_CH_TYPES_SPLIT:
+        title = _handle_default('titles')[picks]
     picks = _picks_to_idx(info, picks, allow_empty=True)
     if len(picks) == 0:
         logger.info("No picks, plotting the GFP ...")
diff --git a/mne/viz/topo.py b/mne/viz/topo.py
index 3ff72dde7..f2e7ce65c 100644
--- a/mne/viz/topo.py
+++ b/mne/viz/topo.py
@@ -297,7 +297,7 @@ def _imshow_tfr(ax, ch_idx, tmin, tmax, vmin, vmax, onselect, ylim=None,
     times = np.linspace(tmin, tmax, num=tfr[ch_idx].shape[1])
 
     img, t_end = _plot_masked_image(
-        ax, tfr[ch_idx], times, mask, picks=None, yvals=freq, cmap=cmap,
+        ax, tfr[ch_idx], times, mask, yvals=freq, cmap=cmap,
         vmin=vmin, vmax=vmax, mask_style=mask_style, mask_alpha=mask_alpha,
         mask_cmap=mask_cmap, yscale=yscale)
 
diff --git a/mne/viz/utils.py b/mne/viz/utils.py
index 5c04bf883..45c92c8ae 100644
--- a/mne/viz/utils.py
+++ b/mne/viz/utils.py
@@ -32,7 +32,8 @@ from ..io.pick import (channel_type, channel_indices_by_type, pick_channels,
                        pick_info, _picks_by_type, pick_channels_cov)
 from ..rank import compute_rank
 from ..io.proj import setup_proj
-from ..utils import verbose, set_config, warn, _check_ch_locs, _check_option
+from ..utils import (verbose, set_config, warn, _check_ch_locs, _check_option,
+                     logger)
 
 from ..selection import (read_selection, _SELECTIONS, _EEG_SELECTIONS,
                          _divide_to_regions)
@@ -2557,7 +2558,7 @@ def _set_title_multiple_electrodes(title, combine, ch_names, max_chans=6,
             title = "{} of {} {}".format(
                 combine, len(ch_names), ch_type)
         elif len(ch_names) > max_chans and combine != "gfp":
-            warn("More than {} channels, truncating title ...".format(
+            logger.info("More than {} channels, truncating title ...".format(
                 max_chans))
             title += ", ...\n({} of {} {})".format(
                 combine, len(ch_names), ch_type,)
@@ -2576,7 +2577,7 @@ def _check_time_unit(time_unit, times):
     return time_unit, times
 
 
-def _plot_masked_image(ax, data, times, mask=None, picks=None, yvals=None,
+def _plot_masked_image(ax, data, times, mask=None, yvals=None,
                        cmap="RdBu_r", vmin=None, vmax=None, ylim=None,
                        mask_style="both", mask_alpha=.25, mask_cmap="Greys",
                        yscale="linear"):


Test patch:
diff --git a/mne/tests/test_annotations.py b/mne/tests/test_annotations.py
index 9e1f33852..37ec0f376 100644
--- a/mne/tests/test_annotations.py
+++ b/mne/tests/test_annotations.py
@@ -686,8 +686,22 @@ def dummy_annotation_csv_file(tmpdir_factory):
     return fname
 
 
+@pytest.fixture(scope='session')
+def dummy_broken_annotation_csv_file(tmpdir_factory):
+    """Create csv file for testing."""
+    content = ("onset,duration,description\n"
+               "1.,1.0,AA\n"
+               "3.,2.425,BB")
+
+    fname = tmpdir_factory.mktemp('data').join('annotations_broken.csv')
+    fname.write(content)
+    return fname
+
+
 @requires_version('pandas', '0.16')
-def test_io_annotation_csv(dummy_annotation_csv_file, tmpdir_factory):
+def test_io_annotation_csv(dummy_annotation_csv_file,
+                           dummy_broken_annotation_csv_file,
+                           tmpdir_factory):
     """Test CSV input/output."""
     annot = read_annotations(str(dummy_annotation_csv_file))
     assert annot.orig_time == 1038942071.7201
@@ -707,6 +721,10 @@ def test_io_annotation_csv(dummy_annotation_csv_file, tmpdir_factory):
     annot2 = read_annotations(fname)
     _assert_annotations_equal(annot, annot2)
 
+    # Test broken .csv that does not use timestamps
+    with pytest.warns(RuntimeWarning, match='The number of onsets in the'):
+        annot2 = read_annotations(str(dummy_broken_annotation_csv_file))
+
 
 # Test for IO with .txt files