Extract the matrix (numpy array) with which the spectrogram is generated


I would like to ask if there is a way to obtain, from a spectrogram, the data matrix that generates it.
Reviewing the source code of the spectrogram (Obspy), the numpy array (matrix) that generates the image is called “specgram”.
Next, I put an example (which comes within the source code of the spectrogram) where it generates the graph from this variable. ax.imshow(specgram,interpolation=“nearest”, extent=extent, **kwargs).


please have alook at this thread: