numpy.interp

Here are the examples of the python api numpy.interp taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

380 Examples 7

3 Source : xy.py
with MIT License
from 3ll3d00d

def interp(x1, y1, x2):
    ''' Interpolates xy based on the preferred smoothing style. '''
    start = time.time()
    smooth = preferences.get(DISPLAY_SMOOTH_GRAPHS)
    if smooth:
        cs = PchipInterpolator(x1, y1)
        y2 = cs(x2)
    else:
        y2 = np.interp(x2, x1, y1)
    end = time.time()
    logger.debug(f"Interpolation from {len(x1)} to {len(x2)} in {round((end - start) * 1000, 3)}ms")
    return x2, y2


class ComplexData:

3 Source : ins_data_manager.py
with MIT License
from Aceinna

    def __interp(self, x, xp, fp):
        '''
        data interpolation
        '''
        m = x.shape[0]
        ndim = fp.ndim
        if ndim == 1:
            return np.interp(x, xp, fp)
        elif ndim == 2:
            y = np.zeros((m, fp.shape[1]))
            for i in range(fp.shape[1]):
                y[:, i] = np.interp(x, xp, fp[:, i])
            return y
        else:
            raise ValueError('only 1-D or 2-D fp is supported.')

    def __quat2euler_zyx(self, src, dst):

3 Source : lut_get_tau_sensor.py
with GNU General Public License v3.0
from acolite

def lut_get_tau_sensor(lut_sensor,meta,azi,thv,ths,rtoa):
    from numpy import interp, atleast_1d
    from acolite.aerlut import interplut_sensor, lutpos
    
    tau = dict()
    for band in rtoa:
        if band in lut_sensor:
            ratm = [interplut_sensor(lut_sensor, meta, azi, thv, ths, tau550, band, par='romix') for tau550 in meta['tau']]
            if len(atleast_1d(rtoa[band])) == 1:
                 tau_id, tau_br = lutpos(ratm, rtoa[band]) 
                 tau[band] = interp(tau_id, range(len(meta['tau'])),meta['tau'])
            else:
                 tauband=[]
                 for i in rtoa[band]:
                     tau_id, tau_br = lutpos(ratm, i) 
                     tauband.append(interp(tau_id, range(len(meta['tau'])),meta['tau']))
                 tau[band] = tauband
    return tau

3 Source : datascl.py
with GNU General Public License v3.0
from acolite

def datascl(data, dmin=None, dmax=None, tmin=0, tmax=255, dtype='uint8'):
    from numpy import interp
    if dmin == None: dmin = data.min()
    if dmax == None: dmax = data.max()
    data=interp(data, [dmin,dmax],[tmin,tmax])
    if dtype != None: data=data.astype(dtype)
    return data

3 Source : rsr_convolute_dict.py
with GNU General Public License v3.0
from acolite

def rsr_convolute_dict(wave_data, data, rsr, wave_range=[0.2,2.4], wave_step=0.001):
    from numpy import linspace, interp, nan, zeros, ceil

    ## set up wavelength space
    wave_hyper = linspace(wave_range[0],wave_range[1],int(((wave_range[1]-wave_range[0])/wave_step)+2))

    ## interpolate RSR to same dimensions
    rsr_hyper = dict()
    for band in rsr:
                band_wave_hyper = wave_hyper
                band_response_hyper = interp(wave_hyper, rsr[band]['wave'], rsr[band]['response'], left=0, right=0)
                band_response_sum = sum(band_response_hyper)
                rsr_hyper[band]={'wave':band_wave_hyper, 'response': band_response_hyper, 'sum':band_response_sum}

    resdata={}
    data_hyper = interp(wave_hyper, wave_data, data, left=0, right=0)
    for band in rsr:
        resdata[band] = (sum(data_hyper*rsr_hyper[band]['response'])/rsr_hyper[band]['sum'])
    return resdata

3 Source : test_function_base.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def test_period(self):
        x = [-180, -170, -185, 185, -10, -5, 0, 365]
        xp = [190, -190, 350, -350]
        fp = [5, 10, 3, 4]
        y = [7.5, 5., 8.75, 6.25, 3., 3.25, 3.5, 3.75]
        assert_almost_equal(np.interp(x, xp, fp, period=360), y)
        x = np.array(x, order='F').reshape(2, -1)
        y = np.array(y, order='C').reshape(2, -1)
        assert_almost_equal(np.interp(x, xp, fp, period=360), y)


def compare_results(res, desired):

3 Source : _continuous_distns.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def _cdf(self, x):
        """
        CDF calculated from the histogram
        """
        return np.interp(x, self._hbins, self._hcdf)

    def _ppf(self, x):

3 Source : _continuous_distns.py
with GNU General Public License v3.0
from adityaprakash-bobby

    def _ppf(self, x):
        """
        Percentile function calculated from the histogram
        """
        return np.interp(x, self._hcdf, self._hbins)

    def _munp(self, n):

3 Source : math.py
with MIT License
from ahodges9

def interpolate(y, new_length):
    """Resizes the array by linearly interpolating the values"""

    if len(y) == new_length:
        return y

    x_old = _normalized_linspace(len(y))
    x_new = _normalized_linspace(new_length)
    z = np.interp(x_new, x_old, y)
    
    return z

class ExpFilter:

3 Source : rsna_generator.py
with MIT License
from alessonscap

def histogram_equalize(img):
    """ Apply histogram equalization into an image (not used)
    """
    img_cdf, bin_centers = exposure.cumulative_distribution(img)
    return np.interp(img, bin_centers, img_cdf)
    
class ImageOnlyTransformations():

3 Source : formatters.py
with MIT License
from andyljones

def quantiles(reader, rule):
    final = final_row(reader, rule)
    if final is None:
        return []
    l, r = np.interp([.25, .75], final.index, final.values)
    return [(channel(reader), f'{l:.0f}-{r:.0f}')]

def null(reader, rule):

3 Source : hyperparam_scheduler.py
with Apache License 2.0
from anibali

    def batch_step(self):
        self.batch_count += 1
        for hyperparam_name, milestones in self.hyperparam_milestones.items():
            value = float(np.interp(self.batch_count, self.ts, milestones))
            for param_group in self.optimizer.param_groups:
                param_group[hyperparam_name] = value

3 Source : pet_normalised_lifetime.py
with GNU General Public License v3.0
from AntSimi

def sum_profile(x_new, y, out):
    """Will sum all interpolated given array"""
    out += interp(x_new, linspace(0, 1, y.size), y)


class MyObs(TrackEddiesObservations):

3 Source : grid.py
with GNU General Public License v3.0
from AntSimi

def raw_resample(datas, fixed_size):
    nb_value = datas.shape[0]
    if nb_value == 1:
        raise Exception()
    return interp(
        arange(fixed_size), arange(nb_value) * (fixed_size - 1) / (nb_value - 1), datas
    )


@property

3 Source : arrayfns.py
with GNU General Public License v3.0
from Artikash

def interp(y, x, z, typ=None):
    """y(z) interpolated by treating y(x) as piecewise function
    """
    res = np.interp(z, x, y)
    if typ is None or typ == 'd':
        return res
    if typ == 'f':
        return res.astype('f')

    raise error("incompatible typecode")

def nz(x):

3 Source : safe_colormaps.py
with GNU General Public License v3.0
from baryshnikova-lab

    def __call__(self, value, clip=None):
        x = [self.vmin, self.midrange[0], self.midrange[1], self.midrange[2], self.vmax]
        y = [0, 0.25, 0.5, 0.75, 1]
        return np.ma.masked_array(np.interp(value, x, y))


def get_colors(colormap='hsv', n=10):

3 Source : boxplots.py
with MIT License
from birforce

def _jitter_envelope(pos_data, xvals, violin, side):
    """Determine envelope for jitter markers."""
    if side == 'both':
        low, high = (-1., 1.)
    elif side == 'right':
        low, high = (0, 1.)
    elif side == 'left':
        low, high = (-1., 0)
    else:
        raise ValueError("`side` input incorrect: %s" % side)

    jitter_envelope = np.interp(pos_data, xvals, violin)
    jitter_coord = jitter_envelope * np.random.uniform(low=low, high=high,
                                                       size=pos_data.size)

    return jitter_coord


def _show_legend(ax):

3 Source : HaloFeedback.py
with MIT License
from bradkav

    def interpolate_DF(self, eps_old, correction=1):
        # Distribution of particles before they scatter
        if hasattr(correction, "__len__"):
            f_old = np.interp(
                eps_old[::-1],
                self.eps_grid[::-1],
                self.f_eps[::-1] * correction[::-1],
                left=0,
                right=0,
            )[::-1]
        else:
            f_old = np.interp(
                eps_old[::-1], self.eps_grid[::-1], self.f_eps[::-1], left=0, right=0
            )[::-1]
        return f_old

    def delta_eps_of_b(self, v_orb, b):

3 Source : ops_math.py
with GNU Lesser General Public License v3.0
from brenthuisman

	def map_values(self,table):
		'''Map the imdata-values of this image using the table you supply. This table should be a list of two equally long lists, where the first list maps to the current imdata-values, and the second to where you want them mapped. This function interpolates linearly, and does NOT extrapolate.'''
		assert len(table)==2
		assert len(table[0])==len(table[1])
		self.imdata = np.interp(self.imdata,table[0],table[1]) #type will be different!

	def resample(self, new_ElementSpacing=[2,2,2], allowcrop=True, order=1):

3 Source : archive.py
with MIT License
from bsc-s2

    def calc_interp(self, capa):

        if self.free_interp is None:
            return None

        xp, yp = self.free_interp
        _parse = humannum.parsenum

        xp = [_parse(x) for x in xp]
        yp = [_parse(y) for y in yp]

        # if yp is in percentage
        yp = [(y if y > 1 else y * xp[i])
            for i, y in enumerate(yp)]

        return numpy.interp(capa, xp, yp)

    def _archive(self, src_path):

3 Source : colors.py
with MIT License
from buds-lab

    def __call__(self, value, clip=None):
        """
        Map value to the interval [0, 1]. The clip argument is unused.
        """
        result, is_scalar = self.process_value(value)
        self.autoscale_None(result)  # sets self.vmin, self.vmax if None

        if not self.vmin   <  = self.vcenter  < = self.vmax:
            raise ValueError("vmin, vcenter, vmax must increase monotonically")
        result = np.ma.masked_array(
            np.interp(result, [self.vmin, self.vcenter, self.vmax],
                      [0, 0.5, 1.]), mask=np.ma.getmask(result))
        if is_scalar:
            result = np.atleast_1d(result)[0]
        return result


class LogNorm(Normalize):

3 Source : bamBinCounts.py
with MIT License
from BuysDB

def gc_correct(args):
    observations, gc_vector, MAXCP = args
    correction = lowess(observations, gc_vector)
    return np.clip(observations / np.interp(gc_vector, correction[:, 0], correction[:, 1]), 0, MAXCP)


def genomic_bins_to_gc(reference, df):

3 Source : pandas.py
with MIT License
from BuysDB

def linear_scale(df,vmin,vmax,fmin=None,fmax=None):
    """
    Scale the values in the dataframe using One-dimensional linear interpolation.
    """
    if fmin is None:
        fmin = df.min().min()

    if fmax is None:
        fmax = df.max().max()

    return pd.DataFrame(
        np.interp(df,
            (fmin,fmax),
            (vmin, vmax)),
        index=df.index,
        columns=df.columns
        )

def rolling_smooth(df: pd.DataFrame, window:int, center=True, axis=0):

3 Source : pandas.py
with MIT License
from BuysDB

def interpolate(series, target):
    """
    Interpolate the given pd.series at the coordinates given by target (np.array)
    the index of the series is the x coordinate, the values xp
    """
    # prune missing data:
    series = series[~pd.isnull(series)]

    return  pd.Series(
        #interpolate:
        np.interp(target, series.index,  series.values),
        # re use existing series name:
        name=series.name,
        # use target as new index:
        index=target
    )


def tordist(x1: float, x2: float, wrap_dist: float ) -> float:

3 Source : utils.py
with MIT License
from ByungKwanLee

def get_resolution(epoch, min_res, max_res, end_ramp, start_ramp):
    assert min_res   <  = max_res

    if epoch  < = start_ramp:
        return torchvision.transforms.Resize((min_res, min_res))

    if epoch >= end_ramp:
        return torchvision.transforms.Resize((max_res, max_res))

    # otherwise, linearly interpolate to the nearest multiple of 32
    interp = np.interp([epoch], [start_ramp, end_ramp], [min_res, max_res])
    final_res = int(np.round(interp[0] / 32)) * 32

    return torchvision.transforms.Resize((final_res, final_res))

def str2bool(v):

3 Source : openloop_controller.py
with MIT License
from Cafolkes

    def eval(self, x, t):
        """eval Function to evaluate controller
        
        Arguments:
            x {numpy array [ns,]} -- state
            t {float} -- time
        
        Returns:
            control action -- numpy array [Nu,]
        """
        return array([interp(t, self.t_open_loop.flatten(), self.u_open_loop[:,ii].flatten()) for ii in range(self.m)]).squeeze()

3 Source : ta_functions.py
with Apache License 2.0
from cderinbogaz

def bband_1h(exchange, currency):
    try:
        for x in currency:
            update(x,exchange,'1h')
            output = interp(bband()[1], [-25, 25], [0, 1])
            print(x,output)
    except:
        print("error")
    return output

def bband_1d(exchange, currency):

3 Source : ta_functions.py
with Apache License 2.0
from cderinbogaz

def bband_1d(exchange, currency):
    try:
        for x in currency:
            update(x,exchange,'1d')
            output = interp(bband()[1], [-2, 2], [0, 1])
            print(x,output)

    except:
        print("error")
    return output

def MACD(exchange,currency):

3 Source : predict.py
with MIT License
from cescjf

    def __call__(self, value, clip=None):
        # I'm ignoring masked values and all kinds of edge cases to make a
        # simple example...
        x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1]
        return np.ma.masked_array(np.interp(value, x, y))

plt.rc('text', usetex=True)

3 Source : curve.py
with GNU General Public License v2.0
from chestm007

    def get_speed(self, temp):
        """
        returns a speed for a given temperature
        :param temp: int
        :return:
        """

        return np.interp(x=temp, xp=self.temps, fp=self.speeds)


if __name__ == '__main__':

3 Source : fan_manager.py
with GNU General Public License v2.0
from chestm007

    def main(self):
        """
        returns a speed for a given temperature
        :return:
        """
        return np.interp(x=self._get_temp(), xp=self.temps, fp=self.speeds)

    def _get_temp(self):

3 Source : util_misc.py
with MIT License
from CIRADA-Tools

def extrap(x, xp, yp):
    """
    Wrapper to allow np.interp to linearly extrapolate at function ends.
    
    np.interp function with linear extrapolation
    http://stackoverflow.com/questions/2745329/how-to-make-scipy-interpolate
    -give-a-an-extrapolated-result-beyond-the-input-ran
    """
    
    y = np.interp(x, xp, yp)
    y = np.where(x   <   xp[0], yp[0]+(x-xp[0])*(yp[0]-yp[1])/(xp[0]-xp[1]), y)
    y = np.where(x > xp[-1], yp[-1]+(x-xp[-1])*(yp[-1]-yp[-2])/(xp[-1]-xp[-2]),
                 y)
    return y


#-----------------------------------------------------------------------------#
def toscalar(a):

3 Source : util_RM.py
with MIT License
from CIRADA-Tools

def extrap(x, xp, yp):
    """
    Wrapper to allow np.interp to linearly extrapolate at function ends.
    
    np.interp function with linear extrapolation
    http://stackoverflow.com/questions/2745329/how-to-make-scipy-interpolate
    -give-a-an-extrapolated-result-beyond-the-input-ran

    """
    y = np.interp(x, xp, yp)
    y = np.where(x   <   xp[0], yp[0]+(x-xp[0])*(yp[0]-yp[1])/(xp[0]-xp[1]), y)
    y = np.where(x > xp[-1], yp[-1]+(x-xp[-1])*(yp[-1]-yp[-2])/(xp[-1]-xp[-2]),
                 y)
    return y


#-----------------------------------------------------------------------------#
def fit_rmsf(xData, yData, thresh=0.4, ampThresh=0.4):

3 Source : mathematical_function.py
with GNU Lesser General Public License v3.0
from CNES

def linear_extrap(IN_x, IN_xp, IN_yp):
    if IN_xp[0]   <   IN_xp[-1]:
        OUT_y = np.interp(IN_x, IN_xp, IN_yp)
        OUT_y = np.where(IN_x  <  IN_xp[0], IN_yp[0]+(IN_x-IN_xp[0])*(IN_yp[0]-IN_yp[1])/(IN_xp[0]-IN_xp[1]), OUT_y)
        OUT_y = np.where(IN_x > IN_xp[-1], IN_yp[-1]+(IN_x-IN_xp[-1])*(IN_yp[-1]-IN_yp[-2])/(IN_xp[-1]-IN_xp[-2]), OUT_y)
    else:
        OUT_y = np.interp(IN_x, IN_xp[::-1], IN_yp[::-1])
        OUT_y = np.where(IN_x > IN_xp[0], IN_yp[0], OUT_y)
        OUT_y = np.where(IN_x  <  IN_xp[-1], IN_yp[-1], OUT_y)
    return OUT_y

def calc_sigma0(IN_water_pixels, classification_tab,  water_flag, water_land_flag, darkwater_flag, \

3 Source : redshift.py
with MIT License
from ColmTalbot

    def _cache_dvc_dz(self, redshifts):
        self.cached_dvc_dz = xp.asarray(
            np.interp(to_numpy(redshifts), self.zs_, self.dvc_dz_, left=0, right=0)
        )

    def normalisation(self, parameters):

3 Source : util.py
with MIT License
from dandrino

def normalize(x, bounds=(0, 1)):
  return np.interp(x, (x.min(), x.max()), bounds)


# Fourier-based power law noise with frequency bounds.
def fbm(shape, p, lower=-np.inf, upper=np.inf):

3 Source : colors.py
with Apache License 2.0
from dashanji

    def __call__(self, value, clip=None):
        """
        Map value to the interval [0, 1]. The clip argument is unused.
        """
        result, is_scalar = self.process_value(value)
        self.autoscale_None(result)  # sets self.vmin, self.vmax if None

        if not self.vmin   <  = self.vcenter  < = self.vmax:
            raise ValueError("vmin, vcenter, vmax must increase monotonically")
        result = np.ma.masked_array(
            np.interp(result, [self.vmin, self.vcenter, self.vmax],
                      [0, 0.5, 1.]), mask=np.ma.getmask(result))
        if is_scalar:
            result = np.atleast_1d(result)[0]
        return result


@cbook.deprecation.deprecated('3.2', alternative='TwoSlopeNorm')

3 Source : plot_attn.py
with MIT License
from deep-spin

    def __call__(self, value, clip=None):
        # I'm ignoring masked values and all kinds of edge cases to make a
        # simple example...
        x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1]
        return np.ma.masked_array(np.interp(value, x, y), np.isnan(value))


def config(path):

3 Source : timefrequency.py
with MIT License
from dioph

    def __call__(self, signal):
        if not isinstance(signal, TSeries):
            signal = TSeries(values=signal)
        wav = self.wps(signal)
        gwps = wav.mean("time")
        gwps /= gwps.amax()
        ryy = signal.fill_gaps().acf()
        cs = gwps * np.interp(gwps.period, ryy.time, ryy.values)
        return cs

3 Source : colors.py
with GNU General Public License v3.0
from dnn-security

    def __call__(self, value, clip=None):
        """
        Map value to the interval [0, 1]. The clip argument is unused.
        """
        result, is_scalar = self.process_value(value)
        self.autoscale_None(result)  # sets self.vmin, self.vmax if None

        if not self.vmin   <  = self.vcenter  < = self.vmax:
            raise ValueError("vmin, vcenter, vmax must increase monotonically")
        result = np.ma.masked_array(
            np.interp(result, [self.vmin, self.vcenter, self.vmax],
                      [0, 0.5, 1.]), mask=np.ma.getmask(result))
        if is_scalar:
            result = np.atleast_1d(result)[0]
        return result


class CenteredNorm(Normalize):

3 Source : test_deprecated_windturbines.py
with MIT License
from DTUWindEnergy

    def __init__(self):
        OneTypeWindTurbines.__init__(
            self, name='V80', diameter=80, hub_height=70,
            ct_func=lambda ws: np.interp(ws, hornsrev1.ct_curve[:, 0], hornsrev1.ct_curve[:, 1]),
            power_func=lambda ws: np.interp(ws, hornsrev1.power_curve[:, 0], hornsrev1.power_curve[:, 1]),
            power_unit='w')


def test_DeprecatedWindTurbines():

3 Source : test_deprecated_windturbines.py
with MIT License
from DTUWindEnergy

def test_DeprecatedWindTurbines():

    for wts in [V80Deprecated(),
                WindTurbines(
                    names=['V80'], diameters=[80], hub_heights=[70],
                    ct_funcs=[lambda ws: np.interp(ws, hornsrev1.ct_curve[:, 0], hornsrev1.ct_curve[:, 1])],
                    power_funcs=[lambda ws: np.interp(
                        ws, hornsrev1.power_curve[:, 0], hornsrev1.power_curve[:, 1])],
                    power_unit='w')]:

        types0 = [0] * 9
        wfm = NOJ(Hornsrev1Site(), wts)
        npt.assert_array_equal(wts.types(), [0])
        npt.assert_almost_equal(wfm.aep(wt9_x, wt9_y, type=types0), 81.2066072392765)


def test_deprecated_from_WindTurbines():

3 Source : test_deprecated_windturbines.py
with MIT License
from DTUWindEnergy

def test_twotype_windturbines():
    v80 = V80Deprecated()

    v88 = OneTypeWindTurbines('V88', 88, 77,
                              lambda ws: np.interp(ws, hornsrev1.ct_curve[:, 0], hornsrev1.ct_curve[:, 1]),
                              lambda ws: np.interp(ws, hornsrev1.power_curve[:, 0], hornsrev1.power_curve[:, 1] * 1.1),
                              'w')

    wts = DeprecatedWindTurbines.from_WindTurbines([v80, v88])
    ws = np.reshape([4, 6, 8, 10] * 2, (2, 4))
    types = np.asarray([0, 1])
    p = wts.power(ws, type=types)
    npt.assert_array_equal(p[0], p[1] / 1.1)


def test_get_defaults():

3 Source : test_gradients.py
with MIT License
from DTUWindEnergy

def test_gradients_interp():
    xp, x, y = [5, 16], [0, 10, 20], [100, 200, 400]

    def f(xp):
        return 2 * gradients.interp(xp, x, y)
    npt.assert_array_equal(interp(xp, x, y), np.interp(xp, x, y))
    npt.assert_array_almost_equal(fd(f)(xp), [20, 40])
    npt.assert_array_equal(cs(f)(xp), [20, 40])
    npt.assert_array_equal(autograd(f)(xp), [20, 40])


def test_gradients_logaddexp():

3 Source : wind_turbines_deprecated.py
with MIT License
from DTUWindEnergy

    def from_tabular(name, diameter, hub_height, ws, power, ct, power_unit):
        def power_func(u):
            return np.interp(u, ws, power)

        def ct_func(u):
            return np.interp(u, ws, ct)
        return DeprecatedOneTypeWindTurbines(name=name, diameter=diameter, hub_height=hub_height,
                                             ct_func=ct_func,
                                             power_func=power_func,
                                             power_unit=power_unit)

    def set_gradient_funcs(self, power_grad_funcs, ct_grad_funcs):

3 Source : signal.py
with MIT License
from ebranlard

def resample_interp(x_old, x_new, y_old=None, df_old=None):
    #x_new=np.sort(x_new)
    if df_old is not None:
        # --- Method 1 (pandas)
        #df_new = df_old.copy()
        #df_new = df_new.set_index(x_old)
        #df_new = df_new.reindex(df_new.index | x_new)
        #df_new = df_new.interpolate().loc[x_new]
        #df_new = df_new.reset_index()
        # --- Method 2 interp storing dx
        data_new=multiInterp(x_new, x_old, df_old.values.T)
        df_new = pd.DataFrame(data=data_new.T, columns=df_old.columns.values)
        return x_new, df_new

    if y_old is not None:
        return x_new, np.interp(x_new, x_old, y_old)


def applySamplerDF(df_old, x_col, sampDict):

3 Source : Polar.py
with MIT License
from ebranlard

    def f_st_interp(self,alpha):
        if self.f_st is None:
            self.cl_fully_separated()
        return np.interp(alpha, self.alpha, self.f_st)

    def cl_fs_interp(self,alpha):

3 Source : Polar.py
with MIT License
from ebranlard

    def cl_fs_interp(self,alpha):
        if self.cl_fs is None:
            self.cl_fully_separated()
        return np.interp(alpha, self.alpha, self.cl_fs)

    def cl_inv_interp(self,alpha):

3 Source : TN.py
with MIT License
from ebranlard

    def moments(KF):
        WT=KF.WT
        z_test = fastlib.ED_TwrGag(WT.ED) - WT.ED['TowerBsHt']
        EI     = np.interp(z_test, WT.Twr.s_span, WT.Twr.EI[0,:])
        kappa  = np.interp(z_test, WT.Twr.s_span, WT.Twr.PhiK[0][0,:])
        qx    = KF.X_hat[KF.iX['ut1']]
        KF.M_sim = [qx*EI[i]*kappa[i]/1000 for i in range(len(z_test))]                 # in [kNm]
        KF.M_ref = [KF.df['TwHt{:d}MLyt'.format(i+1)].values for i in range(len(z_test)) ] # in [kNm]
        return KF.M_sim, KF.M_ref

    def export(KF,OutputFile):

3 Source : ae_file.py
with MIT License
from ebranlard

    def _value(self, radius, column, set_nr=1):
        ae_data = self.ae_sets[set_nr]
        if radius is None:
            return ae_data[:, column]
        else:
            return np.interp(radius, ae_data[:, 0], ae_data[:, column])

    def chord(self, radius=None, set_nr=1):

See More Examples