Skip to content
Snippets Groups Projects
Commit a9996217 authored by Kien Le's avatar Kien Le
Browse files

Add tests for functions in plottingData.py

parent 5c99a818
No related branches found
No related tags found
1 merge request!19Add tests for function in plottingData.py
......@@ -7,7 +7,6 @@ import math
from obspy import UTCDateTime
from sohstationviewer.conf import constants as const
maxInt = 1E100
maxFloat = 1.0E100
......@@ -36,10 +35,12 @@ def getMassposValueColors(rangeOpt, chan_id, cMode, processing_log,
if rangeOpt.lower() not in MassPosVoltRanges.keys():
processing_log.append(
f"{chan_id}: The current selected Mass Position color range is "
f"'{rangeOpt}' isn't allowable. The accept ranges are: "
f"{', '.join(MassPosVoltRanges.keys())}",
"error"
(
f"{chan_id}: The current selected Mass Position color range is"
f" '{rangeOpt}' isn't allowable. The accept ranges are: "
f"{', '.join(MassPosVoltRanges.keys())}",
"error"
)
)
return
massPosVoltRange = MassPosVoltRanges[rangeOpt]
......@@ -54,7 +55,8 @@ def getMassposValueColors(rangeOpt, chan_id, cMode, processing_log,
if i == len(massPosVoltRange) - 1:
if retType == 'str':
valueColors.append(
"%s:+%s" % (massPosVoltRange[i], massPosColorPallet[i+1]))
"%s:+%s" % (
massPosVoltRange[i], massPosColorPallet[i + 1]))
else:
valueColors.append(
(massPosVoltRange[i], massPosColorPallet[i + 1]))
......@@ -102,7 +104,7 @@ def getTitle(key, minTime, maxTime, dateMode):
:return: title for the plot - str
"""
diff = maxTime - minTime
hours = diff/3600
hours = diff / 3600
return ("%s %s to %s (%s)" %
(key,
formatTime(minTime, dateMode, "HH:MM:SS"),
......@@ -193,10 +195,10 @@ def getDayTicks():
"""
times = list(range(const.NO_5M_1H, const.NO_5M_DAY, const.NO_5M_1H))
majorTimes = list(range(4*const.NO_5M_1H,
majorTimes = list(range(4 * const.NO_5M_1H,
const.NO_5M_DAY,
4*const.NO_5M_1H))
majorTimeLabels = ["%02d" % int(t/const.NO_5M_1H) for t in majorTimes]
4 * const.NO_5M_1H))
majorTimeLabels = ["%02d" % int(t / const.NO_5M_1H) for t in majorTimes]
return times, majorTimes, majorTimeLabels
......
This diff is collapsed.
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