I have 4 adjacent matrices obtained here link to matrices, which represent a distribution of dark matter, ordinary matter and magnetic fields at the present epoch, for a representative cosmic volume of 100^3 Mpc^3
from astropy.io import fits
import pandas as pd
import networkx as nx
If I understood correctly the concept, every file has a dx=25 Mpc, which accounts for the total of 100Mpc.
with fits.open('matrix_DMX_A_large_2.fits') as data:
matrix_dark_matter_a = pd.DataFrame(data[0].data.byteswap().newbyteorder())
with fits.open('matrix_DMX_B_large_2.fits') as data:
matrix_dark_matter_b = pd.DataFrame(data[0].data.byteswap().newbyteorder())
with fits.open('matrix_DMX_C_large_2.fits') as data:
matrix_dark_matter_c = pd.DataFrame(data[0].data.byteswap().newbyteorder())
with fits.open('matrix_DMX_D_large_2.fits') as data:
matrix_dark_matter_d = pd.DataFrame(data[0].data.byteswap().newbyteorder())
I know how to calculate each 2D network connectivity with a library like networkx, simply applying a sum() to each matrix row or column, like so:
matrix_dark_matter_a['k'] = matrix_dark_matter_a.sum(axis=1)
But how do I account for this connectivity and apply networkx methods using multiple levels like this, on a 3D representation?
from Networkx - use multiple adjacent matrices to calculate node degree on a volume
No comments:
Post a Comment