Skip to content

Commit

Permalink
remove unused code from resample
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Aug 2, 2024
1 parent 79ff9d7 commit df1503a
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions speclite/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
"""
import numpy as np
import numpy.ma as ma
import numpy.lib.recfunctions as rfn
import scipy.interpolate
from packaging import version

if version.parse(np.__version__) >= version.parse('1.16'):
import numpy.lib.recfunctions as rfn

def resample(data_in, x_in, x_out, y, data_out=None, kind='linear'):
"""Resample the data of one spectrum using interpolation.
Expand Down Expand Up @@ -166,16 +164,9 @@ def resample(data_in, x_in, x_out, y, data_out=None, kind='linear'):
for i,y in enumerate(y_names):
y_in[:,i] = data_in[y].filled(np.nan)
else:
if version.parse(np.__version__) >= version.parse('1.16'):
# The slicing does not work in numpy 1.16 and above
# we use structured_to_unstructured to get the slice that we care about
y_in = rfn.structured_to_unstructured(
data_in[y_names]).reshape(data_in.shape + y_shape)
else:
y_in = data_in[y_names]
# View the structured 1D array as a 2D unstructured array (without
# copying any memory).
y_in = y_in.view(y_type).reshape(data_in.shape + y_shape)
# The slicing does not work in numpy 1.16 and above
# we use structured_to_unstructured to get the slice that we care about
y_in = rfn.structured_to_unstructured(data_in[y_names]).reshape(data_in.shape + y_shape)

# interp1d will only propagate NaNs correctly for certain values of `kind`.
# With numpy = 1.6 or 1.7, only 'nearest' and 'linear' work.
Expand Down

0 comments on commit df1503a

Please sign in to comment.