npsolve.legacy.legacy_utils module
Created on Sat Sep 14 08:31:52 2019
@author: Reuben
This module is deprecated and will be removed in a future version!
This module contains helper functions and methods that help you get the most from npsolve.
- class npsolve.legacy.legacy_utils.Dict_Container
Bases:
dict
- class npsolve.legacy.legacy_utils.List_Container
Bases:
dict
- class npsolve.legacy.legacy_utils.List_Container_Container
Bases:
dict
- class npsolve.legacy.legacy_utils.Set_Container
Bases:
dict
- class npsolve.legacy.legacy_utils.Timeseries(xs, ys)
Bases:
objectA utility class to specify values from time-series data
- Parameters:
xs (ndarray) – A 1D array of x values. Must be monotonically increasing.
ys (ndarray) – A 1D array of y values
- Usage:
The Timeseries class is callable. It interpolates values smoothly between the inputs using splines. It offers the 1st integral to the 3rd derivative of values.
timeseries = Timeseries(xs, ys) # Create timeseries(5) # Value at x=5 timeseries(5, -1) # 1st integral (antiderivative) at x=5 timeseries(5, 0) # Value at x=5 timeseries(5, 1) # 1st derivative at x=5 timeseries(5, 2) # 2nd derivative at x=5 timeseries(5, 3) # 3rd derivative at x=5
Note
Use Timeseries.from_csv to generate values from a csv file.
- classmethod from_csv(fname, x_col=0, y_col=1, skip_header=0, delimiter=',', **kwargs)
Create a Timeseries from csv data
- Parameters:
fname (str) – The filename
x_col (int) – The column index of the x data (0 is the first column)
y_col (int) – The column index of the y data
skip_header (int) – [Optional] Number of header rows to skip. Defaults to 0.
delimiter (str) – [Optional] Delimiter. Defaults to ‘,’.
**kwargs – [Optional] Other keyword arguments passed to numpy.genfromtxt.
- get(x, der=0, ext=3)
Get an interpolated value
- Parameters:
x (float, ndarray) – The x value(s).
der (int) – [Optional] The derivative number. Defaults to 0.
ext (int) – [Optional] What to do outside the range of xs. See scipy.interpolate.splev for details. Defaults to 3, which means to return the boundary values.
- Returns:
The y value(s)
- Return type:
ndarray
- npsolve.legacy.legacy_utils.get_dict(name)
- npsolve.legacy.legacy_utils.get_list(name)
- npsolve.legacy.legacy_utils.get_list_container(name)
- npsolve.legacy.legacy_utils.get_logger(name)
- npsolve.legacy.legacy_utils.get_set(name)
- npsolve.legacy.legacy_utils.get_status(name)
- npsolve.legacy.legacy_utils.none()