Skip to content

Commit 734a978

Browse files
committed
Modified the slow log sampling.
1 parent 4b95d59 commit 734a978

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

application_specific_examples/making_transient_dual_interface_measurement/produce_conductive_thermal_resistance.py

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@
99
from matplotlib import pyplot as plt
1010
import numpy as np
1111

12+
def log_and_print_to_console(message_string):
13+
print(message_string)
14+
15+
def receive_user_input_and_log():
16+
inputText = input()
17+
return inputText
18+
1219
slow_sampling_string = "SLOWLOG"
1320
medium_sampling_string = "MEDIUMLOG"
1421
fast_sampling_string = "FASTLOG"
22+
slow_sampling_mode = 3
23+
medium_sampling_mode = 2
24+
fast_sampling_mode = 1
25+
1526
# the number of samples
1627
# use for checking wheather the plot is fast or slow log sampling
1728
num_of_data_fastLog = 525
@@ -21,6 +32,9 @@
2132
filename_grease_log = "digitizer_log_sampling_grease.log"
2233
filename_no_grease_log = "digitizer_log_sampling_noGrease.log"
2334

35+
log_and_print_to_console('\nEnter the option # for sampling mode:\n1. FASTLOG.\n2. MEDIUMLOG\n3. SLOWLOG.\n')
36+
sampling_mode_input = float(receive_user_input_and_log())
37+
2438
### start of main program
2539
try:
2640
# open grease data file in current directory
@@ -58,11 +72,11 @@
5872
else:
5973
num_of_data = num_of_data_noGrease
6074

61-
if num_of_data == num_of_data_fastLog:
75+
if sampling_mode_input == fast_sampling_mode:
6276
sampling_mode_string = fast_sampling_string
63-
elif num_of_data == num_of_data_mediumLog:
77+
elif sampling_mode_input == medium_sampling_mode:
6478
sampling_mode_string = medium_sampling_string
65-
elif num_of_data == num_of_data_slowLog:
79+
elif sampling_mode_input == slow_sampling_mode:
6680
sampling_mode_string = slow_sampling_string
6781

6882
# plot graph
@@ -79,16 +93,22 @@
7993
time_value.append(Time_us/1000000)
8094
if sampling_mode_string == slow_sampling_string:
8195
# log time scale
82-
if i > 0 and i <=99:
83-
Time_us = Time_us + 1000
84-
elif i > 99 and i <= 189:
85-
Time_us = Time_us + 10000
86-
elif i > 189 and i <= 279:
87-
Time_us = Time_us + 100000
88-
elif i > 279 and i <= 369:
89-
Time_us = Time_us + 1000000
90-
elif i > 369 and i <= 459:
91-
Time_us = Time_us + 10000000
96+
if i > 0 and i <=49:
97+
Time_us = Time_us + 2
98+
elif i > 49 and i <= 139:
99+
Time_us = Time_us + 10
100+
elif i > 139 and i <= 229:
101+
Time_us = Time_us + 100
102+
elif i > 229 and i <= 319:
103+
Time_us = Time_us + 1000
104+
elif i > 319 and i <= 364:
105+
Time_us = Time_us + 20000
106+
elif i > 364 and i <= 409:
107+
Time_us = Time_us + 200000
108+
elif i > 409 and i <= 454:
109+
Time_us = Time_us + 2000000
110+
elif i > 454 and i <= 500:
111+
Time_us = Time_us + 20000000
92112
elif sampling_mode_string == medium_sampling_string:
93113
if i >= 0 and i <=49:
94114
Time_us = Time_us + 2

0 commit comments

Comments
 (0)