comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to work with scripts?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
How to work with scripts? [message #93946] Fri, 02 December 2016 12:26 Go to next message
Edson Filho is currently offline  Edson Filho
Messages: 4
Registered: November 2016
Junior Member
Hey guys, I got a program that it ends up a little bit to big, so I'm trying in many ways to make it smaller, and now I'm trying to learn how to use scripts, for exemple, I have this:



nt = 112 ; Time 1 (mys)
nt2 = 81 ; Time 2 (mys)
T=(dindgen(nt)*0.1+1.); Mys
T2=(dindgen(nt2)+20);Mys
time=[T,T2] ; vector time

n=300000
R=6.*randomu(Seed,n, /Normal) + 8.

K= where(R gt 0.5 and R lt 18.5, count)
Np = count

P=fltarr(nt+nt2,Np)
P[0,*]=R[K]

Here is my period distribution, as I was wondering if I could put this as a script, just like

@Period

And Period.pro would be:
nt = 112
nt2 = 81
n=300000
R=6.*randomu(Seed,n, /Normal) + 8.

K= where(R gt 0.5 and R lt 18.5, count)
Np = count

P=fltarr(nt+nt2,Np)
P[0,*]=R[K]

Would that return all the variables to the program or I need to call them?
At this one, I need to return P and Np, is there somehow I do it?

Thanks guys!
Re: How to work with scripts? [message #93953 is a reply to message #93946] Mon, 05 December 2016 02:38 Go to previous message
Markus Schmassmann is currently offline  Markus Schmassmann
Messages: 129
Registered: April 2016
Senior Member
On 12/02/2016 09:26 PM, Edson Filho wrote:
> Hey guys, I got a program that it ends up a little bit to big, so
> I'm trying in many ways to make it smaller, and now I'm trying to learn how
> to use scripts, for exemple, I have this:
>
> nt = 112 ; Time 1 (mys)
> nt2 = 81 ; Time 2 (mys)
> T=(dindgen(nt)*0.1+1.); Mys
> T2=(dindgen(nt2)+20);Mys
> time=[T,T2] ; vector time
>
> n=300000
> R=6.*randomu(Seed,n, /Normal) + 8.
>
> K= where(R gt 0.5 and R lt 18.5, count)
> Np = count
>
> P=fltarr(nt+nt2,Np)
> P[0,*]=R[K]
>
> Here is my period distribution, as I was wondering if I could put this as a script, just like
>
> @Period
>
> And Period.pro would be:
> nt = 112
> nt2 = 81
> n=300000
> R=6.*randomu(Seed,n, /Normal) + 8.
>
> K= where(R gt 0.5 and R lt 18.5, count)
> Np = count
>
> P=fltarr(nt+nt2,Np)
> P[0,*]=R[K]
>
> Would that return all the variables to the program or I need to call them?
> At this one, I need to return P and Np, is there somehow I do it?
if you use a script, it behaves as if you had cut-and-past it to the
command line.
So, no need to to return anything.

for more details see e.g.
http://homepages.see.leeds.ac.uk/~lecjm/Teaching/IDL_course/ Notes/notes/node25.html

Using scripts is rarely a good idea, but i hope my comment & link help
anyway, Markus
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Comparing two float arrays upto 0.0001 precision
Next Topic: matlab compressed to idl

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:24:13 PDT 2025

Total time taken to generate the page: 0.00420 seconds