mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m.internship-documentation.git
synced 2024-11-12 18:43:30 +01:00
figure: toggle grid on single_beacon
This commit is contained in:
parent
c4e6aa3afd
commit
151e711583
1 changed files with 4 additions and 3 deletions
|
@ -15,7 +15,7 @@ def ttl(t, t_start=0, frequency=1, width=0.5):
|
|||
return ( (t%frequency) >= t_start) & ( (t%frequency) < t_start + width)
|
||||
|
||||
|
||||
def main(beacon_type, N_periods=1, overplot_sampling_rates = False, sampling_rate=6, t_start=-0.3, sampling_offset_in_rate=1, ax=None, fig_kwargs={'figsize': (4,2)}, N_t=200):
|
||||
def main(beacon_type, N_periods=1, overplot_sampling_rates = False, sampling_rate=6, t_start=-0.3, sampling_offset_in_rate=1, ax=None, fig_kwargs={'figsize': (4,2)}, N_t=200, plot_grid=True):
|
||||
|
||||
t_end = N_periods - t_start
|
||||
|
||||
|
@ -32,7 +32,7 @@ def main(beacon_type, N_periods=1, overplot_sampling_rates = False, sampling_rat
|
|||
raise ValueError("Unknown beacon_type requested.")
|
||||
|
||||
ax.plot(time, sig_func(time))
|
||||
ax.grid(True)
|
||||
ax.grid(plot_grid)
|
||||
ax.set_xlim(t_start, t_end)
|
||||
ax.set_ylim(-1.5, 1.5)
|
||||
|
||||
|
@ -74,6 +74,7 @@ if __name__ == "__main__":
|
|||
parser.add_argument('type', choices=['ttl','sine'])
|
||||
parser.add_argument('--periods', default=1, help='Number of periods to show', type=int)
|
||||
parser.add_argument('--with-rates', action='store_true', help='show two samplings with different phase')
|
||||
parser.add_argument('--no-grid', dest='grid', action='store_false', help='underlie a grid')
|
||||
parser.add_argument("fname", metavar="path/to/figure[/]", nargs="?", help="Location for generated figure, will append __file__ if a directory. If not supplied, figure is shown.")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
@ -82,7 +83,7 @@ if __name__ == "__main__":
|
|||
args.fname = path.join(args.fname, path.splitext(path.basename(__file__))[0] + ".pdf")
|
||||
|
||||
###
|
||||
fig, _, _ = main(beacon_type=args.type, overplot_sampling_rates=args.with_rates, N_periods=args.periods)
|
||||
fig, _, _ = main(beacon_type=args.type, overplot_sampling_rates=args.with_rates, N_periods=args.periods, plot_grid=args.grid)
|
||||
|
||||
if args.fname is not None:
|
||||
plt.savefig(args.fname)
|
||||
|
|
Loading…
Reference in a new issue