Stream¶
Particula-beta Index / Particula Beta / Data / Stream
Auto-generated documentation for particula_beta.data.stream module.
Stream¶
Consistent format for storing data.
Represents a consistent format for storing and managing data streams within a list. Similar to pandas but with tighter control over the data allowed and expected format.
Attributes¶
header
- Headers of the data stream, each a string.data
- 2D numpy array where rows are timepoints and columns correspond to headers.time
- 1D numpy array representing the time points of the data stream.files
- List of filenames that contain the data stream.
Methods¶
validate_inputs
- Validates the types of class inputs.__getitem__(index)
- Returns the data at the specified index.__setitem__(index,
value) - Sets or updates data at the specified index.__len__()
- Returns the length of the time stream.datetime64
- Converts time stream to numpy datetime64 array for plots.header_dict
- Provides a dictionary mapping of header indices to names.header_float
- Converts header names to a numpy array of floats.
Signature¶
class Stream: ...
Stream().getitem¶
Gets data at a specified index or header name.
Allows indexing of the data stream using an integer index or a string corresponding to the header. If a string is used, the header index is retrieved and used to return the data array. Only one str argument is allowed. A list of int is allowed.
Arguments¶
index
- The index or name of the data column to retrieve.
Returns¶
np.ndarray
- The data array at the specified index.
Signature¶
def __getitem__(self, index: Union[int, str]) -> NDArray[np.float64]: ...
Stream().len¶
Returns the number of time points in the data stream.
Returns¶
int
- Length of the time stream.
Signature¶
def __len__(self) -> int: ...
Stream().pop¶
Removes data at a specified index or header name.
Allows indexing of the data stream using an integer index or a string corresponding to the header. If a string is used, the header index is retrieved and used to return the data array. Only one str argument is allowed. A list of int is allowed.
Arguments¶
index
- The index or name of the data column to retrieve.
Signature¶
def __pop__(self, index: Union[int, str]) -> None: ...
Stream().setitem¶
Sets or adds data at a specified index.
If index is a string and not in headers, it is added. This is used to add new data columns to the stream.
Arguments¶
index
- The index or name of the data column to set.value
- The data to set at the specified index.
Notes¶
Support setting multiple rows by accepting a list of values.
Signature¶
def __setitem__(self, index: Union[int, str], value: NDArray[np.float64]): ...
Stream().datetime64¶
Converts the epoch time array to a datetime64 for plotting.
This method converts the time array to a datetime64 array, which can be used for plotting time series data. This generally assumes that the time array is in seconds since the epoch.
Returns¶
np.ndarray
- Datetime64 array representing the time stream.
Signature¶
@property
def datetime64(self) -> NDArray[np.float64]: ...
Stream().header_dict¶
Provides a dictionary mapping from index to header names.
Returns¶
dict
- Dictionary with indices as keys and header names as values.
Signature¶
@property
def header_dict(self) -> dict[int, str]: ...
Stream().header_float¶
Attempts to convert header names to a float array, where possible.
Returns¶
np.ndarray
- Array of header names converted to floats.
Signature¶
@property
def header_float(self) -> NDArray[np.float64]: ...
Stream().validate_inputs¶
Validates that header is a list.
Raises¶
TypeError
- If header is not a list.
Signature¶
def validate_inputs(self): ...
StreamAveraged¶
Stream Class with Averaged Data and Standard Deviation.
Extends the Stream class with functionalities specific to handling averaged data streams. Mainly adding standard deviation to the data stream.
Attributes¶
average_interval
- The interval in units (e.g., seconds, minutes) over which data is averaged.start_time
- The start time from which data begins to be averaged.stop_time
- The time at which data ceases to be averaged.standard_deviation
- A numpy array storing the standard deviation of data streams.
Signature¶
class StreamAveraged(Stream): ...
See also¶
StreamAveraged().get_std¶
Retrieves the standard deviation
In the averaged data stream, the standard deviation of the data is stored in a separate array that mirrors the same indices as the data stream. This method allows retrieval of the standard deviation at a specified index.
Arguments¶
index
- The index or header name of the data stream for which standard deviation is needed.
Returns¶
np.ndarray
- The standard deviation values at the specified index.
Raises¶
ValueError
- If the specified index does not exist in the header.
Signature¶
def get_std(self, index: Union[int, str]) -> NDArray[np.float64]: ...
StreamAveraged().validate_averaging_params¶
Ensures that averaging parameters are valid.
Raises¶
ValueError
- If average_interval is not a positive number.ValueError
- If start_time or stop_time are not numerical or if start_time is greater than or equal to stop_time.
Signature¶
def validate_averaging_params(self): ...