peng/wave_functions.py
def _bound_waveform(wave, indep_min, indep_max):
    """Add independent variable vector bounds if they are not in vector."""
    indep_min, indep_max = _validate_min_max(wave, indep_min, indep_max)
    indep_vector = copy.copy(wave._indep_vector)
    if (
        isinstance(indep_min, float) or isinstance(indep_max, float)
    ) and indep_vector.dtype.name.startswith("int"):
        indep_vector = indep_vector.astype(float)
    min_pos = np.searchsorted(indep_vector, indep_min)
    if not np.isclose(indep_min, indep_vector[min_pos], FP_RTOL, FP_ATOL):
        indep_vector = np.insert(indep_vector, min_pos, indep_min)
    max_pos = np.searchsorted(indep_vector, indep_max)
    if not np.isclose(indep_max, indep_vector[max_pos], FP_RTOL, FP_ATOL):
        indep_vector = np.insert(indep_vector, max_pos, indep_max)
    dep_vector = _interp_dep_vector(wave, indep_vector)
    wave._indep_vector = indep_vector[min_pos : max_pos + 1]
    wave._dep_vector = dep_vector[min_pos : max_pos + 1]
def _bound_waveform(wave, indep_min, indep_max):
    """Add independent variable vector bounds if they are not in vector."""
    indep_min, indep_max = _validate_min_max(wave, indep_min, indep_max)
    indep_vector = copy.copy(wave._indep_vector)
    if (
        isinstance(indep_min, float) or isinstance(indep_max, float)
    ) and indep_vector.dtype.name.startswith("int"):
        indep_vector = indep_vector.astype(float)
    min_pos = np.searchsorted(indep_vector, indep_min)
    if not np.isclose(indep_min, indep_vector[min_pos], FP_RTOL, FP_ATOL):
        indep_vector = np.insert(indep_vector, min_pos, indep_min)
    max_pos = np.searchsorted(indep_vector, indep_max)
    if not np.isclose(indep_max, indep_vector[max_pos], FP_RTOL, FP_ATOL):
        indep_vector = np.insert(indep_vector, max_pos, indep_max)
    dep_vector = _interp_dep_vector(wave, indep_vector)
    wave._indep_vector = indep_vector[min_pos : max_pos + 1]
    wave._dep_vector = dep_vector[min_pos : max_pos + 1]
def _bound_waveform ( wave , indep_min , indep_max ) : indep_min , indep_max = _validate_min_max ( wave , indep_min , indep_max ) indep_vector = copy . copy ( wave . _indep_vector ) if ( isinstance ( indep_min , float ) or isinstance ( indep_max , float ) ) and indep_vector . dtype . name . startswith ( "int" ) : indep_vector = indep_vector . astype ( float ) min_pos = np . searchsorted ( indep_vector , indep_min ) if not np . isclose ( indep_min , indep_vector [ min_pos ] , FP_RTOL , FP_ATOL ) : indep_vector = np . insert ( indep_vector , min_pos , indep_min ) max_pos = np . searchsorted ( indep_vector , indep_max ) if not np . isclose ( indep_max , indep_vector [ max_pos ] , FP_RTOL , FP_ATOL ) : indep_vector = np . insert ( indep_vector , max_pos , indep_max ) dep_vector = _interp_dep_vector ( wave , indep_vector ) wave . _indep_vector = indep_vector [ min_pos : max_pos + 1 ] wave . _dep_vector = dep_vector [ min_pos : max_pos + 1 ]
Add independent variable vector bounds if they are not in vector.
Add independent variable vector bounds if they are not in vector .