Skip to content

Commit 93a7307

Browse files
committed
fixed and tested np.column_stack
1 parent 3fdb43a commit 93a7307

File tree

12 files changed

+121
-61
lines changed

12 files changed

+121
-61
lines changed

src/CodeMinion.ApiGenerator/NumPy/ApiGenerator.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,9 @@ private void PostProcess(Function decl)
817817
decl.Returns.Clear();
818818
decl.Returns.Add(new Argument() { Type = "NDarray", Name = "array", IsReturnValue = true });
819819
break;
820+
case "column_stack":
821+
decl.ManualOverride = true;
822+
break;
820823
}
821824
}
822825

src/CodeMinion.Core/CodeGenerator.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@ public CodeGenerator()
4343
@"using System.Linq;",
4444
@"using System.Runtime.InteropServices;",
4545
@"using System.Text;",
46-
@"#if NET_STANDARD
47-
using Python.Runtime;
48-
#else
49-
using Pythonnet;
50-
#endif
51-
",
46+
@"using Python.Runtime;",
5247
};
5348
public string StaticApiFilesPath { get; set; }
5449
public string DynamicApiFilesPath { get; set; }

src/Examples/NeuralNetworkExample/NeuralNetworkExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<ProjectReference Include="..\src\Numpy\Numpy.csproj" />
9+
<ProjectReference Include="..\..\Numpy.Bare\Numpy.Bare.csproj" />
1010
</ItemGroup>
1111

1212
</Project>

src/Examples/WebApiExample/WebApiExample.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<ProjectReference Include="..\src\Numpy.Bare\Numpy.Bare.csproj" />
18+
<ProjectReference Include="..\..\Numpy.Bare\Numpy.Bare.csproj" />
1919
</ItemGroup>
2020

2121
</Project>

src/Numpy.Bare.Dotnet/Numpy.Bare.Dotnet.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
</PropertyGroup>
3434
<ItemGroup>
3535
<Reference Include="Python.Runtime, Version=2.4.1.0, Culture=neutral, processorArchitecture=MSIL">
36-
<HintPath>..\..\packages\pythonnet_netframework_win_py37.2.4.1\lib\net40\Python.Runtime.dll</HintPath>
36+
<HintPath>..\..\packages\pythonnet_py37_win.2.4.1\lib\net40\Python.Runtime.dll</HintPath>
3737
</Reference>
3838
<Reference Include="System" />
3939
<Reference Include="System.Core" />
@@ -57,6 +57,9 @@
5757
<Compile Include="..\Numpy\Manual\np.array.cs">
5858
<Link>Manual\np.array.cs</Link>
5959
</Compile>
60+
<Compile Include="..\Numpy\Manual\np.column_stack.cs">
61+
<Link>Manual\np.column_stack.cs</Link>
62+
</Compile>
6063
<Compile Include="..\Numpy\Manual\np.concatenate.cs">
6164
<Link>Manual\np.concatenate.cs</Link>
6265
</Compile>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="pythonnet_netframework_win_py37" version="2.4.1" targetFramework="net452" />
3+
<package id="pythonnet_py37_win" version="2.4.1" targetFramework="net45" />
44
<package id="System.ValueTuple" version="4.5.0" targetFramework="net452" />
55
</packages>

src/Numpy.Bare/Numpy.Bare.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<Compile Include="..\Numpy\Manual\ctypes.module.cs" Link="Manual\ctypes.module.cs" />
3434
<Compile Include="..\Numpy\Manual\np.aliases.cs" Link="Manual\np.aliases.cs" />
3535
<Compile Include="..\Numpy\Manual\np.array.cs" Link="Manual\np.array.cs" />
36+
<Compile Include="..\Numpy\Manual\np.column_stack.cs" Link="Manual\np.column_stack.cs" />
3637
<Compile Include="..\Numpy\Manual\np.concatenate.cs" Link="Manual\np.concatenate.cs" />
3738
<Compile Include="..\Numpy\Manual\np.constants.cs" Link="Manual\np.constants.cs" />
3839
<Compile Include="..\Numpy\Manual\np.linalg.norm.cs" Link="Manual\np.linalg.norm.cs" />
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Runtime.InteropServices;
5+
using System.Text;
6+
using Numpy;
7+
using Numpy.Models;
8+
using Python.Runtime;
9+
10+
namespace Numpy
11+
{
12+
/// <summary>
13+
/// Manual type conversions
14+
/// </summary>
15+
public static partial class np
16+
{
17+
18+
/// <summary>
19+
/// Stack 1-D arrays as columns into a 2-D array.<br></br>
20+
///
21+
/// Take a sequence of 1-D arrays and stack them as columns
22+
/// to make a single 2-D array.<br></br>
23+
/// 2-D arrays are stacked as-is,
24+
/// just like with hstack.<br></br>
25+
/// 1-D arrays are turned into 2-D columns
26+
/// first.
27+
/// </summary>
28+
/// <param name="tup">
29+
/// Arrays to stack.<br></br>
30+
/// All of them must have the same first dimension.
31+
/// </param>
32+
/// <returns>
33+
/// The array formed by stacking the given arrays.
34+
/// </returns>
35+
public static NDarray column_stack(params NDarray[] tup)
36+
{
37+
//auto-generated code, do not change
38+
var __self__ = self;
39+
PyTuple pyargs;
40+
if (tup.Length == 1)
41+
{
42+
pyargs = ToTuple(new object[] { tup[0], });
43+
}
44+
else
45+
{
46+
pyargs = ToTuple(new object[] { tup, });
47+
}
48+
var kwargs = new PyDict();
49+
dynamic py = __self__.InvokeMethod("column_stack", pyargs, kwargs);
50+
return ToCsharp<NDarray>(py);
51+
}
52+
}
53+
}

src/Numpy/Numpy.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,4 @@
3939
<PackageReference Include="Python.Included" Version="3.7.3.4"></PackageReference>
4040
</ItemGroup>
4141

42-
<ItemGroup>
43-
<Folder Include="Manual\" />
44-
</ItemGroup>
45-
4642
</Project>

src/Numpy/np.array_manipulation.gen.cs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -881,36 +881,6 @@ public static NDarray stack(NDarray[] arrays, int? axis = 0, NDarray @out = null
881881
return ToCsharp<NDarray>(py);
882882
}
883883

884-
/// <summary>
885-
/// Stack 1-D arrays as columns into a 2-D array.<br></br>
886-
///
887-
/// Take a sequence of 1-D arrays and stack them as columns
888-
/// to make a single 2-D array.<br></br>
889-
/// 2-D arrays are stacked as-is,
890-
/// just like with hstack.<br></br>
891-
/// 1-D arrays are turned into 2-D columns
892-
/// first.
893-
/// </summary>
894-
/// <param name="tup">
895-
/// Arrays to stack.<br></br>
896-
/// All of them must have the same first dimension.
897-
/// </param>
898-
/// <returns>
899-
/// The array formed by stacking the given arrays.
900-
/// </returns>
901-
public static NDarray column_stack(params NDarray[] tup)
902-
{
903-
//auto-generated code, do not change
904-
var __self__=self;
905-
var pyargs=ToTuple(new object[]
906-
{
907-
tup,
908-
});
909-
var kwargs=new PyDict();
910-
dynamic py = __self__.InvokeMethod("column_stack", pyargs, kwargs);
911-
return ToCsharp<NDarray>(py);
912-
}
913-
914884
/// <summary>
915885
/// Stack arrays in sequence depth wise (along third axis).<br></br>
916886
///

0 commit comments

Comments
 (0)