Skip to content
Snippets Groups Projects
Commit 5b418907 authored by Martin Killenberg's avatar Martin Killenberg
Browse files

feat: introduce normalisation in analysis plots

parent f626324a
No related branches found
No related tags found
No related merge requests found
......@@ -33,11 +33,13 @@ def extract_stable_data(datafile, measurement_set, reference_signal_names):
# sweep_type is either 'temperature' or 'humidity'
def plot_sweep(temperatures, humidities, basename, sweep_type, measurement_sets, reference_signal_names):
def plot_sweep(temperatures, humidities, basename, sweep_type, measurement_sets, reference_signal_names, normalise = [True, False]):
set_data = {}
derivatives = {}
for measurement_set in measurement_sets:
set_data[measurement_set] = {'signal0_means': [], 'signal0_vars': [], 'signal1_means': [], 'signal1_vars': [],
'x_data': []}
derivatives[measurement_set] = {'signal0_deltas': [], 'signal1_deltas': [], 'x_deltas': []}
for temp, hum in zip(temperatures, humidities):
datafile = basename+'_'+str(temp)+'deg_'+str(hum)+'rh.csv'
......@@ -60,10 +62,21 @@ def plot_sweep(temperatures, humidities, basename, sweep_type, measurement_sets,
data['signal1_means'].append(datapoint['signal1_mean'])
data['signal1_vars'].append(datapoint['signal1_var'])
#fig = plt.figure()
#gs = fig.add_gridspec(2, 1, hspace=0)
#(ax1, ax2) = gs.subplots(sharex=True)
fig, (ax1, ax2) = plt.subplots(2, sharex=True, gridspec_kw={'hspace': 0}, figsize=(10, 5))
for measurement_set in measurement_sets:
data = set_data[measurement_set]
if normalise[0]:
data['signal0_means'] -= data['signal0_means'][0]
if normalise[1]:
data['signal1_means'] -= data['signal1_means'][0]
fig = plt.figure(figsize=(10, 5))
gs = gridspec.GridSpec(nrows=2, ncols=1, hspace=0)#, width_ratios=[3, 1], height_ratios=[3, 1])
ax1 = fig.add_subplot(gs[0, 0])
ax2 = fig.add_subplot(gs[1, 0],sharex=ax1)
##gs = fig.add_gridspec(2, 1, hspace=0)
##(ax1, ax2) = gs.subplots(sharex=True)
#fig, (ax1, ax2) = plt.subplots(2, sharex=True, gridspec_kw={'hspace': 0}, figsize=(10, 5))
ax1.tick_params(bottom=True, top=True, direction='in')
ax2.tick_params(bottom=True, top=True, direction='inout')
......@@ -104,5 +117,5 @@ def plot_sweep(temperatures, humidities, basename, sweep_type, measurement_sets,
if __name__ == '__main__':
print('run \'./prototype.py -t first_tempsweep.txt -p -o tempsweep1\' to get the data needed for this plot.' )
plot_sweep(np.arange(25., 31.+1.), [35.]*7, 'tempsweep1', 'temperature',
plot_sweep(np.arange(20., 31.+1.), [35.]*12, 'tempsweep1', 'temperature',
['1.3GHz', '1.0GHz', '3.0GHz', '6.0GHz', '10.0GHz'], ['S21_PHASE', 'S21_MAGNITUDE'])
25 31 1 35 100 10
20 31 1 35 100 10
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