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

In summary, The individual is having difficulties in translating a model of peculiar velocity flow from fortran to python and is seeking pointers and corrections to get the model running properly. They have encountered an error message stating 'return' outside function and are unsure how to fix it. They have also encountered an error with a specific line of code referencing a variable that they believe is defined.
  • #1
daniel.corry
4
0
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

  • sbf2flow.doc
    38.5 KB · Views: 206
  • tonrymodel.doc
    39.5 KB · Views: 198
Technology news on Phys.org
  • #2
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 can't seem to shift that message.
 
  • #4
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 I am sure it is defined above
 

1. What is the Tonry model of Peculiar velocity field in astronomy?

The Tonry model of Peculiar velocity field is a mathematical model used in astronomy to study the peculiar motions of galaxies. It takes into account the effects of gravitational forces and the expansion of the universe on the observed velocities of galaxies.

2. Why is it important to run the Tonry model in python?

Running the Tonry model in python allows for efficient and accurate calculations of the peculiar velocities of galaxies. Python is a popular programming language in the scientific community and has many useful libraries and tools for data analysis and visualization.

3. What are the required steps for running the Tonry model in python?

To run the Tonry model in python, you will need to have a basic understanding of python programming and familiarity with astronomical data analysis. You will also need to install the necessary libraries, such as scipy and astropy, and have access to the necessary data sets.

4. Are there any potential challenges when running the Tonry model in python?

Yes, there can be potential challenges when running the Tonry model in python. These may include difficulties with data formatting and compatibility, as well as ensuring accurate and precise calculations. It is important to thoroughly test and validate the results of the model.

5. Are there any resources available for help with running the Tonry model in python?

Yes, there are many resources available for help with running the Tonry model in python. These may include online tutorials, forums, and communities dedicated to python programming and astronomy. Additionally, consulting with other scientists or seeking guidance from a mentor can also be helpful.

Similar threads

  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
9
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
1
Views
1K
Replies
15
Views
5K
  • Computing and Technology
Replies
3
Views
2K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
6
Views
5K
Back
Top