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

Issue:
Error in Mrtrix3's DWIPreproc
### Summary
The `_list_outputs` method of `DWIPreproc` tries to set up an input called "`export_grad_mrtrix`", which should be "`out_grad_mrtrix`", causing it to fail.

### Actual behavior
```python
AttributeError: 'DWIPreprocInputSpec' object has no attribute 'export_grad_mrtrix'
```
### Expected behavior
No AttributeError raising when running DWIPreproc...

### How to replicate the behavior
```python
from nipype.interfaces import mrtrix3 as mrt

dwipreproc = mrt.DWIPreproc(rpe_options="pair", align_seepi=True,)
dwipreproc.inputs.pe_dir = "j-"
dwipreproc.inputs.in_epi = "path_to_epi"
dwipreproc.inputs.dwi_file = "path_to_dwi"
dwipreproc.run()

```

### Platform details:

<!-- Please run the following code from your shell and place the output between the triple ticks, below.
python -c "import nipype; from pprint import pprint; pprint(nipype.get_info())"
-->

```
{'commit_hash': 'c31d206',
 'commit_source': 'repository',
 'networkx_version': '2.8.4',
 'nibabel_version': '4.0.1',
 'nipype_version': '1.8.6',
 'numpy_version': '1.23.0',
 'pkg_path': '/home/zvi/Projects/connectome_plasticity/venv/lib/python3.9/site-packages/nipype',
 'scipy_version': '1.8.1',
 'sys_executable': '/home/zvi/Projects/connectome_plasticity/venv/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.9.14 (main, Sep  7 2022, 23:43:29) \n[GCC 9.4.0]',
 'traits_version': '6.3.2'}
```

### Execution environment
- My python environment outside container



Discussion:

Resolving patch:
diff --git a/nipype/interfaces/mrtrix3/preprocess.py b/nipype/interfaces/mrtrix3/preprocess.py
--- a/nipype/interfaces/mrtrix3/preprocess.py
+++ b/nipype/interfaces/mrtrix3/preprocess.py
@@ -406,9 +406,9 @@ class DWIPreproc(MRTrix3Base):
     def _list_outputs(self):
         outputs = self.output_spec().get()
         outputs["out_file"] = op.abspath(self.inputs.out_file)
-        if self.inputs.export_grad_mrtrix:
+        if self.inputs.out_grad_mrtrix:
             outputs["out_grad_mrtrix"] = op.abspath(self.inputs.out_grad_mrtrix)
-        if self.inputs.export_grad_fsl:
+        if self.inputs.out_grad_fsl:
             outputs["out_fsl_bvec"] = op.abspath(self.inputs.out_grad_fsl[0])
             outputs["out_fsl_bval"] = op.abspath(self.inputs.out_grad_fsl[1])
 


Test patch:
Repository: nipy/nipype

Issue:
dcm2niix converted_files duplicate entry
### Summary
Converting mosaic dti series with dmc2niix results in a duplicated output

### Actual behavior
converted_files output contains twice the generated nifti file

### Expected behavior
converted_files should contain a single entry

###Possible solution
 _parse_files in Dcm2niix should check if the file is already in lists before appending



Discussion:
Patches are welcome.

Resolving patch:
diff --git a/nipype/interfaces/dcm2nii.py b/nipype/interfaces/dcm2nii.py
--- a/nipype/interfaces/dcm2nii.py
+++ b/nipype/interfaces/dcm2nii.py
@@ -485,6 +485,11 @@ def _parse_files(self, filenames):
                     mvecs.append(fl)
                 elif fl.endswith(".json") or fl.endswith(".txt"):
                     bids.append(fl)
+
+        # in siemens mosaic conversion nipype misread dcm2niix output and generate a duplicate list of results
+        # next line remove duplicates from output files array
+        outfiles = list(dict.fromkeys(outfiles))
+
         self.output_files = outfiles
         self.bvecs = bvecs
         self.mvecs = mvecs


Test patch:
Repository: nipy/nipype

Issue:
ENH: add STC partial volume correction to PETPVC interface
### Summary
Partial Volume Correction using Single-target correction (STC) has been added to PETPVC since the Nipype PETPVC interface was created, and it would therefore be ideal if this could be added to the interface as well.

### Actual behavior
The interface should include the 'STC' option for the 'pvc' flag.

### Expected behavior

### How to replicate the behavior

### Script/Workflow details

Please put URL to code or code here (if not too long).

### Platform details:

<!-- Please run the following code from your shell and place the output between the triple ticks, below.
python -c "import nipype; from pprint import pprint; pprint(nipype.get_info())"
-->

```

```

### Execution environment

Choose one
- Container [Tag: ???]
- My python environment inside container [Base Tag: ???]
- My python environment outside container



Discussion:

Resolving patch:
diff --git a/nipype/interfaces/petpvc.py b/nipype/interfaces/petpvc.py
--- a/nipype/interfaces/petpvc.py
+++ b/nipype/interfaces/petpvc.py
@@ -37,6 +37,7 @@
     "RBV+VC",
     "RL",
     "VC",
+    "STC",
 ]
 
 
@@ -75,6 +76,7 @@ class PETPVCInputSpec(CommandLineInputSpec):
     * Muller Gartner -- ``MG``
     * Muller Gartner with Van-Cittert -- ``MG+VC``
     * Muller Gartner with Richardson-Lucy -- ``MG+RL``
+    * Single-target correction -- ``STC``
 
 """,
     )


Test patch:
Repository: holoviz/holoviews

Issue:
renderer.save with matplotlib puts legend outside figure's bbox
Seems like holoviews is not accouting for the legend when calculating a figure's bounding box with the matplotlib backend. I'm using holoviews version 1.6.2, matplotlib 1.5.3 and python 2.7.12+.

Here's a minimal failing example:

<pre>
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import holoviews as hv
import holoviews.plotting.mpl
renderer = hv.Store.renderers['matplotlib'].instance(fig='svg', holomap='gif')
options={
    "Bars": dict(
        plot=dict(
            color_by=["stack"],
            legend_position="top",
        ),  
    ),  
}
data = [(("foo1", "bar1", "baz1"), 1)]
fig = hv.Bars(data,
              kdims=['Benchmark', 'Tool', ''], vdims=['Execution time [ms]'])
renderer.save(fig, "/tmp/figure", options=options)
</pre>


Discussion:
Could you paste the saved image here? For me the output looks correct:

<img width="367" alt="screen shot 2016-11-29 at 9 14 47 pm" src="https://cloud.githubusercontent.com/assets/1550771/20729205/ed08d478-b678-11e6-8614-12a11f81e039.png">

Edit: The gap between the two levels of axis labels could be increased though.
Here's what I get (the same happens for SVG, PNG and PDF):

![figure](https://cloud.githubusercontent.com/assets/326386/20753659/ae5cd848-b707-11e6-8ce6-d9514c4aaa63.png)

Setting this on options fixes it without me having to modify holoview's code:

<pre>
    def finalize(plot, element):
        # make sure the legend is accounted for during bbox calculation
        axis = plot.handles["axis"]
        legend = axis.get_legend()
        plot.handles["bbox_extra_artists"] += [legend]
    options={
        "Bars": dict(
            plot=dict(
                color_by=["stack"],
                legend_position="top",
                final_hooks=[finalize],
            ),
        ),
    }
</pre>
I'll keep investigating but if you've got a minute could you try it again on holoviews master?

Resolving patch:
diff --git a/holoviews/plotting/mpl/element.py b/holoviews/plotting/mpl/element.py
--- a/holoviews/plotting/mpl/element.py
+++ b/holoviews/plotting/mpl/element.py
@@ -176,7 +176,9 @@ def _finalize_axis(self, key, title=None, dimensions=None, ranges=None, xticks=N
 
                 if not subplots:
                     legend = axis.get_legend()
-                    if legend: legend.set_visible(self.show_legend)
+                    if legend:
+                        legend.set_visible(self.show_legend)
+                        self.handles["bbox_extra_artists"] += [legend]
                     axis.xaxis.grid(self.show_grid)
                     axis.yaxis.grid(self.show_grid)
 


Test patch:
Repository: holoviz/holoviews

Issue:
Table broken with bokeh 0.12.7
When displaying a Table with bokeh 0.12.7 I currently see the following error:

```
Javascript error adding output!
Error: SlickGrid's 'enableColumnReorder = true' option requires jquery-ui.sortable module to be loaded
See your browser Javascript console for more details.
```


Discussion:

Resolving patch:
diff --git a/holoviews/plotting/bokeh/tabular.py b/holoviews/plotting/bokeh/tabular.py
--- a/holoviews/plotting/bokeh/tabular.py
+++ b/holoviews/plotting/bokeh/tabular.py
@@ -7,6 +7,8 @@
 from ...element import ItemTable
 from ..plot import GenericElementPlot
 from .plot import BokehPlot
+from .util import bokeh_version
+
 
 class TablePlot(BokehPlot, GenericElementPlot):
 
@@ -71,6 +73,8 @@ def initialize_plot(self, ranges=None, plot=None, plots=None, source=None):
         dims = element.dimensions()
         columns = [TableColumn(field=d.name, title=d.pprint_label) for d in dims]
         properties = self.lookup_options(element, 'style')[self.cyclic_index]
+        if bokeh_version > '0.12.7':
+            properties['reorderable'] = False
         table = DataTable(source=source, columns=columns, height=self.height,
                           width=self.width, **properties)
         self.handles['plot'] = table


Test patch:
Repository: holoviz/holoviews

Issue:
Bokeh server warning message
the code server = renderer.app(dmap, show=True, new_window=True)
results in a warning message
WARNING:root:BokehServerWidgets24371: Setting non-parameter attribute display_options={'fps': 20} using a mechanism intended only for parameters


Discussion:
Should be a trivial fix.
Is there a way to suppress warnings such as

INFO:bokeh.server.server:Starting Bokeh server version 0.12.6 (running on Tornado 4.5.1)
>Is there a way to suppress warnings

That's a log message and is therefore not easily suppressed but I'm wondering if this is a bad interaction between the param logger and bokeh's logger. I don't think INFO level log messages should be visible to a user by default (might be wrong though).

Resolving patch:
diff --git a/holoviews/plotting/bokeh/widgets.py b/holoviews/plotting/bokeh/widgets.py
--- a/holoviews/plotting/bokeh/widgets.py
+++ b/holoviews/plotting/bokeh/widgets.py
@@ -25,6 +25,9 @@ class BokehServerWidgets(param.Parameterized):
     and dropdown widgets letting you select non-numeric values.
     """
 
+    display_options = param.Dict(default={}, doc="""
+        Additional options controlling display options of the widgets.""")
+
     editable = param.Boolean(default=False, doc="""
         Whether the slider text fields should be editable. Disabled
         by default for a more compact widget layout.""")


Test patch:
Repository: holoviz/holoviews

Issue:
Unable to plot empty Image or Raster
```python
hv.Image([])
```

This is possible with a lot of other `holoviews` plot objects.




Discussion:

Resolving patch:
diff --git a/holoviews/element/raster.py b/holoviews/element/raster.py
--- a/holoviews/element/raster.py
+++ b/holoviews/element/raster.py
@@ -230,7 +230,10 @@ class Image(Dataset, Raster, SheetCoordinateSystem):
     def __init__(self, data, kdims=None, vdims=None, bounds=None, extents=None,
                  xdensity=None, ydensity=None, **params):
         extents = extents if extents else (None, None, None, None)
-        if data is None: data = np.array([[0]])
+        if (data is None
+            or (isinstance(data, (list, tuple)) and not data)
+            or (isinstance(data, np.ndarray) and data.size == 0)):
+            data = np.zeros((2, 2))
         Dataset.__init__(self, data, kdims=kdims, vdims=vdims, extents=extents, **params)
 
         dim2, dim1 = self.interface.shape(self, gridded=True)[:2]


Test patch:
diff --git a/tests/testraster.py b/tests/testraster.py
--- a/tests/testraster.py
+++ b/tests/testraster.py
@@ -50,3 +50,9 @@ def test_image_range_masked(self):
         arr = np.ma.masked_where(arr<=0, arr)
         rrange = Image(arr).range(2)
         self.assertEqual(rrange, (np.min(arr), np.max(arr)))
+
+    def test_empty_image(self):
+        Image([])
+        Image(None)
+        Image(np.array([]))
+        Image(np.zeros((0, 0)))
Repository: holoviz/holoviews

Issue:
Matplotlib raster based plots should ignore origin
As a user had to figure out through a lot of pain, the raster plots in matplotlib use the global origin setting which can be overwritten in the matplotlibrc. The plots should not respect this option since it results in wrong plots. (See https://github.com/ioam/holoviews/issues/2258 for more detail)


Discussion:
This should overwrite the matplotlibrc setting for raster, rgb, hsv and image.
Why is class ImagePlot unused? Is it orphaned?

Resolving patch:
diff --git a/holoviews/plotting/mpl/raster.py b/holoviews/plotting/mpl/raster.py
--- a/holoviews/plotting/mpl/raster.py
+++ b/holoviews/plotting/mpl/raster.py
@@ -76,6 +76,7 @@ def get_data(self, element, ranges, style):
         vdim = element.vdims[0]
         self._norm_kwargs(element, ranges, style, vdim)
         style['extent'] = [l, r, b, t]
+        style['origin'] = 'upper'
 
         return [data], style, {'xticks': xticks, 'yticks': yticks}
 
@@ -175,6 +176,7 @@ def get_data(self, element, ranges, style):
         style['aspect'] = shape[0]/shape[1]
         style['extent'] = (0, shape[1], 0, shape[0])
         style['annotations'] = self._annotate_values(element.gridded)
+        style['origin'] = 'upper'
         vdim = element.vdims[0]
         self._norm_kwargs(element, ranges, style, vdim)
         return [data], style, {'xticks': xticks, 'yticks': yticks}
@@ -201,28 +203,6 @@ def update_handles(self, key, axis, element, ranges, style):
         return axis_kwargs
 
 
-class ImagePlot(RasterPlot):
-
-    def get_data(self, element, ranges, style):
-        data = np.flipud(element.dimension_values(2, flat=False))
-        data = np.ma.array(data, mask=np.logical_not(np.isfinite(data)))
-        l, b, r, t = element.bounds.lbrt()
-        if self.invert_axes:
-            data = data[::-1].T
-            l, b, r, t = b, l, t, r
-        vdim = element.vdims[0]
-        self._norm_kwargs(element, ranges, style, vdim)
-        style['extent'] = [l, r, b, t]
-        return (data,), style, {}
-
-    def get_extents(self, element, ranges):
-        extents = super(ImagePlot, self).get_extents(element, ranges)
-        if self.situate_axes:
-            return extents
-        else:
-            return element.bounds.lbrt()
-
-
 class QuadMeshPlot(ColorbarPlot):
 
     style_opts = ['alpha', 'cmap', 'clims', 'edgecolors', 'norm', 'shading',


Test patch:
Repository: holoviz/holoviews

Issue:
DynamicMap drops streams when faceting methods are called
When constructing a DynamicMap with kdims and streams and calling a faceting method like ``.grid``, ``.layout`` or ``.overlay`` on it, it will simply drop the streams if no other key dimensions are left. 

```
def plot_function(mydim, data):
    return hv.Curve(data[data.channel==mydim], 'x', 'y')

my_buffer = hv.streams.Buffer(data=pd.DataFrame({'x': [], 'y': [], 'channel': np.array([], dtype='S1')}))
hv.DynamicMap(plot_function, streams=[my_buffer], kdims=[hv.Dimension('mydim', values=['A', 'B', 'C'])]).layout(['mydim'])
```

If we print the repr we can see what's going on, it has simply unpacked the DynamicMap:

```
:NdLayout   [mydim]
   :Curve   [x]   (y)
```

There needs to be a conditional to ensure that if there are any streams defined, it should not unpack the DynamicMap.


Discussion:

Resolving patch:
diff --git a/holoviews/core/spaces.py b/holoviews/core/spaces.py
--- a/holoviews/core/spaces.py
+++ b/holoviews/core/spaces.py
@@ -1378,7 +1378,7 @@ def inner_fn(outer_vals, *key, **dynkwargs):
                         inner_dims = zip(inner_kdims, util.wrap_tuple(key))
                         inner_vals = [(d.name, k) for d, k in inner_dims]
                         return self.select(**dict(outer_vals+inner_vals)).last
-                    if inner_kdims:
+                    if inner_kdims or self.streams:
                         group = self.clone(callback=partial(inner_fn, outer_vals),
                                            kdims=inner_kdims)
                     else:


Test patch:
diff --git a/tests/core/testdynamic.py b/tests/core/testdynamic.py
--- a/tests/core/testdynamic.py
+++ b/tests/core/testdynamic.py
@@ -7,7 +7,7 @@
 from holoviews.core.spaces import DynamicMap, HoloMap, Callable
 from holoviews.element import Image, Scatter, Curve, Text, Points
 from holoviews.operation import histogram
-from holoviews.streams import Stream, PointerXY, PointerX, PointerY, RangeX
+from holoviews.streams import Stream, PointerXY, PointerX, PointerY, RangeX, Buffer
 from holoviews.util import Dynamic
 from holoviews.element.comparison import ComparisonTestCase
 
@@ -229,6 +229,20 @@ def history_callback(x, y, history=deque(maxlen=10)):
         with self.assertRaisesRegexp(ValueError, exception):
             dmap.reindex(['x'])
 
+    def test_dynamic_groupby_kdims_and_streams(self):
+        def plot_function(mydim, data):
+            return Scatter(data[data[:, 2]==mydim])
+
+        buff = Buffer(data=np.empty((0, 3)))
+        dmap = DynamicMap(plot_function, streams=[buff], kdims='mydim').redim.values(mydim=[0, 1, 2])
+        ndlayout = dmap.groupby('mydim', container_type=NdLayout)
+        self.assertIsInstance(ndlayout[0], DynamicMap)
+        data = np.array([(0, 0, 0), (1, 1, 1), (2, 2, 2)])
+        buff.send(data)
+        self.assertEqual(ndlayout[0][()], Scatter([(0, 0)]))
+        self.assertEqual(ndlayout[1][()], Scatter([(1, 1)]))
+        self.assertEqual(ndlayout[2][()], Scatter([(2, 2)]))
+
 
 class DynamicMapUnboundedProperty(ComparisonTestCase):
Repository: holoviz/holoviews

Issue:
Colorbar of the scatter shows wrong label
Sample notebook code:

```
import holoviews as hv
import numpy as np
hv.extension('matplotlib')

%opts Scatter [color_index=2 colorbar=True]
hv.Scatter(np.random.rand(100, 3), vdims=["y", "c"])
```

Colorbar should be labeled "c", because that's the name of the column providing values for color. However, the label is "y".



Discussion:
Thanks for the bug report.

Resolving patch:
diff --git a/holoviews/plotting/mpl/element.py b/holoviews/plotting/mpl/element.py
--- a/holoviews/plotting/mpl/element.py
+++ b/holoviews/plotting/mpl/element.py
@@ -539,7 +539,8 @@ def _adjust_cbar(self, cbar, label, dim):
     def _finalize_artist(self, element):
         artist = self.handles.get('artist', None)
         if artist and self.colorbar:
-            self._draw_colorbar()
+            color_dim = element.get_dimension(getattr(self, 'color_index', None))
+            self._draw_colorbar(color_dim)
 
 
     def _draw_colorbar(self, dim=None, redraw=True):


Test patch:
diff --git a/tests/plotting/matplotlib/testelementplot.py b/tests/plotting/matplotlib/testelementplot.py
--- a/tests/plotting/matplotlib/testelementplot.py
+++ b/tests/plotting/matplotlib/testelementplot.py
@@ -1,7 +1,7 @@
 import numpy as np
 
 from holoviews.core.spaces import DynamicMap
-from holoviews.element import Image, Curve
+from holoviews.element import Image, Curve, Scatter
 from holoviews.streams import Stream
 
 from .testplot import TestMPLPlot, mpl_renderer
@@ -54,6 +54,11 @@ def test_colormapper_min_max_colors(self):
         img = Image(np.array([[0, 1], [2, 3]])).options(clipping_colors={'min': 'red', 'max': 'blue'})
         plot = mpl_renderer.get_plot(img)
         cmap = plot.handles['artist'].cmap
-        print(dir(cmap))
         self.assertEqual(cmap._rgba_under, (1.0, 0, 0, 1))
         self.assertEqual(cmap._rgba_over, (0, 0, 1.0, 1))
+
+    def test_colorbar_label(self):
+        scatter = Scatter(np.random.rand(100, 3), vdims=["y", "c"]).options(color_index=2, colorbar=True)
+        plot = mpl_renderer.get_plot(scatter)
+        cbar_ax = plot.handles['cax']
+        self.assertEqual(cbar_ax.get_ylabel(), 'c')
Repository: holoviz/holoviews

Issue:
For HLine/VLine time is in UTC
For HLine/VLine time is in UTC. Same date works fine with Points and Spikes.
![image](https://user-images.githubusercontent.com/31924016/42295881-51bd6f8c-7fef-11e8-935e-17dd871be8f8.png)

VLine does not support Timestamps
In #3075, support for timestamps was removed.

In v1.10.7, the timestamp was incorrectly rendered due to timezones (as was documented), but the fix in #3075 actually just removed support for Timestamps entirely on VLine.

```
hv.VLine(pd.to_datetime('06:00'))
```

"works" in v1.10.7:
![image](https://user-images.githubusercontent.com/5461357/48283526-c7fff580-e42a-11e8-82a2-5c917ee561e4.png)

I get the following error message in v1.10.9:

![image](https://user-images.githubusercontent.com/5461357/48283441-85d6b400-e42a-11e8-8853-303672cc236d.png)



Discussion:
I suspect this may be an issue with how bokeh handles timezones but I haven't yet checked.
Fairly sure it's down to our handling of datetimes, but I'll have to investigate.
I had this issue before with Points, but it got fixed. As workaround I used:
os.environ['TZ'] = 'UTC'
time.tzset().
Should be fixed now.


Resolving patch:
diff --git a/holoviews/plotting/bokeh/annotation.py b/holoviews/plotting/bokeh/annotation.py
--- a/holoviews/plotting/bokeh/annotation.py
+++ b/holoviews/plotting/bokeh/annotation.py
@@ -14,13 +14,13 @@
     arrow_end = {'->': NormalHead, '-[': OpenHead, '-|>': NormalHead,
                  '-': None}
 
-from ...core.util import dimension_sanitizer, basestring
+from ...core.util import datetime_types, dimension_sanitizer, basestring
 from ...element import HLine
 from ..plot import GenericElementPlot
 from .element import (AnnotationPlot, CompositeElementPlot, ColorbarPlot,
                       ElementPlot, text_properties, line_properties)
 from .plot import BokehPlot
-
+from .util import date_to_integer
 
 
 class TextPlot(ElementPlot, AnnotationPlot):
@@ -131,6 +131,8 @@ def get_data(self, element, ranges, style):
             dim = 'width' if dim == 'height' else 'height'
         mapping['dimension'] = dim
         loc = element.data
+        if isinstance(loc, datetime_types):
+            loc = date_to_integer(loc)
         mapping['location'] = loc
         return (data, mapping, style)
 
diff --git a/holoviews/plotting/bokeh/util.py b/holoviews/plotting/bokeh/util.py
--- a/holoviews/plotting/bokeh/util.py
+++ b/holoviews/plotting/bokeh/util.py
@@ -649,9 +649,9 @@ def date_to_integer(date):
     """
     if isinstance(date, np.datetime64):
         date = dt64_to_dt(date)
-    elif pd and isinstance(date, pd.Timestamp):
-        date = date.to_pydatetime()
-    if isinstance(date, (dt.datetime, dt.date)):
+    if pd and isinstance(date, pd.Timestamp):
+        dt_int = date.timestamp()*1000
+    elif isinstance(date, (dt.datetime, dt.date)):
         dt_int = time.mktime(date.timetuple())*1000
     else:
         raise ValueError('Datetime type not recognized')


Test patch: