Skip to content
Snippets Groups Projects
Commit 81338215 authored by Laurent Mercadier's avatar Laurent Mercadier
Browse files

Convert index back to integer values after where() operation

parent 1900b961
No related branches found
No related tags found
1 merge request!326Up8062
...@@ -290,6 +290,7 @@ class Viking: ...@@ -290,6 +290,7 @@ class Viking:
""" """
if key not in data: if key not in data:
return return
print('hello')
x = data.newt_x x = data.newt_x
spectra = data[key] spectra = data[key]
mask = xr.ones_like(x, dtype=bool) mask = xr.ones_like(x, dtype=bool)
...@@ -300,7 +301,8 @@ class Viking: ...@@ -300,7 +301,8 @@ class Viking:
ranges = self.BL_SIGNAL_RANGE ranges = self.BL_SIGNAL_RANGE
for xrange in ranges: for xrange in ranges:
mask = mask & ((x < xrange[0]) | (x > xrange[1])) mask = mask & ((x < xrange[0]) | (x > xrange[1]))
x_bl = x.where(mask, drop=True) x_bl = x.where(mask, drop=True).astype(int)
print(x_bl)
bl = spectra.sel(newt_x=x_bl) bl = spectra.sel(newt_x=x_bl)
fit = np.polyfit(x_bl, bl.T, self.BL_POLY_DEG) fit = np.polyfit(x_bl, bl.T, self.BL_POLY_DEG)
if len(spectra.shape) == 1: if len(spectra.shape) == 1:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment