Closed BackT0TheFuture closed 3 years ago
Here is a unit test that produces the same result that I get on python. Please note: The very last where you assign 255, 255, 255 will not work with the latest code on nuget. I am working on a new release that fixes this problem.
[TestMethod]
public void goodtogoodTest()
{
var img = np.fromfile("test.dat", sep : ",");
img = img.reshape(10, 10, 3);
print(img);
var output = img.Copy();
ndarray equalFlags = np.equal(img, np.array(new float[] { 255, 255, 240 }));
ndarray valid = np.all(equalFlags, axis : -1);
ndarray[] rscs = valid.NonZero();
--> wait for the next release for this to work correctly.
//output[rscs[0], rscs[1], ":"] = np.array(new float[] { 255, 255, 255 }); // works OK
output[rscs[0], rscs[1], ":"] = new float[] { 255, 255, 255 }; // works OK
--> wait for the next release for this to work correctly.
print(output);
return;
}
public void goodgoodTest()
{
var img = np.fromfile("test.dat", sep : ",");
img = img.reshape(10, 10, 3);
print(img);
var output = img.Copy();
ndarray equalFlags = np.equal(img, np.array(new float[] { 255, 255, 240 }));
ndarray valid = np.all(equalFlags, axis : -1);
ndarray[] rscs = valid.NonZero();
//output[rscs[0], rscs[1], ":"] = np.array(new float[] { 255, 255, 255 }); // works OK
output[rscs[0], rscs[1], ":"] = new float[] { 255, 255, 255 }; // works OK
print(output);
return;
}
I just pushed up 0.9.61. It has a bug fix that makes the sample code work. Please get it from nuget.org It also has huge performance improvements.
@KevinBaselinesw
It works correctly now , thank you so much!
BTW: same name but different case , Is it designed ?
public object copy(NPY_ORDER order = NPY_ORDER.NPY_CORDER) {
return ArrayReturn(Copy(order));
}
public ndarray Copy(NPY_ORDER order = NPY_ORDER.NPY_CORDER) {
return NpyCoreApi.NewCopy(this, order);
}
This project was started by a different team many years ago and then abandoned. They left it in open source where I picked it up and finished it. There is a fair amount of legacy code floating around that I did not build. I stripped out a huge amount of it. I agree that copy vs Copy seems weird. I should probably make another cleanup pass at some point.
got it . thanks for your great work !
currently I can not get correct result via c# thanks for your help!
test.zip