Skip to content

Commit

Permalink
Improve handling of one-shot series
Browse files Browse the repository at this point in the history
  • Loading branch information
mncoppola committed Mar 22, 2021
1 parent 70c8bcb commit 37bb30b
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions ChronoPlotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,11 @@ def showGraph(self, save_without_showing=False):
lowest = min(m_velocs)
average = numpy.mean(m_velocs)
es = highest - lowest
stdev = numpy.std(m_velocs, ddof=1)

if len(m_velocs) > 1:
stdev = numpy.std(m_velocs, ddof=1)
else:
stdev = 0

# Obtain display coordinates for points. We need to convert points for both highest/lowest shots and stdev
b_l_scatter_pix = ax.transData.transform_point((enabled_i, lowest))
Expand Down Expand Up @@ -1076,22 +1080,29 @@ def showGraph(self, save_without_showing=False):
above_annotations = []
below_annotations = []

if self.es_checkbox.isChecked():
# Place annotations on graph. Only display ES and SD if there is more than one shot in the series

if self.es_checkbox.isChecked() and len(m_velocs) > 1:
annotation = "ES: %d" % es
if self.es_location.currentIndex() == self.ABOVE_STRING:
above_annotations.append(annotation)
else:
below_annotations.append(annotation)

if self.sd_checkbox.isChecked():
if self.sd_checkbox.isChecked() and len(m_velocs) > 1:
annotation = "SD: %.1f" % stdev
if self.sd_location.currentIndex() == self.ABOVE_STRING:
above_annotations.append(annotation)
else:
below_annotations.append(annotation)

if self.avg_checkbox.isChecked():
annotation = r'$\bar{x}$: %.1f' % average
# Only show the x-bar symbol and decimal place if there's more than one shot in the series
if len(m_velocs) > 1:
annotation = r'$\bar{x}$: %.1f' % average
else:
annotation = "%d" % average

if self.avg_location.currentIndex() == self.ABOVE_STRING:
above_annotations.append(annotation)
else:
Expand Down

0 comments on commit 37bb30b

Please sign in to comment.