isimple.core package¶
Submodules¶
isimple.core.backend module¶
-
exception
isimple.core.backend.BackendSetupError(*args)[source]¶ Bases:
isimple.core.common.SetupError-
msg= 'Error while setting up backend'¶
-
-
exception
isimple.core.backend.BackendError(*args)[source]¶ Bases:
isimple.core.common.RootException-
msg= 'Error in backend'¶
-
-
exception
isimple.core.backend.CacheAccessError(*args)[source]¶ Bases:
isimple.core.common.RootException-
msg= 'Trying to access cache out of context'¶
-
-
class
isimple.core.backend.BackendInstance(config: Optional[isimple.core.config.BackendInstanceConfig])[source]¶ Bases:
object
-
class
isimple.core.backend.CachingBackendInstance(config: isimple.core.config.CachingBackendInstanceConfig = None)[source]¶ Bases:
isimple.core.backend.BackendInstanceInterface to diskcache.Cache
-
class
isimple.core.backend.BackendManager(config: isimple.core.config.BackendManagerConfig = None)[source]¶ Bases:
isimple.core.backend.BackendInstance,isimple.core.common.Manager
isimple.core.common module¶
-
class
isimple.core.common.Endpoint(signature: Type[Callable])[source]¶ Bases:
object-
signature¶
-
registered¶
-
-
class
isimple.core.common.InstanceRegistry[source]¶ Bases:
isimple.core.common.EndpointRegistryThis one is global, collects callables that expose endpoints
-
endpoints¶
-
-
class
isimple.core.common.ImmutableRegistry(endpoints: isimple.core.common.InstanceRegistry = None)[source]¶ Bases:
isimple.core.common.EndpointRegistry-
endpoints¶
-
isimple.core.config module¶
-
class
isimple.core.config.HsvColor(h, s, v)¶ Bases:
tuple-
h¶ Alias for field number 0
-
s¶ Alias for field number 1
-
v¶ Alias for field number 2
-
-
class
isimple.core.config.Factory(string: str = None)[source]¶ Bases:
isimple.core.config.EnforcedStr-
options¶
-
default¶
-
-
class
isimple.core.config.TransformType(string: str = None)[source]¶ Bases:
isimple.core.config.Factory
-
class
isimple.core.config.FilterType(string: str = None)[source]¶ Bases:
isimple.core.config.Factory
-
class
isimple.core.config.VideoFeatureType(string: str = None)[source]¶ Bases:
isimple.core.config.Factory
-
class
isimple.core.config.BackendType(string: str = None)[source]¶ Bases:
isimple.core.config.Factory
-
class
isimple.core.config.Config(**kwargs)[source]¶ Bases:
abc.ABCAbstract class for configuration data. * Default values for Config or Factory subclasses should be provided as
None and ‘’ respectively; in this way they should be caught by self.resolve and resolved at runtime. This is important to resolve to the latest version of the Factory, as it may have been extended.-
static
resolve(val, type, iter=False)[source]¶ Resolve the value of an attribute to match a specific type :param val: current value :param type: type to resolve to :param iter: if True, interpret val as an iterable and resolve
all elements of val to typeReturns: the resolved value for val; this should be written to the original attribute, i.e. self.attr = resolve(self.attr, type)
-
static
-
class
isimple.core.config.BackendInstanceConfig(**kwargs)[source]¶ Bases:
isimple.core.config.Config
-
class
isimple.core.config.CachingBackendInstanceConfig(do_cache: bool = True, do_background: bool = False, cache_dir: str = '.cache', cache_size_limit: int = 4294967296, block_timeout: float = 1, cache_consumer: bool = False)[source]¶ Bases:
isimple.core.config.BackendInstanceConfig-
do_cache= True¶
-
do_background= False¶
-
cache_dir= '.cache'¶
-
cache_size_limit= 4294967296¶
-
block_timeout= 1¶
-
cache_consumer= False¶
-
-
class
isimple.core.config.VideoFileHandlerConfig(do_cache: bool = True, do_background: bool = False, cache_dir: str = '.cache', cache_size_limit: int = 4294967296, block_timeout: float = 1, cache_consumer: bool = False, do_resolve_frame_number: bool = True)[source]¶ Bases:
isimple.core.config.CachingBackendInstanceConfig-
do_resolve_frame_number= True¶
-
-
class
isimple.core.config.TransformHandlerConfig(type: Union[isimple.core.config.TransformType, str] = '', matrix: Union[numpy.ndarray, str] = array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), coordinates: Union[list, str] = '')[source]¶ Bases:
isimple.core.config.BackendInstanceConfigTransformHandlerConfig(type: Union[isimple.core.config.TransformType, str] = ‘’, matrix: Union[numpy.ndarray, str] = array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]), coordinates: Union[list, str] = ‘’)
-
type= ''¶
-
matrix= array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])¶
-
coordinates= ''¶
-
-
class
isimple.core.config.FilterConfig(**kwargs)[source]¶ Bases:
isimple.core.config.Config
-
class
isimple.core.config.HsvRangeFilterConfig(radius: Union[isimple.core.config.HsvColor, str] = HsvColor(h=10, s=75, v=75), c0: Union[isimple.core.config.HsvColor, str] = HsvColor(h=0, s=0, v=0), c1: Union[isimple.core.config.HsvColor, str] = HsvColor(h=0, s=0, v=0))[source]¶ Bases:
isimple.core.config.FilterConfig-
radius= HsvColor(h=10, s=75, v=75)¶
-
c0= HsvColor(h=0, s=0, v=0)¶
-
c1= HsvColor(h=0, s=0, v=0)¶
-
-
class
isimple.core.config.FilterHandlerConfig(type: Union[isimple.core.config.FilterType, str] = '', data: Union[isimple.core.config.FilterConfig, dict, NoneType] = None)[source]¶ Bases:
isimple.core.config.BackendInstanceConfig-
type= ''¶
-
data= None¶
-
-
class
isimple.core.config.MaskConfig(name: Union[str, NoneType] = None, height: Union[float, NoneType] = None, filter: Union[isimple.core.config.FilterHandlerConfig, dict, NoneType] = None)[source]¶ Bases:
isimple.core.config.BackendInstanceConfig-
name= None¶
-
height= None¶
-
filter= None¶
-
-
class
isimple.core.config.DesignFileHandlerConfig(do_cache: bool = True, do_background: bool = False, cache_dir: str = '.cache', cache_size_limit: int = 4294967296, block_timeout: float = 1, cache_consumer: bool = False, render_dir: str = '.render', keep_renders: bool = False, dpi: int = 400, overlay_alpha: float = 0.1, smoothing: int = 7)[source]¶ Bases:
isimple.core.config.CachingBackendInstanceConfig-
render_dir= '.render'¶
-
keep_renders= False¶
-
dpi= 400¶
-
overlay_alpha= 0.1¶
-
smoothing= 7¶
-
-
class
isimple.core.config.VideoAnalyzerConfig(video_path: Union[str, NoneType] = None, design_path: Union[str, NoneType] = None, frame_interval_setting: Union[isimple.core.config.FrameIntervalSetting, str] = '', dt: Union[float, NoneType] = 5.0, Nf: Union[int, NoneType] = 100, height: float = 0.000153, video: Union[isimple.core.config.VideoFileHandlerConfig, dict, NoneType] = None, design: Union[isimple.core.config.DesignFileHandlerConfig, dict, NoneType] = None, transform: Union[isimple.core.config.TransformHandlerConfig, dict, NoneType] = None, masks: Tuple[Union[isimple.core.config.MaskConfig, dict, NoneType], ...] = (None,), features: Tuple[Union[isimple.core.config.VideoFeatureType, str], ...] = ('',))[source]¶ Bases:
isimple.core.config.BackendManagerConfig-
video_path= None¶
-
design_path= None¶
-
frame_interval_setting= ''¶
-
dt= 5.0¶
-
Nf= 100¶
-
height= 0.000153¶
-
video= None¶
-
design= None¶
-
transform= None¶
-
masks= (None,)¶
-
features= ('',)¶
-
isimple.core.endpoints module¶
-
class
isimple.core.endpoints.BackendRegistry(endpoints: isimple.core.common.InstanceRegistry = None)[source]¶ Bases:
isimple.core.common.ImmutableRegistry-
get_config= <isimple.core.common.Endpoint object>¶
-
set_config= <isimple.core.common.Endpoint object>¶
-
get_name= <isimple.core.common.Endpoint object>¶
-
get_total_frames= <isimple.core.common.Endpoint object>¶
-
get_raw_frame= <isimple.core.common.Endpoint object>¶
-
set_transform_implementation= <isimple.core.common.Endpoint object>¶
-
transform= <isimple.core.common.Endpoint object>¶
-
estimate_transform= <isimple.core.common.Endpoint object>¶
-
get_coordinates= <isimple.core.common.Endpoint object>¶
-
get_mask_name= <isimple.core.common.Endpoint object>¶
-
get_mask_names= <isimple.core.common.Endpoint object>¶
-
set_filter_implementation= <isimple.core.common.Endpoint object>¶
-
set_filter_parameters= <isimple.core.common.Endpoint object>¶
-
get_filter_parameters= <isimple.core.common.Endpoint object>¶
-
get_filter_mean_color= <isimple.core.common.Endpoint object>¶
-
get_overlay= <isimple.core.common.Endpoint object>¶
-
get_frame= <isimple.core.common.Endpoint object>¶
-
get_masked_frame= <isimple.core.common.Endpoint object>¶
-
filter= <isimple.core.common.Endpoint object>¶
-
mask= <isimple.core.common.Endpoint object>¶
-
get_filtered_frame= <isimple.core.common.Endpoint object>¶
-
get_filtered_masked_frame= <isimple.core.common.Endpoint object>¶
-
overlay_frame= <isimple.core.common.Endpoint object>¶
-
get_overlaid_frame= <isimple.core.common.Endpoint object>¶
-
get_inverse_transformed_overlay= <isimple.core.common.Endpoint object>¶
-
get_colors= <isimple.core.common.Endpoint object>¶
-
get_time= <isimple.core.common.Endpoint object>¶
-
get_fps= <isimple.core.common.Endpoint object>¶
-
get_h= <isimple.core.common.Endpoint object>¶
-
get_dpi= <isimple.core.common.Endpoint object>¶
-
-
class
isimple.core.endpoints.GuiRegistry(endpoints: isimple.core.common.InstanceRegistry = None)[source]¶ Bases:
isimple.core.common.ImmutableRegistry-
open_setupwindow= <isimple.core.common.Endpoint object>¶
-
open_transformwindow= <isimple.core.common.Endpoint object>¶
-
open_filterwindow= <isimple.core.common.Endpoint object>¶
-
update_filterwindow= <isimple.core.common.Endpoint object>¶
-
open_progresswindow= <isimple.core.common.Endpoint object>¶
-
update_progresswindow= <isimple.core.common.Endpoint object>¶
-
isimple.core.features module¶
-
class
isimple.core.features.Feature(elements: Tuple[isimple.core.backend.BackendInstance, ...])[source]¶ Bases:
abc.ABCA feature implements interactions between BackendElements to produce a certain value
-
calculate(frame: numpy.ndarray, state: numpy.ndarray = None) → Tuple[Any, numpy.ndarray][source]¶ Calculate Feature for given frame and update state image (optional)
-
color¶ Color of the Feature in figures.
A Feature’s color must be set as not to overlap with other Features in the same FeatureSet. Therefore, <Feature>._color must be determined by FeatureSet!
-
state(frame: numpy.ndarray, state: numpy.ndarray = None) → numpy.ndarray[source]¶ Return the Feature instance’s state image for a given frame
-
isimple.core.log module¶
-
class
isimple.core.log.CustomLogger(name, level=0)[source]¶ Bases:
logging.Logger-
debug(msg, *args, **kwargs)[source]¶ Log ‘msg % args’ with severity ‘DEBUG’.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.debug(“Houston, we have a %s”, “thorny problem”, exc_info=1)
-
info(msg, *args, **kwargs)[source]¶ Log ‘msg % args’ with severity ‘INFO’.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.info(“Houston, we have a %s”, “interesting problem”, exc_info=1)
-
warning(msg, *args, **kwargs)[source]¶ Log ‘msg % args’ with severity ‘WARNING’.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.warning(“Houston, we have a %s”, “bit of a problem”, exc_info=1)
-
error(msg, *args, **kwargs)[source]¶ Log ‘msg % args’ with severity ‘ERROR’.
To pass exception information, use the keyword argument exc_info with a true value, e.g.
logger.error(“Houston, we have a %s”, “major problem”, exc_info=1)
-
isimple.core.schema module¶
-
isimple.core.schema.resolve_type_to_most_specific(t: _GenericAlias) → _GenericAlias[source]¶ - Resolve Union in a type annotation to its most specific element
- Use case:
todo: extend to Optional
Parameters: t – Returns:
isimple.core.util module¶
-
isimple.core.util.all_attributes(t: Union[object, type], include_under: bool = True, include_methods: bool = True, include_mro: bool = False) → List[str][source]¶
-
isimple.core.util.frame_number_iterator(total: int, Nf: int = None, dt: float = None, fps: float = None) → Generator[int, None, None][source]¶