$iob4 = $pic->slice('0,$_:$picSize-1:6');
Produces ====>
Invalid slice str '0,$_:$picSize-1:6': '$_:$picSize-1:6' at C:\Users\eclisob\wor
kspace\Perl projects\prs_picOpt.pl line 100.

I put in the first loop indicator and the size of the Rows as below:
$iob4 = $pic->slice('0,0:347:6');
Produces ====>
 iob4 is
[
 [5.7863319e+008]
 [5.7871172e+008]
 [5.7863748e+008]
...
 [5.7843783e+008]
 [5.7840675e+008]
 [5.7846836e+008]
 [5.7847529e+008]
 [5.7843714e+008]
 [5.7844745e+008]
]
 of size 58

Feeling good about seeing a result I tried following Puneet's suggestion of 
using Double quotes.
 $iob4 = $pic->slice("0,$_:$picSize-1:6");

Produced ===>
Invalid slice str '0,0:348-1:6': '-1:6' at C:\Users\eclisob\workspace\Perl proje
cts\prs_picOpt.pl line 100.

So I moved the calculation from inside the string to out side (so that it 
received 347 instead of having to calculate it).
Produced ===>
iob4 is
[
 [5.7863319e+008]
 [5.7871172e+008]
 [5.7863748e+008]
...
 [5.7843783e+008]
 [5.7840675e+008]
 [5.7846836e+008]
 [5.7847529e+008]
 [5.7843714e+008]
 [5.7844745e+008]
]
 of size 58

Try as I might I could not coerce NiceSlice syntax at all though.





CLIFF SOBCHUK

Core RF Engineering
Phone 613-667-1974  ecn : 8109-71974
mobile 403-819-9233
yahoo: sobchuk
www.ericsson.com<http://www.ericsson.com/>

"The author works for Telefonaktiebolaget L M Ericsson ("Ericsson"), who is 
solely responsible for this email and its contents. All inquiries regarding 
this email should be addressed to Ericsson. The web site for Ericsson is 
www.ericsson.com."

This Communication is Confidential. We only send and receive email on the basis 
of the terms set out at 
www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>


________________________________
From: Craig DeForest [mailto:[email protected]]
Sent: November-24-10 10:17 AM
To: Clifford Sobchuk
Cc: Craig DeForest; Puneet Kishor; [email protected]
Subject: Re: [Perldl] Nice Slice Selection confusion

Cliff, the slice call gets a single string -- eliminate the single quotes 
around the comma between the arguments.

On Nov 24, 2010, at 10:14 AM, Clifford Sobchuk wrote:

I guess there must be something more nefarious going on then. I tried both 
methods and I get different errors.

foreach (0..5) {
 use PDL::NiceSlice;
 print $pic;
 $iob4 = $pic(0,[$_:$picSize-1:6]);
 print "iob4 is $iob4 of size ",nelem($iob4),"\n";
Produces ====>
C:\Users\eclisob\workspace\Perl projects>prs_picOpt.pl picSample.txt
Graphics::GnuplotIF : cannot find environment variable DISPLAY
syntax error at C:\Users\eclisob\workspace\Perl projects\prs_picOpt.pl line 100,
 near "$_:"
Execution of C:\Users\eclisob\workspace\Perl projects\prs_picOpt.pl aborted due
to compilation errors.


foreach (0..5) {
 use PDL::NiceSlice;
 print $pic;
 $iob4 = $pic->slice('0','$_:$picSize-1:6');
 print "iob4 is $iob4 of size ",nelem($iob4),"\n";

Produces ====>
Usage:  PDL::slice(PARENT,CHILD,str) (you may leave temporaries or output variab
les out of list) at C:\Users\eclisob\workspace\Perl projects\prs_picOpt.pl line
100.

I'll open a bug. In the meantime I'll send it to my home machine and try it on 
Ubuntu.

Thanks for the help - I'll open a bug.




CLIFF SOBCHUK

Core RF Engineering
Phone 613-667-1974  ecn : 8109-71974
mobile 403-819-9233
yahoo: sobchuk
www.ericsson.com<http://www.ericsson.com/>

"The author works for Telefonaktiebolaget L M Ericsson ("Ericsson"), who is 
solely responsible for this email and its contents. All inquiries regarding 
this email should be addressed to Ericsson. The web site for Ericsson is 
www.ericsson.com<http://www.ericsson.com>."

This Communication is Confidential. We only send and receive email on the basis 
of the terms set out at 
www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>


________________________________
From: Craig DeForest [mailto:[email protected]]
Sent: November-24-10 10:06 AM
To: Clifford Sobchuk
Cc: Craig DeForest; Puneet Kishor; 
[email protected]<mailto:[email protected]>
Subject: Re: [Perldl] Nice Slice Selection confusion

Hmmm...

It would be nice to get to the bottom of this, but if you need a quick result 
you can fall back to the "nslice" command:

  $iob4 = $pic->nslice(0,[$_,$picSize-1,6]);

which is what the NiceSlice preprocessor should be morphing your code into, 
before handing it off to Perl.

If NiceSlice is causing the trouble, then the line above should work OK and you 
are on your way; if you still get an error, it is something else, more puzzling 
still (but you can fall back to using ->slice).

Either way, it would be helpful to file a bug report on SourceForge.



On Nov 24, 2010, at 9:58 AM, Clifford Sobchuk wrote:

Yes. It is at the top of the file. But there is only one file. It isn't called 
by another, nor does it call one. Just for the heck of it I dropped it in to 
the foreach loop preceeding the statement and it gives the same error.

foreach (0..5) {
 use PDL::NiceSlice;
 print $pic;
 $iob4 = $pic(0,$_:$picSize-1:6);
 print "iob4 is $iob4 of size ",nelem($iob4),"\n";
Thanks,


CLIFF SOBCHUK

Core RF Engineering
Phone 613-667-1974  ecn : 8109-71974
mobile 403-819-9233
yahoo: sobchuk
www.ericsson.com<http://www.ericsson.com/>

"The author works for Telefonaktiebolaget L M Ericsson ("Ericsson"), who is 
solely responsible for this email and its contents. All inquiries regarding 
this email should be addressed to Ericsson. The web site for Ericsson is 
www.ericsson.com<http://www.ericsson.com>."

This Communication is Confidential. We only send and receive email on the basis 
of the terms set out at 
www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>


________________________________
From: Craig DeForest [mailto:[email protected]]
Sent: November-24-10 9:32 AM
To: Clifford Sobchuk
Cc: Craig DeForest; Puneet Kishor; 
[email protected]<mailto:[email protected]>
Subject: Re: [Perldl] Nice Slice Selection confusion

Argh.  Sorry, in my pre-coffee fog I didn't see that Puneet was actually 
*answering* Cliff's question.  Sorry, all.  Next time I'll wait till I'm fully 
awake...

Cliff, that error looks as if NiceSlice isn't parsing your line properly.  Do 
you have a "use PDL::NiceSlice;" near the top of your script?  (You have to 
invoke NiceSlice on a per-file basis, since it uses the Perl source filter 
mechanism; this can be confusing if you're moving commands from the perldl 
shell, because perldl jumps through a lot of hoops to do it invisibly for 
you...)





On Nov 24, 2010, at 9:25 AM, Clifford Sobchuk wrote:

I guess what I should have done was brought my "Also" to the top of the print. 
I didn't realize that it doesn't supposed to do this. Attached is the script.
Also I have

use PDL::NiceSlice ;

in the script, I still need to use ' ' around the values when running the 
script in Windows (win32 ActiveState Perl 5.10). I am debugging it in Eclipse 
with the EPIC plugin, and have also tried it at the command line with the same 
results.
Without the single quotes which is what does work in perldl shell
$iob4 = $pic(0,$_:$picSize-1:6);
when I run it in Eclipse or Windows Command Prompt I get the following error:
non piddle ref ' at C:/Perl/site/lib/PDL/Core.pm line 1645.
Thanks,



CLIFF SOBCHUK

Core RF Engineering
Phone 613-667-1974  ecn : 8109-71974
mobile 403-819-9233
yahoo: sobchuk
www.ericsson.com<http://www.ericsson.com/>

"The author works for Telefonaktiebolaget L M Ericsson ("Ericsson"), who is 
solely responsible for this email and its contents. All inquiries regarding 
this email should be addressed to Ericsson. The web site for Ericsson is 
www.ericsson.com<http://www.ericsson.com>."

This Communication is Confidential. We only send and receive email on the basis 
of the terms set out at 
www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>


________________________________
From: Craig DeForest [mailto:[email protected]]
Sent: November-24-10 8:10 AM
To: Puneet Kishor
Cc: Craig DeForest; Clifford Sobchuk; 
[email protected]<mailto:[email protected]>
Subject: Re: [Perldl] Nice Slice Selection confusion

Puneet, by enclosing the niceslice terms in quotes, you are forcing them to be 
evaluated as strings rather than as Perl variables.  Leave off the quotes.


On Nov 24, 2010, at 7:06 AM, Puneet Kishor wrote:



Clifford Sobchuk wrote:

Hi Folks,

I am struggling to understand the slice indexing syntax for $a->slice( a:b:c ). 
I did this in perldl shell:

pdl> $a=sequence (3,10);p $a

[
 [ 0  1  2]
 [ 3  4  5]
 [ 6  7  8]
 [ 9 10 11]
 [12 13 14]
 [15 16 17]
 [18 19 20]
 [21 22 23]
 [24 25 26]
 [27 28 29]
]

pdl> p $a(1,0:9:2)

[
 [ 1]
 [ 7]
 [13]
 [19]
 [25]
]
and it worked like I expected it to.

I then put it in to my script

 foreach (0..5) {
 print $pic;
 $iob4 = $pic('0','$_:$picSize-1:6');
 print "iob4 is $iob4 of size ",nelem($iob4),"\n";
and i only get a single value - the first one:

[
 [5.7863319e+008 5.5061404e+008]
 [5.7863344e+008 5.5635026e+008]
 [ 5.790996e+008 5.3051317e+008]
 [5.7875504e+008 5.3033015e+008]
 [5.7936432e+008  5.277951e+008]
 [5.7675125e+008 5.6184104e+008]
 [5.7871172e+008 5.5064908e+008]
 [ 5.786631e+008 5.5618585e+008]
 [5.7911588e+008 5.3037927e+008]
 ...
 [5.7905481e+008 5.2330437e+008]
 [5.7738847e+008  5.607879e+008]
 [5.7844745e+008 5.5221171e+008]
 [5.7900191e+008 5.5709251e+008]
 [5.7942135e+008 5.2928743e+008]
 [5.7908425e+008  5.286075e+008]
 [5.7902203e+008 5.2338163e+008]
 [ 5.774559e+008 5.6077705e+008]
]
iob4 is
[
 [5.7863319e+008]
]
 of size 1
Where I expected to get the first column with every 6th entry starting from the 
first element in the column.
What am I doing wrong.


Also I have

use PDL::NiceSlice ;

in the script, I still need to use ' ' around the values when running the 
script in Windows (win32 ActiveState Perl 5.10). I am debugging it in Eclipse 
with the EPIC plugin, and have also tried it at the command line with the same 
results.



The single quotes are screwing up here. They are being evaluated as 0, so, in 
effect, your niceslice expression is becoming $pic(0,0)

Consider

my $pdl = sequence (3,10);
print "pdl: " . $pdl(1,0:9:2) . "\n";
my $c = $pdl('0','0:9:2');
my $d = $pdl(0,0);
print "c is $c of size ", nelem($c), "\n";
print "d is $d of size ", nelem($d), "\n";

I get
pdl:
[
 [ 1]
 [ 7]
 [13]
 [19]
 [25]
]

c is
[
 [0]
]
 of size 1
d is
[
 [0]
]
 of size 1


Thanks,





CLIFF SOBCHUK

Ericsson
Core RF Engineering
Calgary, AB, Canada
Phone 613-667-1974  ECN 8109 x71974

Mobile 403-819-9233
[email protected]<mailto:[email protected]>

yahoo: sobchuk
www.ericsson.com<http://www.ericsson.com>


<http://www.ericsson.com/>


"The author works for Telefonaktiebolaget L M Ericsson ("Ericsson"), who is 
solely responsible for this email and its contents. All inquiries regarding 
this email should be addressed to Ericsson. The web site for Ericsson is 
www.ericsson.com."<http://www.ericsson.com.";>

This Communication is Confidential. We only send and receive email on the basis 
of the terms set out at 
www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaimer>




_______________________________________________
Perldl mailing list
[email protected]<mailto:[email protected]>
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl


_______________________________________________
Perldl mailing list
[email protected]<mailto:[email protected]>
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

<prs_picOpt.pl>



<<inline: Email_line.gif>>

_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to