From e3471c1cf5075a99e842e6b99f1ee106d5d2dc1c Mon Sep 17 00:00:00 2001 From: Akshar Sarvesh Date: Mon, 26 Aug 2024 16:26:14 -0700 Subject: [PATCH] STY: Added doc strings --- pydm/widgets/archiver_time_plot.py | 32 +++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pydm/widgets/archiver_time_plot.py b/pydm/widgets/archiver_time_plot.py index 160bb8486..92f7a0d75 100644 --- a/pydm/widgets/archiver_time_plot.py +++ b/pydm/widgets/archiver_time_plot.py @@ -328,7 +328,6 @@ def __init__( use_archive_data: Optional[bool] = True, liveData: Optional[bool] = True, color: Optional[str] = "green", - **kws ): super(FormulaCurveItem, self).__init__(**kws) @@ -461,6 +460,15 @@ def evaluate(self) -> None: ) def set_up_eval(self, archive: bool) -> dict: + """Because we are doing very similar evaluations for Archive and Live Data, + we are going to set up our data structures such that we can compute our evaluation + more easily. This function will (generally) be called twice, once with archive = True, + once with False + + Parameters + ---------------- + archive: bool + Whether this is setting up for Archive Data or Live Data""" pvIndices = dict() for pv in self.pvs.keys(): pv_current_index = 0 @@ -479,6 +487,28 @@ def set_up_eval(self, archive: bool) -> dict: def compute_evaluation( self, formula: str, pvData: dict, pvValues: dict, pvIndices: dict, archive: bool ) -> np.ndarray: + """This is where the actual computation takes place. We are going to go through + the data step by step and calculate our formula at each timestamp available + + Parameters + ---------------- + formula: str + The formula to compute + + pvData: dict + A dictionary containing all of the Archive or Live data for each curve + + pvValues: dict + The value of each curve at the current timestep. At the start of this function, + each is set to their respective last seen values when the time is equal to the + latest start time of all of the curves. + + pvIndices: dict + A dictionary storing where in each curve's data buffer we are currently at while calculating + + archive: bool + Whether or not this is computing for the Archive or for Live""" + current_time = self.min_archiver_x output = np.zeros((2, 0), order="f", dtype=float) while True: