Skip to content
Snippets Groups Projects
Commit 8a46eaef authored by Sai Lakhan Ekal's avatar Sai Lakhan Ekal
Browse files

Add comments for values in Example_sweep file

plot is now saving with CSV file with same name .It doesnt pop up now after reading.
parent 93681d05
No related branches found
No related tags found
No related merge requests found
......@@ -73,10 +73,10 @@ class Measurements:
try:
while line := file.readline().rstrip():
list_of_values = line.split()
next_temp = float(list_of_values[0])
next_hum = float(list_of_values[1])
next_soaking = int(list_of_values[2])
next_reads = int(list_of_values[3])
next_temp = float(list_of_values[0]) # target_temperature
next_hum = float(list_of_values[1]) # target_humidity
next_soaking = int(list_of_values[2]) # soaking_time
next_reads = int(list_of_values[3]) # number of stable readings
set_const_response = self.chamber.set_const((next_temp, next_hum))
print(set_const_response)
......@@ -109,7 +109,6 @@ class Measurements:
magnitudes_queue.append(self.calculate_mean_magnitude(data.s21))
else:
magnitudes_queue.clear()
# check cable stability parameters
self.magnitude_stable = False
if len(magnitudes_queue) >= number_of_soaking_reads:
......@@ -137,8 +136,8 @@ class Measurements:
if self.temperature_stable and self.humidity_stable and self.magnitude_stable and\
self.phase_stable:
self.reference_magnitude = magnitudes_queue[-1]
self.reference_phase = phase_queue[-1]
reference_magnitude = magnitudes_queue[-1]
reference_phase = phase_queue[-1]
print('SOAKING FINISHED!')
break
else:
......@@ -153,30 +152,31 @@ class Measurements:
self.humidity_stable = self.calculate_humidity_stability(next_hum, float(data.hum))
mag = self.calculate_mean_magnitude(data.s21)
phase = self.calculate_mean_phase(data.s21)
self.magnitude_stable = (self.reference_magnitude-self.max_delta_mag <= mag) and\
(mag <= self.reference_magnitude+self.max_delta_mag)
self.phase_stable = (self.reference_phase-self.max_delta_phase <= phase) and\
(phase <= self.reference_phase+self.max_delta_phase)
print('phase '+str(phase)+', ref_phase '+str(self.reference_phase)+', max_delta '+str(self.max_delta_phase))
self.magnitude_stable = (reference_magnitude-self.max_delta_mag <= mag) and\
(mag <= reference_magnitude+self.max_delta_mag)
self.phase_stable = (reference_phase-self.max_delta_phase <= phase) and\
(phase <= reference_phase+self.max_delta_phase)
supposedly_stable_measurements.append([data, self.cook_up_equi_indicator()])
print('Read no.', str(i))
if (self.temperature_stable and self.humidity_stable and self.magnitude_stable and\
if (self.temperature_stable and self.humidity_stable and self.magnitude_stable and
self.phase_stable):
self.clock.sleep(self.sleep_time)
else:
print('HELP, I am lost!')
all_measurements_stable = False
break
for [d, measurement_equi] in supposedly_stable_measurements:
if (all_measurements_stable):
for [d, measurement_equi] in supposedly_stable_measurements:
if all_measurements_stable:
equi = TEMPERATURE_STABLE | HUMIDITY_STABLE | MAGNITUDE_STABLE | PHASE_STABLE | MEASUREMENT_STABLE
do_another_measurement = False
else:
equi = measurement_equi
self.write_data(writer, next_temp, next_hum, d, equi)
parser1 = ArgumentParser()
parser1.add_argument("-p", "--plot",
help="graph plotting", metavar="ADDR",
required=True)
except KeyboardInterrupt:
pass
......@@ -266,7 +266,7 @@ class Measurements:
def plot_output(self, output_file):
csv_data = pd.read_csv(output_file)
fig, ax1 = plt.subplots(2, figsize=(8, 8))
fig, ax1 = plt.subplots(2, figsize=(12, 10))
fig.suptitle("Graphical representation of chamber output", color="red")
path_collection01 = ax1[0].scatter(csv_data.TIMESTAMP, csv_data.S11_PHASE, c='red', marker='<', label='Phase')
......@@ -305,6 +305,9 @@ class Measurements:
labels = [pc.get_label() for pc in all_path_collections]
ax1[1].legend(all_path_collections, labels, loc='lower right')
fig.savefig(time.strftime("%Y_%m_%d-%H_%M_%S") + 'graph.png')
plt.close(fig)
plt.show()
def calculate_temperature_stability(self, target_temp, readback_temp):
......
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