Added old/new comparison plots
This commit is contained in:
parent
d246d15360
commit
9b0520bee8
8 changed files with 113 additions and 10 deletions
|
@ -207,7 +207,7 @@ def plot_single_graph(fig, plot_config, plot_data):
|
|||
x_data = plot_data[x_key];
|
||||
y_data = plot_data[y_key];
|
||||
|
||||
ax.plot(x_data, y_data);
|
||||
ax.plot(x_data, y_data, linewidth=plot_config.get('linewidth'));
|
||||
|
||||
if(not 'xformatter' in plot_config):
|
||||
plot_config['xformatter'] = 'engineering';
|
||||
|
@ -231,16 +231,19 @@ def plot_lt_sweep(fig, plot_config, plot_data):
|
|||
if(y_key == None):
|
||||
raise RuntimeError("No Y-Data Key (`y_key`) specified for plot!")
|
||||
|
||||
num_steps = len(plot_data['steps'])
|
||||
|
||||
for idx, step in enumerate(plot_data['steps']):
|
||||
plot_params = dict()
|
||||
plot_params['label'] = step['step']
|
||||
|
||||
if(plot_config.get('colourmap', 'coolwarm') == 'coolwarm'):
|
||||
num_steps = len(plot_data['steps'])
|
||||
cmap = plt.cm.coolwarm
|
||||
if(plot_config.get('colourmap', 'coolwarm') == 'coolwarm'):
|
||||
cmap = plt.cm.coolwarm
|
||||
plot_params['color'] = cmap(idx/(num_steps-1))
|
||||
|
||||
plot_params['linewidth'] = plot_config.get('linewidth');
|
||||
|
||||
for idx, step in enumerate(plot_data['steps']):
|
||||
ax.plot(step[x_key], step[y_key], color=cmap(idx/(num_steps-1)), label=step['step']);
|
||||
else:
|
||||
for idx, step in enumerate(plot_data['steps']):
|
||||
ax.plot(step[x_key], step[y_key], label=step['step']);
|
||||
ax.plot(step[x_key], step[y_key], **plot_params)
|
||||
|
||||
if(not 'xformatter' in plot_config):
|
||||
plot_config['xformatter'] = 'engineering';
|
||||
|
@ -250,7 +253,14 @@ def plot_lt_sweep(fig, plot_config, plot_data):
|
|||
if(not 'xmax' in plot_config):
|
||||
plot_config['xmax'] = np.max(plot_data['steps'][0][x_key]);
|
||||
|
||||
ax.legend();
|
||||
if(num_steps > 1):
|
||||
legend_opts = dict()
|
||||
legend_opts['title'] = "TEST"
|
||||
|
||||
if('legend_title' in plot_config):
|
||||
legend_opts['title'] = plot_config['legend_title']
|
||||
|
||||
ax.legend(**legend_opts);
|
||||
|
||||
decorate_ax(ax, plot_config);
|
||||
|
||||
|
@ -266,9 +276,45 @@ def perform_bandwidth_normalization(plot_data, plot_config):
|
|||
|
||||
step[plot_config['y_key']] = new_y_data
|
||||
|
||||
def perform_peak_normalization(plot_data, plot_config):
|
||||
print("Normalizing peak height to 1")
|
||||
|
||||
for step in plot_data['steps']:
|
||||
y_data = step[plot_config['y_key']]
|
||||
new_y_data = []
|
||||
|
||||
y_max = max(y_data)
|
||||
y_min = min(y_data)
|
||||
|
||||
scaling_factor = y_max if (y_max > (-y_min)) else y_min
|
||||
|
||||
for datapoint in y_data:
|
||||
new_y_data.append(datapoint / scaling_factor)
|
||||
|
||||
step[plot_config['y_key']] = new_y_data
|
||||
|
||||
def perform_offset_removal(plot_data, plot_config):
|
||||
print("Removing offset")
|
||||
|
||||
for step in plot_data['steps']:
|
||||
y_data = step[plot_config['y_key']]
|
||||
new_y_data = []
|
||||
|
||||
offset_value = np.percentile(y_data, 30)
|
||||
|
||||
for datapoint in y_data:
|
||||
new_y_data.append(datapoint - offset_value)
|
||||
|
||||
step[plot_config['y_key']] = new_y_data
|
||||
|
||||
|
||||
def perform_processing_step(data_process_step, plot_data, plot_config):
|
||||
if(data_process_step == 'normalize_bandwidth'):
|
||||
perform_bandwidth_normalization(plot_data, plot_config)
|
||||
if(data_process_step == 'remove_offset'):
|
||||
perform_offset_removal(plot_data, plot_config)
|
||||
if(data_process_step == 'normalize_peak'):
|
||||
perform_peak_normalization(plot_data, plot_config)
|
||||
|
||||
def generate_plot(plot_config):
|
||||
global YAML_DIR;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue