I apologize if this an unorthodoxed question to ask, but I have had no luck in my attempts or any helpful insight in determining the radial number density for a specific group of subhalos. If this is not appropriate for this forum, I apologize. But any helpfulness in my attempts will be grateful.

I do not want to post the particle data extraction process, so I exported the radial distances of the host and satellite subhalo of a certain halo group which we can call RelDist found here:
https://www.dropbox.com/s/g40gp88k2p6pp6y/RelDist.txt?dl=0

I am ultimately attempting to plot the number density as a distribution given in the form:

My attempt:

logdist= np.log(RelDist)
hist, r_array = np.histogram(logdist, numbins)
dlogR = r_array[1]-r_array[0]
x_array = r_array[1:] - dlogR/2
## I am condifent the above part of this code is correct.
## The succeeding portion does not work.
dR = r_array[1:] - r_array[0:numbins]
dN_dlogR = hist * x_array/dR
volume = 4*np.pi*dist*dist*dist
## I'm needing to somehow include the increasing volume
n = dN_dlogR/volume

Plotting this does not even properly show a distribution like the first plot I posted above and it only works when I choose the bin number to be the same shape as my input array. The bin number should be arbitrary, should it not?

I apologize if this an unorthodoxed question to ask, but I have had no luck in my attempts or any helpful insight in determining the radial number density for a specific group of subhalos. If this is not appropriate for this forum, I apologize. But any helpfulness in my attempts will be grateful.

I do not want to post the particle data extraction process, so I exported the radial distances of the host and satellite subhalo of a certain halo group which we can call

`RelDist`

found here: https://www.dropbox.com/s/g40gp88k2p6pp6y/RelDist.txt?dl=0I am ultimately attempting to plot the number density as a distribution given in the form:

My attempt:

Plotting this does not even properly show a distribution like the first plot I posted above and it only works when I choose the bin number to be the same shape as my input array. The bin number should be arbitrary, should it not?

Never mind, I have resolved it.