simuran.core.base_signal module¶
Module to hold the abstract class setting up information held in a signal.
-
class
simuran.core.base_signal.BaseSignal(attrs: Union[dict, ParamHandler] = <factory>, datetime: datetime = <factory>, tag: Optional[str] = None, loader: Optional[BaseLoader] = None, source_file: Union[str, Path, None] = None, timestamps: Optional[Iterable[float]] = None, samples: Iterable[float] = <factory>, sampling_rate: Optional[float] = None, region: Optional[str] = None, group: Any = None, channel: Any = None, channel_type: str = 'misc', conversion: int = 1.0)¶ Bases:
simuran.core.base_class.BaseSimuranDescribes the base information for a regularly sampled signal.
For example, LFP or EEG could be represented.
-
timestamps¶ The timestamps of the signal sampling in seconds
Type: array style object
-
samples¶ The value of the signal at sample points. By default, this is assumed to be stored in mV.
Type: array style object
-
sampling_rate¶ The sampling rate of the signal in Hz
Type: int
-
region¶ The brain region that the signal is associated with
Type: str
-
group¶ An optional value to group on. For example, if wires are bundled, this could indicate the bundle number.
Type: object
-
channel¶ The channel id of the signal.
Type: object
-
channel_type¶ The type of the signal channel, e.g. eeg. Default is “eeg”.
Type: str
-
conversion¶ The conversion rate to Volts for samples self.samples * self.conversion is in Volts
Type: float
See also
-
channel= None
-
channel_type= 'misc'
-
conversion= 1.0
-
default_name(starting_name=None)¶ Get the default name for this signal based on region.
Parameters: starting_name (str, optional) – By default None, which starts with the chan type. Returns: The name of the channel as {region} - {starting_name} {channel} Return type: str
-
fill_timestamps()¶
-
filter(low=None, high=None, inplace=False, **kwargs)¶ Filter the signal.
Parameters: - low (float, optional) – The low frequency for filtering. Default None.
- high (float, optional) – The high frequency for filtering. Default None.
- inplace (bool, optional) – Whether to perform the operation in place, by default False
Keyword Arguments: https (See) –
Returns: The filtered signal.
Return type: simuran.eeg.Eeg
-
classmethod
from_numpy(np_array, sampling_rate)¶ Set data from a numpy array, assumed in mV and srate in Hz.
Parameters: - np_array (numpy array) – The data in mV.
- sampling_rate (int) – The sampling rate of the signal in Hz.
Returns: Return type: None
-
get_duration()¶ Get the length of the signal in the unit of timestamps.
-
get_end()¶ Get the last time recorded
-
get_samples_in_volts()¶
-
get_start()¶ Get the first time recorded
-
group= None
-
in_range(start, stop, step=None)¶ Splice samples from second based times.
Parameters: - start (int) – The start time in seconds to grab samples from
- stop (int) – The end time in seconds to grab samples from
- step (int, optional) – The amount to skip, as in normal array splicing.
Returns: The spliced array
Return type: np.array
-
load(*args, **kwargs)¶ Load the signal.
-
region= None
-
sampling_rate= None
-
timestamps= None
-
-
class
simuran.core.base_signal.Eeg(attrs: Union[dict, ParamHandler] = <factory>, datetime: datetime = <factory>, tag: Optional[str] = None, loader: Optional[BaseLoader] = None, source_file: Union[str, Path, None] = None, timestamps: Optional[Iterable[float]] = None, samples: Iterable[float] = <factory>, sampling_rate: Optional[float] = None, region: Optional[str] = None, group: Any = None, channel: Any = None, channel_type: str = 'eeg', conversion: int = 1.0)¶ Bases:
simuran.core.base_signal.BaseSignalA signal of channel_type eeg
-
channel_type= 'eeg'¶
-