internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: nilearn/nilearn

Issue:
Use bibtex in nilearn/image
Convert references in  `nilearn/image/image.py` to use footcite / footbibliography.
See #2759 


Discussion:
can take this one

Resolving patch:
diff --git a/nilearn/image/image.py b/nilearn/image/image.py
--- a/nilearn/image/image.py
+++ b/nilearn/image/image.py
@@ -1013,21 +1013,14 @@ def clean_img(imgs, sessions=None, detrend=True, standardize=True,
     Notes
     -----
     Confounds removal is based on a projection on the orthogonal
-    of the signal space [1]_.
+    of the signal space [:footcite:`friston1994statistical`].
 
     Orthogonalization between temporal filters and confound removal is based on
-    suggestions in [2]_.
+    suggestions in [:footcite:`Lindquist407676`].
 
     References
     ----------
-    .. [1] Friston, K. J., A. P. Holmes, K. J. Worsley, J.-P. Poline,
-       C. D. Frith, et R. S. J. Frackowiak. "Statistical Parametric Maps
-       in Functional Imaging: A General Linear Approach". Human Brain
-       Mapping 2, no 4 (1994): 189-210. <http://dx.doi.org/10.1002/hbm.460020402>
-
-    .. [2] Lindquist, M., Geuter, S., Wager, T., & Caffo, B. (2018).
-       Modular preprocessing pipelines can reintroduce artifacts into fMRI data.
-       bioRxiv, 407676. <http://dx.doi.org/10.1101/407676>
+    .. footbibliography::
 
     See Also
     --------


Test patch:
Repository: nilearn/nilearn

Issue:
Add to the docstring of nilearn.datasets.fetch_development_fmri that the t_r of the data is 2.
Add to the docstring of nilearn.datasets.fetch_development_fmri that the t_r of the data is 2.5


Discussion:
Sorry, the TR for the brain development dataset is 2s ! This is what #2016 was fixing.

Should we still add it to the docstring ?
> Sorry, the TR for the brain development dataset is 2s ! This is what #2016 was fixing.

Right. I am so unreliable!!

> Should we still add it to the docstring ?

Yes please.


Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -97,7 +97,7 @@
 
 # General information about the project.
 project = u'Nilearn'
-copyright = u'The nilearn developers 2010-2020'
+copyright = u'The nilearn developers 2010-2021'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
diff --git a/nilearn/datasets/func.py b/nilearn/datasets/func.py
--- a/nilearn/datasets/func.py
+++ b/nilearn/datasets/func.py
@@ -1982,8 +1982,8 @@ def fetch_development_fmri(n_subjects=None, reduce_confounds=True,
                            age_group='both'):
     """Fetch movie watching based brain development dataset (fMRI)
 
-    The data is downsampled to 4mm resolution for convenience. The origin of
-    the data is coming from OpenNeuro. See Notes below.
+    The data is downsampled to 4mm resolution for convenience with a repetition time (TR)
+    of 2 secs. The origin of the data is coming from OpenNeuro. See Notes below.
 
     Please cite [1]_ if you are using this dataset.
 
diff --git a/nilearn/plotting/matrix_plotting.py b/nilearn/plotting/matrix_plotting.py
--- a/nilearn/plotting/matrix_plotting.py
+++ b/nilearn/plotting/matrix_plotting.py
@@ -264,7 +264,7 @@ def plot_contrast_matrix(contrast_def, design_matrix, colorbar=False, ax=None,
         Include a colorbar in the contrast matrix plot. Default=False.
 
     ax : matplotlib Axes object, optional
-        Directory where plotted figures will be stored.
+        Axis on which to plot the figure. If None, a new figure will be created.
 
     output_file : string or None, optional
         The name of an image file to export the plot to. Valid extensions


Test patch:
Repository: nilearn/nilearn

Issue:
BUG: broken reference in example
<!--Provide a brief description of the bug.-->
Broken reference to vol_to_surf in:

examples/01_plotting/plot_3d_map_to_surface_projection.py




Discussion:

Resolving patch:
diff --git a/examples/01_plotting/plot_3d_map_to_surface_projection.py b/examples/01_plotting/plot_3d_map_to_surface_projection.py
--- a/examples/01_plotting/plot_3d_map_to_surface_projection.py
+++ b/examples/01_plotting/plot_3d_map_to_surface_projection.py
@@ -153,7 +153,7 @@
 # Impact of plot parameters on visualization
 # ------------------------------------------
 # You can specify arguments to be passed on to the function
-# :func:`nilearn.plotting.vol_to_surf` using `vol_to_surf_kwargs`. This allows
+# :func:`nilearn.surface.vol_to_surf` using `vol_to_surf_kwargs`. This allows
 # fine-grained control of how the input 3D image is resampled and interpolated -
 # for example if you are viewing a volumetric atlas, you would want to avoid
 # averaging the labels between neighboring regions. Using nearest-neighbor


Test patch:
Repository: nilearn/nilearn

Issue:
Use plot_event in a example
The function `plot_event` has currently no example linked to its [doc](https://nilearn.github.io/modules/generated/nilearn.plotting.plot_event.html#nilearn.plotting.plot_event). 
It wouldn't be too costly to use it in one example somewhere.


Discussion:
+1
keen to try this issue
Maybe https://nilearn.github.io/auto_examples/04_glm_first_level/write_events_file.html#sphx-glr-auto-examples-04-glm-first-level-write-events-file-py ?

Resolving patch:
diff --git a/examples/04_glm_first_level/write_events_file.py b/examples/04_glm_first_level/write_events_file.py
--- a/examples/04_glm_first_level/write_events_file.py
+++ b/examples/04_glm_first_level/write_events_file.py
@@ -63,3 +63,10 @@
 tsvfile = 'localizer_events.tsv'
 events.to_csv(tsvfile, sep='\t', index=False)
 print("Created the events file in %s " % tsvfile)
+
+#########################################################################
+# Optionally, the events can be visualized using the plot_event function.
+from matplotlib import pyplot as plt
+from nilearn.plotting import plot_event
+plot_event(events, figsize=(15, 5))
+plt.show()


Test patch:
Repository: nilearn/nilearn

Issue:
cut_coords should not force plotting of slices in ascending order
When specifying the coordinates of slices in plotting through `cut_coords`, they are automatically sorted in ascending order. This is a problem for people who wants a specific order, e.g. descending.



Discussion:
I find this to be an issue too. It is really throwing us off.
interested in this issue
As far as I can tell - `cut_coords` is passed upstream all the way to `BaseSlicer` so I'm a little worried that making tweaks could have a lot of unpredictable downstream consequences. I'm happy to play around with this to explore this further.
> As far as I can tell - `cut_coords` is passed upstream all the way to `BaseSlicer` so I'm a little worried that making tweaks could have a lot of unpredictable downstream consequences. I'm happy to play around with this to explore this further.

sounds good! any info that you can gather would be helpful

This might be a good place to start. 
An attribute `_direction` is initialized as 'x', 'y', or 'z' for each of `XSlicer`, `YSlicer` and `ZSlicer` classes, which are subclasses of  `nilearn.plotting.displays.BaseStackedSlicer`. 

`_direction` is passed to the classmethod `find_cut_coords`, and the internal logic here assumes a positive direction along each of the axes. 

Options may be to:
- add a boolean parameter `reverse` that will reverse the direction
- try to specify the order of cuts in a more granular way

Thoughts?

I think that `find_cut_coords` is called only when coordinates are not specified. The case that we need to address is when coordinates are specified, yet not in ascending order. 
HTH

Resolving patch:
diff --git a/nilearn/plotting/displays.py b/nilearn/plotting/displays.py
--- a/nilearn/plotting/displays.py
+++ b/nilearn/plotting/displays.py
@@ -1798,7 +1798,7 @@ def _locator(self, axes, renderer):
             width_dict[ax] = width / total_width * (x1 - x0)
         left_dict = dict()
         left = float(x0)
-        for coord, display_ax in sorted(display_ax_dict.items()):
+        for coord, display_ax in display_ax_dict.items():
             left_dict[display_ax.ax] = left
             this_width = width_dict[display_ax.ax]
             left += this_width


Test patch:
Repository: nilearn/nilearn

Issue:
doc not building with sphinx 4.0.1
`make html-noplot` fails since the latest release of sphinx on monday

see for example [this build](https://app.circleci.com/pipelines/github/nilearn/nilearn/2034/workflows/2bd1d45d-b513-41d2-a941-c17feab7e8e2/jobs/7212)


Discussion:
I don't yet see an issue flagging this issue on `sphinx-copybutton` (https://github.com/executablebooks/sphinx-copybutton). ~It seems like an upstream problem there rather than a nilearn issue. Should we open an issue there directly ?~

EDIT : It looks like we're actually not relying on `sphinx-copybutton`, which could be part of the problem ! I can open a PR adding it as a dependency (and removing `copybutton.js`) if we want to see whether that would work equivalently.
Or maybe you can try switching to `add_js_file` which has replaced `add_javascript` according to the doc : https://www.sphinx-doc.org/en/master/extdev/appapi.html?highlight=add_js_file#sphinx.application.Sphinx.add_js_file
Thanks, @RaphaelMeudec ! That seems like a good solution.

In fact, despite the name, I realized that `sphinx_copybutton` and our `copybutton.js` share almost no overlap. `sphinx_copybutton` adds the ability to copy code blocks to the user's clipboard; for example, [here](https://7214-1235740-gh.circle-artifacts.com/0/dev/auto_examples/01_plotting/plot_visualize_megatrawls_netmats.html#fetching-the-megatrawls-network-matrices).

`copybutton.js`, meanwhile, only acts on code blocks starting with a `>>>` to hide or show the prompt and code output, like [here](http://nilearn.github.io/connectivity/functional_connectomes.html#a-functional-connectome-extracting-coordinates-of-regions). So they're largely non-overlapping in functionality, though I'm not sure what their interaction would be for those cells that are covered by `copybutton.js`.

Either way, I think the best patch to close this issue is just amending the call (exactly as you suggest). I still find `sphinx_copybutton` useful, so I won't close #2838 , but maybe we can continue discussion on its implementation there !

Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -345,5 +345,5 @@ def touch_example_backreferences(app, what, name, obj, options, lines):
 
 
 def setup(app):
-    app.add_javascript('copybutton.js')
+    app.add_js_file('copybutton.js')
     app.connect('autodoc-process-docstring', touch_example_backreferences)


Test patch:
Repository: nilearn/nilearn

Issue:
Axes3D no longer adds itself to figure
Upcoming break in Matplotlib `3.4.0`, see: [https://github.com/matplotlib/matplotlib/pull/18564](https://github.com/matplotlib/matplotlib/pull/18564)

This is causing 3 tests to fail on Travis with matplotlib-dev: 

```
FAILED plotting/tests/test_surf_plotting.py::test_plot_surf_stat_map - assert...
FAILED plotting/tests/test_surf_plotting.py::test_plot_surf_contours - IndexE...
FAILED plotting/tests/test_surf_plotting.py::test_plot_surf_contours_error - ...
===== 3 failed, 829 passed, 1 skipped, 1800 warnings in 721.48s
```

`ax = Axes3d(fig)` will need to be explicitly added to the figure with `fig.add_axes(ax)`


Discussion:
there is still [this pending comment in a matplotlib issue](https://github.com/matplotlib/matplotlib/issues/18939#issuecomment-726142191) that suggests making the axis add itself by default
You will now be warned about this change rather than broken.   Long term we are still deprecating the behavior,  but hopefully this is enough of a migration window. 
@tacaswell  Thx for the information !
xref https://github.com/matplotlib/matplotlib/pull/19496

Resolving patch:
diff --git a/nilearn/plotting/surf_plotting.py b/nilearn/plotting/surf_plotting.py
--- a/nilearn/plotting/surf_plotting.py
+++ b/nilearn/plotting/surf_plotting.py
@@ -161,7 +161,7 @@ def custom_function(vertices):
     nilearn.surface.vol_to_surf : For info on the generation of surfaces.
 
     """
-    _default_figsize = [6, 4]
+    _default_figsize = [4, 4]
 
     # load mesh and derive axes limits
     mesh = load_surf_mesh(surf_mesh)
@@ -227,13 +227,12 @@ def custom_function(vertices):
     if axes is None:
         if figure is None:
             figure = plt.figure(figsize=figsize)
-        axes = Axes3D(figure, rect=[0, 0, 1, 1],
-                      xlim=limits, ylim=limits)
+        axes = figure.add_axes((0, 0, 1, 1), projection="3d")
     else:
         if figure is None:
             figure = axes.get_figure()
-        axes.set_xlim(*limits)
-        axes.set_ylim(*limits)
+    axes.set_xlim(*limits)
+    axes.set_ylim(*limits)
     axes.view_init(elev=elev, azim=azim)
     axes.set_axis_off()
 
@@ -375,8 +374,8 @@ def custom_function(vertices):
             # we need to create a proxy mappable
             proxy_mappable = ScalarMappable(cmap=our_cmap, norm=norm)
             proxy_mappable.set_array(surf_map_faces)
-            cax, kw = make_axes(axes, location='right', fraction=.1,
-                                shrink=.6, pad=.0)
+            cax, kw = make_axes(axes, location='right', fraction=.15,
+                                shrink=.5, pad=.0, aspect=10.)
             cbar = figure.colorbar(
                 proxy_mappable, cax=cax, ticks=ticks,
                 boundaries=bounds, spacing='proportional',


Test patch:
Repository: nilearn/nilearn

Issue:
Rename master branch into main
This was decided in the last core-devs meeting and scheduled after the coding sprint.


Discussion:

Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -331,7 +331,7 @@
         'org': 'nilearn',
         'repo': 'nilearn.github.io',
         'binderhub_url': 'https://mybinder.org',
-        'branch': 'master',
+        'branch': 'main',
         'dependencies': ['../requirements-build-docs.txt',
                          'binder/requirements.txt'],
         'notebooks_dir': 'examples'
@@ -363,5 +363,5 @@ def setup(app):
 linkcode_resolve = make_linkcode_resolve('nilearn',
                                          'https://github.com/nilearn/'
                                          'nilearn/blob/{revision}/'
-                                         '{package}/{path}#L{lineno}') 
+                                         '{package}/{path}#L{lineno}')
 


Test patch:
diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml
--- a/.github/workflows/testing.yml
+++ b/.github/workflows/testing.yml
@@ -3,7 +3,7 @@ name: 'build'
 on:
   push:
     branches:
-      - "master"
+      - "main"
   pull_request:
     branches:
       - '*'
diff --git a/nilearn/tests/test_signal.py b/nilearn/tests/test_signal.py
--- a/nilearn/tests/test_signal.py
+++ b/nilearn/tests/test_signal.py
@@ -564,7 +564,7 @@ def test_clean_frequencies_using_power_spectrum_density():
 def test_clean_finite_no_inplace_mod():
     """
     Test for verifying that the passed in signal array is not modified.
-    For PR #2125 . This test is failing on master, passing in this PR.
+    For PR #2125 . This test is failing on main, passing in this PR.
     """
     n_samples = 2
     # n_features  Must be higher than 500
Repository: nilearn/nilearn

Issue:
Use bibtex in nilearn/signal.py
Convert references in `nilearn/signal.py` to use footcite / footbibliography.
See #2759 


Discussion:
Hello, 
I would like to be assigned on this issue to train more with PR and git commands.
Thank you :)
Thank you @NicolasGensollen 
Actually, I don't see any reference to add in nilearn/signal.py, or maybe should I create a reference section in the clean() function for Lindquist et al. (2018)? 
In the dostrings there are refs to Behzadi et al.  2007 and Lindquist et al. 2018.

Resolving patch:
diff --git a/nilearn/signal.py b/nilearn/signal.py
--- a/nilearn/signal.py
+++ b/nilearn/signal.py
@@ -370,7 +370,7 @@ def high_variance_confounds(series, n_confounds=5, percentile=2.,
     Notes
     -----
     This method is related to what has been published in the literature
-    as 'CompCor' (Behzadi NeuroImage 2007).
+    as 'CompCor' :footcite:`BEHZADI200790`.
 
     The implemented algorithm does the following:
 
@@ -380,6 +380,10 @@ def high_variance_confounds(series, n_confounds=5, percentile=2.,
     - return a given number (n_confounds) of series from the svd with
       highest singular values.
 
+    References
+    ----------
+    .. footbibliography::
+
     See also
     --------
     nilearn.image.high_variance_confounds
@@ -434,7 +438,7 @@ def clean(signals, runs=None, detrend=True, standardize='zscore',
 
     Filtering is only meaningful on evenly-sampled signals.
 
-    According to Lindquist et al. (2018), removal of confounds will be done
+    According to :footcite:`Lindquist407676`, removal of confounds will be done
     orthogonally to temporal filters (low- and/or high-pass filters), if both
     are specified.
 
@@ -512,16 +516,14 @@ def clean(signals, runs=None, detrend=True, standardize='zscore',
     Notes
     -----
     Confounds removal is based on a projection on the orthogonal
-    of the signal space. See `Friston, K. J., A. P. Holmes,
-    K. J. Worsley, J.-P. Poline, C. D. Frith, et R. S. J. Frackowiak.
-    "Statistical Parametric Maps in Functional Imaging: A General
-    Linear Approach". Human Brain Mapping 2, no 4 (1994): 189-210.
-    <http://dx.doi.org/10.1002/hbm.460020402>`_
+    of the signal space. See :footcite:`Friston1994`.
 
     Orthogonalization between temporal filters and confound removal is based on
-    suggestions in `Lindquist, M., Geuter, S., Wager, T., & Caffo, B. (2018).
-    Modular preprocessing pipelines can reintroduce artifacts into fMRI data.
-    bioRxiv, 407676. <http://dx.doi.org/10.1101/407676>`_
+    suggestions in :footcite:`Lindquist407676`.
+
+    References
+    ----------
+    .. footbibliography::
 
     See Also
     --------


Test patch:
Repository: nilearn/nilearn

Issue:
modulation column for make_first_level_design_matrix 
<!--Provide a brief description what you would like changes and why.-->
When having a 'modulation' column in the events.tsv that is passed to ```nilearn.glm.first_level.make_first_level_design_matrix```, a UserWarning occurs saying 
```
UserWarning: ‘modulation’ column found in the given events data.
```
This should be changed into a simple message saying that the 'modulation'-column is being used rather than printing a warning which is confusing.


<!--Please fill in the following information, to the best of your ability.-->
### Benefits to the change
Clearer information about what is happening 

### Pseudocode for the new behavior, if applicable

```python
if modulation:
    print('Modulation column is found in events-data and is used')

```



Discussion:
Linking #2680 where this warning was added.
Thanks for opening this @maalaria. I don't mind replacing the warning by a print and modifying the message if people think it is confusing.
It can be confusing indeed IMHO.

Resolving patch:
diff --git a/nilearn/glm/first_level/experimental_paradigm.py b/nilearn/glm/first_level/experimental_paradigm.py
--- a/nilearn/glm/first_level/experimental_paradigm.py
+++ b/nilearn/glm/first_level/experimental_paradigm.py
@@ -76,8 +76,8 @@ def check_events(events):
 
     # Handle modulation
     if 'modulation' in events_copy.columns:
-        warnings.warn("'modulation' column found in "
-                      "the given events data.")
+        print("A 'modulation' column was found in "
+              "the given events data and is used.")
     else:
         events_copy['modulation'] = 1
 


Test patch:
diff --git a/nilearn/glm/tests/test_paradigm.py b/nilearn/glm/tests/test_paradigm.py
--- a/nilearn/glm/tests/test_paradigm.py
+++ b/nilearn/glm/tests/test_paradigm.py
@@ -129,9 +129,8 @@ def test_check_events():
 
     # Modulation is provided
     events['modulation'] = np.ones(len(events))
-    with pytest.warns(UserWarning,
-                      match="'modulation' column found in the given events data."):
-        check_events(events)
+    _, _, _, mod = check_events(events)
+    assert_array_equal(mod, events['modulation'])
 
     # An unexpected field is provided
     events = events.drop(columns=['modulation'])
Repository: nilearn/nilearn

Issue:
Cannot use threshold with `plot_epi` although it is documented
The function `nilearn.plotting.plot_epi` documents a `threshold` parameter:

https://github.com/nilearn/nilearn/blob/78f7d133b564f30883d5771a716bd9109cf7cac9/nilearn/plotting/img_plotting.py#L698-L703

but does not have a `threshold` argument:

https://github.com/nilearn/nilearn/blob/78f7d133b564f30883d5771a716bd9109cf7cac9/nilearn/plotting/img_plotting.py#L631-L634

So, when trying to set a threshold through `plot_epi`, it gets passed to `plot_img` through kwargs and is also passed explicitly as None:

https://github.com/nilearn/nilearn/blob/78f7d133b564f30883d5771a716bd9109cf7cac9/nilearn/plotting/img_plotting.py#L716-L722

Which results in the following error:

```python
from nilearn import plotting, datasets
plotting.plot_epi(datasets.MNI152_FILE_PATH, threshold=.2)
```
```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-3944ca75bc88> in <module>
      1 from nilearn import plotting, datasets
----> 2 plotting.plot_epi(datasets.MNI152_FILE_PATH, threshold=.2)

~/GitRepos/nilearn-fork/nilearn/plotting/img_plotting.py in plot_epi(epi_img, cut_coords, output_file, display_mode, figure, axes, title, annotate, draw_cross, black_bg, cmap, vmin, vmax, **kwargs)
    714 
    715     """
--> 716     display = plot_img(epi_img, cut_coords=cut_coords,
    717                        output_file=output_file, display_mode=display_mode,
    718                        figure=figure, axes=axes, title=title,

TypeError: plot_img() got multiple values for keyword argument 'threshold'
```

We should either remove the docstring entry or add threshold to the parameters of `plot_epi`. WDYT?


Discussion:
It doesn't seem like threshold fits with `plot_epi`'s purpose. I vote for removing the docstring entry.

Resolving patch:
diff --git a/nilearn/plotting/img_plotting.py b/nilearn/plotting/img_plotting.py
--- a/nilearn/plotting/img_plotting.py
+++ b/nilearn/plotting/img_plotting.py
@@ -695,13 +695,6 @@ def plot_epi(epi_img=None, cut_coords=None, output_file=None,
         The colormap for specified image.
         Default=plt.cm.nipy_spectral.
 
-    threshold : a number, None, or 'auto', optional
-        If None is given, the image is not thresholded.
-        If a number is given, it is used to threshold the image:
-        values below the threshold (in absolute value) are plotted
-        as transparent. If auto is given, the threshold is determined
-        magically by analysis of the image.
-
     vmin : float, optional
         Lower bound for plotting, passed to matplotlib.pyplot.imshow.
 


Test patch: