Coverage for cvpack/reporting/custom_writer.py: 78%

9 statements  

« prev     ^ index     » next       coverage.py v7.5.1, created at 2024-05-09 16:14 +0000

1""" 

2.. class:: CustomWriter 

3 :platform: Linux, MacOS, Windows 

4 :synopsis: An abstract class for StateDataReporter writers 

5 

6.. moduleauthor:: Charlles Abreu <craabreu@gmail.com> 

7 

8""" 

9 

10import typing as t 

11 

12from openmm import app as mmapp 

13 

14 

15@t.runtime_checkable 

16class CustomWriter(t.Protocol): 

17 """ 

18 An abstract class for StateDataReporter writers 

19 """ 

20 

21 def initialize(self, simulation: mmapp.Simulation) -> None: 

22 """ 

23 Initializes the writer. This method is called before the first report and 

24 can be used to perform any necessary setup. 

25 

26 Parameters 

27 ---------- 

28 simulation 

29 The simulation object. 

30 """ 

31 

32 def getHeaders(self) -> t.List[str]: 

33 """ 

34 Gets a list of strigs containing the headers to be added to the report. 

35 """ 

36 raise NotImplementedError("Method 'getHeaders' not implemented") 

37 

38 def getValues(self, simulation: mmapp.Simulation) -> t.List[float]: 

39 """ 

40 Gets a list of floats containing the values to be added to the report. 

41 

42 Parameters 

43 ---------- 

44 simulation 

45 The simulation object. 

46 """ 

47 raise NotImplementedError("Method 'getValues' not implemented")