Skip to content

Commit 5f6af07

Browse files
committed
add significance coloring
1 parent a60a115 commit 5f6af07

File tree

1 file changed

+38
-24
lines changed

1 file changed

+38
-24
lines changed

v2dl5/light_curves/binary_plotting.py

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -71,34 +71,38 @@ def plot_flux_vs_time(
7171

7272
ax = axes if axes else plotting_utilities.paper_figures(None, None)
7373

74+
significance_list = [None, 4.0, 5.0]
75+
significance_colors = [None, "g", "r"]
76+
7477
for idx, (instrument, data) in enumerate(self.data.items()):
7578

76-
x, y, e, x_ul, y_ul = self._get_light_curve_in_mjd_limits(
77-
data, time_axis, mjd_min, mjd_max, orbit_number
78-
)
7979
if not self.plot_this_instrument(instrument):
8080
continue
8181
color, marker = self.get_marker_and_color(idx)
82-
plt.errorbar(
83-
x,
84-
y,
85-
e,
86-
None,
87-
# TODO - label can also be orbit number?
88-
label=(
89-
instrument
90-
if self.config[idx].get("plot_label") is None
91-
else self.config[idx]["plot_label"]
92-
),
93-
color=color,
94-
marker=marker,
95-
linestyle="none",
96-
fillstyle="none",
97-
linewidth=plotting_utilities.get_line_width(),
98-
markersize=(
99-
plotting_utilities.get_marker_size() if markersize is None else markersize
100-
),
101-
)
82+
83+
for sig_limit, sig_color in zip(significance_list, significance_colors):
84+
x, y, e, x_ul, y_ul = self._get_light_curve_in_mjd_limits(
85+
data, time_axis, mjd_min, mjd_max, orbit_number, sig_limit
86+
)
87+
plt.errorbar(
88+
x,
89+
y,
90+
e,
91+
None,
92+
label=(
93+
instrument
94+
if self.config[idx].get("plot_label") is None
95+
else self.config[idx]["plot_label"]
96+
),
97+
color=color if sig_color is None else sig_color,
98+
marker=marker,
99+
linestyle="none",
100+
fillstyle="none",
101+
linewidth=plotting_utilities.get_line_width(),
102+
markersize=(
103+
plotting_utilities.get_marker_size() if markersize is None else markersize
104+
),
105+
)
102106
if len(y_ul) > 0:
103107
plt.errorbar(
104108
x_ul,
@@ -200,7 +204,9 @@ def _get_time_axis_label(self, time_axis):
200204
return "phase"
201205
return "Modified Julian Date (MJD)"
202206

203-
def _get_light_curve_in_mjd_limits(self, data, time_axis, mjd_min, mjd_max, orbit_number):
207+
def _get_light_curve_in_mjd_limits(
208+
self, data, time_axis, mjd_min, mjd_max, orbit_number, min_significance=None
209+
):
204210
"""
205211
Get light curve restricted in MJD or for a certain orbit number.
206212
@@ -216,6 +222,8 @@ def _get_light_curve_in_mjd_limits(self, data, time_axis, mjd_min, mjd_max, orbi
216222
Maximum MJD value.
217223
orbit_number : int
218224
Select orbit number.
225+
min_significance : float
226+
Minimum significance for flux values.
219227
220228
Returns
221229
-------
@@ -228,6 +236,12 @@ def _get_light_curve_in_mjd_limits(self, data, time_axis, mjd_min, mjd_max, orbi
228236
x_ul = []
229237
y_ul = []
230238
for i in range(len(data["MJD"])):
239+
if (
240+
min_significance is not None
241+
and "significance" in data
242+
and data["significance"][i] < min_significance
243+
):
244+
continue
231245
if mjd_min is not None and data["MJD"][i] < mjd_min:
232246
continue
233247
if mjd_max is not None and data["MJD"][i] > mjd_max:

0 commit comments

Comments
 (0)