Skip to content

Commit

Permalink
More correct handling of frame time
Browse files Browse the repository at this point in the history
  • Loading branch information
brettviren committed Dec 12, 2023
1 parent 76687b8 commit 839c1bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions wirecell/plot/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def wave(dat, out, tier='orig', unit='ADC', interactive=False, **kwds):
for fname in frames:
_,tag,num = fname.split("_")
print(f'frame "{tag}" #{num}')
ticks = dat[f'tickinfo_{tag}_{num}']
reftime, tick, tbin0 = dat[f'tickinfo_{tag}_{num}']
chans = dat[f'channels_{tag}_{num}']
chmin = numpy.min(chans)
chmax = numpy.max(chans)
Expand All @@ -136,14 +136,16 @@ def wave(dat, out, tier='orig', unit='ADC', interactive=False, **kwds):
chwaves = numpy.zeros((nchan, waves.shape[1]), dtype=dtype)
for ind,ch in enumerate(chans):
chwaves[ch-chmin] = waves[ind]
maxtime = ticks[1]*waves.shape[1]

time_begin = reftime + tick*tbin0
time_end = time_begin + tick*waves.shape[1]

fig,(ax,ax2) = plt.subplots(1,2, figsize=(10,6), sharey=True,
gridspec_kw={'width_ratios': [5, 1]})
ax.set_title(f"Waveforms ({unit}) \"{tier}\"")
im = ax.imshow(chwaves,
aspect='auto', interpolation='none',
extent=(0,maxtime/units.ms, chmax, chmin),
extent=(time_begin/units.ms,time_end/units.ms, chmax, chmin),
cmap=cmap, vmin=vmin, vmax=vmax)

ax.set_xlabel("time [ms]")
Expand Down
6 changes: 3 additions & 3 deletions wirecell/util/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,11 +345,11 @@ def get_xyz(wires, spec):


@cli.command("wires-volumes")
@click.option('-a', '--anode', default=1.0,
@click.option('-a', '--anode', default=1.0*units.cm,
help='Distance from collection plane to "anode" (cutoff) plane (cm)')
@click.option('-r', '--response', default=10.0,
@click.option('-r', '--response', default=10.0*units.cm,
help='Distance from collection plane to "respones" plane, should probably match Garfield (cm)')
@click.option('-c', '--cathode', default=1.0,
@click.option('-c', '--cathode', default=1.0*units.m,
help='Distance from colleciton plane to "cathode" plane (cm)')
@click.argument("json-file")
@click.pass_context
Expand Down

0 comments on commit 839c1bf

Please sign in to comment.