Re: [R] Fourier descriptors created in a loop

2012-06-06 Thread aledanda
Hi David,

Thank you for your reply.

/Somehow I'm guessing that this will involve load an unnamed package.  
Yep:
  ?create.fourier.descriptor
No documentation for ‘create.fourier.descriptor’ in specified packages  
and libraries:
you could try ‘??create.fourier.descriptor’/

So I indeed forgot to mention in my post that my script starts with 

*library('FourierDescriptors')*


/ *count - seq(1, 7, 0.06)

 for (i in 1:count){

I was also  wondering what would happen when you passed a vector to  
the : operator. A warning at the very least. What was the point of  
this outer loop?/

I need the outer loop for changing the amplitude of my shapes at every
iteration.
I specified the amplitudes I want in 

count - seq(1, 7, 0.06).

This outer loop actually works (when I correct the  for (i in 1:count){
into  for (i in count){.)
It generates in fact all the shapes I want. The problem is with the inner
loop, it doesn't seem to save any png picture in my directory. The error is:

*Error in switch(units, `in` = res, cm = res/2.54, mm = res/25.4, px = 1) * 
: 
  non-numeric argument to binary operator*

I report my all script here again:

library('FourierDescriptors')

count - seq(1, 7, 1)
# Controlled shapes
for (i in count){
  for (s in 1:length(count)){
png(~/Desktop/EMAS/FD_stimuli/s1_,s,.png)
plot(create.fourier.descriptor(amplitude = c(0, i)));
dev.off()
  }
}

Thank you for your help
Best

Ale


--
View this message in context: 
http://r.789695.n4.nabble.com/Fourier-descriptors-created-in-a-loop-tp4632414p4632505.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fourier descriptors created in a loop

2012-06-06 Thread Jeff Newmiller
It would help if you read the manual page for png and gave it arguments 
that matched what the function expects.  You probably also need to read 
?paste.


Also, based on what you have said so far, you do NOT need nested for 
loops. Just use the inner loop and when you need i use instead 
count[s].


On Wed, 6 Jun 2012, aledanda wrote:


Hi David,

Thank you for your reply.

/Somehow I'm guessing that this will involve load an unnamed package. 
Yep:

 ?create.fourier.descriptor
No documentation for ?create.fourier.descriptor? in specified packages 
and libraries:

you could try ???create.fourier.descriptor?/

So I indeed forgot to mention in my post that my script starts with 


*library('FourierDescriptors')*


/ *count - seq(1, 7, 0.06)


for (i in 1:count){


I was also  wondering what would happen when you passed a vector to 
the : operator. A warning at the very least. What was the point of 
this outer loop?/


I need the outer loop for changing the amplitude of my shapes at every
iteration.
I specified the amplitudes I want in 


count - seq(1, 7, 0.06).

This outer loop actually works (when I correct the  for (i in 1:count){
into  for (i in count){.)
It generates in fact all the shapes I want. The problem is with the inner
loop, it doesn't seem to save any png picture in my directory. The error is:

*Error in switch(units, `in` = res, cm = res/2.54, mm = res/25.4, px = 1) * 
:

 non-numeric argument to binary operator*

I report my all script here again:

library('FourierDescriptors')

count - seq(1, 7, 1)
# Controlled shapes
for (i in count){
 for (s in 1:length(count)){
   png(~/Desktop/EMAS/FD_stimuli/s1_,s,.png)
   plot(create.fourier.descriptor(amplitude = c(0, i)));
   dev.off()
 }
}

Thank you for your help
Best

Ale


--
View this message in context: 
http://r.789695.n4.nabble.com/Fourier-descriptors-created-in-a-loop-tp4632414p4632505.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fourier descriptors created in a loop

2012-06-06 Thread David Winsemius


On Jun 6, 2012, at 5:13 AM, aledanda wrote:


Hi David,

Thank you for your reply.

/Somehow I'm guessing that this will involve load an unnamed package.
Yep:

?create.fourier.descriptor

No documentation for ‘create.fourier.descriptor’ in specified packages
and libraries:
you could try ‘??create.fourier.descriptor’/

So I indeed forgot to mention in my post that my script starts with

*library('FourierDescriptors')*


/ *count - seq(1, 7, 0.06)


for (i in 1:count){


I was also  wondering what would happen when you passed a vector to
the : operator. A warning at the very least. What was the point of
this outer loop?/

I need the outer loop for changing the amplitude of my shapes at every
iteration.
I specified the amplitudes I want in

count - seq(1, 7, 0.06).

This outer loop actually works (when I correct the  for (i in  
1:count){

into  for (i in count){.)
It generates in fact all the shapes I want. The problem is with the  
inner
loop, it doesn't seem to save any png picture in my directory. The  
error is:


*Error in switch(units, `in` = res, cm = res/2.54, mm = res/25.4, px  
= 1) *

:
 non-numeric argument to binary operator*

I report my all script here again:

library('FourierDescriptors')

count - seq(1, 7, 1)
# Controlled shapes
for (i in count){
 for (s in 1:length(count)){
   png(~/Desktop/EMAS/FD_stimuli/s1_,s,.png)


Have you considered how difficult it might be to extract any  
information from a .png file that was constructed only one pixel wide?




   plot(create.fourier.descriptor(amplitude = c(0, i)));
   dev.off()
 }
}

Thank you for your help
Best

Ale


--

David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fourier descriptors created in a loop

2012-06-06 Thread David Winsemius


On Jun 6, 2012, at 11:46 AM, David Winsemius wrote:



On Jun 6, 2012, at 5:13 AM, aledanda wrote:


Hi David,

Thank you for your reply.

/Somehow I'm guessing that this will involve load an unnamed package.
Yep:

?create.fourier.descriptor
No documentation for ‘create.fourier.descriptor’ in specified  
packages

and libraries:
you could try ‘??create.fourier.descriptor’/

So I indeed forgot to mention in my post that my script starts with

*library('FourierDescriptors')*


/ *count - seq(1, 7, 0.06)


for (i in 1:count){


I was also  wondering what would happen when you passed a vector to
the : operator. A warning at the very least. What was the point of
this outer loop?/

I need the outer loop for changing the amplitude of my shapes at  
every

iteration.
I specified the amplitudes I want in

count - seq(1, 7, 0.06).

This outer loop actually works (when I correct the  for (i in  
1:count){

into  for (i in count){.)
It generates in fact all the shapes I want. The problem is with the  
inner
loop, it doesn't seem to save any png picture in my directory. The  
error is:


*Error in switch(units, `in` = res, cm = res/2.54, mm = res/25.4,  
px = 1) *

:
non-numeric argument to binary operator*

I report my all script here again:

library('FourierDescriptors')

count - seq(1, 7, 1)
# Controlled shapes
for (i in count){
for (s in 1:length(count)){
  png(~/Desktop/EMAS/FD_stimuli/s1_,s,.png)


Have you considered how difficult it might be to extract any  
information from a .png file that was constructed only one pixel wide?


Perhaps too cryptic and perhaps not exactly the reason the error was  
thrown. You called png() with three arguments when you were  
incorrectly expecting png() to read you mind and paste() them. The  
second argument, 1, was accepted as the width in pixels...  and did  
not throw the error, but the third argument .png created an error  
when it was matched to the height parameter of the png() function.


--

David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fourier descriptors created in a loop

2012-06-06 Thread aledanda
Thanks for your email, in fact the problem was in the nested loop!! By
removing it and adding at the end 

i = i + 1

I solved the problem, all the rest stays the same.
Best

--
View this message in context: 
http://r.789695.n4.nabble.com/Fourier-descriptors-created-in-a-loop-tp4632414p4632539.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Fourier descriptors created in a loop

2012-06-05 Thread aledanda
Hi All,

Here is the problem: I'm trying to generate a number of Fourier Descriptors
figures for an experiment.
All I need is that they are created within a  loop and saved with sequential
names (e.g., s1_1.png, s1_2.png etc..) in my directory. 

I created a nested loop with a counter for the different amplitudes for the
actual shapes and a counter for the file names.  

This script:


*count - seq(1, 7, 0.06)

for (i in 1:count){
  for (s in 1:length(count)){

png(~/Desktop/EMAS/FD_stimuli/s1_,s,.png)

plot(create.fourier.descriptor(amplitude = c(0, i, 0, 0)));

dev.off()

  }
}*

 gives me the following error:

/Error in switch(units, `in` = res, cm = res/2.54, mm = res/25.4, px = 1) * 
: 
  non-numeric argument to binary operator
In addition: Warning message:
In 1:count : numerical expression has 101 elements: only the first used/

it seems to be a problem with the resolution of each picture which is
different one form the other. In principle this shouldn't be a problem if
every time a new png is created.

could you help me with this?
Thank you very much
Best,

Ale

--
View this message in context: 
http://r.789695.n4.nabble.com/Fourier-descriptors-created-in-a-loop-tp4632414.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Fourier descriptors created in a loop

2012-06-05 Thread David Winsemius


On Jun 5, 2012, at 11:50 AM, aledanda wrote:


Hi All,

Here is the problem: I'm trying to generate a number of Fourier  
Descriptors

figures for an experiment.


Somehow I'm guessing that this will involve load an unnamed package.  
Yep:


 ?create.fourier.descriptor
No documentation for ‘create.fourier.descriptor’ in specified packages  
and libraries:

you could try ‘??create.fourier.descriptor’


All I need is that they are created within a  loop and saved with  
sequential

names (e.g., s1_1.png, s1_2.png etc..) in my directory.

I created a nested loop with a counter for the different amplitudes  
for the

actual shapes and a counter for the file names.

This script:


*count - seq(1, 7, 0.06)

for (i in 1:count){


I was also  wondering what would happen when you passed a vector to  
the : operator. A warning at the very least. What was the point of  
this outer loop?




 for (s in 1:length(count)){

   png(~/Desktop/EMAS/FD_stimuli/s1_,s,.png)

   plot(create.fourier.descriptor(amplitude = c(0, i, 0, 0)));

   dev.off()

 }
}*

 gives me the following error:

/Error in switch(units, `in` = res, cm = res/2.54, mm = res/25.4, px  
= 1) *

:
 non-numeric argument to binary operator


Makes me wonder if this package's code has caused the interpreter to  
attempt something illegal with the 'in' control construct.


 in-5
Error: unexpected 'in' in in

 `in` -5
 in
Error: unexpected 'in' in in
 rm(`in`)


In addition: Warning message:
In 1:count : numerical expression has 101 elements: only the first  
used/


Oh... there it is.



it seems to be a problem with the resolution of each picture which is
different one form the other. In principle this shouldn't be a  
problem if

every time a new png is created.

could you help me with this?
Thank you very much
Best,

Ale

--
View this message in context: 
http://r.789695.n4.nabble.com/Fourier-descriptors-created-in-a-loop-tp4632414.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.