simuran.core.base_class module¶
The base class sets up information and methods held in most SIMURAN classes.
-
class
simuran.core.base_class.BaseSimuran(attrs: Union[dict, ParamHandler] = <factory>, datetime: datetime = <factory>, tag: Optional[str] = None, loader: Optional[BaseLoader] = None, source_file: Union[str, Path, None] = None)¶ Bases:
abc.ABCAn abstract class which is the base class for most SIMURAN classes.
This dataclass describes a general framework for any object which loads information from a source file. The abstract method load must be implemented by subclasses.
-
attrs¶ Fixed information about this object, e.g. model or session type.
Type: dict or ParamHandler
-
datetime¶ The date associated with this object, e.g. recording date.
Type: datetime.datetime
-
tag¶ An optional tag to describe the object. Default “untagged”
Type: str
-
loader¶ A loader object that is used to load this object. The relationship between the loader and this object is established in self.load()
Type: simuran.loader.BaseLoader
-
source_file¶ The path to the source file for this object. For instance, an NWB file or an online URL.
Type: str
-
last_loaded_source¶ The path to the last file this object was loaded from.
Type: str
-
data¶ When this object is loaded, complex variables can be stored in data. For instance, an xarray object could be set as the data. Generally speaking it is where the large (in terms of memory) objects are stored after loading.
Type: Any
-
results¶ A dictionary of results.
Type: dict
-
data= None
-
get_attrs() → dict[str, Any]¶ Return all attributes of this object
-
get_attrs_and_methods() → list[str]¶ Return all attributes and methods of this object
-
inspect(methods: bool = False, **kwargs) → None¶ Inspect this object (see attributes and methods).
Passes this object into rich.inspect - see this for kwargs. Note: You could also try objexplore for this purpose.
Parameters: - methods (bool, optional) – Show the methods, by default False
- **kwargs – Keyword arguments to pass into rich.inspect
Returns: Return type: None
-
is_loaded() → bool¶ Return True if the file has been loaded.
Returns: True if the source file has been loaded. Return type: bool
-
last_loaded_source= <object object>
-
load() → None¶ Load the data using the set loader object.
Skips loading if self.is_loaded().
Raises: ValueError– If no loader has been set.
-
loader= None
-
source_file= None
-
tag= None
-
unload()¶ Unload / close related open files.
-
-
class
simuran.core.base_class.NoLoader(attrs: Union[dict, ParamHandler] = <factory>, datetime: datetime = <factory>, tag: Optional[str] = None, loader: Optional[BaseLoader] = None, source_file: Union[str, Path, None] = None)¶ Bases:
simuran.core.base_class.BaseSimuran-
is_loaded()¶ Return True if the file has been loaded.
Returns: True if the source file has been loaded. Return type: bool
-
load()¶ Load the data using the set loader object.
Skips loading if self.is_loaded().
Raises: ValueError– If no loader has been set.
-