Help Getting the Tonry model of Peculiar velocity field running in python

  • Comp Sci
  • Thread starter daniel.corry
  • Start date
  • #1
I am attempting to translate the model of peculiar velocity flow given by Tonry et al (1999) from fortran into python, the language we use on my course, however I am experiencing difficulties in getting the thing to run.


I have attached the original fortran (sbf2flow) and my attempt at translating it into python (tonrymodel).

Any pointers or corrections would be greatly appreciated as this is not a computing project although I am not able to proceed until I have got this model working properly
 

Attachments

Answers and Replies

  • #2
34,687
6,394
What difficulties are you having in getting your python code to run? Incorrect results? Error messages?
 
  • #3
i am getting the message 'return' outside function and I have played around but cant seem to shift that message.
 
  • #4
34,687
6,394
I'm fairly certain it's this line, down near the bottom:

return (vx,vy,vz,vr,vsig)

That line is not part of a function, so it makes no sense to try to return something.
 
  • #5
so i got somewhere however now in line 123,
ivrw = int((vx*x + vy*y + vz*z) / math.sqrt(x*x+y*y+z*z))
it is telling me x is not defined, however im sure it is defined above
 

Related Threads on Help Getting the Tonry model of Peculiar velocity field running in python

Replies
3
Views
8K
  • Last Post
Replies
14
Views
4K
Replies
2
Views
5K
  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
6
Views
2K
  • Last Post
Replies
1
Views
1K
Replies
8
Views
664
Replies
5
Views
2K
Replies
5
Views
471
Top