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

Add some comments for functions

Ploting window is now in PDF format not in png format
parent d3b5cec7
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ import VNA
import virtual_time
import json
TEMPERATURE_STABLE = 0x1
HUMIDITY_STABLE = 0x2
MAGNITUDE_STABLE = 0x4
......@@ -19,6 +20,7 @@ PHASE_STABLE = 0x8
MEASUREMENT_STABLE = 0x10
# Class has only attributes which we are using in the read_data_function to read data from VNA and Chamber
class MeasurementData:
def __init__(self, timestamp, temp, hum, power, frequency, s11, s21, s12, s22):
self.timestamp = timestamp
......@@ -66,6 +68,7 @@ class Measurements:
'READBACK_HUMIDITY', 'RF_POWER', 'RF_FREQUENCY', 'DUT_IDENTIFIER', 'RUN_ID',
'EQUILIBRIUM_INDICATOR', 'S11_MAGNITUDE', 'S11_PHASE', 'S12_MAGNITUDE', 'S12_PHASE',
'S21_MAGNITUDE', 'S21_PHASE', 'S22_MAGNITUDE', 'S22_PHASE']
# csv.dict writer add adda row wise
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
writer.writeheader()
......@@ -144,6 +147,7 @@ class Measurements:
self.clock.sleep(self.sleep_time)
# perform the configured number of measurements and check that they are really stable
# It started running after everything become stable
supposedly_stable_measurements = []
all_measurements_stable = True
for i in range(0, next_reads):
......@@ -173,10 +177,7 @@ class Measurements:
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
......@@ -305,9 +306,7 @@ 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)
fig.savefig(time.strftime("%Y_%m_%d-%H_%M_%S") + 'graph.pdf')
plt.show()
def calculate_temperature_stability(self, target_temp, readback_temp):
......@@ -318,6 +317,7 @@ class Measurements:
return (target_hum-self.max_delta_hum <= float(readback_hum)) and \
(float(readback_hum) <= target_hum+self.max_delta_hum)
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument("-c", "--chamber",
......@@ -351,11 +351,20 @@ if __name__ == '__main__':
with open('test_stand_parameter.json', 'r') as f:
config_data = json.load(f)
# FIXME: Move this to inside the chamber. But just putting it into perform_measurements is not good at the moment.
# Move this to inside the chamber. But just putting it into perform_measurements is not good at the moment.
# That function needs refactoring first.
mes = Measurements(args.chamber, args.vna, args.file, output, args.standby, config_data)
try:
mes = Measurements(args.chamber, args.vna, args.file, output, args.standby, config_data)
mes.perform_measurements()
plot_graph = input('want to plot a graph? ans[Yes/no]?').lower()
if plot_graph == "yes":
mes.plot_output(output)
else:
print("graph is stored with output file")
finally:
mes.chamber.close()
mes.plot_output(output)
# mes.plot_output(output)
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