Skip to content

Instantly share code, notes, and snippets.

@tspriggs
Created October 7, 2020 10:58
Show Gist options
  • Save tspriggs/e98350f258988d98018fc7403b4439f8 to your computer and use it in GitHub Desktop.
Save tspriggs/e98350f258988d98018fc7403b4439f8 to your computer and use it in GitHub Desktop.
def minicube_extractor(x, y, n_pix, data):
"""Extract a PNe minicube from a given MUSE residual cube.
Parameters
----------
x : [float]
x coordinate
y : [float]
y coordinate
n_pix : [int]
number of pixels
data : [multi dimensional array]
residual data, in list format
wave : [list]
wavelength array
Returns
-------
[list]
minicube spectra array of shape: (len(wave), n_pix, n_pix, )
"""
xc = round(x)
yc = round(y)
offset = n_pix // 2
minicube = data[:, int(yc-offset):int(yc+offset+1), int(xc-offset):int(xc+offset+1)]
# minicube = minicube.reshape(len(wave),n_pix*n_pix) #ignore if you want a minicube of x,y, lambda
return minicube
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment