I am currently working on the dynamics of the galaxy cluster, so i am trying to get the distance $r$ between the galaxies inside the galaxy cluster from its centre. As a input i have RA , DEC and Z (Redshift of the galaxies and its centre). my approach is something like this
# comoving distances
D_cl=cosmos.comoving_distance(z).value # z for each galaxy
D_clus=cosmos.comoving_distance(z_cl).value # z_cl for Cluster's centre
c1 = SkyCoord(ra_cl*180/np.pi *u.deg, dec_cl*180/np.pi *u.deg, distance=D_cl*u.Mpc, frame='icrs')
c2 = SkyCoord(ra*180/np.pi *u.deg, dec*180/np.pi *u.deg, distance=D_clus*u.Mpc, frame='icrs')
distance_3d = c1.separation_3d(c2)
distance_3d
So after using this method i am getting a wrong value's (Almost 70 Mpc for a given redshift distribution of the galaxy cluster, therefore i would like to know what can i change or adapt to have right measurement of the 3d distances or my method is wrong. As you can see i am going to use this distance r in order to calculate the jeans solution. where i need two distances r and R.
R is the projected distance of the galaxies from clusters centre (which i already calculated)
r is the actual 3d distance of the galaxies from clusters centre