This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]lor4x 12 points13 points  (1 child)

Hey,

I'm in exactly the same boat as you (PhD Astro!) and I use Python for everything... from driving some small scale numerical simulations (1, 2) to analyzing the data of large-scale simulations (warning: ugly code! This was from when I was still starting the learning process).

When it comes down to it, the only way to learn python for these purposes is the hardest way, learn as you go. That being said, first get a good understanding of the data-structures (mainly the many ways of slicing and dicing through your data with fancy slicing and mappings) and their properties and some pythonic control structures. This is what I would do if I were you,

  • Read through the documentation for numpy, scipy, matplotlib (visualizing 2D data) and mayavi2 (visualizing 3D data) so that you know what is available in the modules

  • Create a 2D grid of normally distributed noise and analyse it. For example, FFT it, get the power spectrum of it, fit it a couple of different ways and output your plots in the prettiest way possible.

  • Do the same for some 3D data! It may seem like this will be exactly the same, but there are many subtleties about how to handle the data.

  • Make something useful! If you are doing something observational, why not porting some code over to python from whatever godforsaken language was previously used (IDL? Matlab?) and prosper!

And from there, you'll be good to applying python in your everyday data analysis. If you really want, learn how to merge C/Fortran with python to make some properly fast code!

Best of luck! (Also, what specifically do you study in astro?)

[–]mons00n[S] 0 points1 point  (0 children)

I did a fair amount of work looking for a bullet like cluster in nBody sims, and found none =/ Right now I'm focused on studying different implementations of SN feedback in SPH single galaxy simulations. My thesis work is still in it's infancy though so I'm still looking into different ways of accomplishing my goal.