Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options to select data to plot #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Options to select data to plot
Added parameter -w --wavelength to select data to plot. Plots all data if left empty. Multiple data rows can be selected as e.g. -w 215nm -w 280nm.
  • Loading branch information
ondrejtichacek committed Jul 21, 2017
commit 03fb4a81abada0d0c7cf143ffbc01d64b08b7992
30 changes: 24 additions & 6 deletions examplescripts/pycorn-bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
help="Data for 2nd y-axis (Default=Cond), to disable 2nd y-axis, use --par1 None")
group1.add_argument("--par2", type = str, default=None,
help="Data for 3rd y-axis (Default=None)")
parser.add_argument("-w", "--wavelength", action='append', default=None,
help="Data to plot (Default=None)")
group1.add_argument('-f', '--format', type = str,
choices=['svg','svgz','tif','tiff','jpg','jpeg',
'png','ps','eps','raw','rgba','pdf','pgf'],
Expand Down Expand Up @@ -144,7 +146,17 @@ def smartscale(inp):
checks user input/fractions to determine scaling of x/y-axis
returns min/max for x/y
'''
UV_blocks = [i for i in inp.keys() if i.startswith('UV') and not i.endswith('_0nm')]
#UV_blocks = [i for i in inp.keys() if i.startswith('UV') and not i.endswith('_0nm')]
UV_blocks = []
for i in inp.keys():
if i.startswith('UV') and not i.endswith('_0nm'):
plot_this_data = True
if args.wavelength:
plot_this_data = any([w in i for w in args.wavelength])

if plot_this_data:
UV_blocks.append(i)

uv1_data = inp[UV_blocks[0]]['data']
uv1_x, uv1_y = xy_data(uv1_data)
try:
Expand Down Expand Up @@ -210,11 +222,17 @@ def plotterX(inp,fname):
host.set_ylim(plot_y_min, plot_y_max)
for i in inp.keys():
if i.startswith('UV') and not i.endswith('_0nm'):
x_dat, y_dat = xy_data(inp[i]['data'])
print("Plotting: " + inp[i]['data_name'])
stl = styles[i[:4]]
p0, = host.plot(x_dat, y_dat, label=inp[i]['data_name'], color=stl['color'],
ls=stl['ls'], lw=stl['lw'],alpha=stl['alpha'])

plot_this_data = True
if args.wavelength:
plot_this_data = any([w in i for w in args.wavelength])

if plot_this_data:
x_dat, y_dat = xy_data(inp[i]['data'])
print("Plotting: " + inp[i]['data_name'])
stl = styles[i[:4]]
p0, = host.plot(x_dat, y_dat, label=inp[i]['data_name'], color=stl['color'],
ls=stl['ls'], lw=stl['lw'],alpha=stl['alpha'])
if args.par1 == 'None':
args.par1 = None
if args.par1:
Expand Down