A plain text matrix: one line per detector row, one value per pixel, separated by whitespace or a delimiter:
# GISAS detector image, 1043 rows x 981 columns
1.204e+00 3.410e+00 ... 4.198e+00
2.317e+00 4.523e+00 ... 3.885e+00
...
3.406e+00 5.611e+00 ... 2.976e+00
import numpy as np
image = np.loadtxt(fname)
For a CSV table, pass the delimiter explicitly:
image = np.loadtxt(fname, delimiter=",")
The array shape must match the detector pixel layout used by the
simulation, namely (n_alpha, n_phi) for SphericalDetector
intensities, with row 0 at the smallest alpha_f. If the file stores
the image top-down, flip it:
image = np.flipud(image)
Some tables carry the axis arguments — q values, angles, or whatever the axes hold — in the first row and the first column:
# corner, then x-axis arguments; below: y-axis argument, then one data row
0.000e+00 -1.700e+00 -1.697e+00 ... 1.700e+00
-6.000e-01 1.204e+00 3.410e+00 ... 4.198e+00
-5.982e-01 2.317e+00 4.523e+00 ... 3.885e+00
...
1.240e+00 3.406e+00 5.611e+00 ... 2.976e+00
Slice them off after loading:
table = np.loadtxt(fname)
x = table[0, 1:] # first row, without the corner
y = table[1:, 0] # first column, without the corner
image = table[1:, 1:] # the intensities
If only one of the two carries axis values:
image = np.loadtxt(fname, skiprows=1) # axis values in the first row only
image = np.loadtxt(fname)[:, 1:] # axis values in the first column only