round_to_raster#
- pypulseqpp.round_to_raster()[source]#
Round seconds to the nearest multiple of
raster_s, with ties to even.raster_sis a raster period in seconds, such aspypulseqpp.Opts.grad_raster_timeorpypulseqpp.Opts.block_duration_raster.- Parameters:
- Returns:
The nearest multiple of
raster_s.- Return type:
Examples
>>> import pypulseqpp as pp >>> pp.round_to_raster(23e-6, 10e-6) 2e-05
A value halfway between two multiples rounds to the even one, so 1.5 and 2.5 raster periods both round to 2:
>>> pp.round_to_raster(15e-6, 10e-6), pp.round_to_raster(25e-6, 10e-6) (2e-05, 2e-05)