[Scilab-users] ipcv vs scicv

classic Classic list List threaded Threaded
12 messages Options
der_Phil der_Phil
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] ipcv vs scicv

Dear developers,

as I have many scripts with "imread" I wonder if some time in the future duplicate functions names from IPCV and SCICV are going to be removed/changed.

It's kind of disturbing to have to use atomsInstall/atomsRemove when using different scripts.

I think this was discussed already in the past, though an update would be nice.

Thank you,
Philipp


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

Hi all

I imagine naming conflicts can occur across different ATOMS.

How about a change where one has to specify which ATOMS module you're using when calling a function, such that both can coexist side-by-side ?

I'm thinking Pythonic here, like if you import for example numpy, you can write import numpy as np ... from hereon, you write np.pi for the definition of pi (=3.14159 ... ), and so on.

Maybe something for Scilab 7 (?)

Cheers,
Claus

On 24-11-2020 14:15, P M wrote:
Dear developers,

as I have many scripts with "imread" I wonder if some time in the future duplicate functions names from IPCV and SCICV are going to be removed/changed.

It's kind of disturbing to have to use atomsInstall/atomsRemove when using different scripts.

I think this was discussed already in the past, though an update would be nice.

Thank you,
Philipp


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
der_Phil der_Phil
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

Mh. Nice Idea.

Maybe something like this is already possible?

Install toolboxed but remove from autoloader.
So scilab starts without toolboxed from atoms.

The script includes than the command,  which module shall be loaded.

Thanks for the idea...i will try this.
Philipp 




Am Dienstag, 24. November 2020 schrieb Claus Futtrup <[hidden email]>:
Hi all

I imagine naming conflicts can occur across different ATOMS.

How about a change where one has to specify which ATOMS module you're using when calling a function, such that both can coexist side-by-side ?

I'm thinking Pythonic here, like if you import for example numpy, you can write import numpy as np ... from hereon, you write np.pi for the definition of pi (=3.14159 ... ), and so on.

Maybe something for Scilab 7 (?)

Cheers,
Claus

On 24-11-2020 14:15, P M wrote:
Dear developers,

as I have many scripts with "imread" I wonder if some time in the future duplicate functions names from IPCV and SCICV are going to be removed/changed.

It's kind of disturbing to have to use atomsInstall/atomsRemove when using different scripts.

I think this was discussed already in the past, though an update would be nice.

Thank you,
Philipp


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
TanCL TanCL
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

Hi, my previous message seems like not able to get posted due to some reason,
just to add some comment on this, I think the functions with same name under
2 different modules could be possibly called by:

moduleA.myfunc

moduleB.myfunc


______________________

Start Toolbox A
        Load macros

Start Toolbox B
        Load macros


--> toolboxAlib.scilab_sum(2,1)

  "This is function from ToolboxA"
 ans  =

   3.

--> toolboxBlib.scilab_sum(2,1)

  "This is function from ToolboxB"
 ans  =

   3.





--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

Hi Tan

I agree. The proposal, is it something we can do ourselves now, or will
it require implementation into Scilab first? Thank you for resending.

/Claus

On 03-12-2020 02:10, TanCL wrote:

> Hi, my previous message seems like not able to get posted due to some reason,
> just to add some comment on this, I think the functions with same name under
> 2 different modules could be possibly called by:
>
> moduleA.myfunc
>
> moduleB.myfunc
>
>
> ______________________
>
> Start Toolbox A
> Load macros
>
> Start Toolbox B
> Load macros
>
>
> --> toolboxAlib.scilab_sum(2,1)
>
>    "This is function from ToolboxA"
>   ans  =
>
>     3.
>
> --> toolboxBlib.scilab_sum(2,1)
>
>    "This is function from ToolboxB"
>   ans  =
>
>     3.
>
>
>
>
>
> --
> Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant Antoine Monmayrant
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

In reply to this post by TanCL


On 03/12/2020 02:10, TanCL wrote:
Hi, my previous message seems like not able to get posted due to some reason,
just to add some comment on this, I think the functions with same name under
2 different modules could be possibly called by:

That is exactly how things are working in Ada:

myfunc : local definition in the current file
somepackage.myfunc : definition one can find in somepackage that is included in the current file by "with somepackage;"

And one can rename the package with "package S renames somepackage" which allow writting "s.myfunc"
I assume it's similar in Python too.

Antoine

moduleA.myfunc

moduleB.myfunc


______________________

Start Toolbox A
	Load macros

Start Toolbox B
	Load macros


--> toolboxAlib.scilab_sum(2,1)

  "This is function from ToolboxA"
 ans  =

   3.

--> toolboxBlib.scilab_sum(2,1)

  "This is function from ToolboxB"
 ans  =

   3.





--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

This is the way it works in scilab for libraries:

mkdir lib1
mputl("function y=foo(x);y=x;end","lib1/foo.sci")
genlib("lib1","lib1")
mkdir lib2
mputl("function y=foo(x);y=2*x;end","lib2/foo.sci")
genlib("lib2","lib2")
lib("lib1")
lib("lib2")

-> lib1.foo(1)
 ans  =

   1.

--> lib2.foo(1)
 ans  =

   2.

S.

Le 03/12/2020 à 17:28, Antoine Monmayrant a écrit :


On 03/12/2020 02:10, TanCL wrote:
Hi, my previous message seems like not able to get posted due to some reason,
just to add some comment on this, I think the functions with same name under
2 different modules could be possibly called by:

That is exactly how things are working in Ada:

myfunc : local definition in the current file
somepackage.myfunc : definition one can find in somepackage that is included in the current file by "with somepackage;"

And one can rename the package with "package S renames somepackage" which allow writting "s.myfunc"
I assume it's similar in Python too.

Antoine

moduleA.myfunc

moduleB.myfunc


______________________

Start Toolbox A
	Load macros

Start Toolbox B
	Load macros


--> toolboxAlib.scilab_sum(2,1)

  "This is function from ToolboxA"
 ans  =

   3.

--> toolboxBlib.scilab_sum(2,1)

  "This is function from ToolboxB"
 ans  =

   3.





--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
TanCL TanCL
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

Hi all, 

Stephane, Thanks for the quick  examples to illustrate this.

Claus, as shown by Stephane, this could be now by ourselves now from our own modules. Stephane has illustrated a quick demo on this, while the one I was testing with is the copy of toolbox skeleton inside the Scilab contrib, modified to 2 modules, installed with atoms and let it load at start, results are the same. 

There are 2 potential issues which we should take notes: 
1. The module which is loaded last, will have the "dominant" in the base function. for e.g.: the example that Stephane showed, we could call "lib1.foo" and "lib2.foo", and calling just "foo" will be the same as  "lib2.foo".
2. Only macros function could be called this way, if a module has a scilab gateway that called direct from Scilab, (such as scicv), you could not call scicvlib.imread as the imread is directly expose from the C lib to Scilab. So during the design of the module, you could have a macros wrapper to call the gateway functions so that they could be listed in the library's macros list.

Thanks.

rgds,
CL

On Fri, 4 Dec 2020 at 00:36, Stéphane Mottelet <[hidden email]> wrote:

This is the way it works in scilab for libraries:

mkdir lib1
mputl("function y=foo(x);y=x;end","lib1/foo.sci")
genlib("lib1","lib1")
mkdir lib2
mputl("function y=foo(x);y=2*x;end","lib2/foo.sci")
genlib("lib2","lib2")
lib("lib1")
lib("lib2")

-> lib1.foo(1)
 ans  =

   1.

--> lib2.foo(1)
 ans  =

   2.

S.

Le 03/12/2020 à 17:28, Antoine Monmayrant a écrit :


On 03/12/2020 02:10, TanCL wrote:
Hi, my previous message seems like not able to get posted due to some reason,
just to add some comment on this, I think the functions with same name under
2 different modules could be possibly called by:

That is exactly how things are working in Ada:

myfunc : local definition in the current file
somepackage.myfunc : definition one can find in somepackage that is included in the current file by "with somepackage;"

And one can rename the package with "package S renames somepackage" which allow writting "s.myfunc"
I assume it's similar in Python too.

Antoine

moduleA.myfunc

moduleB.myfunc


______________________

Start Toolbox A
	Load macros

Start Toolbox B
	Load macros


--> toolboxAlib.scilab_sum(2,1)

  "This is function from ToolboxA"
 ans  =

   3.

--> toolboxBlib.scilab_sum(2,1)

  "This is function from ToolboxB"
 ans  =

   3.





--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

Hello Chin Luh,

Le 04/12/2020 à 01:57, Chin Luh Tan a écrit :
Hi all, 

Stephane, Thanks for the quick  examples to illustrate this.

Claus, as shown by Stephane, this could be now by ourselves now from our own modules. Stephane has illustrated a quick demo on this, while the one I was testing with is the copy of toolbox skeleton inside the Scilab contrib, modified to 2 modules, installed with atoms and let it load at start, results are the same. 

There are 2 potential issues which we should take notes: 
1. The module which is loaded last, will have the "dominant" in the base function.

Are you sure about this? This was the rule with Scilab 5, but the removal of the variables stack changed it within Scilab 6. I noticed with Scilab 6.0 that the libraries are scanned for the required function only after sorting their names in anti-alphabetical order.
So if both alib.myfunc() and zlib.myfunc() exist, myfunc() will call zlib.myfunc(), whatever is the loading order of alib and zlib.

On this respect, neither the https://help.scilab.org/docs/6.1.0/en_US/library.html page is up-to-date, not other pages dealing with libraries, like the genlib().
Here is the test:

File = TMPDIR+"\test\";
mkdir(File+"alib");
mkdir(File+"zlib");

code = [ "function test()" ; "    disp(""test from alib"")" ; "endfunction"];
mputl(code, File+"alib\test.sci");
genlib("alib", File+"alib");

code = [ "function test()" ; "    disp(""test from zlib"")" ; "endfunction"];
mputl(code, File+"zlib\test.sci");
genlib("zlib", File+"zlib");

clear alib zlib
load(File+"zlib\lib")
load(File+"alib\lib")

test()

--> test()
  "test from zlib"
for e.g.: the example that Stephane showed, we could call "lib1.foo" and "lib2.foo", and calling just "foo" will be the same as  "lib2.foo".
2. Only macros function could be called this way, if a module has a scilab gateway that called direct from Scilab, (such as scicv), you could not call scicvlib.imread as the imread is directly expose from the C lib to Scilab.

This is true only if the homonymous function is called without specifying its library. Otherwise, the name resolution works:

File = TMPDIR+"\test\";
mkdir(File+"alib");
code = [ "function cos(a)" ; "    disp(""cos() from alib"")" ; "endfunction"];
mputl(code, File+"alib\cos.sci");
genlib("alib", File+"alib");
clear alib
load(File+"alib\lib")

cos(1)
alib.cos(1)

--> cos(1)
 ans  =
   0.5403023

--> alib.cos(1)
  "cos() from alib"

Best regards
Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
TanCL TanCL
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

Hi Samuel, 

Thanks for your details explanations and examples, they are really helpful. Yes you're right, the functions loaded are base on what you have describe, not depending on the order the modules being loaded. Thanks for pointing this out. 

Regards,
Chin Luh

On Sat, 5 Dec 2020 at 02:37, Samuel Gougeon <[hidden email]> wrote:
Hello Chin Luh,

Le 04/12/2020 à 01:57, Chin Luh Tan a écrit :
Hi all, 

Stephane, Thanks for the quick  examples to illustrate this.

Claus, as shown by Stephane, this could be now by ourselves now from our own modules. Stephane has illustrated a quick demo on this, while the one I was testing with is the copy of toolbox skeleton inside the Scilab contrib, modified to 2 modules, installed with atoms and let it load at start, results are the same. 

There are 2 potential issues which we should take notes: 
1. The module which is loaded last, will have the "dominant" in the base function.

Are you sure about this? This was the rule with Scilab 5, but the removal of the variables stack changed it within Scilab 6. I noticed with Scilab 6.0 that the libraries are scanned for the required function only after sorting their names in anti-alphabetical order.
So if both alib.myfunc() and zlib.myfunc() exist, myfunc() will call zlib.myfunc(), whatever is the loading order of alib and zlib.

On this respect, neither the https://help.scilab.org/docs/6.1.0/en_US/library.html page is up-to-date, not other pages dealing with libraries, like the genlib().
Here is the test:

File = TMPDIR+"\test\";
mkdir(File+"alib");
mkdir(File+"zlib");

code = [ "function test()" ; "    disp(""test from alib"")" ; "endfunction"];
mputl(code, File+"alib\test.sci");
genlib("alib", File+"alib");

code = [ "function test()" ; "    disp(""test from zlib"")" ; "endfunction"];
mputl(code, File+"zlib\test.sci");
genlib("zlib", File+"zlib");

clear alib zlib
load(File+"zlib\lib")
load(File+"alib\lib")

test()

--> test()
  "test from zlib"
for e.g.: the example that Stephane showed, we could call "lib1.foo" and "lib2.foo", and calling just "foo" will be the same as  "lib2.foo".
2. Only macros function could be called this way, if a module has a scilab gateway that called direct from Scilab, (such as scicv), you could not call scicvlib.imread as the imread is directly expose from the C lib to Scilab.

This is true only if the homonymous function is called without specifying its library. Otherwise, the name resolution works:

File = TMPDIR+"\test\";
mkdir(File+"alib");
code = [ "function cos(a)" ; "    disp(""cos() from alib"")" ; "endfunction"];
mputl(code, File+"alib\cos.sci");
genlib("alib", File+"alib");
clear alib
load(File+"alib\lib")

cos(1)
alib.cos(1)

--> cos(1)
 ans  =
   0.5403023

--> alib.cos(1)
  "cos() from alib"

Best regards
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
der_Phil der_Phil
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

Please enlighten me....on my PC the current situation is like this:

Scilab 6.1.0

Loading order 1:
- scicv
- IPCV
--> in console: help imread

--> img = imread(filename[,flag])            // hence the imread function from scicv is found / used (?)

-------
Loading order 2:

- IPCV
- scicv
--> in console: help imread

--> im = imread(filename)
--> im = imread(url)                         // hence the imread function from IPCV is found / used (?)

Does this not describe what Chin Luh has mentioned?


The behaviour described above would be different, when there is:
scicv.imread
IPCV.imread

...which is indeed python-like.

Thanks for your patience.

Philipp






Am Sa., 5. Dez. 2020 um 01:56 Uhr schrieb Chin Luh Tan <[hidden email]>:
Hi Samuel, 

Thanks for your details explanations and examples, they are really helpful. Yes you're right, the functions loaded are base on what you have describe, not depending on the order the modules being loaded. Thanks for pointing this out. 

Regards,
Chin Luh

On Sat, 5 Dec 2020 at 02:37, Samuel Gougeon <[hidden email]> wrote:
Hello Chin Luh,

Le 04/12/2020 à 01:57, Chin Luh Tan a écrit :
Hi all, 

Stephane, Thanks for the quick  examples to illustrate this.

Claus, as shown by Stephane, this could be now by ourselves now from our own modules. Stephane has illustrated a quick demo on this, while the one I was testing with is the copy of toolbox skeleton inside the Scilab contrib, modified to 2 modules, installed with atoms and let it load at start, results are the same. 

There are 2 potential issues which we should take notes: 
1. The module which is loaded last, will have the "dominant" in the base function.

Are you sure about this? This was the rule with Scilab 5, but the removal of the variables stack changed it within Scilab 6. I noticed with Scilab 6.0 that the libraries are scanned for the required function only after sorting their names in anti-alphabetical order.
So if both alib.myfunc() and zlib.myfunc() exist, myfunc() will call zlib.myfunc(), whatever is the loading order of alib and zlib.

On this respect, neither the https://help.scilab.org/docs/6.1.0/en_US/library.html page is up-to-date, not other pages dealing with libraries, like the genlib().
Here is the test:

File = TMPDIR+"\test\";
mkdir(File+"alib");
mkdir(File+"zlib");

code = [ "function test()" ; "    disp(""test from alib"")" ; "endfunction"];
mputl(code, File+"alib\test.sci");
genlib("alib", File+"alib");

code = [ "function test()" ; "    disp(""test from zlib"")" ; "endfunction"];
mputl(code, File+"zlib\test.sci");
genlib("zlib", File+"zlib");

clear alib zlib
load(File+"zlib\lib")
load(File+"alib\lib")

test()

--> test()
  "test from zlib"
for e.g.: the example that Stephane showed, we could call "lib1.foo" and "lib2.foo", and calling just "foo" will be the same as  "lib2.foo".
2. Only macros function could be called this way, if a module has a scilab gateway that called direct from Scilab, (such as scicv), you could not call scicvlib.imread as the imread is directly expose from the C lib to Scilab.

This is true only if the homonymous function is called without specifying its library. Otherwise, the name resolution works:

File = TMPDIR+"\test\";
mkdir(File+"alib");
code = [ "function cos(a)" ; "    disp(""cos() from alib"")" ; "endfunction"];
mputl(code, File+"alib\cos.sci");
genlib("alib", File+"alib");
clear alib
load(File+"alib\lib")

cos(1)
alib.cos(1)

--> cos(1)
 ans  =
   0.5403023

--> alib.cos(1)
  "cos() from alib"

Best regards
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: ipcv vs scicv

Hello Philipp,

Le 07/12/2020 à 09:02, P M a écrit :

> Please enlighten me....on my PC the current situation is like this:
>
> Scilab 6.1.0
>
> Loading order 1:
> - scicv
> - IPCV
> --> in console: help imread
>
> --> img = imread(filename[,flag])            // hence the imread
> function from scicv is found / used (?)

I guess that you are here only calling the help, not the function.
This is a different topic.

I don't know how the help viewer manages homonymous pages from external
modules
(or even an external against an internal). Maybe yes the last loaded is
the default one.
Anyway, in the viewer, all modules and homonymous pages are displayed in
distinct chapters.

Now, we could address the way to force the viewer targeting a given
chapter from the command line, for instance with something like
--> help alib.cos
If so, i am afraid that, to me, it will be a (very) low priority wish ;-)

Regards
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users