-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathget_graphical_selection.py
More file actions
executable file
·29 lines (24 loc) · 1.08 KB
/
get_graphical_selection.py
File metadata and controls
executable file
·29 lines (24 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import numpy as np
import matplotlib.pyplot as plt
def get_graphical_selection(points_object):
"""
% (C) Nick Holschuh - Amherst College - 2022 (Nick.Holschuh@gmail.com)
% This takes the structure generated by graphical_selection(points_object)
% and extracts from it x, y, and metadata.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The inputs are as follows:
%
% points_object -- This is the output of graphical selection
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The outputs are as follows:
%
% outdata -- a dictionary containing the x and y values of the selected points
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
"""
if 'meta_ndh' in points_object[0].__dict__.keys():
outdata = {'x':points_object[0].get_xdata(), 'y':points_object[0].get_ydata(), 'meta':points_object[0].__dict__['meta_ndh']}
else:
outdata = {'x':points_object[0].get_xdata(), 'y':points_object[0].get_ydata()}
return outdata