jason-neal / companion_simulations

Simulating combined host+companion spectra, and fitting to observed crires spectra.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broadcast inner loops

jason-neal opened this issue · comments

broadcast the alpha parameter for the combined modeling.

something like
xy = x + y[:, np.newaxis] * alpha

will result in shape(len(x), len(alpha))

If the vectors are atleast 2d with shapes like A.shape = (2,3,1) and B.shape= (7,1) can transpose them to broad cast out the one (numpy does this when they are on the right)
(A.T * B.T).T).shape = (2,3,7)
which would be the same as
A * B[:,:, np.newaxis]