(self, *args, **kwargs)
| 1024 | self.chart = valid_plot_types[plot_type] |
| 1025 | |
| 1026 | def log(self, *args, **kwargs): |
| 1027 | if self.win is not None and self.viz.win_exists(win=self.win, env=self.env): |
| 1028 | if len(args) != 2: |
| 1029 | raise ValueError("When logging to {}, must pass in x and y values (and optionally z).".format( |
| 1030 | type(self))) |
| 1031 | x, y = args |
| 1032 | self.chart( |
| 1033 | X=np.array([x]), |
| 1034 | Y=np.array([y]), |
| 1035 | update='append', |
| 1036 | win=self.win, |
| 1037 | env=self.env, |
| 1038 | opts=self.opts, |
| 1039 | **kwargs) |
| 1040 | else: |
| 1041 | if self.plot_type == 'scatter': |
| 1042 | chart_args = {'X': np.array([args])} |
| 1043 | else: |
| 1044 | chart_args = {'X': np.array([args[0]]), |
| 1045 | 'Y': np.array([args[1]])} |
| 1046 | self.win = self.chart( |
| 1047 | win=self.win, |
| 1048 | env=self.env, |
| 1049 | opts=self.opts, |
| 1050 | **chart_args) |
| 1051 | # For some reason, the first point is a different trace. So for now |
| 1052 | # we can just add the point again, this time on the correct curve. |
| 1053 | self.log(*args, **kwargs) |
| 1054 | |
| 1055 | |
| 1056 | class VisdomTextLogger(BaseVisdomLogger): |
nothing calls this directly
no outgoing calls
no test coverage detected