Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

""" 

Definition of the base observer class. 

""" 

 

from abc import ABC, abstractmethod 

 

 

class BaseObserver(ABC): 

""" 

Base observer class. 

 

Parameters 

---------- 

interval : int 

the observation interval 

tag : str 

human readable tag used for identifying the observer 

 

Attributes 

---------- 

tag : str 

human readable tag used for identifying the observer 

interval : int 

the observation interval 

""" 

 

def __init__(self, return_type: type, interval: int = None, 

tag: str = 'BaseObserver') -> None: 

self.tag = tag 

self.interval = interval 

self._return_type = return_type 

 

@property 

def return_type(self) -> type: 

"""Data type of the observed data.""" 

return self._return_type 

 

@abstractmethod 

def get_observable(self): 

""" 

Method used for extracting data. 

 

Returns 

------- 

self.return_type() 

 

When implementing this method use the following names for the 

following types of data: 

 

ASE Atoms object : `structure`. 

list of chemical species : `species`. 

icet cluster expansion : `cluster_expansion`. 

mchammer calculator : `calculator`. 

""" 

raise NotImplementedError