Skip to content
Snippets Groups Projects
Commit e129e8b9 authored by Lan Dam's avatar Lan Dam
Browse files

Merge branch 'master' into i162_show_GPS_clock_0_when_no_data

parents d7ce47c1 bee232dd
No related branches found
No related tags found
1 merge request!180Make GPS Lk/Unlk and GPS Clock Power to plot in the same channel
Pipeline #3039 failed with stage
in 2 minutes and 49 seconds
...@@ -100,6 +100,69 @@ class Plotting: ...@@ -100,6 +100,69 @@ class Plotting:
ax.chan_db_info = chan_db_info ax.chan_db_info = chan_db_info
return ax return ax
def plot_tri_colors(
self, c_data: Dict, chan_db_info: Dict, chan_id: str) -> Axes:
"""
Plot 3 different values in 3 lines with 3 different colors according
to valueColors:
Ex: -1:M|0:R|1:Y means
value = -1 => plot on line y=-1 with M color
value = 0 => plot on line y=0 with R color
value = 1 => plot on line y=1 with Y color
Color codes are defined in colorSettings and limitted in 'valColRE'
in dbSettings.py
:param c_data: data of the channel which includes down-sampled
(if needed) data in keys 'times' and 'data'.
:param chan_db_info: info of channel from DB
:param chan_id: name of channel
:return ax: axes of the channel
"""
plot_h = self.plotting_axes.get_height(chan_db_info['height'])
ax = self.plotting_axes.create_axes(
self.parent.plotting_bot, plot_h,
has_min_max_lines=False)
value_colors = chan_db_info['valueColors'].split('|')
sample_no_colors = []
total_sample_list = []
for vc in value_colors:
v, c = vc.split(':')
sample_no_colors.append(clr[c])
val = get_val(v)
indexes = np.where(c_data['data'][0] == val)[0]
times = c_data['times'][0][indexes]
# base line
ax.plot([self.parent.min_x, self.parent.max_x],
[val, val],
color=clr['r'],
linewidth=0.5,
zorder=constants.Z_ORDER['CENTER_LINE']
)
ax.plot(times, len(times) * [val], linestyle="",
marker='s', markersize=2,
zorder=constants.Z_ORDER['DOT'],
color=clr[c], picker=True, pickradius=3)
total_sample_list.append(len(times))
if val == -1:
ax.x_bottom = times
elif val == 0:
ax.x_center = times
else:
ax.x_top = times
self.plotting_axes.set_axes_info(
ax, sample_no_list=total_sample_list,
sample_no_colors=sample_no_colors,
sample_no_pos=[0.05, 0.5, 0.95],
chan_db_info=chan_db_info)
ax.chan_db_info = chan_db_info
return ax
def plot_multi_color_dots_equal_on_upper_bound( def plot_multi_color_dots_equal_on_upper_bound(
self, c_data: Dict, chan_db_info: Dict, chan_id: str) -> Axes: self, c_data: Dict, chan_db_info: Dict, chan_id: str) -> Axes:
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment