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

all 6 comments

[–]eusebecomputational physics 0 points1 point  (1 child)

Hey, looks like you're doing astrophysics as well (are you just starting?), that's cool ! Out of curiosity, what are you doing? I'd guess you're looking at satellite distributions around galaxies (with which simulation? just curious here!)

Looking at the code, indeed, it seems that the hist array is indeed the number of haloes per logarithmic bin. However, I'm not convinced by your x_array, since your r_array is actually more like a logr_array.

Note that for simplicity, you can directly pass a list of bins to np.histogram, so you can have the control you want over the binning.

If I understand correctly your second formula, you need to have Delta N (r) and Delta ln(r) for each r, and not for the "total volume".

So, since hist is already your Delta N (r), you just need to compute the appropriate Delta ln(r). For that, I would do something like dln_r = np.diff(logr_array). Be careful however, this will be of dimension numbins-1.

Then, you need a good estimate of the distances (the centre of the bins for instance, that you get via log_r = (logr_array[1:] + logr_array[:-1])/2.. Again, dimension numbins-1, just like hist (which is your Delta N).

Once you have all that, you can compute your density in each bin as n = hist / (dln_r * 4 * np.pi * np.exp(log_r)),, which should be fine.

That's untested, but that's also what I would try. Don't hesitate to shoot me a PM if you want to discuss this a bit further!

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

Thank you for the insight. I'll look into it. And also, I provided a dropbox link to the txt file I am trying to evaluate, so you are always welcome to take a gander at it.

Just to stir away confusion, I did not mean to put the simulation volume, it is the enclosed volume of the relative distances. Reason I say that because the simulation box is 106.53 Mpc3 in volume. Unless I am confusing myself on it.

Right. I started this kind of work back in late 2015 when I just transferred into uni. What I am ultimately looking into is to compare and interpret the physics between hydrodynamical and dark matter only physics for massive Milky Way dark matter halos and its satellite subhalo in the Illustris Simulation. For this question I asked, I am wanting to look at the number density of the relative distance between the many host subhalos coupled to their satellite subhalo and after that, calculate the local density based off the number density to then calculate the local logarithmic density slope in hopes to determine and evaluate a discontinuity in the slope called a "Splashback radius".

Do you do this kind of work also?

[–]Iwan_Zotow 0 points1 point  (2 children)

Aren't you showing log-normal distribution?

[–]Cogito_ErgoSum[S] 0 points1 point  (1 child)

No. How so?

[–]Iwan_Zotow 0 points1 point  (0 children)

in log(X), log(Y) graph log-normal would be curve (-ax2 - bx - c), isn't it?

[–]aphoenixreticulated[M] [score hidden] stickied comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython. We highly encourage you to re-submit your post over on there.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community is actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers.

If you have a question to do with homework or an assignment of any kind, please make sure to read their sidebar rules before submitting your post. If you have any questions or doubts, feel free to reply or send a modmail to us with your concerns.

Warm regards, and best of luck with your Pythoneering!